Files
angular__angular/e2e/components/input-e2e.spec.ts
T
Paul Gschwendtner 326f8bb32f build: run e2e tests with bazel (#14656)
* Builds the e2e app with Bazel
* Serves the e2e app with Bazel
* Runs the e2e tests with Bazel protractor rules
2019-01-11 14:43:04 -08:00

74 lines
2.4 KiB
TypeScript

import {browser, by, element} from 'protractor';
describe('input', () => {
beforeEach(async () => await browser.get('/input'));
describe('text input', () => {
it('should update input value when user types', async () => {
const input = element(by.id('text-input'));
await input.sendKeys('abc123');
expect(await input.getAttribute('value')).toBe('abc123');
});
});
describe('number input', () => {
it('should update input value when user types', async () => {
const input = element(by.id('number-input'));
await input.sendKeys('abc123');
expect(await input.getAttribute('value')).toBe('123');
});
it('should increment when increment button clicked', async () => {
const input = element(by.id('number-input'));
await input.click();
const size = await input.getSize();
await browser.actions()
.mouseMove(input, {x: size.width - 5, y: 5})
.perform();
// Workaround: https://github.com/angular/protractor/issues/4578
await browser.actions().click().perform();
expect(await input.getAttribute('value')).toBe('1');
await browser.actions()
.mouseMove(input, {x: size.width - 5, y: size.height - 5})
.perform();
// Workaround: https://github.com/angular/protractor/issues/4578
await browser.actions().click().perform();
expect(await input.getAttribute('value')).toBe('0');
});
});
describe('textarea', () => {
it('should update input value when user types', async () => {
const input = element(by.id('text-area'));
await input.sendKeys('abc123');
expect(await input.getAttribute('value')).toBe('abc123');
});
});
describe('autosize-textarea', () => {
it('should resize correctly', async () => {
const input = element(by.id('autosize-text-area'));
await input.sendKeys('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
});
it('should enfore max rows', async () => {
const input = element(by.id('autosize-text-area'));
await input.sendKeys(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
});
});
});