-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[14494] - Improve e2e testing docs and add cli args #14673
[14494] - Improve e2e testing docs and add cli args #14673
Conversation
@@ -50,4 +50,10 @@ if ( hasCliArg( '--puppeteer-interactive' ) ) { | |||
process.env.PUPPETEER_SLOWMO = getCliArg( '--puppeteer-slowmo' ) || 80; | |||
} | |||
|
|||
if ( hasCliArg( '--puppeteer-local' ) ) { |
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.
Hello @gziolo :)
I am not sure of 2 things here:
- whether
local
is the best arg name - if checking arg with
--puppeteer-
as in example above is easy to reason about
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.
Actually, the defaults are:
process.env.WP_BASE_URL = 'http://localhost:8889';
process.env.WP_USERNAME = 'admin';
process.env.WP_PASSWORD = 'password';
So there is no need to set them explicitly. We need the opposite, to have a way to override all those 3 values:
if ( hasCliArg( '--wordpress-host' ) ) {
process.env.WP_BASE_URL = getCliArg( '--wordpress-host' );
}
if ( hasCliArg( '--wordpress-username' ) ) {
process.env. WP_USERNAME = getCliArg( '--wordpress-username' );
}
if ( hasCliArg( '--wordpress-password' ) ) {
process.env. WP_PASSWORD = getCliArg( '--wordpress-password' );
}
or even better something which uses look up table and loops over it.
@@ -215,6 +215,10 @@ _Example:_ | |||
This is how you execute those scripts using the presented setup: | |||
|
|||
* `npm run test:e2e` - runs all unit tests. | |||
* `npm run test-e2e interactive` - runs all unit tests interactively. |
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.
Shouldn't it look as follows? /cc @draganescu
* `npm run test-e2e -- --puppeteer-interactive` - runs all unit tests interactively.
* `npm run test-e2e FILE_NAME -- --puppeteer-interactive ` - runs one test file interactively.
* `npm run test-e2e:watch -- --puppeteer-interactive` - runs all tests interactively and watch for changes.
In watch mode, you rather don't pass the name of the file as by default it runs only for modified files.
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 made this change based on this PR's description: #14129
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.
yes, but I didn't update the PR's description with the changes in the comments. @gziolo is right, in the end it was developed as:
* `npm run test-e2e -- --puppeteer-interactive` - runs all unit tests interactively.
* `npm run test-e2e FILE_NAME -- --puppeteer-interactive ` - runs one test file interactively.
* `npm run test-e2e:watch -- --puppeteer-interactive` - runs all tests interactively and watch for changes.
@@ -50,4 +50,10 @@ if ( hasCliArg( '--puppeteer-interactive' ) ) { | |||
process.env.PUPPETEER_SLOWMO = getCliArg( '--puppeteer-slowmo' ) || 80; | |||
} | |||
|
|||
if ( hasCliArg( '--puppeteer-local' ) ) { |
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.
Actually, the defaults are:
process.env.WP_BASE_URL = 'http://localhost:8889';
process.env.WP_USERNAME = 'admin';
process.env.WP_PASSWORD = 'password';
So there is no need to set them explicitly. We need the opposite, to have a way to override all those 3 values:
if ( hasCliArg( '--wordpress-host' ) ) {
process.env.WP_BASE_URL = getCliArg( '--wordpress-host' );
}
if ( hasCliArg( '--wordpress-username' ) ) {
process.env. WP_USERNAME = getCliArg( '--wordpress-username' );
}
if ( hasCliArg( '--wordpress-password' ) ) {
process.env. WP_PASSWORD = getCliArg( '--wordpress-password' );
}
or even better something which uses look up table and loops over it.
I messed up deleting the fork, created another PR based on current feedback: #14717 |
Description
Fixes to: #14494
I added
local
arg tonpm run test-e2e
command.How has this been tested?
It was tested locally.
Checklist: