mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-24 03:35:38 +00:00
@@ -12,6 +12,7 @@ import * as stripJsonComments from 'strip-json-comments';
|
||||
import { SpectronApplication, Quality } from '../../spectron/application';
|
||||
|
||||
describe('Debug', () => {
|
||||
let skip = false;
|
||||
|
||||
before(async function () {
|
||||
const app = this.app as SpectronApplication;
|
||||
@@ -27,11 +28,13 @@ describe('Debug', () => {
|
||||
|
||||
if (!debugExists) {
|
||||
console.warn(`Skipping debug tests because vscode-node-debug extension was not found in ${extensionsPath}`);
|
||||
skip = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!debug2Exists) {
|
||||
console.warn(`Skipping debug tests because vscode-node-debug2 extension was not found in ${extensionsPath}`);
|
||||
skip = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,6 +47,11 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('configure launch json', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.debug.openDebugViewlet();
|
||||
@@ -69,6 +77,11 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('breakpoints', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.quickopen.openFile('index.js');
|
||||
@@ -78,6 +91,11 @@ describe('Debug', () => {
|
||||
|
||||
let port: number;
|
||||
it('start debugging', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
port = await app.workbench.debug.startDebugging();
|
||||
@@ -93,6 +111,11 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('focus stack frames and variables', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.client.waitFor(() => app.workbench.debug.getLocalVariableCount(), c => c === 4, 'there should be 4 local variables');
|
||||
@@ -108,6 +131,11 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('stepOver, stepIn, stepOut', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.debug.stepIn();
|
||||
@@ -125,6 +153,11 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('continue', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.debug.continue();
|
||||
@@ -140,12 +173,22 @@ describe('Debug', () => {
|
||||
});
|
||||
|
||||
it('debug console', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.debug.waitForReplCommand('2 + 2', r => r === '4');
|
||||
});
|
||||
|
||||
it('stop debugging', async function () {
|
||||
if (skip) {
|
||||
this.skip();
|
||||
return;
|
||||
}
|
||||
|
||||
const app = this.app as SpectronApplication;
|
||||
|
||||
await app.workbench.debug.stopDebugging();
|
||||
|
||||
@@ -52,12 +52,6 @@ describe('Git', () => {
|
||||
it('stages correctly', async function () {
|
||||
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();
|
||||
|
||||
const appJs = await app.workbench.scm.waitForChange(c => c.name === 'app.js' && c.type === 'Modified');
|
||||
@@ -72,13 +66,6 @@ describe('Git', () => {
|
||||
it(`stages, commits changes and verifies outgoing change`, async function () {
|
||||
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();
|
||||
|
||||
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`;
|
||||
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 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}"]`;
|
||||
|
||||
export interface Change {
|
||||
@@ -49,7 +49,7 @@ export class SCM extends Viewlet {
|
||||
const result = await this.spectron.webclient.selectorExecute(SCM_RESOURCE,
|
||||
div => (Array.isArray(div) ? div : [div]).map(element => {
|
||||
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 actionElements: any[] = [];
|
||||
|
||||
@@ -60,7 +60,7 @@ export class SCM extends Viewlet {
|
||||
|
||||
return {
|
||||
name: name.textContent,
|
||||
type: (icon.title || '').replace(/^([^,]+),.*$/, '$1'),
|
||||
type: (icon.title || ''),
|
||||
element,
|
||||
actionElements
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('Multiroot', () => {
|
||||
|
||||
// for some reason Code opens 2 windows at this point
|
||||
// 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 () {
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('Search', () => {
|
||||
await app.workbench.search.openSearchViewlet();
|
||||
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 () {
|
||||
@@ -34,7 +34,7 @@ describe('Search', () => {
|
||||
const app = this.app as SpectronApplication;
|
||||
await app.workbench.search.searchFor('body');
|
||||
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 () {
|
||||
@@ -46,7 +46,7 @@ describe('Search', () => {
|
||||
await app.workbench.search.replaceFileMatch(1);
|
||||
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.setReplaceText('body');
|
||||
|
||||
@@ -195,7 +195,7 @@ async function setup(): Promise<void> {
|
||||
* @see https://github.com/webdriverio/webdriverio/issues/2076
|
||||
*/
|
||||
// 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:
|
||||
const warn = console.warn;
|
||||
console.warn = function suppressWebdriverWarnings(message) {
|
||||
|
||||
@@ -271,9 +271,9 @@ export class SpectronApplication {
|
||||
await this.webclient.waitUntilWindowLoaded();
|
||||
// Spectron opens multiple terminals in Windows platform
|
||||
// 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.client.waitForHTML('[id="workbench.main.container"]');
|
||||
await this.client.waitForElement('.monaco-workbench');
|
||||
}
|
||||
|
||||
private async waitForWelcome(): Promise<any> {
|
||||
|
||||
@@ -54,10 +54,6 @@ export class SpectronClient {
|
||||
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> {
|
||||
return this.waitFor(() => this.spectron.client.click(selector), void 0, `click with selector ${selector}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user