diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 23b9a33db2..f3e7ff04d0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' + cache: "yarn" - name: Install dependencies run: yarn @@ -37,12 +37,11 @@ jobs: - name: Save build in cache id: cache-build - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 with: path: dist key: cache-${{ github.sha }} - # Run linters linters: runs-on: ubuntu-latest @@ -57,7 +56,7 @@ jobs: - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - cache: 'yarn' + cache: "yarn" node-version: ${{ matrix.node-version }} - name: Install dependencies @@ -69,7 +68,6 @@ jobs: - name: Run tests run: yarn test:linters - # Run playwright tests components: runs-on: ubuntu-latest @@ -89,11 +87,11 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' + cache: "yarn" - name: Restore build from cache id: cache-build - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: dist key: cache-${{ github.sha }} @@ -101,13 +99,15 @@ jobs: - name: Install dependencies run: yarn + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Build tsconfig run: yarn build:tsconfig - name: Run components' unit tests run: yarn test:unit --shard=${{ matrix.shard-index }}/${{ matrix.shard-total }} - # Run module tests modules: runs-on: ubuntu-latest @@ -125,14 +125,14 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: 'yarn' + cache: "yarn" - name: Restore build from cache id: cache-build - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: - path: dist - key: cache-${{ github.sha }} + path: dist + key: cache-${{ github.sha }} - name: Install dependencies run: yarn diff --git a/.gitignore b/.gitignore index 158736b7ba..a6be7c4966 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ $RECYCLE.BIN # Build && test /coverage /storybook-static +/test-results /.nyc_output /dist /tsconfig.json diff --git a/package.json b/package.json index ae1220c588..012af04670 100644 --- a/package.json +++ b/package.json @@ -155,7 +155,7 @@ "webpack-cli": "5.1.4" }, "devDependencies": { - "@playwright/test": "1.32.1", + "@playwright/test": "1.49.0", "@storybook/addon-essentials": "7.0.23", "@storybook/addon-interactions": "7.0.23", "@storybook/addon-links": "7.0.23", @@ -180,7 +180,7 @@ "jest": "29.7.0", "jest-runner-eslint": "2.1.2", "nyc": "15.1.0", - "playwright": "1.32.1", + "playwright": "1.49.0", "react": "18.2.0", "react-dom": "18.2.0", "storybook": "7.0.23", diff --git a/src/components/pages/p-v4-components-demo/test/api/page.ts b/src/components/pages/p-v4-components-demo/test/api/page.ts index b13a358dc2..8338abbb83 100644 --- a/src/components/pages/p-v4-components-demo/test/api/page.ts +++ b/src/components/pages/p-v4-components-demo/test/api/page.ts @@ -65,7 +65,7 @@ export default class DemoPage { await this.page.goto(concatURLs(this.baseUrl, `${this.pageFileName}.html`) + (query.length > 0 ? `?${query}` : ''), {waitUntil: 'networkidle'}); await root.waitFor({state: 'attached'}); - this.component = await root.evaluateHandle((ctx) => ctx.component); + this.component = await root.evaluate((ctx) => (ctx).component); return this; } diff --git a/tests/helpers/utils/index.ts b/tests/helpers/utils/index.ts index 37f35f8d9e..ed6e1d8d45 100644 --- a/tests/helpers/utils/index.ts +++ b/tests/helpers/utils/index.ts @@ -6,7 +6,7 @@ * https://github.com/V4Fire/Client/blob/master/LICENSE */ -import type { Page, JSHandle } from 'playwright'; +import type { Page, JSHandle, ElementHandle } from 'playwright'; import { evalFn } from 'core/prelude/test-env/components/json'; @@ -96,7 +96,7 @@ export default class Utils { moduleName = `${moduleName}/index.ts`; } - return >>page.evaluateHandle( + return >>page.evaluateHandle( ([{moduleName}]) => globalThis.importModule(moduleName), [{moduleName}] ); } diff --git a/yarn.lock b/yarn.lock index bc9a8d636a..67d9fdf22d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3007,19 +3007,14 @@ __metadata: languageName: node linkType: hard -"@playwright/test@npm:1.32.1": - version: 1.32.1 - resolution: "@playwright/test@npm:1.32.1" +"@playwright/test@npm:1.49.0": + version: 1.49.0 + resolution: "@playwright/test@npm:1.49.0" dependencies: - "@types/node": "npm:*" - fsevents: "npm:2.3.2" - playwright-core: "npm:1.32.1" - dependenciesMeta: - fsevents: - optional: true + playwright: "npm:1.49.0" bin: playwright: cli.js - checksum: 496236db5867eec9b80a485c3facf926294ab93d2f4fc981fe1518a1534ff09c08fcbe3c02cd70b11c05aa5f27b0ffa32f262c20c94e7f4f375d034e827b56bb + checksum: e87485ab4c02b6dc0bc20a43ea3965c949c45caa4e7f5beea4a0abd29be0a318662931e887072db0d165f8dde93709b97ea1b2c6f4c833b403aa13427d76dd22 languageName: node linkType: hard @@ -5719,7 +5714,7 @@ __metadata: "@babel/preset-env": "npm:7.16.11" "@babel/preset-typescript": "npm:7.16.7" "@config/config": "npm:config@1.31.0" - "@playwright/test": "npm:1.32.1" + "@playwright/test": "npm:1.49.0" "@pzlr/build-core": "npm:2.13.0" "@pzlr/stylus-inheritance": "npm:3.3.0" "@statoscope/webpack-plugin": "npm:5.25.1" @@ -5806,7 +5801,7 @@ __metadata: nyc: "npm:15.1.0" path-equal: "npm:1.1.3" path-to-regexp: "npm:3.2.0" - playwright: "npm:1.32.1" + playwright: "npm:1.49.0" portfinder: "npm:1.0.28" postcss: "npm:8.4.6" postcss-discard-comments: "npm:6.0.0" @@ -20153,23 +20148,27 @@ __metadata: languageName: node linkType: hard -"playwright-core@npm:1.32.1": - version: 1.32.1 - resolution: "playwright-core@npm:1.32.1" +"playwright-core@npm:1.49.0": + version: 1.49.0 + resolution: "playwright-core@npm:1.49.0" bin: - playwright: cli.js - checksum: 90786f1ef3b82781f151c0f389511e67807d995a055b3200e78d1ce2a1e6d6762b984a5b26a438d7360f21eb54bb0c0f672b55ff244fcc6c654bde644aaced94 + playwright-core: cli.js + checksum: ef9c708293adab100337ed7fd8e61660be381707fc2b84f07b5f40d1ead44feb6a8e52fef98075e594522229d15a9ad56dd1471689cfa59409bec6447c22944d languageName: node linkType: hard -"playwright@npm:1.32.1": - version: 1.32.1 - resolution: "playwright@npm:1.32.1" +"playwright@npm:1.49.0": + version: 1.49.0 + resolution: "playwright@npm:1.49.0" dependencies: - playwright-core: "npm:1.32.1" + fsevents: "npm:2.3.2" + playwright-core: "npm:1.49.0" + dependenciesMeta: + fsevents: + optional: true bin: playwright: cli.js - checksum: 34a23bf3c599741bb8aaaf26fe6d2cecb643efdf24cac7867a956eb998a2be83df5a8f91ced562bb04a0de4d78fbefcc5d1d99e24907c6e16dcf7b4e5b3f8638 + checksum: 1fb198d09d388ec46cc2f0fc6b889a8bde8a75066ded82d35f08ba333091ebf3fc4ddf11263a86058a7078c7238ec4f23a86a9f1dc3ebd4f610c9eb07841fb32 languageName: node linkType: hard