Skip to content

Commit ab349a7

Browse files
committed
Eslint fix
1 parent fb9b75e commit ab349a7

8 files changed

Lines changed: 51 additions & 35 deletions

File tree

example/wdio.conf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const config: Options.Testrunner = {
6363
capabilities: [
6464
{
6565
browserName: 'chrome',
66-
browserVersion: '144.0.7559.133', // specify chromium browser version for testing
66+
browserVersion: '145.0.7632.110', // specify chromium browser version for testing
6767
'goog:chromeOptions': {
6868
args: [
6969
'--headless',

packages/app/src/components/sidebar/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import { TestState } from './types.js'
2+
3+
export const STATE_MAP: Record<string, TestState> = {
4+
running: TestState.RUNNING,
5+
failed: TestState.FAILED,
6+
passed: TestState.PASSED,
7+
skipped: TestState.SKIPPED
8+
}
19
import type { RunCapabilities } from './types.js'
210

311
export const DEFAULT_CAPABILITIES: RunCapabilities = {

packages/app/src/components/sidebar/explorer.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
TestRunDetail
1818
} from './types.js'
1919
import { TestState } from './types.js'
20-
import { DEFAULT_CAPABILITIES, FRAMEWORK_CAPABILITIES } from './constants.js'
20+
import { DEFAULT_CAPABILITIES, FRAMEWORK_CAPABILITIES, STATE_MAP } from './constants.js'
2121

2222
import '~icons/mdi/play.js'
2323
import '~icons/mdi/stop.js'
@@ -31,13 +31,6 @@ import type { DevtoolsSidebarFilter } from './filter.js'
3131

3232
const EXPLORER = 'wdio-devtools-sidebar-explorer'
3333

34-
const STATE_MAP: Record<string, TestState> = {
35-
'running': TestState.RUNNING,
36-
'failed': TestState.FAILED,
37-
'passed': TestState.PASSED,
38-
'skipped': TestState.SKIPPED
39-
}
40-
4134
@customElement(EXPLORER)
4235
export class DevtoolsSidebarExplorer extends CollapseableEntry {
4336
#testFilter: DevtoolsSidebarFilter | undefined
@@ -376,12 +369,18 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
376369

377370
// Check explicit state first
378371
const mappedState = STATE_MAP[state]
379-
if (mappedState) return mappedState
372+
if (mappedState) {
373+
return mappedState
374+
}
380375

381376
// For suites, compute state from children
382377
if ('tests' in entry) {
383-
if (this.#isRunning(entry)) return TestState.RUNNING
384-
if (this.#hasFailed(entry)) return TestState.FAILED
378+
if (this.#isRunning(entry)) {
379+
return TestState.RUNNING
380+
}
381+
if (this.#hasFailed(entry)) {
382+
return TestState.FAILED
383+
}
385384
return TestState.PASSED
386385
}
387386

@@ -480,8 +479,7 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
480479
<p class="text-disabledForeground">No tests to display</p>
481480
<p class="text-xs text-disabledForeground mt-2">
482481
Debug: suites=${this.suites?.length || 0},
483-
rootSuites=${uniqueSuites.length},
484-
filtered=${suites.length}
482+
rootSuites=${uniqueSuites.length}, filtered=${suites.length}
485483
</p>
486484
</div>`}
487485
</wdio-test-suite>

packages/app/src/controller/DataManager.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,17 @@ export const isTestRunningContext = createContext<boolean>(
4949
)
5050

5151
interface SocketMessage<
52-
T extends keyof TraceLog | 'testStopped' | 'clearExecutionData' = keyof TraceLog | 'testStopped' | 'clearExecutionData'
52+
T extends keyof TraceLog | 'testStopped' | 'clearExecutionData' =
53+
| keyof TraceLog
54+
| 'testStopped'
55+
| 'clearExecutionData'
5356
> {
5457
scope: T
55-
data: T extends keyof TraceLog ? TraceLog[T] : T extends 'clearExecutionData' ? { uid?: string } : unknown
58+
data: T extends keyof TraceLog
59+
? TraceLog[T]
60+
: T extends 'clearExecutionData'
61+
? { uid?: string }
62+
: unknown
5663
}
5764

5865
export class DataManagerController implements ReactiveController {

packages/backend/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ export function broadcastToClients(message: string) {
3030
})
3131
}
3232

33-
export async function start(opts: DevtoolsBackendOptions = {}): Promise<{ server: FastifyInstance; port: number }> {
33+
export async function start(
34+
opts: DevtoolsBackendOptions = {}
35+
): Promise<{ server: FastifyInstance; port: number }> {
3436
const host = opts.hostname || 'localhost'
3537
// Use getPort to find an available port, starting with the preferred port
3638
const preferredPort = opts.port || DEFAULT_PORT
@@ -122,7 +124,7 @@ export async function start(opts: DevtoolsBackendOptions = {}): Promise<{ server
122124
})
123125
return
124126
}
125-
} catch (e) {
127+
} catch {
126128
// Not JSON or parsing failed, forward as-is
127129
}
128130

@@ -150,7 +152,10 @@ export async function stop() {
150152

151153
// Close all WebSocket connections first
152154
clients.forEach((client) => {
153-
if (client.readyState === WebSocket.OPEN || client.readyState === WebSocket.CONNECTING) {
155+
if (
156+
client.readyState === WebSocket.OPEN ||
157+
client.readyState === WebSocket.CONNECTING
158+
) {
154159
client.terminate()
155160
}
156161
})

packages/nightwatch-devtools/example/tests/login.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
describe('The Internet Guinea Pig Website', function() {
2-
3-
it('should log into the secure area with valid credentials', async function(browser) {
1+
describe('The Internet Guinea Pig Website', function () {
2+
it('should log into the secure area with valid credentials', async function (browser) {
43
console.log('[TEST] Navigating to login page')
54
browser
65
.url('https://the-internet.herokuapp.com/login')
@@ -12,15 +11,17 @@ describe('The Internet Guinea Pig Website', function() {
1211
.setValue('#password', 'SuperSecretPassword!')
1312
.click('button[type="submit"]')
1413

15-
console.log('[TEST] Verifying flash message: You logged into a secure area!')
14+
console.log(
15+
'[TEST] Verifying flash message: You logged into a secure area!'
16+
)
1617
await browser
1718
.waitForElementVisible('#flash')
1819
.assert.textContains('#flash', 'You logged into a secure area!')
1920

2021
console.log('[TEST] Flash message verified successfully')
2122
})
2223

23-
it('should show error with invalid credentials', async function(browser) {
24+
it('should show error with invalid credentials', async function (browser) {
2425
console.log('[TEST] Navigating to login page')
2526
await browser
2627
.url('https://the-internet.herokuapp.com/login')
@@ -39,5 +40,4 @@ describe('The Internet Guinea Pig Website', function() {
3940

4041
console.log('[TEST] Flash message verified successfully')
4142
})
42-
4343
})
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
describe('Sample Nightwatch Test with DevTools', function() {
2-
3-
it('should navigate to example.com and check title', async function(browser) {
1+
describe('Sample Nightwatch Test with DevTools', function () {
2+
it('should navigate to example.com and check title', async function (browser) {
43
await browser
54
.url('https://example.com')
65
.waitForElementVisible('body', 5000)
76
.assert.titleContains('Example')
87
.assert.visible('h1')
9-
8+
109
const result = await browser.getText('h1')
1110
browser.assert.ok(result.includes('Example'), 'H1 contains "Example"')
12-
});
11+
})
1312

14-
it('should perform basic interactions', async function(browser) {
13+
it('should perform basic interactions', async function (browser) {
1514
await browser
1615
.url('https://www.google.com')
1716
.waitForElementVisible('body', 5000)
1817
.assert.visible('textarea[name="q"]')
1918
.setValue('textarea[name="q"]', 'WebdriverIO DevTools')
2019
.pause(1000)
21-
});
22-
23-
});
20+
})
21+
})

packages/nightwatch-devtools/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const TEST_STATE = {
109109
SKIPPED: 'skipped'
110110
} as const
111111

112-
export type TestState = typeof TEST_STATE[keyof typeof TEST_STATE]
112+
export type TestState = (typeof TEST_STATE)[keyof typeof TEST_STATE]
113113

114114
/**
115115
* Temporary UID generation pattern

0 commit comments

Comments
 (0)