import { browser, $, $$, expect } from '../../packages/wdio-globals/build/index.js'
describe('global usage', () => {
it('has no globals registered', () => {
expect(typeof global.browser).toBe('undefined')
expect(typeof global.$).toBe('undefined')
expect(typeof global.$$).toBe('undefined')
expect(typeof global.driver).toBe('undefined')
expect(typeof global.multiremotebrowser).toBe('undefined')
})
it('can use browser global', async () => {
expect(await browser.getTitle()).toBe('Mock Page Title')
})
it.skip('supports non globals using expect-webdriverio', async () => {
await expect(browser).toHaveTitle('Mock Page Title')
})
it('it can use $ and $$ globals', async () => {
browser.isExistingScenario()
const el = $('body')
expect(await el.$('.selector-1').isExisting()).toBe(true)
})
it('can use $$ global', async () => {
browser.asyncIterationScenario()
const els = await $$('body')
expect(els.length).toBe(2)
})
})