Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/ui-test/contentAssistTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export function contentAssistSuggestionTest(): void {
const yamlFilePath = path.join(homeDir, yamlFileName);

before(async function setup() {
this.timeout(20000);
this.timeout(80000);
driver = VSBrowser.instance.driver;
editor = await createCustomFile(yamlFilePath);
await driver.wait(async () => {
return await getSchemaLabel(yamlFileName);
}, 18000);
}, 45000);
});

it('Content assist suggests right suggestion', async function () {
this.timeout(15000);
this.timeout(45000);
editor = new TextEditor();
await editor.setText('api');
const contentAssist = await editor.toggleContentAssist(true);
Expand Down
22 changes: 18 additions & 4 deletions test/ui-test/customTagsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ export function customTagsTest(): void {
let editorView: EditorView;

before(async function setup() {
this.timeout(20000);
this.timeout(80000);
driver = VSBrowser.instance.driver;
editorView = new EditorView();
await createCustomFile(yamlFilePath);
await driver.wait(async () => {
return await getSchemaLabel(yamlFileName);
}, 18000);
}, 45000);
});

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

const settingsEditor = await new Workbench().openSettings();
const setting = await settingsEditor.findSetting('Custom Tags', 'Yaml');
Expand All @@ -37,7 +37,21 @@ export function customTagsTest(): void {
await hardDelay(2000);
const textSettingsEditor = (await editorView.openEditor('settings.json')) as TextEditor;
if (process.platform === 'darwin') {
await driver.actions().sendKeys(' "customTag1"').perform();
const fullText = await textSettingsEditor.getText();
const lines = fullText.split('\n');

// find the line with "yaml.customTags"
let targetLine = -1;
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes('"yaml.customTags"') && lines[i].includes('[')) {
targetLine = i + 2; // position on the line after the opening bracket
break;
}
}
if (targetLine === -1) {
expect.fail('Could not find yaml.customTags in settings.json');
}
await textSettingsEditor.typeTextAt(targetLine, 5, ' "customTag1"');
} else {
const coor = await textSettingsEditor.getCoordinates();
await textSettingsEditor.typeTextAt(coor[0], coor[1], ' "customTag1"');
Expand Down
40 changes: 33 additions & 7 deletions test/ui-test/extensionUITest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,53 @@ export function extensionUIAssetsTest(): void {
let yamlItem: ExtensionsViewItem;

before(async function () {
this.timeout(20000);
this.timeout(100000);
driver = VSBrowser.instance.driver;
view = await new ActivityBar().getViewControl('Extensions');
sideBar = await view.openView();
driver.wait(
await driver.wait(
async () => !(await sideBar.getContent().hasProgress()),
5000,
30000,
"Progress bar hasn't been hidden within the timeout"
);
section = (await sideBar.getContent().getSection('Installed')) as ExtensionsViewSection;
// wait a bit for sections to load
await new Promise((resolve) => setTimeout(resolve, 10000));
section = await driver.wait(
async () => {
try {
const content = sideBar.getContent();
const sections = await content.getSections();
for (const sectionName of ['Installed', 'INSTALLED', 'installed']) {
try {
const sec = await content.getSection(sectionName);
if (sec) return sec as ExtensionsViewSection;
} catch {
// try next name
}
}
if (sections.length > 0) {
return sections[0] as ExtensionsViewSection;
}
return null;
} catch {
return null;
}
},
40000,
'Could not find extensions section'
);
await section.expand();
yamlItem = await driver.wait(
async () => {
return await section.findItem(`@installed ${YamlConstants.YAML_NAME}`);
},
5000,
20000,
'There were not visible items available under installed section'
);
});

it('YAML extension is installed', async function () {
this.timeout(5000);
this.timeout(10000);
expect(yamlItem).not.undefined;
let author: string;
let name: string;
Expand All @@ -62,7 +87,8 @@ export function extensionUIAssetsTest(): void {
expect(author).to.equal('Red Hat');
});

after(async () => {
after(async function () {
this.timeout(5000);
if (sideBar && (await sideBar.isDisplayed()) && view) {
await view.closeView();
}
Expand Down
Loading