Philipp Schrader | d999c9f | 2022-02-27 15:48:58 -0800 | [diff] [blame] | 1 | import {browser, by, element} from 'protractor'; |
| 2 | |
| 3 | class AppPage { |
| 4 | async navigateTo() { |
| 5 | await browser.get(browser.baseUrl); |
| 6 | } |
| 7 | |
| 8 | // Wait for basically forever for these elements to appear. |
| 9 | // Bazel will manage the timeouts. |
| 10 | async waitForElement(el, timeout = 1000000) { |
| 11 | await browser.wait(() => el.isPresent(), timeout); |
| 12 | await browser.wait(() => el.isDisplayed(), timeout); |
| 13 | return el; |
| 14 | } |
| 15 | |
| 16 | async getParagraphText() { |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 17 | return (await this.waitForElement(element(by.css('.header')))).getText(); |
Philipp Schrader | d999c9f | 2022-02-27 15:48:58 -0800 | [diff] [blame] | 18 | } |
| 19 | } |
| 20 | |
| 21 | describe('The scouting web page', () => { |
| 22 | let page: AppPage; |
| 23 | |
| 24 | beforeEach(() => { |
| 25 | page = new AppPage(); |
| 26 | }); |
| 27 | |
| 28 | it('should display: This is an app.', async () => { |
| 29 | await page.navigateTo(); |
Philipp Schrader | 8058743 | 2022-03-05 15:41:22 -0800 | [diff] [blame] | 30 | expect(await page.getParagraphText()).toEqual('Auto'); |
Philipp Schrader | d999c9f | 2022-02-27 15:48:58 -0800 | [diff] [blame] | 31 | }); |
| 32 | }); |