-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from kinotio/develop
docs: update code usage
- Loading branch information
Showing
1 changed file
with
28 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|