angular/aio/content/examples/dynamic-form/e2e/src/app.e2e-spec.ts
George Kalpakas 23c36a24ed test(docs-infra): disable the Selenium Promise Manager in docs examples e2e tests (#39818)
This commit disables the Selenium Promise Manager when running e2e tests
for docs examples in order to more closely align them with new apps
created with CLI v11. This change requires that any async operations in
tests are handled explicitly (e.g. using `async/await` or
`Promise#then()`).

PR Close #39818
2020-11-24 14:56:14 -08:00

22 lines
846 B
TypeScript

import { browser, element, by } from 'protractor';
/* tslint:disable:quotemark */
describe('Dynamic Form', () => {
beforeAll(() => browser.get(''));
it('should submit form', async () => {
const firstNameElement = element.all(by.css('input[id=firstName]')).get(0);
expect(await firstNameElement.getAttribute('value')).toEqual('Bombasto');
const emailElement = element.all(by.css('input[id=emailAddress]')).get(0);
const email = 'test@test.com';
await emailElement.sendKeys(email);
expect(await emailElement.getAttribute('value')).toEqual(email);
await element(by.css('select option[value="solid"]')).click();
await element.all(by.css('button')).get(0).click();
expect(await element(by.cssContainingText('strong', 'Saved the following values')).isPresent()).toBe(true);
});
});