Skip to content

Commit 7e825fd

Browse files
authored
Fix macOS CI UI tests (#1186)
* await for progress bar to disappear * Update customTagsTest.ts * Update extensionUITest.ts * Update extensionUITest.ts * Update extensionUITest.ts * Update extensionUITest.ts * Update extensionUITest.ts * increase timeout * Update extensionUITest.ts
1 parent 9b164e0 commit 7e825fd

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
lines changed

test/ui-test/contentAssistTest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ export function contentAssistSuggestionTest(): void {
1616
const yamlFilePath = path.join(homeDir, yamlFileName);
1717

1818
before(async function setup() {
19-
this.timeout(20000);
19+
this.timeout(80000);
2020
driver = VSBrowser.instance.driver;
2121
editor = await createCustomFile(yamlFilePath);
2222
await driver.wait(async () => {
2323
return await getSchemaLabel(yamlFileName);
24-
}, 18000);
24+
}, 45000);
2525
});
2626

2727
it('Content assist suggests right suggestion', async function () {
28-
this.timeout(15000);
28+
this.timeout(45000);
2929
editor = new TextEditor();
3030
await editor.setText('api');
3131
const contentAssist = await editor.toggleContentAssist(true);

test/ui-test/customTagsTest.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export function customTagsTest(): void {
1818
let editorView: EditorView;
1919

2020
before(async function setup() {
21-
this.timeout(20000);
21+
this.timeout(80000);
2222
driver = VSBrowser.instance.driver;
2323
editorView = new EditorView();
2424
await createCustomFile(yamlFilePath);
2525
await driver.wait(async () => {
2626
return await getSchemaLabel(yamlFileName);
27-
}, 18000);
27+
}, 45000);
2828
});
2929

3030
it('YAML custom tags works as expected', async function () {
31-
this.timeout(30000);
31+
this.timeout(60000);
3232

3333
const settingsEditor = await new Workbench().openSettings();
3434
const setting = await settingsEditor.findSetting('Custom Tags', 'Yaml');
@@ -37,7 +37,21 @@ export function customTagsTest(): void {
3737
await hardDelay(2000);
3838
const textSettingsEditor = (await editorView.openEditor('settings.json')) as TextEditor;
3939
if (process.platform === 'darwin') {
40-
await driver.actions().sendKeys(' "customTag1"').perform();
40+
const fullText = await textSettingsEditor.getText();
41+
const lines = fullText.split('\n');
42+
43+
// find the line with "yaml.customTags"
44+
let targetLine = -1;
45+
for (let i = 0; i < lines.length; i++) {
46+
if (lines[i].includes('"yaml.customTags"') && lines[i].includes('[')) {
47+
targetLine = i + 2; // position on the line after the opening bracket
48+
break;
49+
}
50+
}
51+
if (targetLine === -1) {
52+
expect.fail('Could not find yaml.customTags in settings.json');
53+
}
54+
await textSettingsEditor.typeTextAt(targetLine, 5, ' "customTag1"');
4155
} else {
4256
const coor = await textSettingsEditor.getCoordinates();
4357
await textSettingsEditor.typeTextAt(coor[0], coor[1], ' "customTag1"');

test/ui-test/extensionUITest.ts

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,53 @@ export function extensionUIAssetsTest(): void {
2222
let yamlItem: ExtensionsViewItem;
2323

2424
before(async function () {
25-
this.timeout(20000);
25+
this.timeout(100000);
2626
driver = VSBrowser.instance.driver;
2727
view = await new ActivityBar().getViewControl('Extensions');
2828
sideBar = await view.openView();
29-
driver.wait(
29+
await driver.wait(
3030
async () => !(await sideBar.getContent().hasProgress()),
31-
5000,
31+
30000,
3232
"Progress bar hasn't been hidden within the timeout"
3333
);
34-
section = (await sideBar.getContent().getSection('Installed')) as ExtensionsViewSection;
34+
// wait a bit for sections to load
35+
await new Promise((resolve) => setTimeout(resolve, 10000));
36+
section = await driver.wait(
37+
async () => {
38+
try {
39+
const content = sideBar.getContent();
40+
const sections = await content.getSections();
41+
for (const sectionName of ['Installed', 'INSTALLED', 'installed']) {
42+
try {
43+
const sec = await content.getSection(sectionName);
44+
if (sec) return sec as ExtensionsViewSection;
45+
} catch {
46+
// try next name
47+
}
48+
}
49+
if (sections.length > 0) {
50+
return sections[0] as ExtensionsViewSection;
51+
}
52+
return null;
53+
} catch {
54+
return null;
55+
}
56+
},
57+
40000,
58+
'Could not find extensions section'
59+
);
3560
await section.expand();
3661
yamlItem = await driver.wait(
3762
async () => {
3863
return await section.findItem(`@installed ${YamlConstants.YAML_NAME}`);
3964
},
40-
5000,
65+
20000,
4166
'There were not visible items available under installed section'
4267
);
4368
});
4469

4570
it('YAML extension is installed', async function () {
46-
this.timeout(5000);
71+
this.timeout(10000);
4772
expect(yamlItem).not.undefined;
4873
let author: string;
4974
let name: string;
@@ -62,7 +87,8 @@ export function extensionUIAssetsTest(): void {
6287
expect(author).to.equal('Red Hat');
6388
});
6489

65-
after(async () => {
90+
after(async function () {
91+
this.timeout(5000);
6692
if (sideBar && (await sideBar.isDisplayed()) && view) {
6793
await view.closeView();
6894
}

0 commit comments

Comments
 (0)