webdriverio/e2e/wdio/xvfb/base-install.e2e.ts
goosewobbler 3ac2341c00
fix(wdio-xvfb): autoXvfb should disable xvfb completely (#14700)
* feat(wdio-xvfb): add `enable`, remove CI check, update types

* chore: update lockfile

* docs(wdio-xvfb): update for new options

* test(wdio-xvfb): update units

* docs(wdio-xvfb): verbiage tweaks

* fix(wdio-local-runner): explicitly disable xvfb when autoXvfb is false

* docs(website): add page on headless / xvfb to testrunner

* test(wdio-local-runner): add tests for new options

* test(e2e): update for new behaviour

* chore(wdio-xvfb): revert some type changes

* chore(wdio-xvfb): fix type error

* test(wdio-xvfb): add comments

* test(wdio-xvfb): fix units and type issues

* feat(wdio-xvfb): improve auto install handling

* chore(wdio-local-runner): update type

* chore(types): update `xvfbAutoInstall` option for advanced control

* test(wdio-xvfb): update units for new behaviour

* test(wdio-local-runner): add tests for passing xvfbAutoInstall

* docs(wdio-xvfb): update for new xvfbAutoInstall

* docs(website): update for new `xvfbAutoInstall`

* refactor(wdio-xvfb): fix logic and clean up

* test(wdio-xvfb): fix units

* test(wdio-xvfb): fix windows-specific test failures

* test(e2e): fix base xvfb tests

* test(wdio-xvfb): add a couple more object format units

* test(e2e): add advanced config tests

* refactor(e2e): use marker files to test custom commands

* docs(website): add more detail

* test(e2e): dynamically assign mode

* feat(wdio-xvfb): array command escaping

* fix(e2e): update command

* docs(website): add missing xvfb options

* chore(wdio-local-runner): remove unnecessary `any`

* refactor(wdio-xvfb): pull apart options

* docs(wdio-xvfb): update for new options

* docs(website): update for new options

* refactor(types): rework xvfb options

* chore(wdio-local-runner): pass through new options

* test(e2e): update for new options, skip non-linux platforms

* test(wdio-xvfb): update units

* test(wdio-local-runner): update units

* fix(e2e): remove unnecessary `forceInstall`

* refactor(e2e): simplify tests

* fix(e2e): change `autoInstallMode` default

* docs(wdio-xvfb): change `autoInstallMode` default

* docs(website): update `autoInstallMode` default

* test(wdio-xvfb): update for `autoInstallMode` default change
2025-08-23 21:12:18 -07:00

44 lines
1.5 KiB
TypeScript

import { expect } from '@wdio/globals'
import { execSync } from 'node:child_process'
import { XvfbManager } from '@wdio/xvfb'
describe('xvfb fresh installation', () => {
it('should install xvfb using detected package manager', async function(this: Mocha.Context) {
this.timeout(300000) // 5 minutes for real installation
const manager = new XvfbManager({ autoInstall: true })
// Should initially not be available in base image
expect(manager.shouldRun()).toBe(true)
// Real installation attempt
const result = await manager.init()
expect(result).toBe(true)
// Verify xvfb-run is now available
const xvfbRunPath = execSync('which xvfb-run', { encoding: 'utf8' }).trim()
expect(xvfbRunPath).toContain('xvfb-run')
})
it('should verify xvfb works after installation', async function(this: Mocha.Context) {
this.timeout(300000)
const manager = new XvfbManager({ autoInstall: true })
// Install and initialize
const result = await manager.init()
expect(result).toBe(true)
// Test that xvfb-run can execute a simple command
try {
const testResult = execSync('xvfb-run --auto-servernum -- echo "installation verified"', {
encoding: 'utf8',
timeout: 10000
})
expect(testResult.trim()).toBe('installation verified')
} catch (error) {
throw new Error(`xvfb-run execution failed after installation: ${error}`)
}
})
})