From 323a331f3d5932a587964c7e1587c435e327e714 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Fri, 27 Aug 2021 12:43:37 +0300 Subject: [PATCH] E2E tests: run against atomic test site (#20807) * * Add config for atomic test site * Always login in wpcom in e2e tests relevant for atomic * Github workflow for e2e tests on atomic * Add changelog * Add push event for testing * Add missing workflow step * Add empty browserlist to fix babel error * Install Jetpack CLI * Merge install steps * Temporary skipping wordads test on atomic run * Disable push trigger --- .github/workflows/e2e-tests-atomic.yml | 168 ++++++++++++++++++ .../jetpack/changelog/e2e-atomic-e2e-ci | 4 + .../jetpack/tests/e2e/config/encrypted.enc | Bin 1120 -> 1216 bytes .../plugins/jetpack/tests/e2e/package.json | 3 +- .../tests/e2e/specs/free-blocks.test.js | 1 + .../tests/e2e/specs/pro-blocks.test.js | 2 +- 6 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/e2e-tests-atomic.yml create mode 100644 projects/plugins/jetpack/changelog/e2e-atomic-e2e-ci diff --git a/.github/workflows/e2e-tests-atomic.yml b/.github/workflows/e2e-tests-atomic.yml new file mode 100644 index 0000000000000..f6c09714f0f98 --- /dev/null +++ b/.github/workflows/e2e-tests-atomic.yml @@ -0,0 +1,168 @@ +name: E2E Tests on Atomic sites + +on: + schedule: + - cron: '0 */4 * * *' + +jobs: + e2e-tests: + name: "E2E tests" + runs-on: ubuntu-latest + timeout-minutes: 25 + + steps: + - uses: actions/checkout@v2 + + - name: Read tool versions + id: versions + uses: ./.github/actions/read-versions + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.versions.outputs.node-version }} + + - name: Use pnpm cache + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ steps.versions.outputs.node-version }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-pnpm-${{ steps.versions.outputs.node-version }}- + + - name: Setup pnpm + uses: pnpm/action-setup@v2.0.1 + with: + version: ${{ steps.versions.outputs.pnpm-version }} + + - name: Tool versions + run: | + which node + node --version + which pnpm + pnpm --version + which jq + jq --version + + - name: Install + working-directory: projects/plugins/jetpack/tests/e2e + env: + CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }} + run: | + pnpm install --dir ../../../../tools/cli + pnpm install + pnpm run test-decrypt-config + + - name: Run tests + working-directory: projects/plugins/jetpack/tests/e2e + env: + TEST_SITE: atomic + run: pnpm run test-e2e -- --group=atomic + + - name: Upload test artifacts + if: ${{ always() }} + continue-on-error: true + uses: actions/upload-artifact@v2 + with: + name: test-output-${{ matrix.group }} + path: projects/plugins/jetpack/tests/e2e/output + + - name: Send Slack notification + if: ${{ failure() }} + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + working-directory: projects/plugins/jetpack/tests/e2e + run: NODE_ENV=test node ./bin/slack.js run atomic + + - uses: testspace-com/setup-testspace@v1 + with: + domain: ${{github.repository_owner}} + if: always() + - name: Publish to Testspace + working-directory: projects/plugins/jetpack/tests/e2e + run: | + testspace "[${GROUP}]output/reports/junit-*.xml" + if: always() + + slack-notification: + name: "Slack notification" + runs-on: ubuntu-latest + needs: e2e-tests + env: + CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }} + GITHUB_CONTEXT: ${{ toJson(github) }} + + steps: + - uses: actions/checkout@v2 + + - name: Read tool versions + id: versions + uses: ./.github/actions/read-versions + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.versions.outputs.node-version }} + + - name: Use pnpm cache + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ steps.versions.outputs.node-version }}-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-pnpm-${{ steps.versions.outputs.node-version }}- + + - name: Setup pnpm + uses: pnpm/action-setup@v2.0.1 + with: + version: ${{ steps.versions.outputs.pnpm-version }} + + - name: Tool versions + run: | + which node + node --version + which pnpm + pnpm --version + + - name: Send Slack notification + working-directory: projects/plugins/jetpack/tests/e2e + env: + RESULT: ${{ needs.e2e-tests.result }} + run: | + pnpm install + pnpm run test-decrypt-config + NODE_ENV=test node ./bin/slack.js job $RESULT + + test-reports: + name: "Trigger test report workflow" + runs-on: ubuntu-latest + if: ${{ ! cancelled() }} + needs: e2e-tests + + steps: + - name: Trigger test report workflow + env: + TOKEN: ${{ secrets.E2E_TEST_REPORTS_TOKEN }} + PR_TITLE: ${{ github.event.pull_request.title }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + if [ "$GITHUB_EVENT_NAME" == pull_request ]; then + BRANCH=$GITHUB_HEAD_REF + EVENT_NAME="$PR_NUMBER: $PR_TITLE" + else + BRANCH=${GITHUB_REF:11} + EVENT_NAME="Run $GITHUB_RUN_ID" + fi + + curl -X POST https://api.github.com/repos/automattic/jetpack-e2e-reports/dispatches \ + -H "Accept: application/vnd.github.v3+json" \ + -u "user:$TOKEN" \ + --data "{\"event_type\": \"$EVENT_NAME\", + \"client_payload\": { + \"repository\": \"$GITHUB_REPOSITORY\", + \"run_id\": \"$GITHUB_RUN_ID\", + \"run_number\": \"$GITHUB_RUN_NUMBER\", + \"branch\": \"$BRANCH\", + \"pr_title\": \"$PR_TITLE\", + \"pr_number\": \"$PR_NUMBER\" + }}" diff --git a/projects/plugins/jetpack/changelog/e2e-atomic-e2e-ci b/projects/plugins/jetpack/changelog/e2e-atomic-e2e-ci new file mode 100644 index 0000000000000..ac73b0c889f43 --- /dev/null +++ b/projects/plugins/jetpack/changelog/e2e-atomic-e2e-ci @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +E2E tests: scheduled test runs on atomic test site diff --git a/projects/plugins/jetpack/tests/e2e/config/encrypted.enc b/projects/plugins/jetpack/tests/e2e/config/encrypted.enc index b93df0e573aa2e1f6e7f08fb27858fdd6cf5fec0..b9d191acec06dff7d05b207ed880ebed543137e6 100644 GIT binary patch literal 1216 zcmV;x1V8&zVQh3|WM5yOkc1zBNaWyek9f&@wdd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c=pQ(8IQhuL($Kt=(yq?Q)JA~O9X0l0 zggNS-@;gHwE8JfS!Muw07ja3!QL#U^H#xW)O9llX_h9_{y*0cj557v$rWdpUjr#RE z8j9~SyWS6}BHWxrAclwLT+eR+RS2J{z4ywjYP-5AV3b8Gwk4RO&P)akp5g$= zuqTF|+3B1tIET2c(IT4|jxy^rIG~SR6;HUBV@qBc^`-(#B%26q@6`@n#1~>n2}-%~ z0Zz?nf2{V*S}8}0cgsiwv$-vIYw?ys&B|G)c5C&Yt=eYPec-BsiJ)gO=RoQ~%JcK+ zY)k@JYJJvxbZ%V1fL9F2VN=n|yM_km5+~`= z6xmcFKN0?v(p)qQTdPZzbqPDfUz>Z+pxo%0^?4oflZ8N&TtqtLD;{M=1soM$Zrn&w z{Qd~G4EQryun*u^o8-q|mcVj%^8LTiL~JB9HK32Zs@Zvz=f3>Geanv_ATkSw__a+_ z1dh0Kv^HG2771R$XGg*GL9}>$icdl0R&K^)Tifqn0&Vg`Dc@ruKrS56+Ps6^Jzgc7 z2>X>UDN;-Mq#KX_|U~`{7C~TO7r0?h}2hp&uFnQwJRwOkKgXG zn;Wb@PLplu#lskbLkq5}%_0eN)z!61I?KyM=ANn6Pc;%$-10@A>3k_S1DXn>xiTSz z=BGH5R%N6>%8yAQ;tXeZp=@!k6bxVLWH}57q0a~YHo{5!e<@`aMp*u0$vK*a0x&BwxP|?^E+n-l558Zidfej`4+0+f zo;lF91x*lVnWoP@VA49lm_^o0pwu}mb{3(+Is# { beforeAll( async () => { await prerequisitesBuilder() + .withWpComLoggedIn( true ) .withLoggedIn( true ) .withConnection( true ) .withPlan( Plans.Free ) diff --git a/projects/plugins/jetpack/tests/e2e/specs/pro-blocks.test.js b/projects/plugins/jetpack/tests/e2e/specs/pro-blocks.test.js index 25c2ab73e0a3c..05a4e539a4a4c 100644 --- a/projects/plugins/jetpack/tests/e2e/specs/pro-blocks.test.js +++ b/projects/plugins/jetpack/tests/e2e/specs/pro-blocks.test.js @@ -20,8 +20,8 @@ describe( 'Paid blocks', () => { beforeAll( async () => { await prerequisitesBuilder() - .withLoggedIn( true ) .withWpComLoggedIn( true ) + .withLoggedIn( true ) .withConnection( true ) .withPlan( Plans.Complete ) .withActiveModules( [ 'publicize' ] )