### Quick start E2E commands Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Initial setup and execution commands for running E2E tests from the plugin root. ```bash npm i npm run build npx playwright install --with-deps # first run only make start-e2e # wp-env plus Elasticsearch make setup-e2e-tests # build the database npm run playwright:test ``` -------------------------------- ### Install shared library dependencies Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Resolve shared library loading errors in WSL by installing the required system packages. ```bash sudo apt update && sudo apt install libatk1.0-0 libatk-bridge2.0-0 libcups2 libgtk-3-0 libgbm-dev libasound2 xvfb ``` -------------------------------- ### Setup E2E environment script Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Bypass the Makefile to configure the E2E environment by calling the setup script directly with host, credentials, and index prefix arguments. ```bash ./bin/setup-e2e-env.sh --ep-host="https://..." --ep-credentials="username:password" --ep-index-prefix="username" ``` -------------------------------- ### Install and Build ElasticPress Assets Source: https://github.com/10up/elasticpress/blob/develop/README.md Run these commands to install Node.js dependencies and build assets for a development version of ElasticPress. Node.js v20 and npm v9 are required. ```bash npm install && npm run build ``` -------------------------------- ### Makefile E2E targets Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Common Makefile commands for managing the local E2E environment and database setup. ```makefile make start-e2e # wp-env plus Elasticsearch make setup-e2e-tests # latest WordPress and WooCommerce make setup-e2e-tests-min # minimum supported WordPress and WooCommerce make destroy-e2e # tear everything down ``` -------------------------------- ### Configure display environment variables Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Resolve server address parsing errors by exporting the necessary display environment variables. ```bash export LIBGL_ALWAYS_INDIRECT=1 export DISPLAY=:0 ``` -------------------------------- ### Write a test using custom fixtures Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Import test and expect from the local fixtures file and use the loggedInPage fixture to avoid manual authentication. ```ts import { test, expect } from '../fixtures.js'; import { goToAdminPage, wpCli } from '../utils.js'; test.describe('My feature', { tag: '@group1' }, () => { test('does the thing', async ({ loggedInPage }) => { await goToAdminPage(loggedInPage, 'admin.php?page=elasticpress'); await expect(loggedInPage.locator('.wrap')).toContainText('ElasticPress'); }); }); ``` -------------------------------- ### Recreate Docker containers for platform mismatch Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Fix platform mismatch errors on Apple Silicon by forcing a rebuild of the Docker containers. ```bash docker compose down docker compose up -d --build --force-recreate ``` -------------------------------- ### Generate POT file for internationalization Source: https://github.com/10up/elasticpress/blob/develop/CONTRIBUTING.md Run this command to update the POT file for translations. If errors occur, consider disabling Xdebug. ```bash wp i18n make-pot . lang/elasticpress.pot ``` -------------------------------- ### Set EP_HOST in wp-env Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Resolve connection errors to Elasticsearch in WSL by setting the EP_HOST configuration via wp-env-cli. ```bash ./bin/wp-env-cli wordpress "wp --allow-root config set EP_HOST http://host.docker.internal:8890/" ``` -------------------------------- ### Push trunk branch to GitHub Source: https://github.com/10up/elasticpress/blob/develop/CONTRIBUTING.md Push the updated trunk branch to the remote repository after testing. ```bash git push origin trunk ``` -------------------------------- ### ElasticPress.io E2E targets Source: https://github.com/10up/elasticpress/blob/develop/tests/e2e/README.md Specific Makefile targets for running tests against an ElasticPress.io environment. ```makefile make start-e2e-epio make setup-e2e-tests-epio # or setup-e2e-tests-epio-min ```