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

WIP: Lay out some basic concepts around the Docker Container #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stevegrunwell
Copy link
Member

No description provided.


```yaml
env:
- WP_PLUGINS=jetpack@latest,[email protected]
Copy link

Choose a reason for hiding this comment

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

This makes sense. It should also allow installing via zip. For example caldera-forms@https://github.com/CalderaWP/Caldera-Forms/releases/download/1.8.3-beta.1/1.8.3-beta.1.zip or [email protected].

wp-cli can install plugin by WordPress.org slug or ZIP file https://developer.wordpress.org/cli/commands/plugin/install/

@Shelob9
Copy link

Shelob9 commented Dec 2, 2019

@stevegrunwell Thanks for getting this started. I'm going to put a lot of thaughts here so they are public and beacuse it helps me think. I will take a pass at expanding your draft once I have thaught.

I think we should have two use cases in mind for docker containers we should consider:

  1. Running tests in CI
  2. Local development using test-driven development.

That way not only is it easy to run tests in my local docker-compose, it's the same environment as CI will run in.

I think there are four buckets of tests we should focus on:

  1. PHP unit tests with phpunit
  2. WordPress test suite tests with phpunit
  3. JavaScript tests with Jest via wordpress-scripts
  4. end to end tests/ browser automation tests via wordpress-scripts

I think that we have everything we need for this, in scattered verry messy peices that we can package in containers. Which is great.

PHP unit tests with phpunit
There are many ways to do this. This is a simpler part of the project, since these types of tests do not require WordPress or MySql.

Examples:

WordPress test suite tests with phpunit
These tests are generally setup using wp-cli and then each plugin has the same scripts committed. Adding to existing projects is hard.

https://developer.wordpress.org/cli/commands/scaffold/plugin-tests/

Those scripts cut and paste stuff from core. Can we extend the docker image used in core for testing to include copying those files as well as installing other depenenencies. That feels like a good solution?

Examples:

JavaScript tests with Jest via wordpress-scripts

This one is fairly simple as well, beacuse it does not require WordPress or MySQL. Basically we need yarn && yarn wordpress-tests

end to end tests/ browser automation tests via wordpress-scripts
This one is a massive pain. I got it working here -- locally not CI -- with lot of copypasta:

https://github.com/Shelob9/testing-react-wordpress/tree/master/e2e

In core, they have a directory with all the useful tools:

https://github.com/WordPress/wordpress-develop/tree/master/tests/e2e

I think a good strategy here is to extend core's docker image that runs these to unclude copying these tests from wordpress-develop to the test environment and installing depencies and setting up MySQL and WordPress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants