-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: WPGraphQL Codeception Module for E2E test implemented and tested
- Loading branch information
Showing
17 changed files
with
1,021 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
TEST_SITE_DB_DSN=mysql:host=mysql;dbname=wordpress | ||
TEST_SITE_DB_HOST=mysql | ||
TEST_SITE_DB_PORT=3306 | ||
TEST_SITE_DB_NAME=wordpress | ||
TEST_SITE_DB_USER=wordpress | ||
TEST_SITE_DB_PASSWORD=password | ||
|
@@ -13,6 +14,6 @@ TEST_DB_HOST=mysql | |
TEST_DB_USER=wordpress | ||
TEST_DB_PASSWORD=password | ||
TEST_TABLE_PREFIX=wp_ | ||
TEST_SITE_WP_URL=localhost:8080 | ||
TEST_SITE_WP_DOMAIN=localhost:8080 | ||
TEST_SITE_WP_URL=http://localhost | ||
TEST_SITE_WP_DOMAIN=localhost | ||
TEST_SITE_ADMIN_EMAIL=[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ extensions: | |
- Codeception\Command\GenerateWPXMLRPC | ||
params: | ||
- .env.testing | ||
- .env.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
|
||
work_dir=$(pwd) | ||
|
||
cd "${WP_ROOT_FOLDER}" || exit | ||
|
||
# Run WordPress docker entrypoint. | ||
# shellcheck disable=SC1091 | ||
. docker-entrypoint.sh 'apache2' | ||
|
||
set +u | ||
|
||
# Ensure mysql is loaded | ||
wait-for-it -s -t 300 "${TEST_SITE_DB_HOST}:${DB_PORT:-3306}" -- echo "Application database is operationally..." | ||
|
||
# Install WP if not yet installed | ||
echo "Installing WordPress..." | ||
wp core install \ | ||
--path="${WP_ROOT_FOLDER}" \ | ||
--url="${TEST_SITE_WP_URL}" \ | ||
--title='Test' \ | ||
--admin_user="${TEST_SITE_ADMIN_USERNAME}" \ | ||
--admin_password="${TEST_SITE_ADMIN_PASSWORD}" \ | ||
--admin_email="${TEST_SITE_ADMIN_EMAIL}" \ | ||
--allow-root | ||
|
||
wp plugin activate wp-graphql --allow-root | ||
|
||
if [ -f "${PROJECT_DIR}/tests/codeception/_data/dump.sql" ]; then | ||
rm -rf "${PROJECT_DIR}/tests/codeception/_data/dump.sql" | ||
fi | ||
|
||
echo "Setting pretty permalinks..." | ||
wp rewrite structure '/%year%/%monthnum%/%postname%/' --allow-root | ||
|
||
app_user="admin" | ||
app_password=$(wp user application-password create 1 testing --porcelain --allow-root) | ||
|
||
echo TEST_SITE_ADMIN_APP_PASSWORD="$(echo -n "${app_user}:${app_password}" | base64)" >> $PROJECT_DIR/.env.docker | ||
|
||
echo "Dumping app database..." | ||
wp db export "${PROJECT_DIR}/tests/codeception/_data/dump.sql" \ | ||
--dbuser="${TEST_SITE_DB_USER}" \ | ||
--dbpass="${TEST_SITE_DB_PASSWORD}" \ | ||
--skip-plugins \ | ||
--skip-themes \ | ||
--allow-root | ||
|
||
echo "Running WordPress version: $(wp core version --allow-root) at $(wp option get home --allow-root)" | ||
|
||
cd "${work_dir}" || exit | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# BEGIN WordPress | ||
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are | ||
# dynamically generated, and should only be modified via WordPress filters. | ||
# Any changes to the directives between these markers will be overwritten. | ||
<IfModule mod_rewrite.c> | ||
RewriteEngine On | ||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | ||
RewriteBase / | ||
RewriteRule ^index\.php$ - [L] | ||
RewriteCond %{REQUEST_FILENAME} !-f | ||
RewriteCond %{REQUEST_FILENAME} !-d | ||
RewriteRule . /index.php [L] | ||
</IfModule> | ||
|
||
# END WordPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
/** | ||
* Plugin Name: Enable App Passwords | ||
* Text Domain: enable-app-passwords | ||
*/ | ||
|
||
add_filter( 'wp_is_application_passwords_available', '__return_true' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.