-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbasicCucumber.spec.ts
More file actions
89 lines (65 loc) · 2.99 KB
/
basicCucumber.spec.ts
File metadata and controls
89 lines (65 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { browser, expect } from '@wdio/globals'
import { createCucumberExpected } from '../helpers/cucumber.js'
import {
STATUS,
clearAllTestResults,
clickTitleActionButton,
clickTreeItemButton,
collapseAllTests,
getTestingSection,
openTestingView,
waitForResolved,
waitForTestStatus,
} from '../helpers/index.js'
import type { SideBarView, ViewControl, Workbench } from 'wdio-vscode-service'
const targetFramework = process.env.VSCODE_WDIO_E2E_SCENARIO || 'mocha'
const expected = createCucumberExpected()
describe(`VS Code Extension Testing with ${targetFramework}`, function () {
this.retries(3)
let workbench: Workbench
let testingViewControl: ViewControl
let sideBarView: SideBarView<any>
beforeEach(async function () {
workbench = await browser.getWorkbench()
testingViewControl = await openTestingView(workbench)
sideBarView = workbench.getSideBar()
const testingSection = await getTestingSection(sideBarView.getContent())
await collapseAllTests(testingSection)
await browser.waitUntil(async () => (await testingSection.getVisibleItems()).length === 1)
})
afterEach(async function () {
await clearAllTestResults(workbench)
})
it('should be displayed the testing screen at the sideBar', async function () {
expect(await testingViewControl.getTitle()).toBe('Testing')
expect(await sideBarView.getTitlePart().getTitle()).toBe('TESTING')
})
it('should resolve defined tests correctly', async function () {
const testingSection = await getTestingSection(sideBarView.getContent())
const items = await testingSection.getVisibleItems()
await waitForResolved(browser, items[0])
await expect(items).toMatchTreeStructure(expected.notRun)
})
it('should run at top Level', async function () {
const testingSection = await getTestingSection(sideBarView.getContent())
const items = await testingSection.getVisibleItems()
await waitForResolved(browser, items[0])
await clickTitleActionButton(sideBarView.getTitlePart(), 'Run Tests')
await waitForTestStatus(browser, items[0], STATUS.PASSED)
await expect(items).toMatchTreeStructure(expected.runAll)
})
it('should run Scenario level even if select step level test', async function () {
const testingSection = await getTestingSection(sideBarView.getContent())
const items = await testingSection.getVisibleItems()
await waitForResolved(browser, items[0])
const target = await items[0]
.getChildren()
.then((items) => items[0].getChildren())
.then((items) => items[0].getChildren())
.then((items) => items[0].getChildren())
.then((items) => items[1])
await clickTreeItemButton(browser, target, 'Run Test')
await waitForTestStatus(browser, items[0], STATUS.PASSED)
await expect(items).toMatchTreeStructure(expected.runPartially)
})
})