提交 d8989c95 编写于 作者: J Joao Moreno

fix smoketests

fixes #37603
上级 12fb325e
...@@ -12,6 +12,7 @@ import * as stripJsonComments from 'strip-json-comments'; ...@@ -12,6 +12,7 @@ import * as stripJsonComments from 'strip-json-comments';
import { SpectronApplication, Quality } from '../../spectron/application'; import { SpectronApplication, Quality } from '../../spectron/application';
describe('Debug', () => { describe('Debug', () => {
let skip = false;
before(async function () { before(async function () {
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
...@@ -27,11 +28,13 @@ describe('Debug', () => { ...@@ -27,11 +28,13 @@ describe('Debug', () => {
if (!debugExists) { if (!debugExists) {
console.warn(`Skipping debug tests because vscode-node-debug extension was not found in ${extensionsPath}`); console.warn(`Skipping debug tests because vscode-node-debug extension was not found in ${extensionsPath}`);
skip = true;
return; return;
} }
if (!debug2Exists) { if (!debug2Exists) {
console.warn(`Skipping debug tests because vscode-node-debug2 extension was not found in ${extensionsPath}`); console.warn(`Skipping debug tests because vscode-node-debug2 extension was not found in ${extensionsPath}`);
skip = true;
return; return;
} }
...@@ -44,6 +47,11 @@ describe('Debug', () => { ...@@ -44,6 +47,11 @@ describe('Debug', () => {
}); });
it('configure launch json', async function () { it('configure launch json', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.debug.openDebugViewlet(); await app.workbench.debug.openDebugViewlet();
...@@ -69,6 +77,11 @@ describe('Debug', () => { ...@@ -69,6 +77,11 @@ describe('Debug', () => {
}); });
it('breakpoints', async function () { it('breakpoints', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.quickopen.openFile('index.js'); await app.workbench.quickopen.openFile('index.js');
...@@ -78,6 +91,11 @@ describe('Debug', () => { ...@@ -78,6 +91,11 @@ describe('Debug', () => {
let port: number; let port: number;
it('start debugging', async function () { it('start debugging', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
port = await app.workbench.debug.startDebugging(); port = await app.workbench.debug.startDebugging();
...@@ -93,6 +111,11 @@ describe('Debug', () => { ...@@ -93,6 +111,11 @@ describe('Debug', () => {
}); });
it('focus stack frames and variables', async function () { it('focus stack frames and variables', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; 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.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
...@@ -108,6 +131,11 @@ describe('Debug', () => { ...@@ -108,6 +131,11 @@ describe('Debug', () => {
}); });
it('stepOver, stepIn, stepOut', async function () { it('stepOver, stepIn, stepOut', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.debug.stepIn(); await app.workbench.debug.stepIn();
...@@ -125,6 +153,11 @@ describe('Debug', () => { ...@@ -125,6 +153,11 @@ describe('Debug', () => {
}); });
it('continue', async function () { it('continue', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.debug.continue(); await app.workbench.debug.continue();
...@@ -140,12 +173,22 @@ describe('Debug', () => { ...@@ -140,12 +173,22 @@ describe('Debug', () => {
}); });
it('debug console', async function () { it('debug console', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.debug.waitForReplCommand('2 + 2', r => r === '4'); await app.workbench.debug.waitForReplCommand('2 + 2', r => r === '4');
}); });
it('stop debugging', async function () { it('stop debugging', async function () {
if (skip) {
this.skip();
return;
}
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.debug.stopDebugging(); await app.workbench.debug.stopDebugging();
......
...@@ -52,12 +52,6 @@ describe('Git', () => { ...@@ -52,12 +52,6 @@ describe('Git', () => {
it('stages correctly', async function () { it('stages correctly', async function () {
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
// TODO@joao get these working once joh fixes scm viewlet
if (!false) {
this.skip();
return;
}
await app.workbench.scm.openSCMViewlet(); await app.workbench.scm.openSCMViewlet();
const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js' && c.type === 'Modified'); const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js' && c.type === 'Modified');
...@@ -72,13 +66,6 @@ describe('Git', () => { ...@@ -72,13 +66,6 @@ describe('Git', () => {
it(`stages, commits changes and verifies outgoing change`, async function () { it(`stages, commits changes and verifies outgoing change`, async function () {
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
// TODO@joao get these working once joh fixes scm viewlet
if (!false) {
cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath });
this.skip();
return;
}
await app.workbench.scm.openSCMViewlet(); await app.workbench.scm.openSCMViewlet();
const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js' && c.type === 'Modified'); const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js' && c.type === 'Modified');
......
...@@ -13,7 +13,7 @@ const SCM_RESOURCE = `${VIEWLET} .monaco-list-row > .resource`; ...@@ -13,7 +13,7 @@ const SCM_RESOURCE = `${VIEWLET} .monaco-list-row > .resource`;
const SCM_RESOURCE_GROUP = `${VIEWLET} .monaco-list-row > .resource-group`; const SCM_RESOURCE_GROUP = `${VIEWLET} .monaco-list-row > .resource-group`;
const REFRESH_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[title="Refresh"]`; const REFRESH_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[title="Refresh"]`;
const COMMIT_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[title="Commit"]`; const COMMIT_COMMAND = `div[id="workbench.parts.sidebar"] .actions-container a.action-label[title="Commit"]`;
const SCM_RESOURCE_CLICK = name => `${SCM_RESOURCE} .monaco-icon-label[title$="${name}"]`; const SCM_RESOURCE_CLICK = name => `${SCM_RESOURCE} .monaco-icon-label[title*="${name}"]`;
const SCM_RESOURCE_GROUP_COMMAND_CLICK = name => `${SCM_RESOURCE_GROUP} .actions .action-label[title="${name}"]`; const SCM_RESOURCE_GROUP_COMMAND_CLICK = name => `${SCM_RESOURCE_GROUP} .actions .action-label[title="${name}"]`;
export interface Change { export interface Change {
...@@ -49,7 +49,7 @@ export class SCM extends Viewlet { ...@@ -49,7 +49,7 @@ export class SCM extends Viewlet {
const result = await this.spectron.webclient.selectorExecute(SCM_RESOURCE, const result = await this.spectron.webclient.selectorExecute(SCM_RESOURCE,
div => (Array.isArray(div) ? div : [div]).map(element => { div => (Array.isArray(div) ? div : [div]).map(element => {
const name = element.querySelector('.label-name') as HTMLElement; const name = element.querySelector('.label-name') as HTMLElement;
const icon = element.querySelector('.monaco-icon-label') as HTMLElement; const icon = element.querySelector('.decoration-icon') as HTMLElement;
const actionElementList = element.querySelectorAll('.actions .action-label'); const actionElementList = element.querySelectorAll('.actions .action-label');
const actionElements: any[] = []; const actionElements: any[] = [];
...@@ -60,7 +60,7 @@ export class SCM extends Viewlet { ...@@ -60,7 +60,7 @@ export class SCM extends Viewlet {
return { return {
name: name.textContent, name: name.textContent,
type: (icon.title || '').replace(/^([^,]+),.*$/, '$1'), type: (icon.title || ''),
element, element,
actionElements actionElements
}; };
......
...@@ -17,7 +17,7 @@ describe('Multiroot', () => { ...@@ -17,7 +17,7 @@ describe('Multiroot', () => {
// for some reason Code opens 2 windows at this point // for some reason Code opens 2 windows at this point
// so let's select the last one // so let's select the last one
await app.client.windowByIndex(2); await app.client.windowByIndex(1);
}); });
it('shows results from all folders', async function () { it('shows results from all folders', async function () {
......
...@@ -15,7 +15,7 @@ describe('Search', () => { ...@@ -15,7 +15,7 @@ describe('Search', () => {
await app.workbench.search.openSearchViewlet(); await app.workbench.search.openSearchViewlet();
await app.workbench.search.searchFor('body'); await app.workbench.search.searchFor('body');
await app.workbench.search.waitForResultText('7 results in 4 files'); await app.workbench.search.waitForResultText('14 results in 5 files');
}); });
it('searches only for *.js files & checks for correct result number', async function () { it('searches only for *.js files & checks for correct result number', async function () {
...@@ -34,7 +34,7 @@ describe('Search', () => { ...@@ -34,7 +34,7 @@ describe('Search', () => {
const app = this.app as SpectronApplication; const app = this.app as SpectronApplication;
await app.workbench.search.searchFor('body'); await app.workbench.search.searchFor('body');
await app.workbench.search.removeFileMatch(1); await app.workbench.search.removeFileMatch(1);
await app.workbench.search.waitForResultText('3 results in 3 files'); await app.workbench.search.waitForResultText('10 results in 4 files');
}); });
it('replaces first search result with a replace term', async function () { it('replaces first search result with a replace term', async function () {
...@@ -46,7 +46,7 @@ describe('Search', () => { ...@@ -46,7 +46,7 @@ describe('Search', () => {
await app.workbench.search.replaceFileMatch(1); await app.workbench.search.replaceFileMatch(1);
await app.workbench.saveOpenedFile(); await app.workbench.saveOpenedFile();
await app.workbench.search.waitForResultText('3 results in 3 files'); await app.workbench.search.waitForResultText('10 results in 4 files');
await app.workbench.search.searchFor('ydob'); await app.workbench.search.searchFor('ydob');
await app.workbench.search.setReplaceText('body'); await app.workbench.search.setReplaceText('body');
......
...@@ -195,7 +195,7 @@ async function setup(): Promise<void> { ...@@ -195,7 +195,7 @@ async function setup(): Promise<void> {
* @see https://github.com/webdriverio/webdriverio/issues/2076 * @see https://github.com/webdriverio/webdriverio/issues/2076
*/ */
// Filter out the following messages: // Filter out the following messages:
const wdioDeprecationWarning = /^WARNING: the "\w+" command will be depcrecated soon./; // [sic] const wdioDeprecationWarning = /^WARNING: the "\w+" command will be deprecated soon../; // [sic]
// Monkey patch: // Monkey patch:
const warn = console.warn; const warn = console.warn;
console.warn = function suppressWebdriverWarnings(message) { console.warn = function suppressWebdriverWarnings(message) {
......
...@@ -271,9 +271,9 @@ export class SpectronApplication { ...@@ -271,9 +271,9 @@ export class SpectronApplication {
await this.webclient.waitUntilWindowLoaded(); await this.webclient.waitUntilWindowLoaded();
// Spectron opens multiple terminals in Windows platform // Spectron opens multiple terminals in Windows platform
// Workaround to focus the right window - https://github.com/electron/spectron/issues/60 // Workaround to focus the right window - https://github.com/electron/spectron/issues/60
await this.client.windowByIndex(1); // await this.client.windowByIndex(1);
// await this.app.browserWindow.focus(); // await this.app.browserWindow.focus();
await this.client.waitForHTML('[id="workbench.main.container"]'); await this.client.waitForElement('.monaco-workbench');
} }
private async waitForWelcome(): Promise<any> { private async waitForWelcome(): Promise<any> {
......
...@@ -54,10 +54,6 @@ export class SpectronClient { ...@@ -54,10 +54,6 @@ export class SpectronClient {
return this.waitFor(() => this.spectron.client.getValue(selector), accept, `getValue with selector ${selector}`); return this.waitFor(() => this.spectron.client.getValue(selector), accept, `getValue with selector ${selector}`);
} }
async waitForHTML(selector: string, accept: (result: string) => boolean = (result: string) => !!result): Promise<any> {
return this.waitFor(() => this.spectron.client.getHTML(selector), accept, `getHTML with selector ${selector}`);
}
async waitAndClick(selector: string): Promise<any> { async waitAndClick(selector: string): Promise<any> {
return this.waitFor(() => this.spectron.client.click(selector), void 0, `click with selector ${selector}`); return this.waitFor(() => this.spectron.client.click(selector), void 0, `click with selector ${selector}`);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册