Skip to content

Commit 9b6323f

Browse files
authored
DevTool dependencies update (#111)
* Initial dev test update * Live interaction on main screen * Refined commands that are shown in Actions tab specific to the test cases * UI - Border fix * Example test case update * Close the browser only when the user manages to close it manually and not when the test runner completes its execution * Action tab cleanup * Removed dummy browser pause * Slider UI update * Logger update * Horizontal slider update * Ignore all retries command in case of failure test case * Added documentation * Removed duplicates when importing trace file * Dependencies update * Improved the generic working of commands recorder * Revert "Improved the generic working of commands recorder" This reverts commit 260ed6e. * Trace data update * Fixed top level commands trace * Updated browser context injection * Metadata tab UI changes * Tailwind and major UI updates * Test-suit scroll bar * Iframe UI update * Hide scrollbar * Fix for wdio-devtools-tab scrollbar issue * Fix for horizontal slider * Horizontal slider updates * Slider fixes
1 parent b008af0 commit 9b6323f

File tree

26 files changed

+6447
-4087
lines changed

26 files changed

+6447
-4087
lines changed
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Given, When, Then } from '@wdio/cucumber-framework'
2-
import { expect } from '@wdio/globals'
1+
import { Given, When, Then, After } from '@wdio/cucumber-framework'
2+
import { browser, expect } from '@wdio/globals'
33

44
import LoginPage from '../pageobjects/login.page.js'
55
import SecurePage from '../pageobjects/secure.page.js'
@@ -8,6 +8,10 @@ const pages = {
88
login: LoginPage
99
} as const
1010

11+
After(async () => {
12+
await browser.reloadSession()
13+
})
14+
1115
Given(/^I am on the (\w+) page$/, async (page: keyof typeof pages) => {
1216
await pages[page].open()
1317
})
@@ -17,8 +21,9 @@ When(/^I login with (\w+) and (.+)$/, async (username, password) => {
1721
})
1822

1923
Then(/^I should see a flash message saying (.*)$/, async (message) => {
20-
await expect(SecurePage.flashAlert).toBeExisting()
21-
await expect(SecurePage.flashAlert).toHaveTextContaining(message)
24+
const el = await SecurePage.flashAlert
25+
await expect(el).toBeExisting()
26+
await expect(el).toHaveText(expect.stringContaining(message))
2227
await browser.pause(15000)
2328
})
2429

example/package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
"name": "examples",
33
"type": "module",
44
"devDependencies": {
5-
"@wdio/cli": "8.39.0",
6-
"@wdio/cucumber-framework": "^8.39.0",
7-
"@wdio/devtools-service": "workspace:^",
8-
"@wdio/globals": "^8.39.0",
9-
"@wdio/local-runner": "^8.39.0",
10-
"@wdio/spec-reporter": "^8.39.0",
11-
"@wdio/types": "^8.39.0",
12-
"expect-webdriverio": "^4.15.1",
5+
"@wdio/cli": "9.18.0",
6+
"@wdio/cucumber-framework": "9.18.0",
7+
"@wdio/devtools-service": "workspace:*",
8+
"@wdio/globals": "9.17.0",
9+
"@wdio/local-runner": "9.18.0",
10+
"@wdio/spec-reporter": "9.18.0",
11+
"@wdio/types": "9.16.2",
12+
"expect-webdriverio": "^5.4.0",
1313
"ts-node": "^10.9.2",
14-
"typescript": "^5.4.5"
14+
"tsconfig-paths": "^4.2.0",
15+
"tsx": "^4.20.3",
16+
"typescript": "^5.8.3"
1517
},
1618
"scripts": {
1719
"wdio": "wdio run ./wdio.conf.ts"

package.json

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@
1010
"watch": "pnpm build --watch"
1111
},
1212
"devDependencies": {
13-
"@types/node": "^20.14.5",
14-
"@typescript-eslint/eslint-plugin": "^6.9.0",
15-
"@typescript-eslint/parser": "^6.9.0",
16-
"@typescript-eslint/utils": "^6.9.0",
17-
"@vitest/browser": "^0.34.6",
18-
"autoprefixer": "^10.4.19",
19-
"eslint": "^8.52.0",
20-
"eslint-plugin-import": "^2.29.1",
21-
"eslint-plugin-unicorn": "^48.0.1",
13+
"@types/node": "^24.3.0",
14+
"@typescript-eslint/eslint-plugin": "^8.40.0",
15+
"@typescript-eslint/parser": "^8.40.0",
16+
"@typescript-eslint/utils": "^8.40.0",
17+
"@vitest/browser": "^3.2.4",
18+
"autoprefixer": "^10.4.21",
19+
"eslint": "^9.33.0",
20+
"eslint-plugin-import": "^2.32.0",
21+
"eslint-plugin-unicorn": "^59.0.1",
2222
"npm-run-all": "^4.1.5",
23-
"postcss": "^8.4.38",
24-
"postcss-lit": "^1.1.1",
25-
"tailwindcss": "^3.4.4",
23+
"postcss": "^8.5.6",
24+
"postcss-lit": "^1.2.0",
25+
"tailwindcss": "^4.1.12",
2626
"ts-node": "^10.9.2",
27-
"typescript": "^5.0.2",
28-
"unplugin-icons": "^0.19.0",
29-
"vite": "^4.4.5",
30-
"vitest": "^0.34.6",
31-
"webdriverio": "^8.39.0"
27+
"tsx": "^4.20.4",
28+
"typescript": "^5.9.2",
29+
"unplugin-icons": "^22.2.0",
30+
"vite": "^7.1.3",
31+
"vitest": "^3.2.4",
32+
"webdriverio": "^9.19.1"
3233
},
3334
"dependencies": {
34-
"@wdio/cli": "8.39.0"
35+
"@wdio/cli": "9.18.0"
3536
}
3637
}

packages/app/package.json

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,30 @@
1111
"test": "eslint ."
1212
},
1313
"dependencies": {
14-
"@codemirror/lang-javascript": "^6.2.1",
15-
"@codemirror/theme-one-dark": "^6.1.2",
16-
"@codemirror/view": "^6.22.0",
17-
"@iconify-json/mdi": "^1.1.54",
18-
"@lit/context": "^1.0.1",
19-
"@wdio/protocols": "^8.23.0",
20-
"codemirror": "^6.0.1",
21-
"lit": "^2.7.6",
22-
"placeholder-loading": "^0.6.0",
14+
"@codemirror/lang-javascript": "^6.2.4",
15+
"@codemirror/theme-one-dark": "^6.1.3",
16+
"@codemirror/view": "^6.38.1",
17+
"@iconify-json/mdi": "^1.2.3",
18+
"@lit/context": "^1.1.6",
19+
"@wdio/protocols": "9.16.2",
20+
"codemirror": "^6.0.2",
21+
"lit": "^3.3.1",
22+
"placeholder-loading": "^0.7.0",
2323
"pointer-tracker": "^2.5.3",
24-
"preact": "^10.18.1"
24+
"preact": "^10.27.1"
2525
},
2626
"author": "Christian Bromann <[email protected]>",
2727
"license": "MIT",
2828
"devDependencies": {
29-
"@wdio/devtools-service": "workspace:^",
30-
"@wdio/reporter": "^8.23.0"
29+
"@tailwindcss/postcss": "^4.1.12",
30+
"@wdio/devtools-service": "workspace:*",
31+
"@wdio/reporter": "9.18.0",
32+
"autoprefixer": "^10.4.21",
33+
"postcss": "^8.5.6",
34+
"rollup": "^4.47.0",
35+
"stylelint": "^16.24.0",
36+
"stylelint-config-recommended": "^17.0.0",
37+
"stylelint-config-tailwindcss": "^1.0.0",
38+
"tailwindcss": "~3.4.17"
3139
}
3240
}

packages/app/postcss.config.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line no-undef
21
module.exports = {
32
plugins: {
43
tailwindcss: {},

packages/app/src/app.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ export class WebdriverIODevtoolsApplication extends Element {
3838
@query('section')
3939
window?: HTMLElement
4040

41+
@query('section[data-resizer-window]')
42+
resizerWindow?: HTMLElement
43+
4144
async #getWindow() {
4245
await this.updateComplete
43-
return this.window as Element
46+
return this.resizerWindow as Element
4447
}
4548

4649
connectedCallback(): void {
@@ -66,16 +69,15 @@ export class WebdriverIODevtoolsApplication extends Element {
6669
}
6770

6871
return html`
69-
<section class="flex h-[calc(100%-40px)] w-full relative">
72+
<section data-resizer-window class="flex h-[calc(100%-40px)] w-full relative">
7073
${
7174
// only render sidebar if trace file is captured using testrunner
7275
this.dataManager.traceType === TraceType.Testrunner
73-
? html`<wdio-devtools-sidebar style="${this.#drag.getPosition()}"></wdio-devtools-sidebar>`
76+
? html`<wdio-devtools-sidebar style="${this.#drag?.getPosition()}"></wdio-devtools-sidebar>`
7477
: nothing
7578
}
76-
79+
${this.#drag.getSlider('z-10 h-full')}
7780
<wdio-devtools-workbench class="basis-auto"></wdio-devtools-workbench>
78-
${this.#drag.getSlider()}
7981
</section>
8082
`
8183
}

packages/app/src/components/browser/snapshot.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { consume } from '@lit/context'
44

55
import { type ComponentChildren, h, render, type VNode } from 'preact'
66
import { customElement, query } from 'lit/decorators.js'
7+
import type { SimplifiedVNode } from '../../../../script/types'
78

89
import { mutationContext, type TraceMutation, metadataContext, type Metadata } from '../../controller/DataManager.js'
910

@@ -49,11 +50,20 @@ export class DevtoolsBrowser extends Element {
4950
width: 100%;
5051
height: 100%;
5152
display: flex;
52-
margin: 2rem;
53+
padding: 2rem;
5354
align-items: center;
5455
justify-content: center;
5556
}
5657
58+
section {
59+
box-sizing: border-box;
60+
width: calc(100% - 0px); /* host padding already applied */
61+
height: calc(100% - 0px);
62+
display: flex;
63+
flex-direction: column;
64+
overflow: hidden;
65+
}
66+
5767
.frame-dot {
5868
border-radius: 50%;
5969
height: 12px;
@@ -87,9 +97,6 @@ export class DevtoolsBrowser extends Element {
8797
return
8898
}
8999

90-
this.section.style.width = 'auto'
91-
this.section.style.height = 'auto'
92-
93100
this.iframe.removeAttribute('style')
94101
const viewportWidth = metadata.viewport.width
95102
const viewportHeight = metadata.viewport.height
@@ -301,7 +308,7 @@ export class DevtoolsBrowser extends Element {
301308
}
302309

303310
return html`
304-
<section class="w-full bg-sideBarBackground rounded-t-md shadow-md">
311+
<section class="w-full h-full bg-sideBarBackground rounded-t-md shadow-md">
305312
<header class="flex block mx-2">
306313
<div class="frame-dot bg-notificationsErrorIconForeground"></div>
307314
<div class="frame-dot bg-notificationsWarningIconForeground"></div>
@@ -312,7 +319,7 @@ export class DevtoolsBrowser extends Element {
312319
</div>
313320
</header>
314321
${this.mutations && this.mutations.length
315-
? html`<iframe class="origin-top-left"></iframe>`
322+
? html`<iframe class="origin-top-left h-full w-full"></iframe>`
316323
: html`<wdio-devtools-placeholder style="height: 100%"></wdio-devtools-placeholder>`
317324
}
318325
</section>

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

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { html, css, nothing, type TemplateResult } from 'lit'
33
import { customElement } from 'lit/decorators.js'
44
import { consume } from '@lit/context'
55
import type { TestStats, SuiteStats } from '@wdio/reporter'
6-
6+
import { repeat } from 'lit/directives/repeat.js'
77
import { TestState } from './test-suite.js'
88
import { suiteContext } from '../../controller/DataManager.js'
99

@@ -20,6 +20,7 @@ import type { DevtoolsSidebarFilter } from './filter.js'
2020
const EXPLORER = 'wdio-devtools-sidebar-explorer'
2121

2222
interface TestEntry {
23+
uid: string
2324
state?: string
2425
label: string
2526
children: TestEntry[]
@@ -32,7 +33,21 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
3233
static styles = [...Element.styles, css`
3334
:host {
3435
width: 100%;
35-
display: block;
36+
display: flex;
37+
flex-direction: column;
38+
min-height: 0;
39+
}
40+
41+
header {
42+
flex: 0 0 auto;
43+
}
44+
45+
wdio-test-suite {
46+
flex: 1 1 auto;
47+
overflow-y: auto;
48+
overflow-x: hidden;
49+
min-height: 0;
50+
scrollbar-width: none;
3651
}
3752
`]
3853

@@ -53,10 +68,16 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
5368
return html`
5469
<wdio-test-entry state="${entry.state as any}">
5570
<label slot="label">${entry.label}</label>
56-
${entry.children && entry.children.length ?
57-
html`
58-
<wdio-test-suite slot="children">${entry.children.map(this.#renderEntry.bind(this))}</wdio-test-suite>
59-
`
71+
${entry.children && entry.children.length
72+
? html`
73+
<wdio-test-suite slot="children">
74+
${repeat(
75+
entry.children,
76+
child => child.uid,
77+
child => this.#renderEntry(child)
78+
)}
79+
</wdio-test-suite>
80+
`
6081
: nothing
6182
}
6283
</wdio-test-entry>
@@ -88,6 +109,7 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
88109
if ('tests' in entry) {
89110
const entries = [...entry.tests, ...entry.suites]
90111
return {
112+
uid: entry.uid,
91113
label: entry.title,
92114
state: entry.tests.some((t) => !t.end)
93115
? TestState.RUNNING
@@ -100,6 +122,7 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
100122
}
101123
}
102124
return {
125+
uid: entry.uid,
103126
label: entry.title,
104127
state: !entry.end
105128
? TestState.RUNNING
@@ -114,7 +137,18 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
114137
if (!this.suites) {
115138
return
116139
}
117-
const suites = Object.values(this.suites[0])
140+
141+
// ✅ Only root suites (no parent = true top-level suite)
142+
const rootSuites = this.suites
143+
.flatMap(s => Object.values(s))
144+
.filter(suite => !suite.parent)
145+
146+
// Deduplicate by uid (in case some frameworks still push duplicates)
147+
const uniqueSuites = Array.from(
148+
new Map(rootSuites.map(suite => [suite.uid, suite])).values()
149+
)
150+
151+
const suites = uniqueSuites
118152
.map(this.#getTestEntry.bind(this))
119153
.filter(this.#filterEntry.bind(this))
120154

@@ -132,7 +166,11 @@ export class DevtoolsSidebarExplorer extends CollapseableEntry {
132166
</header>
133167
<wdio-test-suite>
134168
${suites.length
135-
? suites.map(this.#renderEntry.bind(this))
169+
? repeat(
170+
suites,
171+
suite => suite.uid,
172+
suite => this.#renderEntry(suite)
173+
)
136174
: html`<p class="text-disabledForeground text-sm px-4 py-2">No tests found</p>`
137175
}
138176
</wdio-test-suite>

packages/app/src/components/tabs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class DevtoolsTabs extends Element {
1515
:host {
1616
width: 100%;
1717
flex-grow: 1;
18+
min-height: 0;
1819
display: flex;
1920
flex-direction: column;
2021
color: var(--vscode-foreground);
@@ -130,7 +131,9 @@ export class DevtoolsTab extends Element {
130131
:host {
131132
display: none;
132133
flex-grow: 1;
133-
overflow-y: scroll;
134+
min-height: 0;
135+
overflow-y: auto;
136+
scrollbar-width: none;
134137
}
135138
136139
:host([active]) {

0 commit comments

Comments
 (0)