Skip to content

Commit 66f4c5b

Browse files
committed
ci: update assertions
1 parent 1457d6e commit 66f4c5b

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

e2e/assertions/index.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MatcherContext } from 'expect'
2-
import type { TreeItem, Workbench } from 'wdio-vscode-service'
2+
import type { BottomBarPanel, TreeItem, Workbench } from 'wdio-vscode-service'
33
import type { STATUS } from '../helpers/index.ts'
44

55
export interface ExpectedTreeItem {
@@ -94,18 +94,39 @@ try {
9494
},
9595
async hasExpectedLog(workbench: Workbench, expectedLog: RegExp | string) {
9696
const bottomBar = workbench.getBottomBar()
97+
await bottomBar.toggle(true)
98+
await clickGlobalAction(bottomBar, bottomBar.locators.maximize)
99+
97100
const outputView = await bottomBar.openOutputView()
98101
await outputView.selectChannel('WebdriverIO')
99102
const logs = await outputView.getText()
100103

101104
const regexp = typeof expectedLog === 'string' ? new RegExp(expectedLog) : expectedLog
102105

103106
const pass = logs.some((log) => regexp.test(log))
107+
108+
await bottomBar.toggle(true)
109+
await clickGlobalAction(bottomBar, bottomBar.locators.restore)
104110
const message = pass ? 'The log outputs include expected text.' : 'The expected text is not included'
105-
return { pass, message }
111+
return { pass, message: () => message }
106112
},
107113
})
108114
}
109115
} catch (error) {
110116
console.warn('Failed to extend expect:', error)
111117
}
118+
119+
async function clickGlobalAction(bottomBar: BottomBarPanel, label: string) {
120+
await bottomBar.toggle(true)
121+
let action
122+
try {
123+
action = await bottomBar.elem
124+
.$(bottomBar.locators.globalActions)
125+
.$(`.//a[contains(@aria-label, '${label}') and @role='checkbox']`)
126+
} catch {
127+
// the panel is already maximized
128+
}
129+
if (action) {
130+
await action.click()
131+
}
132+
}

0 commit comments

Comments
 (0)