-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install plugins via .wp-env.json for e2e testing. #709
Changes from all commits
1e8da50
9bdfab9
008a569
edde621
269b848
84ef5ca
5004fb0
0307e5c
b390e20
f835264
970c047
3999ae4
a6ec6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ jobs: | |
with: | ||
# To make sure all history is fetched for jest --changedSince to work as expected | ||
fetch-depth: ${{ ( matrix.task != 'test' && 1 ) || 0 }} # 0 for test, 1 otherwise | ||
token: ${{ secrets.GH_ACTIONS_ACCESS_TOKEN }} | ||
|
||
# TODO replace this when setup-node action supports LTS alias | ||
- name: Set up Node | ||
|
@@ -66,6 +67,18 @@ jobs: | |
- name: Make sure PlayWright doesn't play it wrong | ||
run: yarn add -WD playwright | ||
|
||
- name: Check out event-espresso-core | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: eventespresso/event-espresso-core | ||
path: event-espresso-core | ||
persist-credentials: true | ||
ref: dev | ||
token: ${{ secrets.GH_ACTIONS_ACCESS_TOKEN }} | ||
|
||
- name: Build event-espresso-core | ||
run: cd event-espresso-core && yarn && yarn build | ||
Comment on lines
+79
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not entirely happy with this approach, but I was getting the error that there is no manifest file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if GitHub ever adds composite actions then we'll need to build one that handles all of the WP && EE core setup. @manzoorwanijk can we cache things at any point during a workflow and reuse in another step? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, we can. But it's better to wait for composite actions |
||
|
||
- name: Install WordPress | ||
run: yarn wp-env start | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"core": "WordPress/WordPress", | ||
"env": { | ||
"tests": { | ||
"mappings": { | ||
"wp-content/plugins/event-espresso-core": "./event-espresso-core", | ||
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins" | ||
} | ||
} | ||
}, | ||
"plugins": ["."] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,7 +117,6 @@ | |
"@wordpress/dependency-extraction-webpack-plugin": "^3.0.0", | ||
"@wordpress/env": "^3.0.2", | ||
"@wordpress/eslint-plugin": "^8.0.0", | ||
"@wordpress/jest-console": "^4.0.1", | ||
"babel-eslint": "10.1.0", | ||
"babel-jest": "^26.6.3", | ||
"babel-loader": "8.2.2", | ||
|
@@ -163,7 +162,7 @@ | |
"mini-css-extract-plugin": "1.3.4", | ||
"npm-check": "^5.9.2", | ||
"optimize-css-assets-webpack-plugin": "5.0.4", | ||
"playwright": "^1.8.0", | ||
"playwright": "^1.7.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as seen here |
||
"pnp-webpack-plugin": "1.6.4", | ||
"postcss-flexbugs-fixes": "4.2.1", | ||
"postcss-loader": "3.0.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
module.exports = { | ||
preset: 'jest-playwright-preset', | ||
globalSetup: 'jest-playwright-preset/setup.js', | ||
reporters: undefined, | ||
setupFilesAfterEnv: ['<rootDir>/config/setup-playwright.js'], | ||
testMatch: ['**/specs/**/*.[jt]s', '**/?(*.)spec.[jt]s'], | ||
testEnvironmentOptions: { | ||
'jest-playwright': { | ||
launchOptions: { | ||
headless: process.env.CI === 'true' ? true : process.env.HEADLESS === 'true', | ||
// slowMo: +process.env.SLOW_MO, | ||
}, | ||
}, | ||
}, | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
reporters: undefined, | ||
setupFilesAfterEnv: ['<rootDir>/config/setup-playwright.js', '@wordpress/jest-console'], | ||
verbose: process.env.CI === 'true', | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
<?php | ||
/** | ||
* Plugin Name: Gutenberg Test Plugin, Disables the CSS animations | ||
* Plugin URI: https://github.com/WordPress/gutenberg | ||
* Author: Gutenberg Team | ||
* | ||
* @package gutenberg-test-disable-animations | ||
*/ | ||
|
||
/** | ||
* Enqueue CSS stylesheet disabling animations. | ||
*/ | ||
function enqueue_disable_animations_stylesheet() { | ||
$custom_css = '* { animation-duration: 0ms !important; transition-duration: 0s !important; }'; | ||
wp_add_inline_style( 'wp-components', $custom_css ); | ||
} | ||
|
||
add_action( 'admin_enqueue_scripts', 'enqueue_disable_animations_stylesheet' ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Plugin Name: Gutenberg Test Plugin, Nonce | ||
* Plugin URI: https://github.com/WordPress/gutenberg | ||
* Author: Gutenberg Team | ||
* | ||
* @package gutenberg-test-plugin-nonce | ||
*/ | ||
|
||
/** | ||
* Returns the nonce life time. | ||
*/ | ||
function gutenberg_test_plugin_nonce_life() { | ||
return 5; | ||
} | ||
add_filter( 'nonce_life', 'gutenberg_test_plugin_nonce_life' ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference types="jest-playwright-preset" /> | ||
/// <reference types="expect-playwright" /> | ||
import { activatePlugin, loginUser } from '../utils'; | ||
|
||
describe('hello playwright', () => { | ||
it('should work', async () => { | ||
await loginUser(); | ||
|
||
await activatePlugin('event-espresso'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
await page.click(`.toplevel_page_espresso_events > a`); | ||
|
||
const espressoAdmin = await page.$eval('.espresso-admin', (el) => el.innerHTML); | ||
|
||
expect(espressoAdmin).toContain('Event Espresso - Events'); | ||
|
||
await browser.close(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"files": ["node_modules/jest-playwright-preset/types/global.d.ts", "node_modules/expect-playwright/global.d.ts"], | ||
"compilerOptions": { | ||
"isolatedModules": false | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the errors I had before was related to the order of this step, it needs to be before WP install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really? that... doesn't make any sense...
if WP isn't installed then there's no
/wp-content/plugins/
folder to put the EE plugin into !!?!?!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in
.wp-env.json
we havemappings
to corresponding pluginThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from https://developer.wordpress.org/block-editor/packages/packages-env/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my point was that how do you install EE (a WP plugin) before WP is installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to add the EE after WP installation, but was getting a lot of permission issues, so tried this way and it was working;
I am not aware of
wordress/env
internals and can't tell how this is installed internally into that docker container, my guess would be that they feed somehow the mappings after the install process automagically 🤷♂️