Skip to content

Commit 531d0f6

Browse files
committed
test: update E2E tests to support protractor with native promises
1 parent 8087404 commit 531d0f6

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ export default async function () {
5656
import { browser, logging, element, by } from 'protractor';
5757
5858
describe('workspace-project App', () => {
59-
it('should display lazy route', () => {
60-
browser.get(browser.baseUrl + '/lazy');
61-
expect(element(by.css('app-lazy-comp p')).getText()).toEqual('lazy-comp works!');
59+
it('should display lazy route', async () => {
60+
await browser.get(browser.baseUrl + '/lazy');
61+
expect(await element(by.css('app-lazy-comp p')).getText()).toEqual('lazy-comp works!');
6262
});
6363
6464
afterEach(async () => {

tests/legacy-cli/e2e/tests/build/rollup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ export default async function () {
3535
import { browser, logging, element, by } from 'protractor';
3636
3737
describe('workspace-project App', () => {
38-
it('should display lazy route', () => {
39-
browser.get(browser.baseUrl + '/lazy');
40-
expect(element(by.css('app-lazy p')).getText()).toEqual('lazy works!');
38+
it('should display lazy route', async () => {
39+
await browser.get(browser.baseUrl + '/lazy');
40+
expect(await element(by.css('app-lazy p')).getText()).toEqual('lazy works!');
4141
});
4242
4343
afterEach(async () => {

tests/legacy-cli/e2e/tests/generate/library/library-consumption.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export default async function () {
5252
page = new AppPage();
5353
});
5454
55-
it('should display text from library component', () => {
56-
page.navigateTo();
57-
expect(element(by.css('lib-my-lib p')).getText()).toEqual('my-lib works!');
55+
it('should display text from library component', async () => {
56+
await page.navigateTo();
57+
expect(await element(by.css('lib-my-lib p')).getText()).toEqual('my-lib works!');
5858
});
5959
6060
afterEach(async () => {

tests/legacy-cli/e2e/tests/i18n/legacy.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export async function setupI18nConfig(useLocalize = true, format: keyof typeof f
125125
import { browser, logging, element, by } from 'protractor';
126126
127127
describe('workspace-project App', () => {
128-
const getParagraph = (name: string) => element(by.css('app-root p#' + name)).getText();
128+
const getParagraph = async (name: string) => element(by.css('app-root p#' + name)).getText();
129129
beforeEach(() => browser.get(browser.baseUrl));
130130
afterEach(async () => {
131131
// Assert that there are no errors emitted from the browser
@@ -135,17 +135,17 @@ export async function setupI18nConfig(useLocalize = true, format: keyof typeof f
135135
} as logging.Entry));
136136
});
137137
138-
it('should display welcome message', () =>
139-
expect(getParagraph('hello')).toEqual('${translation.hello}'));
138+
it('should display welcome message', async () =>
139+
expect(await getParagraph('hello')).toEqual('${translation.hello}'));
140140
141-
it('should display locale', () =>
142-
expect(getParagraph('locale')).toEqual('${lang}'));
141+
it('should display locale', async () =>
142+
expect(await getParagraph('locale')).toEqual('${lang}'));
143143
144-
it('should display localized date', () =>
145-
expect(getParagraph('date')).toEqual('${translation.date}'));
144+
it('should display localized date', async () =>
145+
expect(await getParagraph('date')).toEqual('${translation.date}'));
146146
147-
it('should display pluralized message', () =>
148-
expect(getParagraph('plural')).toEqual('${translation.plural}'));
147+
it('should display pluralized message', async () =>
148+
expect(await getParagraph('plural')).toEqual('${translation.plural}'));
149149
});
150150
`);
151151
}

tests/legacy-cli/e2e/tests/misc/third-party-decorators.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export default function () {
1616
'./e2e/src/app.po.ts': `
1717
import { browser, by, element } from 'protractor';
1818
export class AppPage {
19-
navigateTo() { return browser.get('/'); }
19+
async navigateTo() { return browser.get('/'); }
2020
getIncrementButton() { return element(by.buttonText('Increment')); }
2121
getDecrementButton() { return element(by.buttonText('Decrement')); }
2222
getResetButton() { return element(by.buttonText('Reset Counter')); }
23-
getCounter() { return element(by.xpath('/html/body/app-root/div/span')).getText(); }
23+
async getCounter() { return element(by.xpath('/html/body/app-root/div/span')).getText(); }
2424
}
2525
`,
2626
'./e2e/src/app.e2e-spec.ts': `
@@ -33,15 +33,15 @@ export default function () {
3333
page = new AppPage();
3434
});
3535
36-
it('should operate counter', () => {
37-
page.navigateTo();
38-
page.getIncrementButton().click();
39-
page.getIncrementButton().click();
40-
expect(page.getCounter()).toEqual('2');
41-
page.getDecrementButton().click();
42-
expect(page.getCounter()).toEqual('1');
43-
page.getResetButton().click();
44-
expect(page.getCounter()).toEqual('0');
36+
it('should operate counter', async () => {
37+
await page.navigateTo();
38+
await page.getIncrementButton().click();
39+
await page.getIncrementButton().click();
40+
expect(await page.getCounter()).toEqual('2');
41+
await page.getDecrementButton().click();
42+
expect(await page.getCounter()).toEqual('1');
43+
await page.getResetButton().click();
44+
expect(await page.getCounter()).toEqual('0');
4545
});
4646
});
4747
`,

0 commit comments

Comments
 (0)