Skip to content

Commit

Permalink
Make slide toggle e2e test take screenshots when ripple disappeared (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tinayuangao authored and mmalerba committed Feb 21, 2017
1 parent 83b5842 commit 537ef17
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions e2e/components/slide-toggle/slide-toggle.e2e.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand Down

0 comments on commit 537ef17

Please sign in to comment.