Skip to content

Commit

Permalink
Merge pull request #71 from kinotio/develop
Browse files Browse the repository at this point in the history
docs: update code usage
  • Loading branch information
andostronaut authored Dec 28, 2024
2 parents 9a535df + 8fec652 commit 7956113
Showing 1 changed file with 28 additions and 43 deletions.
71 changes: 28 additions & 43 deletions src/pages/docs/drowser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Create a drowser.json in root directory and define some configuration like this:
}
```

## Deno 2
## Installation

Install npm dependecies on `node_modules` with this command:
Install dependencies using Deno with this command:

```sh
deno install --allow-scripts
Expand All @@ -37,47 +37,32 @@ With this test we only test this sample code inside a Chrome ,Firefox but create
```ts
import { driver } from 'https://deno.land/x/[email protected]/mod.ts'

driver({ browser: 'chrome' })
.then(({ service }) => {
service.cases = [
{
name: 'Verify Failed Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowsers')
}
},
{
name: 'Verify Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowser')
}
}
]
})
.catch((error) => console.log(error))

driver({ browser: 'firefox' })
.then(({ service }) => {
service.cases = [
{
name: 'Verify Failed Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowsers')
}
},
{
name: 'Verify Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowser')
}
}
]
})
.catch((error) => console.log(error))
const testCases = [
{
name: 'Verify Failed Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowsers')
}
},
{
name: 'Verify Title',
fn: async ({ builder, assert }) => {
const title = await builder.getTitle()
assert.assertEquals(title, 'Drowser')
}
}
]

;[('chrome', 'firefox')].forEach((browser) => {
driver({ browser })
.then(({ service }) => {
service.cases = testCases
})
.catch((error) => {
console.error(`Error in ${browser} tests:`, error)
})
})
```

## Report
Expand Down

0 comments on commit 7956113

Please sign in to comment.