Skip to content

Commit

Permalink
Support for latest stable VSCode 1.75.x release (#635)
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Jelinek <[email protected]>
  • Loading branch information
djelinek authored Feb 18, 2023
1 parent 9cfc61e commit 1ca0038
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 76 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/insiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

jobs:
test:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand Down Expand Up @@ -51,10 +51,7 @@ jobs:
- name: Run Tests (linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt-get install xvfb
export DISPLAY=:99
Xvfb -ac :99 -screen 0 1920x1080x16 &
npm run ci-test
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run ci-test
- name: Upload screenshots
uses: actions/upload-artifact@v3
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
version: [ min, 1.71.2, 1.72.2, 1.73.1, max ]
version: [ min, 1.72.2, 1.73.1, 1.74.3, max ]
include:
- os: macos-latest
version: max
Expand Down Expand Up @@ -57,10 +57,7 @@ jobs:
- name: Run Tests (linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo apt-get install xvfb
export DISPLAY=:99
Xvfb -ac :99 -screen 0 1920x1080x16 &
npm run ci-test
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm run ci-test
- name: Upload Screenshots
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions page-objects/src/components/bottomBar/Views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class TerminalView extends ChannelView {
}
const list = await this.findElement(TerminalView.locators.TerminalView.tabList);
const row = await list.findElement(TerminalView.locators.TerminalView.selectedRow);
await this.getDriver().sleep(1000);
const label = (await row.getAttribute('aria-label')).split(' ');

return `${label[1]}: ${label[2]}`
Expand Down
4 changes: 2 additions & 2 deletions src/extester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const DEFAULT_SETUP_OPTIONS = {
installDependencies: false
}

export const VSCODE_VERSION_MIN = '1.70.1';
export const VSCODE_VERSION_MAX = '1.74.3';
export const VSCODE_VERSION_MIN = '1.71.2';
export const VSCODE_VERSION_MAX = '1.75.1';

/**
* VSCode Extension Tester
Expand Down
2 changes: 1 addition & 1 deletion test/test-project/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"window.title": "${activeEditorShort}${separator}${rootName}${separator}folder: ${rootPath}"
"window.title": "${activeEditorShort}${separator}folder: ${rootPath}"
}
2 changes: 1 addition & 1 deletion test/test-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"compile": "rimraf out && tsc -p ./ && npm run lint",
"lint": "eslint src --ext .ts",
"watch": "tsc -watch -p ./",
"ui-test": "npm run compile && extest setup-and-run './out/src/test/**/customView*test.js' -u -i -r . -e ./test-extensions ",
"ui-test": "npm run compile && extest setup-and-run './out/src/test/**/customView*test.js' -u -i -r . -e ./test-extensions",
"ci-test": "npm run compile && extest setup-and-run './out/src/test/**/*test.js' -u -i -r . -e ./test-extensions"
},
"devDependencies": {
Expand Down
12 changes: 11 additions & 1 deletion test/test-project/src/test/debug/debug-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActivityBar, Breakpoint, DebugConsoleView, DebugToolbar, DebugView, DefaultTreeSection, EditorView, InputBox, Key, TextEditor, TitleBar, until, VSBrowser, WebDriver, Workbench } from "vscode-extension-tester";
import { ActivityBar, BottomBarPanel, Breakpoint, DebugConsoleView, DebugToolbar, DebugView, DefaultTreeSection, EditorView, InputBox, Key, TextEditor, TitleBar, until, VSBrowser, WebDriver, Workbench } from "vscode-extension-tester";
import * as path from 'path';
import { expect } from "chai";

Expand All @@ -22,6 +22,16 @@ import { expect } from "chai";
await (await tree.findItem('test.js')).select();

view = (await (await new ActivityBar().getViewControl('Run')).openView()) as DebugView;

// clear notifications center which causes flaky tests from VSCode version 1.75.x
await (await new Workbench().openNotificationsCenter()).clearAllNotifications();
});

after('After cleanup', async function () {
this.timeout(10000);
await new EditorView().closeAllEditors();
await (await new ActivityBar().getViewControl('Run and Debug')).closeView();
await new BottomBarPanel().toggle(false);
});

describe('Debug View', () => {
Expand Down
67 changes: 35 additions & 32 deletions test/test-project/src/test/editor/editorView-test.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
import { expect } from 'chai';
import { EditorView, EditorTab, Workbench, TextEditor, SettingsEditor, WebView, QuickOpenBox, DiffEditor, Key, InputBox, VSBrowser } from 'vscode-extension-tester';

describe('EditorView', () => {
describe('EditorView', function () {
let view: EditorView;

before(async function() {
before(async function () {
this.timeout(25000);
view = new EditorView();
await new Workbench().executeCommand('File: New File');
await new Promise((res) => { setTimeout(res, 500); });
await new Workbench().executeCommand('File: New File');
await new Promise((res) => { setTimeout(res, 500); });
await newUntitledFile();
await newUntitledFile();
await new Workbench().executeCommand('Webview Test');
await new Promise((res) => { setTimeout(res, 2500); });
await view.getDriver().sleep(2500);
await new Workbench().executeCommand('Open Settings UI');
await new Promise((res) => { setTimeout(res, 500); });
await view.getDriver().sleep(500);
});

after(async () => {
after(async function () {
await view.closeAllEditors();
});

it('openEditor works with text editor', async () => {
it('openEditor works with text editor', async function () {
const editor = await view.openEditor('Untitled-1') as TextEditor;
expect(await editor.getTitle()).equals('Untitled-1');
});

it('openEditor works with settings editor', async () => {
it('openEditor works with settings editor', async function () {
const editor = await view.openEditor('Settings') as SettingsEditor;
expect(editor.findSetting).not.undefined;
});

it('openEditor works with webview editor', async () => {
it('openEditor works with webview editor', async function () {
let editorTitle: string;
(await view.getOpenEditorTitles()).forEach(title => {
if(title.startsWith('Test WebView')) {
Expand All @@ -42,7 +40,7 @@ describe('EditorView', () => {
expect(editor.findWebElement).not.undefined;
});

it('openEditor works with diff editor', async () => {
it('openEditor works with diff editor', async function () {
await view.openEditor('Untitled-2');

await new Workbench().executeCommand('File: Compare Active File With...');
Expand All @@ -54,68 +52,67 @@ describe('EditorView', () => {
}
await quickOpen.setText('Untitled-1');
await quickOpen.confirm();
await new Promise((res) => { setTimeout(res, 500); });
await quickOpen.getDriver().sleep(500);

const diffEditor = await view.openEditor('Untitled-2 ↔ Untitled-1') as DiffEditor;
await new Promise((res) => { setTimeout(res, 500); });
await diffEditor.getDriver().sleep(500);
expect(await diffEditor.getOriginalEditor()).not.undefined;
expect(await diffEditor.getModifiedEditor()).not.undefined;
});

it('getTabByTitle works', async () => {
it('getTabByTitle works', async function () {
const tab = await view.getTabByTitle('Untitled-1');
expect(tab).not.undefined;
});

it('getOpenEditorTitles works', async () => {
it('getOpenEditorTitles works', async function () {
const tabs = await view.getOpenEditorTitles();
expect(tabs).not.empty;
expect(tabs).contains('Untitled-1');
expect(tabs).contains('Untitled-2');
});

it('closeEditor works', async () => {
it('closeEditor works', async function () {
await view.closeEditor('Untitled-1');
const tabs = await view.getOpenEditorTitles();
expect(tabs).not.contains('Untitled-1');
});

it('getActions works', async () => {
it('getActions works', async function () {
const actions = await view.getActions();
expect(actions).not.empty;
});

it('getAction works', async () => {
it('getAction works', async function () {
const action = await view.getAction('More Actions...');
expect(action).not.undefined;
});

describe('Editor Tab', () => {
describe('Editor Tab', function () {
let tab: EditorTab;

before(async () => {
before(async function () {
tab = await view.getTabByTitle('Untitled-2');
});

it('getTitle works', async () => {
it('getTitle works', async function () {
expect(await tab.getTitle()).equals('Untitled-2');
});
});

describe('Editor Groups', () => {
describe('Editor Groups', function () {
before(async function() {
this.timeout(5000);
view = new EditorView();
await new Workbench().executeCommand('File: New File');
await new Promise((res) => { setTimeout(res, 500); });
await newUntitledFile();
});

it('getEditorGroups works', async () => {
it('getEditorGroups works', async function () {
let driverActions = view.getDriver().actions();
driverActions.clear();
driverActions.keyDown(Key.CONTROL).sendKeys('\\').keyUp(Key.CONTROL).perform();

await new Promise((res) => { setTimeout(res, 500); });
await view.getDriver().sleep(500);
const groups = await view.getEditorGroups();
const group1 = await view.getEditorGroup(0);
const group2 = await view.getEditorGroup(1);
Expand All @@ -125,22 +122,22 @@ describe('EditorView', () => {
expect((await group2.getRect()).x).equals((await groups[1].getRect()).x);
});

it('openEditor works for different groups', async () => {
it('openEditor works for different groups', async function () {
const editor1 = await view.openEditor('Untitled-3', 0);
const editor2 = await view.openEditor('Untitled-3', 1);

expect((await editor1.getRect()).x < (await editor2.getRect()).x);
});

it('closeEditor works for different groups', async () => {
it('closeEditor works for different groups', async function () {
await view.getDriver().actions().keyDown(EditorView.ctlKey).sendKeys('\\').perform();
await new Promise((res) => { setTimeout(res, 500); });
await view.getDriver().sleep(500);

await view.closeEditor('Untitled-3', 2);
expect((await view.getEditorGroups()).length).equals(2);
});

it('getOpenEditorTitles works for different editor groups', async () => {
it('getOpenEditorTitles works for different editor groups', async function () {
const titles = await view.getOpenEditorTitles();
const titles1 = await view.getOpenEditorTitles(0);
const titles2 = await view.getOpenEditorTitles(1);
Expand All @@ -149,4 +146,10 @@ describe('EditorView', () => {
expect(titles).deep.equals(allTitles);
});
});

async function newUntitledFile(): Promise<void> {
await new Workbench().executeCommand('Create: New File...');
await (await InputBox.create()).selectQuickPick('Text File');
await view.getDriver().sleep(500);
}
});
5 changes: 3 additions & 2 deletions test/test-project/src/test/editor/textEditor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ describe('TextEditor', () => {

before(async function() {
this.timeout(8000);
await new Workbench().executeCommand('File: New File');
await new Workbench().executeCommand('Create: New File...');
await (await InputBox.create()).selectQuickPick('Text File');
await new Promise((res) => { setTimeout(res, 1000); });
view = new EditorView();
editor = new TextEditor(view);
Expand Down Expand Up @@ -291,7 +292,7 @@ describe('TextEditor', () => {
});

it('clicking triggers the lens command', async () => {
const lens = await editor.getCodeLens(0);
const lens = await editor.getCodeLens(2);
await lens.click();
await lens.getDriver().sleep(1000);
const notifications = await new Workbench().getNotifications();
Expand Down
Loading

0 comments on commit 1ca0038

Please sign in to comment.