Files
angular__angular/e2e/components/input-e2e.spec.ts
T
Paul Gschwendtner afb0ee37eb chore: remove screenshot testing (#12155)
Removes the screenshot test tool since Angular Material is visually being tested inside of Google.
2018-07-11 08:24:21 -07:00

74 lines
2.3 KiB
TypeScript

import {browser, by, element} from 'protractor';
describe('input', () => {
describe('text input', () => {
beforeEach(() => browser.get('/input'));
it('should update input value when user types', async () => {
let input = element(by.id('text-input'));
input.sendKeys('abc123');
expect(await input.getAttribute('value')).toBe('abc123');
});
});
describe('number input', () => {
beforeEach(() => browser.get('/input'));
it('should update input value when user types', async () => {
let input = element(by.id('number-input'));
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'));
input.click();
const size = await input.getSize();
browser.actions()
.mouseMove(input, {x: size.width - 5, y: 5})
.click()
.perform();
expect(await input.getAttribute('value')).toBe('1');
browser.actions()
.mouseMove(input, {x: size.width - 5, y: size.height - 5})
.click()
.perform();
expect(await input.getAttribute('value')).toBe('0');
});
});
describe('textarea', () => {
beforeEach(() => browser.get('/input'));
it('should update input value when user types', async () => {
let input = element(by.id('text-area'));
input.sendKeys('abc123');
expect(await input.getAttribute('value')).toBe('abc123');
});
});
describe('autosize-textarea', () => {
beforeEach(() => browser.get('/input'));
it('should resize correctly', () => {
let input = element(by.id('autosize-text-area'));
input.sendKeys('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
});
it('should enfore max rows', () => {
let input = element(by.id('autosize-text-area'));
input.sendKeys(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');
});
});
});