From 69edf0aa000465f9ddeb3790842e45ac7c5748e2 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Thu, 16 Aug 2018 15:16:33 +0200 Subject: [PATCH] test: fix slide-toggle e2e failures Fixes some e2e failures in the slide toggle after the new design got in. The tests expect the ripples to go away at some point, however we introduced a permanent ripple. --- e2e/components/slide-toggle-e2e.spec.ts | 28 ++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/e2e/components/slide-toggle-e2e.spec.ts b/e2e/components/slide-toggle-e2e.spec.ts index 98352dcd640a..34774c9e2a4b 100644 --- a/e2e/components/slide-toggle-e2e.spec.ts +++ b/e2e/components/slide-toggle-e2e.spec.ts @@ -1,4 +1,4 @@ -import {browser, element, by, Key, ExpectedConditions} from 'protractor'; +import {browser, element, by, Key} from 'protractor'; import {expectToExist} from '../util/index'; @@ -13,59 +13,49 @@ describe('slide-toggle', () => { }); it('should change the checked state on click', async () => { - let inputEl = getInput(); + const inputEl = getInput(); expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked'); getNormalToggle().click(); expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked'); - - await browser.wait(ExpectedConditions.not( - ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element'))))); }); it('should change the checked state on click', async () => { - let inputEl = getInput(); + const inputEl = getInput(); expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked'); getNormalToggle().click(); expect(inputEl.getAttribute('checked')).toBeTruthy('Expect slide-toggle to be checked'); - await browser.wait(ExpectedConditions.not( - ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element'))))); }); it('should not change the checked state on click when disabled', async () => { - let inputEl = getInput(); + const inputEl = getInput(); expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked'); element(by.css('#disabled-slide-toggle')).click(); expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked'); - await browser.wait(ExpectedConditions.not( - ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element'))))); }); it('should move the thumb on state change', async () => { - let slideToggleEl = getNormalToggle(); - let thumbEl = element(by.css('#normal-slide-toggle .mat-slide-toggle-thumb-container')); - let previousPosition = await thumbEl.getLocation(); + const slideToggleEl = getNormalToggle(); + const thumbEl = element(by.css('#normal-slide-toggle .mat-slide-toggle-thumb-container')); + const previousPosition = await thumbEl.getLocation(); slideToggleEl.click(); - let position = await thumbEl.getLocation(); + const position = await thumbEl.getLocation(); expect(position.x).not.toBe(previousPosition.x); - - await browser.wait(ExpectedConditions.not( - ExpectedConditions.presenceOf(element(by.css('div.mat-ripple-element'))))); }); it('should toggle the slide-toggle on space key', () => { - let inputEl = getInput(); + const inputEl = getInput(); expect(inputEl.getAttribute('checked')).toBeFalsy('Expect slide-toggle to be unchecked');