From e939b5732be15464397071e01e0319223c532d0a Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 17:05:08 +0530 Subject: [PATCH 1/9] Bump actions/upload-artifact from v3 to v4 --- .github/workflows/e2e-tests.yml | 2 +- .github/workflows/linting.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 33c950a16..5bd7ef641 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -44,7 +44,7 @@ jobs: npm run test:e2e - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: failures-artifacts diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b3345342b..e55ce18d9 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -49,7 +49,7 @@ jobs: continue-on-error: true - if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }} name: Upload ESLint report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: eslint_report.json path: eslint_report.json From 4d2fa433f1ebcae46bc8a9fabc73b94bf24ffa81 Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 17:57:09 +0530 Subject: [PATCH 2/9] Try reverting to v3 --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 5bd7ef641..33c950a16 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -44,7 +44,7 @@ jobs: npm run test:e2e - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3 if: always() with: name: failures-artifacts From cd240b59e8cda52900e7e3cde149ea89bcf0c728 Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 18:09:10 +0530 Subject: [PATCH 3/9] Use ubuntu-22.04 --- .github/workflows/e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 33c950a16..fdbdeb491 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -7,7 +7,7 @@ on: jobs: Setup: name: Setup - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - name: Cache node modules From f9c313862b5ebe1d4dfd849971b43e8e33ba58cb Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 18:54:14 +0530 Subject: [PATCH 4/9] Testing "E2E tests" workflow --- e2e/specs/browser.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/e2e/specs/browser.test.js b/e2e/specs/browser.test.js index 0170ef6df..f7fc8111b 100644 --- a/e2e/specs/browser.test.js +++ b/e2e/specs/browser.test.js @@ -4,7 +4,9 @@ describe( 'Storefront', () => { } ); it( 'should have "built with WooCommerce" footer', async () => { - const footerText = await page.evaluate( () => document.querySelector( 'body' ).innerText ); - expect( footerText ).toMatch( 'Built with WooCommerce.' ); + const footerText = await page.evaluate( + () => document.querySelector( 'body' ).innerText + ); + expect( footerText ).toMatch( 'This text does not exist' ); } ); } ); From fddd56fb8626011cc19d29b536a2cbb14f5fe1ba Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 19:02:20 +0530 Subject: [PATCH 5/9] Add missing jest-html-reporters configuration - Add jest-html-reporters configuration to generate HTML test reports - Reports will be saved in ./artifacts/report.html --- package.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index aa1fa7906..adc427ac2 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,17 @@ ], "globals": { "STORE_URL": "http://localhost:8802" - } + }, + "reporters": [ + "default", + [ + "jest-html-reporters", + { + "publicPath": "./artifacts", + "filename": "report.html" + } + ] + ] }, "config": { "wp_org_slug": "storefront", From 1d68aa5496616772ba94aa288699ee8114877212 Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 19:10:55 +0530 Subject: [PATCH 6/9] Add jest-html-reporters to generate HTML test reports --- package-lock.json | 29 +++++++++++++++++++++++++++-- package.json | 1 + 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index bac9da75e..4a23873de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "cross-env": "7.0.3", "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", + "jest-html-reporters": "^3.1.4", "jest-puppeteer": "10.1.0", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", @@ -35,8 +36,8 @@ "uglify-js": "3.19.3" }, "engines": { - "node": "^20.11.1", - "npm": "9.1.3" + "node": "20.17.0", + "npm": "10.8.2" } }, "node_modules/@ampproject/remapping": { @@ -14044,6 +14045,30 @@ "fsevents": "^2.3.2" } }, + "node_modules/jest-html-reporters": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/jest-html-reporters/-/jest-html-reporters-3.1.7.tgz", + "integrity": "sha512-GTmjqK6muQ0S0Mnksf9QkL9X9z2FGIpNSxC52E0PHDzjPQ1XDu2+XTI3B3FS43ZiUzD1f354/5FfwbNIBzT7ew==", + "dev": true, + "dependencies": { + "fs-extra": "^10.0.0", + "open": "^8.0.3" + } + }, + "node_modules/jest-html-reporters/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/jest-leak-detector": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", diff --git a/package.json b/package.json index adc427ac2..88287db34 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", "jest-puppeteer": "10.1.0", + "jest-html-reporters": "^3.1.4", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", "onchange": "7.1.0", From 0c0cb018195fa26b994f1581392292ea4c9a8241 Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 19:26:08 +0530 Subject: [PATCH 7/9] Remove failing tests which was added for testing --- e2e/specs/browser.test.js | 6 ++---- package.json | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/e2e/specs/browser.test.js b/e2e/specs/browser.test.js index f7fc8111b..0170ef6df 100644 --- a/e2e/specs/browser.test.js +++ b/e2e/specs/browser.test.js @@ -4,9 +4,7 @@ describe( 'Storefront', () => { } ); it( 'should have "built with WooCommerce" footer', async () => { - const footerText = await page.evaluate( - () => document.querySelector( 'body' ).innerText - ); - expect( footerText ).toMatch( 'This text does not exist' ); + const footerText = await page.evaluate( () => document.querySelector( 'body' ).innerText ); + expect( footerText ).toMatch( 'Built with WooCommerce.' ); } ); } ); diff --git a/package.json b/package.json index 88287db34..6fa0d4942 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", "jest-puppeteer": "10.1.0", - "jest-html-reporters": "^3.1.4", + "jest-html-reporters": "^3.1.7", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", "onchange": "7.1.0", From 2cd0a17bcc8ef12f37a2237739e8e3c91514ea3c Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Mon, 23 Dec 2024 19:35:55 +0530 Subject: [PATCH 8/9] Update jest-html-reporters version --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 4a23873de..6f6ec1099 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "cross-env": "7.0.3", "eslint-plugin-import": "2.29.1", "github-label-sync": "2.3.1", - "jest-html-reporters": "^3.1.4", + "jest-html-reporters": "^3.1.7", "jest-puppeteer": "10.1.0", "lodash": "4.17.21", "node-wp-i18n": "1.2.7", From 995ea38d672aa73c3bcde6b5f697fa04792df4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Fri, 27 Dec 2024 11:52:51 +0100 Subject: [PATCH 9/9] Add failing test --- e2e/specs/browser.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2e/specs/browser.test.js b/e2e/specs/browser.test.js index 0170ef6df..4b9f49422 100644 --- a/e2e/specs/browser.test.js +++ b/e2e/specs/browser.test.js @@ -4,7 +4,10 @@ describe( 'Storefront', () => { } ); it( 'should have "built with WooCommerce" footer', async () => { - const footerText = await page.evaluate( () => document.querySelector( 'body' ).innerText ); + const footerText = await page.evaluate( + () => document.querySelector( 'body' ).innerText + ); expect( footerText ).toMatch( 'Built with WooCommerce.' ); + expect( 1 ).toBe( 2 ); } ); } );