Skip to content

Commit 6651dd5

Browse files
committed
clean API
1 parent 7a312c1 commit 6651dd5

8 files changed

Lines changed: 12 additions & 17 deletions

File tree

test/smoke/src/areas/editor/peek.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class References {
1919
}
2020

2121
async waitForReferencesCountInTitle(count: number): Promise<void> {
22-
await this.api.waitForText(References.REFERENCES_TITLE_COUNT, void 0, titleCount => {
22+
await this.api.waitForTextContent(References.REFERENCES_TITLE_COUNT, void 0, titleCount => {
2323
const matches = titleCount.match(/\d+/);
2424
return matches ? parseInt(matches[0]) === count : false;
2525
});
@@ -30,7 +30,7 @@ export class References {
3030
}
3131

3232
async waitForFile(file: string): Promise<void> {
33-
await this.api.waitForText(References.REFERENCES_TITLE_FILE_NAME, file);
33+
await this.api.waitForTextContent(References.REFERENCES_TITLE_FILE_NAME, file);
3434
}
3535

3636
async close(): Promise<void> {

test/smoke/src/areas/explorer/explorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class Explorer extends Viewlet {
2222
}
2323

2424
getOpenEditorsViewTitle(): Promise<string> {
25-
return this.api.waitForText(Explorer.OPEN_EDITORS_VIEW);
25+
return this.api.waitForTextContent(Explorer.OPEN_EDITORS_VIEW);
2626
}
2727

2828
async openFile(fileName: string): Promise<any> {

test/smoke/src/areas/git/git.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ export function setup() {
6767
await app.workbench.scm.waitForChange('app.js', 'Index Modified');
6868

6969
await app.workbench.scm.commit('first commit');
70-
await app.client.waitForText(SYNC_STATUSBAR, ' 0↓ 1↑');
70+
await app.client.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 1↑');
7171

7272
await app.workbench.runCommand('Git: Stage All Changes');
7373
await app.workbench.scm.waitForChange('index.jade', 'Index Modified');
7474

7575
await app.workbench.scm.commit('second commit');
76-
await app.client.waitForText(SYNC_STATUSBAR, ' 0↓ 2↑');
76+
await app.client.waitForTextContent(SYNC_STATUSBAR, ' 0↓ 2↑');
7777

7878
cp.execSync('git reset --hard origin/master', { cwd: app.workspacePath });
7979
});

test/smoke/src/areas/quickopen/quickopen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class QuickOpen {
8484
while (++retries < 10) {
8585
await this.commands.runCommand('workbench.action.gotoSymbol');
8686

87-
const text = await this.api.waitForText('div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row .quick-open-entry .monaco-icon-label .label-name .monaco-highlighted-label span');
87+
const text = await this.api.waitForTextContent('div[aria-label="Quick Picker"] .monaco-tree-rows.show-twisties div.monaco-tree-row .quick-open-entry .monaco-icon-label .label-name .monaco-highlighted-label span');
8888

8989
if (text !== 'No symbol information for the file') {
9090
return;

test/smoke/src/areas/search/search.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ export class Search extends Viewlet {
6161

6262
async removeFileMatch(index: number): Promise<void> {
6363
await this.api.waitAndMoveToObject(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch`);
64-
const file = await this.api.waitForText(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch a.label-name`);
64+
const file = await this.api.waitForTextContent(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch a.label-name`);
6565
await this.api.waitAndClick(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch .action-label.icon.action-remove`);
66-
await this.api.waitForText(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch a.label-name`, void 0, result => result !== file);
66+
await this.api.waitForTextContent(`${VIEWLET} .results .monaco-tree-rows>:nth-child(${index}) .filematch a.label-name`, void 0, result => result !== file);
6767
}
6868

6969
async expandReplace(): Promise<void> {
@@ -82,6 +82,6 @@ export class Search extends Viewlet {
8282
}
8383

8484
async waitForResultText(text: string): Promise<void> {
85-
await this.api.waitForText(`${VIEWLET} .messages[aria-hidden="false"] .message>p`, text);
85+
await this.api.waitForTextContent(`${VIEWLET} .messages[aria-hidden="false"] .message>p`, text);
8686
}
8787
}

test/smoke/src/areas/statusbar/statusbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ export class StatusBar {
3535
}
3636

3737
async waitForEOL(eol: string): Promise<string> {
38-
return this.api.waitForText(this.getSelector(StatusBarElement.EOL_STATUS), eol);
38+
return this.api.waitForTextContent(this.getSelector(StatusBarElement.EOL_STATUS), eol);
3939
}
4040

4141
async getStatusbarTextByTitle(title: string): Promise<string> {
42-
return await this.api.waitForText(`${this.mainSelector} span[title="smoke test"]`);
42+
return await this.api.waitForTextContent(`${this.mainSelector} span[title="smoke test"]`);
4343
}
4444

4545
private getSelector(element: StatusBarElement): string {

test/smoke/src/areas/workbench/viewlet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export abstract class Viewlet {
1212
}
1313

1414
async getTitle(): Promise<string> {
15-
return this.api.waitForText('.monaco-workbench-container .part.sidebar > .title > .title-label > span');
15+
return this.api.waitForTextContent('.monaco-workbench-container .part.sidebar > .title > .title-label > span');
1616
}
1717
}

test/smoke/src/spectron/client.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ export class API {
3333
return Promise.resolve();
3434
}
3535

36-
async waitForText(selector: string, text?: string, accept?: (result: string) => boolean): Promise<string> {
37-
accept = accept ? accept : result => text !== void 0 ? text === result : !!result;
38-
return this.waitFor(() => this.spectronClient.getText(selector), accept, `getText with selector ${selector}`);
39-
}
40-
4136
async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean): Promise<string> {
4237
accept = accept ? accept : (result => textContent !== void 0 ? textContent === result : !!result);
4338
const fn = async () => await this.spectronClient.selectorExecute(selector, div => Array.isArray(div) ? div[0].textContent : div.textContent);

0 commit comments

Comments
 (0)