Skip to content

Commit 4160413

Browse files
release: fixes
- Fix language pack loading - Fix onboarding layout overflow and responsiveness
2 parents fbea7dc + fc16dd3 commit 4160413

File tree

25 files changed

+23007
-12933
lines changed

25 files changed

+23007
-12933
lines changed

.github/workflows/e2e.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,16 @@ jobs:
2626
composer install --no-dev --prefer-dist --no-progress --no-suggest
2727
yarn run build
2828
- name: Setup Node.js
29-
uses: actions/setup-node@v3
29+
uses: actions/setup-node@v4
3030
with:
31-
node-version: 16
32-
- name: Install testing env
33-
run: bash ./bin/e2e-env.sh
34-
- name: Run Cypress tests
35-
env:
36-
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
37-
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
38-
uses: cypress-io/github-action@v6
31+
node-version: 18
32+
cache: "npm"
33+
- name: Run E2E
34+
run: npm run ci:e2e
35+
- name: Upload artifacts on failure
36+
if: failure()
37+
uses: actions/upload-artifact@v4
3938
with:
40-
working-directory: ./e2e-tests
41-
env: host=localhost,port=8080
42-
browser: chrome
39+
name: e2e-artifacts
40+
path: ./artifacts
41+
retention-days: 1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ languages/*.pot
88
**/build/*
99
**/.DS_Store
1010
.phpunit.result.cache
11-
.vscode
11+
.vscode
12+
/e2e-tests/artifacts

Gruntfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ module.exports = function (grunt) {
3939
},
4040
src: [ 'templates-patterns-collection.php' ]
4141
},
42+
readmetxt: {
43+
options: {
44+
prefix: 'Stable tag:\\s*'
45+
},
46+
src: [
47+
'readme.txt'
48+
]
49+
},
4250
},
4351
wp_readme_to_markdown: {
4452
plugin: {

e2e-tests/.eslintrc.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

e2e-tests/.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"trailingComma": "all",
3-
"tabWidth": 2,
3+
"tabWidth": 4,
44
"semi": true,
55
"singleQuote": true,
66
"printWidth": 100,

e2e-tests/.wp-env.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"plugins": [ ".." ],
3+
"phpVersion": "8.1"
4+
}

e2e-tests/README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1-
### How to run cypress tests locally
1+
### How to run Playwright E2E tests locally
22

3-
* First you will need to setup the environment on your local machine and have wp-cli installed. Assuming that your local url is http://neve.test you can `CYPRESS_BASE_URL=http://neve.test bash bin/envs/local.sh` or if you want to install a specific environment you can use `CYPRESS_BASE_URL=http://neve.test bash bin/envs/local.sh amp` where amp is the environment inside `bin/envs/amp`
4-
5-
* Than you can move to e2e-tests folder and run `yarn install --frozen-lockfile` to install the dependencies.
6-
* After this you will have to open cypress with the proper base url, as `CYPRESS_BASE_URL=http://neve.test npm run cypress:open` and run the spec that you want.
3+
- First, ensure you have Node.js installed on your system.
4+
5+
- Install dependencies by running in this folder:
6+
7+
```bash
8+
npm install
9+
```
10+
11+
- Start the WordPress test environment:
12+
13+
```bash
14+
npm run wp-env start
15+
```
16+
17+
- To run the tests, you have several options:
18+
19+
- Run all tests: `npm run test:playwright`
20+
- Run tests in debug mode: `npm run test:playwright:debug`
21+
- Run tests with UI mode: `npm run test:playwright:ui`
22+
23+
- For additional test options, you can run:
24+
```bash
25+
npm run test:playwright:help
26+
```
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/**
2+
* A **flaky** test is defined as a test which passed after auto-retrying.
3+
* - By default, all tests run once if they pass.
4+
* - If a test fails, it will automatically re-run at most 2 times.
5+
* - If it pass after retrying (below 2 times), then it's marked as **flaky**
6+
* but displayed as **passed** in the original test suite.
7+
* - If it fail all 3 times, then it's a **failed** test.
8+
*/
9+
/**
10+
* External dependencies
11+
*/
12+
import fs from 'fs';
13+
import type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';
14+
import filenamify from 'filenamify';
15+
16+
type FormattedTestResult = Omit< TestResult, 'steps' >;
17+
18+
// Remove "steps" to prevent stringify circular structure.
19+
function formatTestResult( testResult: TestResult ): FormattedTestResult {
20+
const result = { ...testResult, steps: undefined };
21+
delete result.steps;
22+
return result;
23+
}
24+
25+
class FlakyTestsReporter implements Reporter {
26+
failingTestCaseResults = new Map< string, FormattedTestResult[] >();
27+
28+
onBegin() {
29+
try {
30+
fs.mkdirSync( 'flaky-tests' );
31+
} catch ( err ) {
32+
if (
33+
err instanceof Error &&
34+
( err as NodeJS.ErrnoException ).code === 'EEXIST'
35+
) {
36+
// Ignore the error if the directory already exists.
37+
} else {
38+
throw err;
39+
}
40+
}
41+
}
42+
43+
onTestEnd( test: TestCase, testCaseResult: TestResult ) {
44+
const testPath = test.location.file;
45+
const testTitle = test.title;
46+
47+
switch ( test.outcome() ) {
48+
case 'unexpected': {
49+
if ( ! this.failingTestCaseResults.has( testTitle ) ) {
50+
this.failingTestCaseResults.set( testTitle, [] );
51+
}
52+
this.failingTestCaseResults
53+
.get( testTitle )!
54+
.push( formatTestResult( testCaseResult ) );
55+
break;
56+
}
57+
case 'flaky': {
58+
fs.writeFileSync(
59+
`flaky-tests/${ filenamify( testTitle ) }.json`,
60+
JSON.stringify( {
61+
version: 1,
62+
runner: '@playwright/test',
63+
title: testTitle,
64+
path: testPath,
65+
results: this.failingTestCaseResults.get( testTitle ),
66+
} ),
67+
'utf-8'
68+
);
69+
break;
70+
}
71+
default:
72+
break;
73+
}
74+
}
75+
76+
onEnd() {
77+
this.failingTestCaseResults.clear();
78+
}
79+
80+
printsToStdio() {
81+
return false;
82+
}
83+
}
84+
85+
module.exports = FlakyTestsReporter;

e2e-tests/config/global-setup.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { request } from '@playwright/test';
5+
import type { FullConfig } from '@playwright/test';
6+
7+
/**
8+
* WordPress dependencies
9+
*/
10+
import { RequestUtils } from '@wordpress/e2e-test-utils-playwright';
11+
12+
async function globalSetup( config: FullConfig ) {
13+
const { storageState, baseURL } = config.projects[ 0 ].use;
14+
const storageStatePath =
15+
typeof storageState === 'string' ? storageState : undefined;
16+
17+
const requestContext = await request.newContext( {
18+
baseURL,
19+
} );
20+
21+
const requestUtils = new RequestUtils( requestContext, {
22+
storageStatePath,
23+
} );
24+
25+
// Authenticate and save the storageState to disk.
26+
await requestUtils.setupRest();
27+
28+
// Reset the test environment before running the tests.
29+
await Promise.all( [
30+
// requestUtils.activateTheme( 'twentytwentyone' ),
31+
// // Disable this test plugin as it's conflicting with some of the tests.
32+
// // We already have reduced motion enabled and Playwright will wait for most of the animations anyway.
33+
// requestUtils.deactivatePlugin(
34+
// 'gutenberg-test-plugin-disables-the-css-animations'
35+
// ),
36+
requestUtils.deleteAllPosts(),
37+
requestUtils.deleteAllBlocks(),
38+
requestUtils.resetPreferences(),
39+
] );
40+
41+
await requestContext.dispose();
42+
}
43+
44+
export default globalSetup;

e2e-tests/cypress.config.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)