Revert "smoketest: use commands instead of actions in git"

This reverts commit 1651eb2eb4.
This commit is contained in:
Joao Moreno
2018-06-08 22:11:57 +02:00
parent 57aabf1c42
commit 273ef1dfda
3 changed files with 26 additions and 18 deletions

View File

@@ -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 });
});
});

View File

@@ -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<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);

View File

@@ -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 });
});
});
}