From bdcf1686d87ee5d0be5b90c5345aef04f903f80c Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Fri, 1 Feb 2019 11:01:11 -0500 Subject: [PATCH] test(searchbar): update searchbar tests to take focused ss (#17318) - gets focus test working properly - adds a no cancel button focus test this should prevent the regression in #17252 in the future --- .../components/searchbar/test/basic/e2e.ts | 27 ++++++++++++++++--- .../searchbar/test/basic/index.html | 10 +++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/core/src/components/searchbar/test/basic/e2e.ts b/core/src/components/searchbar/test/basic/e2e.ts index 138346ad34..bea469b781 100644 --- a/core/src/components/searchbar/test/basic/e2e.ts +++ b/core/src/components/searchbar/test/basic/e2e.ts @@ -7,10 +7,29 @@ test('searchbar: basic', async () => { await page.waitFor(250); - const compare = await page.compareScreenshot(); - expect(compare).toMatchScreenshot(); + const compares = []; + compares.push(await page.compareScreenshot()); - const searchbar = await page.find('ion-searchbar'); + let searchbar = await page.find('#basic'); await searchbar.callMethod('setFocus'); - expect(await page.compareScreenshot('focused')).toMatchScreenshot(); + + await page.waitFor(250); + searchbar = await page.find('#basic'); + expect(searchbar).toHaveClass('searchbar-has-focus'); + + compares.push(await page.compareScreenshot('focused')); + + // No Cancel Button Searchbar + searchbar = await page.find('#noCancel'); + await searchbar.callMethod('setFocus'); + + await page.waitFor(250); + searchbar = await page.find('#noCancel'); + expect(searchbar).toHaveClass('searchbar-has-focus'); + + compares.push(await page.compareScreenshot('no cancel button, focused')); + + for (const compare of compares) { + expect(compare).toMatchScreenshot(); + } }); diff --git a/core/src/components/searchbar/test/basic/index.html b/core/src/components/searchbar/test/basic/index.html index f58b911383..49cc0501f2 100644 --- a/core/src/components/searchbar/test/basic/index.html +++ b/core/src/components/searchbar/test/basic/index.html @@ -22,7 +22,11 @@
Search - Default
- + + + +
Search - No Cancel Button
+
Search - Danger
@@ -42,10 +46,6 @@ type="number" placeholder="Filter Schedules">
-
Search - No Cancel Button
- - -
Search - Custom Cancel Button Danger