diff --git a/.github/workflows/test-e2e-cypress.yml b/.github/workflows/test-e2e-cypress.yml
index e63d37ab250..416da4c7903 100644
--- a/.github/workflows/test-e2e-cypress.yml
+++ b/.github/workflows/test-e2e-cypress.yml
@@ -103,78 +103,76 @@ jobs:
node-version-file: '.nvmrc'
cache: 'yarn'
+ - name: Install dependencies
+ run: |
+ composer install --prefer-dist --optimize-autoloader &
+ yarn install --immutable
+
+ - name: Build plugin
+ run: |
+ npx grunt build
+ # moving the built directory to this location means no dev files in tests-container.
+ mv ./build/coblocks $(wp-env install-path)/${{ inputs.installPath }}/wp-content/plugins/
+
+ - name: Prepare Theme
+ run: |
+ if [ "${{ inputs.theme }}" = "https://downloads.wordpress.org/theme/go.zip" ]; then
+ cd $(wp-env install-path)/go
+ else
+ cd $(wp-env install-path)/${{ inputs.installPath }}/wp-content/themes/twentytwentythree
+ fi
+ mkdir -p coblocks/icons
+ echo '' >> coblocks/icons/custom.svg
+
- name: Prepare tests
- run: ls $(wp-env install-path)
- # - name: Install dependencies
- # run: |
- # composer install --prefer-dist --optimize-autoloader &
- # yarn install --immutable
-
- # - name: Build plugin
- # run: |
- # npx grunt build
- # # moving the built directory to this location means no dev files in tests-container.
- # mv ./build/coblocks $(wp-env install-path)/tests-WordPress/wp-content/plugins/
-
- # - name: Prepare Theme
- # run: |
- # if [ "${{ inputs.theme }}" = "https://downloads.wordpress.org/theme/go.zip" ]; then
- # cd $(wp-env install-path)/go
- # else
- # cd $(wp-env install-path)/tests-WordPress/wp-content/themes/twentytwentythree
- # fi
- # mkdir -p coblocks/icons
- # echo '' >> coblocks/icons/custom.svg
-
- # - name: Prepare tests
- # run: |
- # WP_CORE_VERSION=$(wp-env run cli wp core version)
- # echo "WP_CORE_VERSION=${WP_CORE_VERSION}" >> $GITHUB_ENV
- # wp-env run tests-cli wp post generate --count=5
- # wp-env run cli wp post generate --count=5
- # wp-env run cli wp option update permalink_structure '/%postname%'
- # if [ "${{ inputs.theme }}" = "https://downloads.wordpress.org/theme/go.zip" ]; then
- # wp-env run tests-cli wp theme activate go
- # fi
-
- # # Only create a new post if running the migrated specs
- # - name: Create post and get ID
- # if: matrix.spec == 'alert.cypress.js' || matrix.spec == 'author.cypress.js'
- # run: |
- # # Generate application-password to use with WP REST API.
- # app_password=$(wp-env run tests-cli wp user application-password create admin gha-password --porcelain)
-
- # # Retrieve post content from fixture.
- # post_content=$(cat .dev/tests/cypress/fixtures/${{matrix.spec}}.html)
- # echo $post_content
-
- # # Create a post using the REST API and parse the postId from the response.
- # postId=$(curl -s -X POST 'http://localhost:8889/?rest_route=/wp/v2/posts' --data-urlencode "title=${{matrix.spec}}" --data-raw "content=$post_content" --data-urlencode "status=publish" --user "admin:$app_password"| jq '.id')
-
- # # Save the postId to the output.
- # echo "postId=$postId" >> $GITHUB_OUTPUT
- # id: create-post
-
- # # Only retrieve the post ID if running the first spec
- # - name: Save post ID to file
- # if: matrix.spec == 'alert.cypress.js' || matrix.spec == 'author.cypress.js'
- # run: |
- # path="$GITHUB_WORKSPACE/.dev/tests/cypress/fixtures/${{matrix.spec}}.json"
- # touch "$path"
- # echo "{\"${{matrix.spec}}\": \"$(echo "${{ steps.create-post.outputs.postId }}")\"}" > "$path"
-
- # - name: Run tests
- # run: |
- # CYPRESS_SPEC=$(find ./src/* -name ${{ matrix.spec }} -type f)
- # echo '{"wpUsername":"admin","wpPassword":"password","testURL":"http://localhost:8889"}' | jq . > cypress.env.json
- # ./node_modules/.bin/cypress verify
- # ./node_modules/.bin/cypress run --browser ${{ inputs.browser }} --spec $CYPRESS_SPEC
-
- # - name: Upload failure video
- # if: ${{ failure() }}
- # uses: actions/upload-artifact@v3
- # with:
- # name: ${{ matrix.spec }}-fail.mp4
- # path: ./.dev/tests/cypress/videos/${{ matrix.spec }}.mp4
- # retention-days: 1
+ run: |
+ WP_CORE_VERSION=$(wp-env run cli wp core version)
+ echo "WP_CORE_VERSION=${WP_CORE_VERSION}" >> $GITHUB_ENV
+ wp-env run tests-cli wp post generate --count=5
+ wp-env run cli wp post generate --count=5
+ wp-env run cli wp option update permalink_structure '/%postname%'
+ if [ "${{ inputs.theme }}" = "https://downloads.wordpress.org/theme/go.zip" ]; then
+ wp-env run tests-cli wp theme activate go
+ fi
+
+ # Only create a new post if running the migrated specs
+ - name: Create post and get ID
+ if: matrix.spec == 'alert.cypress.js' || matrix.spec == 'author.cypress.js'
+ run: |
+ # Generate application-password to use with WP REST API.
+ app_password=$(wp-env run tests-cli wp user application-password create admin gha-password --porcelain)
+
+ # Retrieve post content from fixture.
+ post_content=$(cat .dev/tests/cypress/fixtures/${{matrix.spec}}.html)
+ echo $post_content
+
+ # Create a post using the REST API and parse the postId from the response.
+ postId=$(curl -s -X POST 'http://localhost:8889/?rest_route=/wp/v2/posts' --data-urlencode "title=${{matrix.spec}}" --data-raw "content=$post_content" --data-urlencode "status=publish" --user "admin:$app_password"| jq '.id')
+
+ # Save the postId to the output.
+ echo "postId=$postId" >> $GITHUB_OUTPUT
+ id: create-post
+
+ # Only retrieve the post ID if running the first spec
+ - name: Save post ID to file
+ if: matrix.spec == 'alert.cypress.js' || matrix.spec == 'author.cypress.js'
+ run: |
+ path="$GITHUB_WORKSPACE/.dev/tests/cypress/fixtures/${{matrix.spec}}.json"
+ touch "$path"
+ echo "{\"${{matrix.spec}}\": \"$(echo "${{ steps.create-post.outputs.postId }}")\"}" > "$path"
+
+ - name: Run tests
+ run: |
+ CYPRESS_SPEC=$(find ./src/* -name ${{ matrix.spec }} -type f)
+ echo '{"wpUsername":"admin","wpPassword":"password","testURL":"http://localhost:8889"}' | jq . > cypress.env.json
+ ./node_modules/.bin/cypress verify
+ ./node_modules/.bin/cypress run --browser ${{ inputs.browser }} --spec $CYPRESS_SPEC
+
+ - name: Upload failure video
+ if: ${{ failure() }}
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ matrix.spec }}-fail.mp4
+ path: ./.dev/tests/cypress/videos/${{ matrix.spec }}.mp4
+ retention-days: 1
diff --git a/.github/workflows/test-wp-next.yml b/.github/workflows/test-wp-next.yml
index 67ad4505c14..c7741b9ca5c 100644
--- a/.github/workflows/test-wp-next.yml
+++ b/.github/workflows/test-wp-next.yml
@@ -31,6 +31,7 @@ jobs:
uses: ./.github/workflows/test-e2e-cypress.yml
with:
wpVersion: ${{needs.set_constant.outputs.wp_next}}
+ installPath: "tests-wordpress-6.4-RC1"
concurrency:
group: chrome-defaults
cancel-in-progress: true