Skip to content

Commit 8b352da

Browse files
(docs): use example recipe for emulate command
1 parent f6c6261 commit 8b352da

1 file changed

Lines changed: 2 additions & 31 deletions

File tree

  • packages/webdriverio/src/commands/browser

packages/webdriverio/src/commands/browser/emulate.ts

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,10 @@ interface EmulationOptions {
2121
*
2222
* :::
2323
*
24-
* <example>
25-
:emulateColorScheme.js
26-
it('should open WebdriverIO using light color scheme', async () => {
27-
await browser.emulate('colorScheme', 'light')
28-
await browser.url('https://webdriver.io')
29-
const backgroundColor = await browser.$('nav').getCSSProperty('background-color')
30-
console.log(backgroundColor.parsed.hex) // outputs: "#efefef"
31-
})
32-
it('should open WebdriverIO using dark color scheme'm async () => {
33-
await browser.emulate('colorScheme', 'dark')
34-
await browser.url('https://webdriver.io')
35-
const backgroundColor = await browser.$('nav').getCSSProperty('background-color')
36-
console.log(backgroundColor.parsed.hex) // outputs: "#000000"
37-
})
38-
* </example>
39-
*
40-
* <example>
41-
:emulateGeoLocation.js
42-
it('should find my emulated geo location', async () => {
43-
await browser.emulate('geolocation', {
44-
latitude: 52.52,
45-
longitude: 13.39,
46-
accuracy: 100
47-
})
48-
await browser.url('https://www.google.com/maps')
49-
await browser.$('aria/Show Your Location').click()
50-
await browser.pause(5000)
51-
console.log(await browser.getUrl()) // outputs: "https://www.google.com/maps/@52.52,13.39,16z?entry=ttu"
52-
})
53-
* </example>
54-
*
5524
* @param {string} scope feature of the browser you like to emulate, can be either `geolocation`, `userAgent`, `colorScheme` or `onLine`
5625
* @param {EmulationOptions} options emulation option for specific scope
26+
* @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L4-L18
27+
* @example https://github.com/webdriverio/example-recipes/blob/9bff2baf8a0678c6886f8591d9fc8dea201895d3/emulate/example.js#L20-L36
5728
* @returns `void`
5829
*/
5930
export async function emulate<Scope extends SupportedScopes> (

0 commit comments

Comments
 (0)