Skip to content
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

Improve e2e testing docs and add cli args. #14717

Merged
merged 5 commits into from
Apr 1, 2019
Merged

Improve e2e testing docs and add cli args. #14717

merged 5 commits into from
Apr 1, 2019

Conversation

nicolad
Copy link
Member

@nicolad nicolad commented Mar 29, 2019

Description

Fixes to: #14494
I added local arg to npm run test-e2e command.

How has this been tested?

It was tested locally.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

WP_PASSWORD: "--wordpress-password"
};

Object.entries(configsMapping).forEach(([key, value]) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this readable enough on first glance?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it looks good. You can use more specific names instead key and name, e.g. envKey and argName or something like that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted, thx.

@gziolo
Copy link
Member

gziolo commented Mar 31, 2019

There are 24 warnings reported by ESLint:
https://travis-ci.com/WordPress/gutenberg/jobs/188963416#L914

It reports also that most of them can be fixed by running npm run lint-js — --fix

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add one more tweak as explained in my comment and this is ready to land :)

Thanks for addressing all comments.

process.env[ key ] = getCliArg( value );
}
} );

jest.run( [ ...config, ...runInBand, ...getCliArgs( cleanUpPrefixes ) ] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const cleanUpPrefixes = [ '--puppeteer-' ];

At the moment cleanUpPrefixes doesn't filter out --wordpress-. It should be a good practice to ensure they are never passed to Jest as we discovered some issues with --interactive in the past.

Screen Shot 2019-04-01 at 10 23 38

That's why @draganescu added logic which allows to filter out CLI args starting with a given pattern.

Copy link
Member Author

@nicolad nicolad Apr 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't knew that, had adjusted, thx.

@gziolo gziolo added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Enhancement A suggestion for improvement. [Type] Developer Documentation Documentation for developers labels Apr 1, 2019
@@ -50,4 +50,16 @@ if ( hasCliArg( '--puppeteer-interactive' ) ) {
process.env.PUPPETEER_SLOWMO = getCliArg( '--puppeteer-slowmo' ) || 80;
}

const configsMapping = {
WP_BASE_URL: '--wordpress-host',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should align with the env variable name? --wordpress-base-url maybe. I forgot that WordPress can be also installed in subfolder and seeing the actual implementation made me think :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's better, since there is no need to think twice why the argument name is describing a different thing than expected from env key.

Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work. Thanks for your contribution 👍

@gziolo gziolo merged commit a61e351 into WordPress:master Apr 1, 2019
@gziolo gziolo added this to the 5.5 (Gutenberg) milestone Apr 1, 2019
@nicolad nicolad deleted the docs/14494/improve-e2e-testing-docs-and-add-cli-args branch April 1, 2019 10:14
@nicolad nicolad self-assigned this Sep 29, 2019
@nicolad nicolad changed the title [14494] - Improve e2e testing docs and add cli args. Improve e2e testing docs and add cli args. Sep 29, 2019
@gziolo gziolo mentioned this pull request Apr 29, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Type] Developer Documentation Documentation for developers [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants