angular/aio/content/examples/attribute-directives/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

28 lines
1 KiB
TypeScript

import { browser, element, by } from 'protractor';
describe('Attribute directives', () => {
const title = 'My First Attribute Directive';
beforeAll(() => browser.get(''));
it(`should display correct title: ${title}`, async () => {
expect(await element(by.css('h1')).getText()).toEqual(title);
});
it('should be able to select green highlight', async () => {
const highlightedEle = element(by.cssContainingText('p', 'Highlight me!'));
const lightGreen = 'rgba(144, 238, 144, 1)';
const getBgColor = () => highlightedEle.getCssValue('background-color');
expect(await highlightedEle.getCssValue('background-color')).not.toEqual(lightGreen);
const greenRb = element.all(by.css('input')).get(0);
await greenRb.click();
await browser.actions().mouseMove(highlightedEle).perform();
// Wait for up to 4s for the background color to be updated,
// to account for slow environments (e.g. CI).
await browser.wait(async () => await getBgColor() === lightGreen, 4000);
});
});