本文整理汇总了TypeScript中@stencil/core/testing.newE2EPage函数的典型用法代码示例。如果您正苦于以下问题:TypeScript newE2EPage函数的具体用法?TypeScript newE2EPage怎么用?TypeScript newE2EPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newE2EPage函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
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);
});
示例2: it
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');
});
示例3: test
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();
});
示例4: test
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');
}
});
示例5: test
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();
}
});
示例6: test
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();
});
示例7: test
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();
});