From 273ef1dfdaff9c20320eb52554092a882aba4cd7 Mon Sep 17 00:00:00 2001 From: Joao Moreno Date: Fri, 8 Jun 2018 22:11:57 +0200 Subject: [PATCH] Revert "smoketest: use commands instead of actions in git" This reverts commit 1651eb2eb4b73b09a5b5632efdaf1c9514b8c486. --- test/smoke/src/areas/git/git.test.ts | 17 +++++------------ test/smoke/src/areas/git/scm.ts | 15 +++++++++++++++ test/smoke/src/areas/search/search.test.ts | 12 ++++++------ 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/test/smoke/src/areas/git/git.test.ts b/test/smoke/src/areas/git/git.test.ts index 82e42385d49..8846db475a2 100644 --- a/test/smoke/src/areas/git/git.test.ts +++ b/test/smoke/src/areas/git/git.test.ts @@ -47,27 +47,24 @@ export function setup() { it('stages correctly', async function () { const app = this.app as Application; - await app.workbench.quickopen.openFile('app.js'); - await app.workbench.scm.openSCMViewlet(); + await app.workbench.scm.waitForChange('app.js', 'Modified'); + await app.workbench.scm.stage('app.js'); - await app.workbench.quickopen.runCommand('Git: Stage Changes'); await app.workbench.scm.waitForChange('app.js', 'Index Modified'); + await app.workbench.scm.unstage('app.js'); - await app.workbench.quickopen.runCommand('Git: Unstage Changes'); await app.workbench.scm.waitForChange('app.js', 'Modified'); }); it(`stages, commits changes and verifies outgoing change`, async function () { const app = this.app as Application; - await app.workbench.quickopen.openFile('app.js'); - await app.workbench.scm.openSCMViewlet(); - await app.workbench.scm.waitForChange('app.js', 'Modified'); - await app.workbench.quickopen.runCommand('Git: Stage Changes'); + await app.workbench.scm.waitForChange('app.js', 'Modified'); + await app.workbench.scm.stage('app.js'); await app.workbench.scm.waitForChange('app.js', 'Index Modified'); await app.workbench.scm.commit('first commit'); @@ -78,11 +75,7 @@ export function setup() { await app.workbench.scm.commit('second commit'); await app.code.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 2↑'); - }); - after(function () { - const app = this.app as Application; - cp.execSync('git checkout .', { cwd: app.workspacePath }); cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath }); }); }); diff --git a/test/smoke/src/areas/git/scm.ts b/test/smoke/src/areas/git/scm.ts index cade77c191e..0107b900ebd 100644 --- a/test/smoke/src/areas/git/scm.ts +++ b/test/smoke/src/areas/git/scm.ts @@ -10,9 +10,12 @@ import { findElement, findElements, Code } from '../../vscode/code'; const VIEWLET = 'div[id="workbench.view.scm"]'; const SCM_INPUT = `${VIEWLET} .scm-editor textarea`; 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: string) => `${SCM_RESOURCE} .monaco-icon-label[title*="${name}"] .label-name`; +const SCM_RESOURCE_ACTION_CLICK = (name: string, actionName: string) => `${SCM_RESOURCE} .monaco-icon-label[title*="${name}"] .actions .action-label[title="${actionName}"]`; +const SCM_RESOURCE_GROUP_COMMAND_CLICK = (name: string) => `${SCM_RESOURCE_GROUP} .actions .action-label[title="${name}"]`; interface Change { name: string; @@ -59,6 +62,18 @@ export class SCM extends Viewlet { await this.code.waitAndClick(SCM_RESOURCE_CLICK(name)); } + async stage(name: string): Promise { + await this.code.waitAndClick(SCM_RESOURCE_ACTION_CLICK(name, 'Stage Changes')); + } + + async stageAll(): Promise { + await this.code.waitAndClick(SCM_RESOURCE_GROUP_COMMAND_CLICK('Stage All Changes')); + } + + async unstage(name: string): Promise { + await this.code.waitAndClick(SCM_RESOURCE_ACTION_CLICK(name, 'Unstage Changes')); + } + async commit(message: string): Promise { await this.code.waitAndClick(SCM_INPUT); await this.code.waitForActiveElement(SCM_INPUT); diff --git a/test/smoke/src/areas/search/search.test.ts b/test/smoke/src/areas/search/search.test.ts index 5beb18d6c9e..d6c0a368185 100644 --- a/test/smoke/src/areas/search/search.test.ts +++ b/test/smoke/src/areas/search/search.test.ts @@ -8,6 +8,12 @@ import { Application } from '../../application'; export function setup() { describe('Search', () => { + after(function () { + const app = this.app as Application; + cp.execSync('git checkout .', { cwd: app.workspacePath }); + cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath }); + }); + it('searches for body & checks for correct result number', async function () { const app = this.app as Application; await app.workbench.search.openSearchViewlet(); @@ -49,11 +55,5 @@ export function setup() { await app.workbench.search.replaceFileMatch('app.js'); await app.workbench.search.waitForNoResultText(); }); - - after(function () { - const app = this.app as Application; - cp.execSync('git checkout .', { cwd: app.workspacePath }); - cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath }); - }); }); } \ No newline at end of file