import path from 'node:path'
import { expect, describe, beforeEach, afterEach, it, vi } from 'vitest'
import { remote } from '../../../src/index.js'
vi.mock('fetch')
vi.useFakeTimers()
vi.spyOn(global, 'setTimeout')
vi.mock('@wdio/logger', () => import(path.join(process.cwd(), '__mocks__', '@wdio/logger')))
describe('pause test', () => {
let browser: WebdriverIO.Browser
beforeEach(async () => {
browser = await remote({
baseUrl: 'http://foobar.com',
capabilities: {
browserName: 'foobar'
}
})
})
it('should pause for value provided as arg', async () => {
browser.pause(500)
expect(setTimeout)
.toHaveBeenLastCalledWith(expect.any(Function), 500)
})
it('should pause for default value', async () => {
browser.pause()
expect(setTimeout)
.toHaveBeenLastCalledWith(expect.any(Function), 1000)
})
afterEach(() => {
vi.mocked(fetch).mockClear()
})
})