mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
Make slide toggle e2e test take screenshots when ripple disappeared (#3171)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {browser, element, by, Key} from 'protractor';
|
||||
import {browser, element, by, Key, ExpectedConditions} from 'protractor';
|
||||
import {expectToExist} from '../../util/asserts';
|
||||
import {screenshot} from '../../screenshot';
|
||||
|
||||
@@ -21,7 +21,9 @@ describe('slide-toggle', () => {
|
||||
getNormalToggle().click();
|
||||
|
||||
expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked');
|
||||
screenshot();
|
||||
browser.wait(ExpectedConditions.not(
|
||||
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
||||
.then(() => screenshot());
|
||||
});
|
||||
|
||||
it('should change the checked state on click', () => {
|
||||
@@ -32,7 +34,9 @@ describe('slide-toggle', () => {
|
||||
getNormalToggle().click();
|
||||
|
||||
expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked');
|
||||
screenshot();
|
||||
browser.wait(ExpectedConditions.not(
|
||||
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
||||
.then(() => screenshot());
|
||||
});
|
||||
|
||||
it('should not change the checked state on click when disabled', () => {
|
||||
@@ -43,7 +47,9 @@ describe('slide-toggle', () => {
|
||||
element(by.css('#disabled-slide-toggle')).click();
|
||||
|
||||
expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');
|
||||
screenshot();
|
||||
browser.wait(ExpectedConditions.not(
|
||||
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
||||
.then(() => screenshot());
|
||||
});
|
||||
|
||||
it('should move the thumb on state change', () => {
|
||||
@@ -57,7 +63,9 @@ describe('slide-toggle', () => {
|
||||
let newX = thumbEl.getLocation().then(pos => pos.x);
|
||||
|
||||
expect(previousX).not.toBe(newX);
|
||||
screenshot();
|
||||
browser.wait(ExpectedConditions.not(
|
||||
ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element')))))
|
||||
.then(() => screenshot());
|
||||
});
|
||||
|
||||
it('should toggle the slide-toggle on space key', () => {
|
||||
|
||||
Reference in New Issue
Block a user