mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(): sync feature-6.1 with main for playwright utilities
chore(): sync feature-6.1 with main for playwright utilities
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic-framework/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **angular:** button components now route correctly without reload ([#25071](https://github.com/ionic-team/ionic-framework/issues/25071)) ([fb994fa](https://github.com/ionic-team/ionic-framework/commit/fb994fa9a7721a3575fb8d123be34aea4bf076a4))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic-framework/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **angular:** button components now route correctly without reload ([#25071](https://github.com/ionic-team/ionic/issues/25071)) ([fb994fa](https://github.com/ionic-team/ionic/commit/fb994fa9a7721a3575fb8d123be34aea4bf076a4))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
|
||||
|
||||
2
angular/package-lock.json
generated
2
angular/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/angular",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/angular",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Angular specific wrappers for @ionic/core",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -44,7 +44,7 @@
|
||||
"validate": "npm i && npm run lint && npm run test && npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ionic/core": "^6.0.15",
|
||||
"@ionic/core": "^6.0.16",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/core
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
|
||||
|
||||
982
core/package-lock.json
generated
982
core/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/core",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Base components for Ionic",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -67,6 +67,7 @@
|
||||
"puppeteer": "^10.4.0",
|
||||
"rollup": "^2.26.4",
|
||||
"sass": "^1.26.10",
|
||||
"serve": "^13.0.2",
|
||||
"stylelint": "^13.6.1",
|
||||
"stylelint-order": "^4.1.0",
|
||||
"swiper": "5.4.1",
|
||||
|
||||
@@ -101,7 +101,7 @@ const config: PlaywrightTestConfig = {
|
||||
/* Configure projects for major browsers */
|
||||
projects: generateProjects(),
|
||||
webServer: {
|
||||
command: 'python3 -m http.server 3333',
|
||||
command: 'serve -p 3333',
|
||||
port: 3333
|
||||
}
|
||||
};
|
||||
|
||||
100
core/src/utils/test/playwright/eventSpy.ts
Normal file
100
core/src/utils/test/playwright/eventSpy.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import type { IonicPage } from './fixtures';
|
||||
|
||||
/**
|
||||
* The EventSpy class allows
|
||||
* developers to listen for
|
||||
* a particular event emission and
|
||||
* pass/fail the test based on whether
|
||||
* or not the event was emitted.
|
||||
* Based off https://github.com/ionic-team/stencil/blob/16b8ea4dabb22024872a38bc58ba1dcf1c7cc25b/src/testing/puppeteer/puppeteer-events.ts#L64
|
||||
*/
|
||||
export class EventSpy {
|
||||
/**
|
||||
* Keeping track of a cursor
|
||||
* ensures that no two spy.next()
|
||||
* calls point to the same event.
|
||||
*/
|
||||
private cursor = 0;
|
||||
private queuedHandler: (() => void)[] = [];
|
||||
public events: Event[] = [];
|
||||
|
||||
constructor(public eventName: string) {}
|
||||
|
||||
get length() {
|
||||
return this.events.length;
|
||||
}
|
||||
|
||||
public next() {
|
||||
const { cursor } = this;
|
||||
this.cursor++;
|
||||
|
||||
const next = this.events[cursor];
|
||||
if (next) {
|
||||
return Promise.resolve(next);
|
||||
} else {
|
||||
/**
|
||||
* If the event has not already been
|
||||
* emitted, then add it to the queuedHandler.
|
||||
* When the event is emitted, the push
|
||||
* method is called which results in the
|
||||
* Promise below being resolved.
|
||||
*/
|
||||
let resolve: () => void;
|
||||
const promise = new Promise<void>((r) => (resolve = r));
|
||||
// @ts-ignore
|
||||
this.queuedHandler.push(resolve);
|
||||
|
||||
return promise.then(() => this.events[cursor]);
|
||||
}
|
||||
}
|
||||
|
||||
public push(ev: Event) {
|
||||
this.events.push(ev);
|
||||
const next = this.queuedHandler.shift();
|
||||
if (next) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes information required to
|
||||
* spy on events.
|
||||
* The ionicOnEvent function is called in the
|
||||
* context of the current page. This lets us
|
||||
* respond to an event listener created within
|
||||
* the page itself.
|
||||
*/
|
||||
export const initPageEvents = async (page: IonicPage) => {
|
||||
page._e2eEventsIds = 0;
|
||||
page._e2eEvents = new Map();
|
||||
|
||||
await page.exposeFunction('ionicOnEvent', (id: number, ev: any) => {
|
||||
const context = page._e2eEvents.get(id);
|
||||
if (context) {
|
||||
context.callback(ev);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a new event listener in the current
|
||||
* page context to updates the _e2eEvents map
|
||||
* when an event is fired.
|
||||
*/
|
||||
export const addE2EListener = async (page: IonicPage, eventName: string, callback: (ev: any) => void) => {
|
||||
const id = page._e2eEventsIds++;
|
||||
page._e2eEvents.set(id, {
|
||||
eventName,
|
||||
callback,
|
||||
});
|
||||
|
||||
await page.evaluate(
|
||||
([eventName, id]) => {
|
||||
window.addEventListener(eventName as string, (ev: Event) => {
|
||||
(window as any).ionicOnEvent(id, ev);
|
||||
});
|
||||
},
|
||||
[eventName, id]
|
||||
);
|
||||
};
|
||||
@@ -9,10 +9,15 @@ import type {
|
||||
} from '@playwright/test';
|
||||
import { test as base } from '@playwright/test';
|
||||
|
||||
type IonicPage = Page & {
|
||||
import { EventSpy, initPageEvents, addE2EListener } from './eventSpy';
|
||||
|
||||
export type IonicPage = Page & {
|
||||
goto: (url: string) => Promise<null | Response>;
|
||||
setIonViewport: () => Promise<void>;
|
||||
getSnapshotSettings: () => string;
|
||||
spyOnEvent: (eventName: string) => Promise<EventSpy>;
|
||||
_e2eEventsIds: number;
|
||||
_e2eEvents: Map<number, any>;
|
||||
};
|
||||
|
||||
type CustomTestArgs = PlaywrightTestArgs &
|
||||
@@ -124,6 +129,27 @@ export const test = base.extend<CustomFixtures>({
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new EventSpy and listens
|
||||
* on the window for an event.
|
||||
* The test will timeout if the event
|
||||
* never fires.
|
||||
*
|
||||
* Usage:
|
||||
* const ionChange = await page.spyOnEvent('ionChange');
|
||||
* ...
|
||||
* await ionChange.next();
|
||||
*/
|
||||
page.spyOnEvent = async (eventName: string): Promise<EventSpy> => {
|
||||
const spy = new EventSpy(eventName);
|
||||
|
||||
await addE2EListener(page, eventName, (ev: Event) => spy.push(ev));
|
||||
|
||||
return spy;
|
||||
};
|
||||
|
||||
initPageEvents(page);
|
||||
|
||||
await use(page);
|
||||
},
|
||||
});
|
||||
2
core/src/utils/test/playwright/index.ts
Normal file
2
core/src/utils/test/playwright/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './fixtures';
|
||||
export * from './eventSpy';
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic-docs/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/docs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic-docs/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/docs
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/docs",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Pre-packaged API documentation for the Ionic docs.",
|
||||
"main": "core.json",
|
||||
"types": "core.d.ts",
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
"angular",
|
||||
"packages/*"
|
||||
],
|
||||
"version": "6.0.15"
|
||||
"version": "6.0.16"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/angular-server
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/angular-server
|
||||
|
||||
2
packages/angular-server/package-lock.json
generated
2
packages/angular-server/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/angular-server",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/angular-server",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Angular SSR Module for Ionic",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -56,7 +56,7 @@
|
||||
"@angular/platform-browser": "^12.0.0",
|
||||
"@angular/platform-browser-dynamic": "^12.2.10",
|
||||
"@angular/platform-server": "^12.0.0",
|
||||
"@ionic/core": "^6.0.15",
|
||||
"@ionic/core": "^6.0.16",
|
||||
"@ionic/eslint-config": "^0.3.0",
|
||||
"@ionic/prettier-config": "^2.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/react-router
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/react-router
|
||||
|
||||
2
packages/react-router/package-lock.json
generated
2
packages/react-router/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/react-router",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/react-router",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "React Router wrapper for @ionic/react",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -37,7 +37,7 @@
|
||||
"dist/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ionic/react": "^6.0.15",
|
||||
"@ionic/react": "^6.0.16",
|
||||
"tslib": "*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/react
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/react
|
||||
|
||||
2
packages/react/package-lock.json
generated
2
packages/react/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/react",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/react",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "React specific wrapper for @ionic/core",
|
||||
"keywords": [
|
||||
"ionic",
|
||||
@@ -41,7 +41,7 @@
|
||||
"css/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ionic/core": "^6.0.15",
|
||||
"@ionic/core": "^6.0.16",
|
||||
"ionicons": "^6.0.0",
|
||||
"tslib": "*"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/vue-router
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/vue-router
|
||||
|
||||
2
packages/vue-router/package-lock.json
generated
2
packages/vue-router/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/vue-router",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/vue-router",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Vue Router integration for @ionic/vue",
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build",
|
||||
@@ -44,7 +44,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/ionic-team/ionic#readme",
|
||||
"dependencies": {
|
||||
"@ionic/vue": "^6.0.15"
|
||||
"@ionic/vue": "^6.0.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.13",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.16](https://github.com/ionic-team/ionic/compare/v6.0.15...v6.0.16) (2022-04-08)
|
||||
|
||||
**Note:** Version bump only for package @ionic/vue
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.15](https://github.com/ionic-team/ionic/compare/v6.0.14...v6.0.15) (2022-04-06)
|
||||
|
||||
**Note:** Version bump only for package @ionic/vue
|
||||
|
||||
2
packages/vue/package-lock.json
generated
2
packages/vue/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/vue",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ionic/vue",
|
||||
"version": "6.0.15",
|
||||
"version": "6.0.16",
|
||||
"description": "Vue specific wrapper for @ionic/core",
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run build",
|
||||
@@ -60,7 +60,7 @@
|
||||
"vue-router": "^4.0.0-rc.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ionic/core": "^6.0.15",
|
||||
"@ionic/core": "^6.0.16",
|
||||
"ionicons": "^6.0.0"
|
||||
},
|
||||
"vetur": {
|
||||
|
||||
Reference in New Issue
Block a user