@@ -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 */
5930export async function emulate < Scope extends SupportedScopes > (
0 commit comments