-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Adding an easy local environment setup and Cypress e2e tests #3069
Changes from all commits
fbdfe7b
a276539
3fb6e13
b376b83
2aff5fc
3d32b0c
7947cbb
c754a5c
5678b25
1aba5f1
af5c287
793ec04
8cc2642
3e3b67d
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Directories/files that may be generated by this project | ||
build | ||
coverage | ||
cypress | ||
node_modules | ||
gutenberg.zip | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Exit if any command fails | ||
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. Guessing our Windows friends are left out here? 😬 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 sure we want to optimize for Windows users here but if dropping this line is enough to make the tests pass there, maybe we should do it? |
||
set -e | ||
|
||
# Change to the expected directory | ||
cd "$(dirname "$0")/../" | ||
|
||
# Setup local environement | ||
( ./bin/setup-local-env.sh ) | ||
|
||
# Run the tests | ||
npm run test-e2e |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Exit if any command fails | ||
set -e | ||
|
||
# Change to the expected directory | ||
cd "$(dirname "$0")/../docker" | ||
|
||
# Launch the WordPress docker | ||
docker-compose up -d | ||
|
||
# Wait until the docker containers are setup properely | ||
echo "Attempting to connect to wordpress" | ||
until $(curl -L http://localhost:8888 -so - | grep -q "WordPress"); do | ||
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. Minor: 8888 is a fairly common port, so we could encounter a conflict; then again, the risk always exists. 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. Is |
||
printf '.' | ||
sleep 5 | ||
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. How long does the setup usually take? Seems like we could check more frequently than once every five seconds, to help reduce time to complete the full test run. 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. It took like 20 seconds for me |
||
done | ||
|
||
# Install WordPress | ||
docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli core install --url=localhost:8888 --title=Gutenberg --admin_user=admin --admin_password=password [email protected] | ||
|
||
# Activate Gutenberg | ||
docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli plugin activate gutenberg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"baseUrl": "http://localhost:8888", | ||
"env": { | ||
"username": "admin", | ||
"password": "password" | ||
}, | ||
"integrationFolder": "test/e2e/integration", | ||
"supportFile": "test/e2e/support", | ||
"videoRecording": false, | ||
"chromeWebSecurity": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: '3.1' | ||
|
||
services: | ||
|
||
wordpress: | ||
image: wordpress | ||
ports: | ||
- 8888:80 | ||
environment: | ||
WORDPRESS_DB_PASSWORD: example | ||
volumes: | ||
- ../:/var/www/html/wp-content/plugins/gutenberg | ||
container_name: wordpress-dev | ||
|
||
mysql: | ||
image: mysql:5.7 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: example |
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.
With source code moved to
test/e2e
we can filter out this folder completely.