diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0db93d8e1cd6..656331b77e6d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: build-plugin: name: Build plugin runs-on: ubuntu-22.04 - if: startsWith( github.repository, 'elementor/' ) +# if: startsWith( github.repository, 'elementor/' ) outputs: artifact_name: ${{ env.PLUGIN_FOLDER_FILENAME}} changelog_diff: ${{ steps.changelog_diff_files.outputs.diff }} diff --git a/.github/workflows/playwright-wp-now-new.yml b/.github/workflows/playwright-wp-now-new.yml new file mode 100644 index 000000000000..ea1d49731a44 --- /dev/null +++ b/.github/workflows/playwright-wp-now-new.yml @@ -0,0 +1,203 @@ +name: Playwright wp-now new + +on: + pull_request: + paths-ignore: + - '**.md' + - '**.txt' + - '.github/config.json' + - 'bin/**' + - '.gitignore' + - 'docs/**' + workflow_dispatch: + inputs: + reporter: + required: false + description: 'Select a reporter' + type: choice + options: + - allure-playwright + - html + - blob + - list + default: allure-playwright + path-to-results: + required: false + description: 'Provide path to reporter files' + default: allure-results + type: choice + options: + - test-results/ + - tests/playwright/blob-report + - allure-results + fail_fast: + type: boolean + required: true + description: 'Cancel tests when one of them fails' + default: false + tag: + description: 'Provide @tag or a keyword' + required: false + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +jobs: + build-plugin: + name: Build plugin + uses: ./.github/workflows/build.yml + Playwright: + name: Playwright test - ${{ matrix.shardIndex }} on PHP 8.0 + runs-on: ubuntu-latest + needs: [build-plugin] + if: ${{ ( github.event.pull_request.title == null || needs.build-plugin.outputs.changelog_diff ) && github.event.inputs.tag == '' }} + strategy: + fail-fast: ${{ inputs.fail_fast || false }} + matrix: + shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] + shardTotal: [ 10 ] + include: + - shardIndex: "elements-regression" + steps: + - name: Checkout source code + uses: actions/checkout@v4 + - name: Install Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + - name: Install dependencies + run: | + composer install + npm ci + sed -i -e "s/image: 'mariadb:lts'/image: 'mariadb:11.2.4-jammy'/g" node_modules/@wordpress/env/lib/build-docker-compose-config.js + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build-plugin.outputs.artifact_name }} + path: ./build +# - name: Update wp-env.json file +# env: +# PHP_VERSION: '8.0' +# WP_CORE_VERSION: 'latest' +# run: node ./.github/scripts/build-wp-env.js +# - name: Install WordPress environment +# run: | +# npm run start-local-server +# - name: Update wordpress to nightly build +# if: ${{ github.event_name == 'schedule' }} +# run: npx wp-env run cli wp core update https://wordpress.org/nightly-builds/wordpress-latest.zip +# - name: Setup test data +# run: npm run test:setup:playwright +# - name: WordPress debug information +# run: | +# npx wp-env run cli wp core version +# npx wp-env run cli wp --info + - name: Install WordPress environment 8888 + run: | + npx wp-now start --php=8.0 --port=8888 --blueprint=./blueprint.json & + - name: Install WordPress environment 8889 + run: | + npx wp-now start --php=8.0 --port=8889 --blueprint=./blueprint.json & + - name: Install playwright/test + run: | + npx playwright install chromium + - name: Run Playwright tests + if: ${{ matrix.shardIndex != 'elements-regression' }} + run: npm run test:playwright -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=${{ inputs.reporter || 'list,github' }} + - name: Run element regression tests + if: ${{ matrix.shardIndex == 'elements-regression' }} + run: npm run test:playwright:elements-regression -- --reporter=${{ inputs.reporter || 'list,github' }} + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-test-results-${{ matrix.shardIndex }} + path: ${{ inputs.path-to-results || 'test-results/' }} + if-no-files-found: ignore + retention-days: 2 + PlaywrightWithTag: + name: Playwright test - tagged tests on PHP 8.0 + runs-on: ubuntu-latest + needs: [ build-plugin ] + if: ${{ github.event.inputs.tag }} + steps: + - name: Checkout source code + uses: actions/checkout@v4 + - name: Install Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + - name: Install dependencies + run: | + npm ci + sed -i -e "s/image: 'mariadb:lts'/image: 'mariadb:11.2.4-jammy'/g" node_modules/@wordpress/env/lib/build-docker-compose-config.js + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build-plugin.outputs.artifact_name }} + path: ./build + - name: Update wp-env.json file + env: + PHP_VERSION: '8.0' + WP_CORE_VERSION: 'latest' + run: node ./.github/scripts/build-wp-env.js + - name: Install WordPress environment + run: | + npm run start-local-server + - name: Setup test data + run: npm run test:setup:playwright + - name: WordPress debug information + run: | + npx wp-env run cli wp core version + npx wp-env run cli wp --info + - name: Install playwright/test + run: | + npx playwright install chromium + - name: Run Playwright tests + run: | + npm run test:playwright -- --grep="${{ inputs.tag }}" --reporter=list,allure-playwright + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-test-results-tagged-tests + path: ${{ inputs.path-to-results || 'test-results/' }} + if-no-files-found: ignore + retention-days: 2 + + + test-result: + needs: Playwright + if: ${{ always() }} # Will be run even if 'Playwright' matrix will be skipped + runs-on: ubuntu-22.04 + name: Playwright - Test Results + steps: + - name: Test status + run: echo "Test status is - ${{ needs.Playwright.result }}" + - name: Checkout source code + if: ${{ needs.Playwright.result == 'failure' && github.event_name == 'schedule' }} + uses: actions/checkout@v4 +# - name: Send slack message +# if: ${{ needs.Playwright.result == 'failure' && github.event_name == 'schedule' }} +# uses: ./.github/workflows/post-to-slack +# with: +# SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }} +# SLACK_TAG_CHANNELS: ${{ secrets.TEST_AUTOMATION_RESULTS }} +# PAYLOAD: | +# { +# "text": "Elementor Core: Playwright with WordPress nightly has failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", +# "blocks": [ +# { +# "type": "section", +# "text": { +# "type": "mrkdwn", +# "text": "Elementor Core: Playwright with WordPress nightly failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" +# } +# } +# ] +# } +# - name: Check Playwright matrix status +# if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }} +# run: exit 1 diff --git a/.github/workflows/pwwpnow.yml b/.github/workflows/pwwpnow.yml index ec626a1b5c43..15a79c695a4f 100644 --- a/.github/workflows/pwwpnow.yml +++ b/.github/workflows/pwwpnow.yml @@ -36,10 +36,10 @@ jobs: .*/**/* !readme.txt !changelog.txt - - name: Install Node.js 18.x + - name: Install Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: 20.x - name: Restore NPM Cache uses: actions/cache/restore@v3 with: @@ -47,7 +47,9 @@ jobs: key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} - name: Install dependencies # if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff - run: npm i + run: | + npm i + composer install - name: Build # if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff run: npx grunt build @@ -113,22 +115,22 @@ jobs: # chmod +x wp-cli.phar # sudo mv wp-cli.phar /usr/local/bin/wp - name: Install dependencies - run: npm i + run: | + composer install + npm i - name: Install WordPress environment run: | npx wp-now start --php=8.0 --port=8888 --blueprint=./blueprint.json & - - name: WP Cli check - run: | - wp --info - wp plugin list - wp theme activate hello-elementor - - - name: Run wp-now CLI commands - run: | - wp-now cli "wp elementor experiments activate e_optimized_css_loading" +# - name: WP Cli check +# run: | +# wp --info +# wp plugin list +# wp theme activate hello-elementor +# - name: Run wp-now CLI commands +# run: | +# wp-now cli "wp elementor experiments activate e_optimized_css_loading" - name: Install playwright/test run: | - npm run test:setup:playwright npx playwright install chromium - name: Run Playwright tests env: diff --git a/blueprint.json b/blueprint.json index 7e0c07f7b783..ccf8003af074 100644 --- a/blueprint.json +++ b/blueprint.json @@ -27,7 +27,7 @@ { "step": "activatePlugin", "pluginName": "elementor", - "pluginPath": ".elementor/build/" + "pluginPath": "elementor/build/" }, { "step": "login", diff --git a/package-lock.json b/package-lock.json index 3ca96f4c31f6..eeaa757a7f3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "@wordpress/data": "^10.5.0", "@wordpress/dom-ready": "^3.45.0", "@wordpress/element": "^5.22.0", - "@wp-now/wp-now": "^0.1.72", + "@wp-now/wp-now": "^0.1.74", "acorn": "^8.7.1", "core-js": "^3.24.1", "dompurify": "^3.1.3", diff --git a/package.json b/package.json index e7fe360af7e6..b71f6e0af84a 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "@wordpress/data": "^10.5.0", "@wordpress/dom-ready": "^3.45.0", "@wordpress/element": "^5.22.0", - "@wp-now/wp-now": "^0.1.72", + "@wp-now/wp-now": "^0.1.74", "acorn": "^8.7.1", "core-js": "^3.24.1", "dompurify": "^3.1.3",