This commit is contained in:
Joao Moreno 2018-04-05 23:36:58 +02:00
parent 3fe4ed9dbb
commit 0d7cc20324
8 changed files with 24 additions and 24 deletions

View file

@ -68,11 +68,11 @@ export class SpectronApplication {
return this.options.quality;
}
get client(): API {
get api(): API {
return this._api;
}
get webclient(): WebClient {
private get webclient(): WebClient {
if (!this.spectron) {
throw new Error('Application not started');
}
@ -292,12 +292,12 @@ export class SpectronApplication {
}
}
await this.client.waitForElement('.monaco-workbench');
await this.api.waitForElement('.monaco-workbench');
}
private async waitForWelcome(): Promise<any> {
await this.client.waitForElement('.explorer-folders-view');
await this.client.waitForElement(`.editor-container[id="workbench.editor.walkThroughPart"] .welcomePage`);
await this.api.waitForElement('.explorer-folders-view');
await this.api.waitForElement(`.editor-container[id="workbench.editor.walkThroughPart"] .welcomePage`);
}
private retrieveKeybindings(): Promise<void> {

View file

@ -25,11 +25,11 @@ export function setup() {
await app.workbench.quickopen.openFile('style.css');
await app.workbench.editor.waitForTypeInEditor('style.css', '.foo{}');
await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
await app.api.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.WARNING));
await app.screenCapturer.capture('CSS Warning in editor');
await app.workbench.problems.showProblemsView();
await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.WARNING));
await app.api.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.WARNING));
await app.screenCapturer.capture('CSS Warning in problems view');
await app.workbench.problems.hideProblemsView();
});
@ -40,12 +40,12 @@ export function setup() {
await app.workbench.quickopen.openFile('style.css');
await app.workbench.editor.waitForTypeInEditor('style.css', '.foo{}');
await app.client.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
await app.api.waitForElement(Problems.getSelectorInEditor(ProblemSeverity.ERROR));
await app.screenCapturer.capture('CSS Error in editor');
const problems = new Problems(app.client, app.workbench);
const problems = new Problems(app.api, app.workbench);
await problems.showProblemsView();
await app.client.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
await app.api.waitForElement(Problems.getSelectorInProblemsView(ProblemSeverity.ERROR));
await app.screenCapturer.capture('CSS Error in probles view');
await problems.hideProblemsView();
});

View file

@ -69,16 +69,16 @@ export function setup() {
it('focus stack frames and variables', async function () {
const app = this.app as SpectronApplication;
await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
await app.api.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
await app.workbench.debug.focusStackFrame('layer.js', 'looking for layer.js');
await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 5, 'there should be 5 local variables');
await app.api.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 5, 'there should be 5 local variables');
await app.workbench.debug.focusStackFrame('route.js', 'looking for route.js');
await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 3, 'there should be 3 local variables');
await app.api.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 3, 'there should be 3 local variables');
await app.workbench.debug.focusStackFrame('index.js', 'looking for index.js');
await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
await app.api.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
});
it('stepOver, stepIn, stepOut', async function () {

View file

@ -25,7 +25,7 @@ export function setup() {
await app.workbench.quickopen.openQuickOpen('.js');
await app.workbench.quickopen.waitForQuickOpenElements(names => expectedNames.every(n => names.some(m => n === m)));
await app.client.keys(['Escape', 'NULL']);
await app.api.keys(['Escape', 'NULL']);
});
it('quick open respects fuzzy matching', async function () {
@ -38,7 +38,7 @@ export function setup() {
await app.workbench.quickopen.openQuickOpen('a.s');
await app.workbench.quickopen.waitForQuickOpenElements(names => expectedNames.every(n => names.some(m => n === m)));
await app.client.keys(['Escape', 'NULL']);
await app.api.keys(['Escape', 'NULL']);
});
});
}

View file

@ -40,7 +40,7 @@ export function setup() {
await app.workbench.scm.openSCMViewlet();
await app.workbench.scm.openChange('app.js');
await app.client.waitForElement(DIFF_EDITOR_LINE_INSERT);
await app.api.waitForElement(DIFF_EDITOR_LINE_INSERT);
});
it('stages correctly', async function () {
@ -67,13 +67,13 @@ export function setup() {
await app.workbench.scm.waitForChange('app.js', 'Index Modified');
await app.workbench.scm.commit('first commit');
await app.client.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 1↑');
await app.api.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 1↑');
await app.workbench.runCommand('Git: Stage All Changes');
await app.workbench.scm.waitForChange('index.jade', 'Index Modified');
await app.workbench.scm.commit('second commit');
await app.client.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 2↑');
await app.api.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 2↑');
cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath });
});

View file

@ -29,7 +29,7 @@ export function setup() {
it('shows workspace name in title', async function () {
const app = this.app as SpectronApplication;
const title = await app.client.getTitle();
const title = await app.api.getTitle();
await app.screenCapturer.capture('window title');
assert.ok(title.indexOf('smoketest (Workspace)') >= 0);
});

View file

@ -18,12 +18,12 @@ export function setup() {
const app = this.app as SpectronApplication;
await app.workbench.explorer.openFile('app.js');
await app.client.waitForElements('.line-numbers', elements => !!elements.length);
await app.api.waitForElements('.line-numbers', elements => !!elements.length);
await app.screenCapturer.capture('app.js has line numbers');
await app.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"');
await app.workbench.editors.selectTab('app.js');
await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
await app.api.waitForElements('.line-numbers', result => !result || result.length === 0);
await app.screenCapturer.capture('line numbers hidden');
});
@ -34,7 +34,7 @@ export function setup() {
await app.workbench.keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u'], 'Control+U');
await app.client.keys(['Control', 'u', 'NULL']);
await app.api.keys(['Control', 'u', 'NULL']);
assert.ok(await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT), 'Activity bar was not moved to right after toggling its position.');
});

View file

@ -67,7 +67,7 @@ export function setup() {
}
await app.workbench.statusbar.clickOn(StatusBarElement.FEEDBACK_ICON);
await app.client.waitForElement('.feedback-form');
await app.api.waitForElement('.feedback-form');
});
it(`checks if 'Go to Line' works if called from the status bar`, async function () {