Skip to content

Commit

Permalink
smoketest: use commands instead of actions in git
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jun 8, 2018
1 parent 2322b4b commit 1651eb2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
17 changes: 12 additions & 5 deletions test/smoke/src/areas/git/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,27 @@ export function setup() {
it('stages correctly', async function () {
const app = this.app as Application;

await app.workbench.scm.openSCMViewlet();
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.scm.openSCMViewlet();
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.commit('first commit');
Expand All @@ -75,7 +78,11 @@ 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 });
});
});
Expand Down
15 changes: 0 additions & 15 deletions test/smoke/src/areas/git/scm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ 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;
Expand Down Expand Up @@ -62,18 +59,6 @@ export class SCM extends Viewlet {
await this.code.waitAndClick(SCM_RESOURCE_CLICK(name));
}

async stage(name: string): Promise<void> {
await this.code.waitAndClick(SCM_RESOURCE_ACTION_CLICK(name, 'Stage Changes'));
}

async stageAll(): Promise<void> {
await this.code.waitAndClick(SCM_RESOURCE_GROUP_COMMAND_CLICK('Stage All Changes'));
}

async unstage(name: string): Promise<void> {
await this.code.waitAndClick(SCM_RESOURCE_ACTION_CLICK(name, 'Unstage Changes'));
}

async commit(message: string): Promise<void> {
await this.code.waitAndClick(SCM_INPUT);
await this.code.waitForActiveElement(SCM_INPUT);
Expand Down
12 changes: 6 additions & 6 deletions test/smoke/src/areas/search/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ 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();
Expand Down Expand Up @@ -55,5 +49,11 @@ 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 });
});
});
}

0 comments on commit 1651eb2

Please sign in to comment.