test('action-sheet: noBackdropDismiss', async () => { const page = await newE2EPage({ url: `/src/components/action-sheet/test/no-backdrop-dismiss?ionic:_testing=true` }); const presentBtn = await page.find('#noBackdropDismiss'); await presentBtn.click(); let actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); let compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); const backdrop = await page.find('ion-backdrop'); await backdrop.click(); compare = await page.compareScreenshot(`dismissed`); expect(compare).toMatchScreenshot(); const isVisible = await actionSheet.isVisible(); expect(isVisible).toBe(true); const cancel = await page.find('.action-sheet-cancel'); await cancel.click(); await actionSheet.waitForNotVisible(); actionSheet = await page.find('ion-action-sheet'); expect(actionSheet).toBe(null); });
it('renders', async () => { const page = await newE2EPage(); await page.setContent('<app-home></app-home>'); const element = await page.find('app-home'); expect(element).toHaveClass('hydrated'); });
test('input: basic', async () => { const page = await newE2EPage({ url: '/src/components/input/test/basic?ionic:_testing=true' }); let compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); const fullInput = await page.find('#fullInput'); await fullInput.click(); const fullItem = await page.find('#fullItem'); expect(fullItem).toHaveClass('item-has-focus'); compare = await page.compareScreenshot('full input focused'); expect(compare).toMatchScreenshot(); const insetInput = await page.find('#insetInput'); await insetInput.click(); const insetItem = await page.find('#insetItem'); expect(insetItem).toHaveClass('item-has-focus'); compare = await page.compareScreenshot('inset input focused'); expect(compare).toMatchScreenshot(); const noneInput = await page.find('#noneInput'); await noneInput.click(); const noneItem = await page.find('#noneItem'); expect(noneItem).toHaveClass('item-has-focus'); compare = await page.compareScreenshot('no lines input focused'); expect(compare).toMatchScreenshot(); });
test('action-sheet: alertFromActionSheet', async () => { const page = await newE2EPage({ url: `/src/components/action-sheet/test/alert-from-action-sheet?ionic:_testing=true` }); const presentBtn = await page.find('#alertFromActionSheet'); await presentBtn.click(); const actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); let compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); const openAlertBtn = await page.find({ text: 'Open Alert' }); await openAlertBtn.click(); const alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitFor(250); compare = await page.compareScreenshot(`alert open`); expect(compare).toMatchScreenshot(); const alertOkayBtn = await page.find({ contains: 'Okay' }); await alertOkayBtn.click(); });
it('contains a "Profile Page" button', async () => { const page = await newE2EPage(); await page.setContent('<app-home></app-home>'); const element = await page.find('app-home >>> button'); expect(element.textContent).toEqual('Profile page'); });
test('alert: basic', async () => { const page = await newE2EPage({ url: '/src/components/alert/test/basic?ionic:_testing=true' }); const alerts = [ ['#basic'], ['#longMessage', 'long message'], ['#multipleButtons', 'multiple buttons'], ['#noMessage', 'no message'], ['#confirm', 'confirm'], ['#prompt', 'prompt'], ['#radio', 'radio'], ['#checkbox', 'checkbox'] ]; for (const [buttonSelector, message] of alerts) { await page.click(buttonSelector); const alert = await page.find('ion-alert'); expect(alert).not.toBe(null); await alert.waitForVisible(); await page.waitFor(250); const compare = await page.compareScreenshot(message); expect(compare).toMatchScreenshot(); await alert.callMethod('dismiss'); } });
it("renders", async () => { const page = await newE2EPage(); await page.setContent("<app-home></app-home>"); const element = await page.find("app-home"); expect(element).toHaveClass("hydrated"); });
test('item-sliding: interactive', async () => { const page = await newE2EPage({ url: '/src/components/item-sliding/test/interactive?ionic:_testing=true' }); const compares = []; compares.push(await page.compareScreenshot()); const items = await page.$$('ion-item-sliding'); expect(items.length).toEqual(3); await slideAndDelete(items[0], page); const itemsAfterFirstSlide = await page.$$('ion-item-sliding'); expect(itemsAfterFirstSlide.length).toEqual(2); await slideAndDelete(items[1], page); const itemsAfterSecondSlide = await page.$$('ion-item-sliding'); expect(itemsAfterSecondSlide.length).toEqual(1); for (const compare of compares) { expect(compare).toMatchScreenshot(); } });
test('select: basic', async () => { const page = await newE2EPage({ url: '/src/components/select/test/basic?ionic:_testing=true' }); let compare = await page.compareScreenshot(); expect(compare).toMatchScreenshot(); let select = await page.find('#gender'); await select.click(); const alert = await page.find('ion-alert'); await alert.waitForVisible(); await page.waitFor(250); compare = await page.compareScreenshot('should open gender single select'); expect(compare).toMatchScreenshot(); await alert.callMethod('dismiss'); select = await page.find('#customSelect'); await select.click(); const actionSheet = await page.find('ion-action-sheet'); await actionSheet.waitForVisible(); await page.waitFor(250); compare = await page.compareScreenshot('should open custom action sheet select'); expect(compare).toMatchScreenshot(); });
test('menu: standalone', async () => { const page = await newE2EPage({ url: '/src/components/menu/test/standalone?ionic:_testing=true' }); const start = await page.find('ion-menu[side="start"]'); expect(start).toHaveClasses([ 'menu-type-overlay', 'menu-enabled', 'menu-side-start' ]); await start.callMethod('open'); await start.waitForVisible(); await page.waitFor(250); expect(await page.compareScreenshot('start menu')).toMatchScreenshot(); await start.callMethod('close'); await page.waitFor(250); const end = await page.find('ion-menu[side="end"]'); expect(end).toHaveClasses([ 'menu-type-push', 'menu-enabled', 'menu-side-end' ]); await end.callMethod('open'); await end.waitForVisible(); await page.waitFor(250); expect(await page.compareScreenshot('end menu')).toMatchScreenshot(); });