Skip to content

Commit 123ff26

Browse files
committed
test(runner): resolve timing issues
1 parent d46ea25 commit 123ff26

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

packages/extester-runner/src/ui-test/01_extension.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('ExTester Runner', function () {
4444
*/
4545
before(async function () {
4646
driver = VSBrowser.instance.driver;
47+
await driver.sleep(3_000); // give vscode workbench some time to load properly
4748
await waitUntilExtensionIsActivated(driver, `${pjson.displayName}`);
4849
});
4950

packages/extester-runner/src/ui-test/03_extersterTreeProvider.test.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ describe('Parser test suite', function () {
5858
this.timeout(30000);
5959

6060
const browser = VSBrowser.instance;
61-
await browser.openResources(EXAMPLE_PROJECT);
61+
await browser.openResources(EXAMPLE_PROJECT, async () => {
62+
await browser.driver.sleep(3_000);
63+
});
6264

6365
await updateSettings(TEST_FILE_GLOB_SETTINGS_ID, TEST_FILE_GLOB);
6466
});
@@ -84,7 +86,7 @@ describe('Parser test suite', function () {
8486
const runnerView = await (await new ActivityBar().getViewControl(EXTESTER_RUNNER))?.openView();
8587
assert.ok(runnerView, 'Runner view not found');
8688

87-
const content = await runnerView.getContent();
89+
const content = runnerView.getContent();
8890
assert.ok(content, 'Content not found');
8991

9092
const sections = await content.getSections();
@@ -101,6 +103,7 @@ describe('Parser test suite', function () {
101103
await tree.openItem(PARSER_FOLDER);
102104
const item = await tree.findItem(SIMPLE_FILE);
103105
await item?.expand();
106+
await item?.getDriver().sleep(1_000); // time to re-render items
104107

105108
// Verify describe block
106109
const describes = await item?.getChildren();
@@ -148,6 +151,7 @@ describe('Parser test suite', function () {
148151
await tree.openItem(PARSER_FOLDER);
149152
const item = await tree.findItem(SIMPLE_FILE_WITH_MODIFIERS);
150153
await item?.expand();
154+
await item?.getDriver().sleep(1_000); // time to re-render items
151155

152156
// Verify describe block
153157
const describes = await item?.getChildren();
@@ -195,6 +199,7 @@ describe('Parser test suite', function () {
195199
await tree.openItem(PARSER_FOLDER);
196200
const item = await tree.findItem(SIMPLE_FILE_WITH_VARIABLES);
197201
await item?.expand();
202+
await item?.getDriver().sleep(1_000); // time to re-render items
198203

199204
// Verify describe block
200205
const describes = await item?.getChildren();
@@ -244,6 +249,7 @@ describe('Parser test suite', function () {
244249
await tree.openItem(PARSER_FOLDER);
245250
const item = await tree.findItem(MULTIPLE_ROOT_DESCRIBES);
246251
await item?.expand();
252+
await item?.getDriver().sleep(1_000); // time to re-render items
247253

248254
// Verify describe blocks
249255
const describes = await item?.getChildren();
@@ -255,12 +261,12 @@ describe('Parser test suite', function () {
255261
assert.strictEqual(firstDescribeLabel.trim(), EXPECTED_DESCRIBE_1);
256262

257263
// first describe first test
258-
const firstDesribeIts = await firstDescribe.getChildren();
259-
assert.ok(firstDesribeIts?.length === 1, 'First describe should have exactly one it');
264+
const firstDescribeIts = await firstDescribe.getChildren();
265+
assert.ok(firstDescribeIts?.length === 1, 'First describe should have exactly one it');
260266

261-
const firstDesribeFirstIt = firstDesribeIts[0];
262-
const firstDesribeFirstItLabel = await firstDesribeFirstIt.getLabel();
263-
assert.strictEqual(firstDesribeFirstItLabel.trim(), EXPECTED_TEST_1);
267+
const firstDescribeFirstIt = firstDescribeIts[0];
268+
const firstDescribeFirstItLabel = await firstDescribeFirstIt.getLabel();
269+
assert.strictEqual(firstDescribeFirstItLabel.trim(), EXPECTED_TEST_1);
264270

265271
// second describe
266272
const secondDescribe = describes[1];

packages/extester-runner/src/ui-test/utils/testUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export async function extensionIsActivated(displayName: string): Promise<boolean
113113
*/
114114
export async function getSection(sectionIndex: number): Promise<ViewSection> {
115115
const runnerView = await (await new ActivityBar().getViewControl(EXTESTER_RUNNER))?.openView();
116-
const content = await (await runnerView?.getContent())?.getSections();
116+
const content = await runnerView?.getContent()?.getSections();
117117
if (!content) {
118118
throw new Error('Content sections not found');
119119
}

0 commit comments

Comments
 (0)