Skip to content

Commit

Permalink
Merge pull request #1885 from Codeinwp/dev/migrate-performance
Browse files Browse the repository at this point in the history
[DEV] Migrate the performance test
  • Loading branch information
HardeepAsrani authored Nov 14, 2023
2 parents 6ce795d + 7c88a20 commit 60129ef
Show file tree
Hide file tree
Showing 24 changed files with 7,230 additions and 13,409 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/e2e-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test e2e for JS

on:
pull_request:
types: [ opened, synchronize, ready_for_review ]
types: [opened, synchronize, ready_for_review]
branches-ignore:
- "update_dependencies"

Expand Down Expand Up @@ -64,18 +64,15 @@ jobs:
- name: Playwright Blocks
run: |
npm run test:e2e:playwright
npm run test:e2e:playwright && echo "PLAYWRIGHT_SUCCESS=true" >> $GITHUB_ENV || echo "PLAYWRIGHT_SUCCESS=false" >> $GITHUB_EN
continue-on-error: true

# run the node.js puppeteer script (which takes the screenshots and controls chrome)
- name: Performance check
run: |
npm run test:e2e:performance
npm run test:performance
cat artifacts/post-editor.performance-results.json
- name: Block ID reliability
run: |
npm run test:e2e:blockId
- name: Upload video files
- name: Upload tests artifacts
if: always()
uses: actions/upload-artifact@v2
with:
Expand All @@ -85,27 +82,18 @@ jobs:

- name: Print the results
run: |
echo "::set-output name=TYPING_AVG::$(jq '.summary.type.average' ./artifacts/performance.spec.performance-results.json)"
echo "::set-output name=TYPING_SD::$(jq '.summary.type.standardDeviation' ./artifacts/performance.spec.performance-results.json)"
echo "::set-output name=TYPING_MD::$(jq '.summary.type.median' ./artifacts/performance.spec.performance-results.json)"
echo "::set-output name=TYPING_QR60::$(jq '.summary.type.quantileRank60' ./artifacts/performance.spec.performance-results.json)"
echo "::set-output name=TYPING_ABOVE_60::$(jq -c '.summary.type.above60' ./artifacts/performance.spec.performance-results.json)"
echo "::set-output name=TYPING_QR80::$(jq '.summary.type.quantileRank80' ./artifacts/performance.spec.performance-results.json)"
RESULTS=$(jq -r 'to_entries|map("\(.key): \(.value)")|join(", ")' artifacts/post-editor.performance-results.json)
FLAKY_TEST_STATUS="Playwright Test Status: $PLAYWRIGHT_SUCCESS"
echo "::set-output name=PERFORMANCE_OUTPUT::$RESULTS"
echo "::set-output name=FLAKY_TEST_STATUS::$FLAKY_TEST_STATUS"
id: summary

- name: Comment
uses: NejcZdovc/comment-pr@v1
uses: NejcZdovc/comment-pr@v2
with:
file: 'e2e-summary.md'
file: "e2e-summary.md"
identifier: "GITHUB_E2E_SUMMARY"
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
TYPING_AVG: ${{ steps.summary.outputs.TYPING_AVG }}
TYPING_SD: ${{ steps.summary.outputs.TYPING_SD }}
TYPING_MD: ${{ steps.summary.outputs.TYPING_MD }}
TYPING_QR60: ${{ steps.summary.outputs.TYPING_QR60 }}
TYPING_QR80: ${{ steps.summary.outputs.TYPING_QR80 }}
TYPING_ABOVE_60: ${{ steps.summary.outputs.TYPING_ABOVE_60 }}



PERFORMANCE_OUTPUT: ${{ steps.summary.outputs.PERFORMANCE_OUTPUT }}
FLAKY_TEST_STATUS: ${{ steps.summary.outputs.FLAKY_TEST_STATUS }}
14 changes: 5 additions & 9 deletions .github/workflows/e2e-summary.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
## E2E Summary
## E2E Tests

### Typing

| Test | Average Time (ms) | Standard Deviation (ms) | Median Time (ms) | Quantile for soft limit (%) | Quantile for hard limit (%) |
| -----: | :---------------: | :---------------------: | :---------------: | :-------------------: | :-------------------: |
| Typing | {TYPING_AVG} | {TYPING_SD} | {TYPING_MD} | {TYPING_QR60} (60ms) | {TYPING_QR80} (80ms) |
{FLAKY_TEST_STATUS}

<details>
<summary>Values above 60ms</summary>
{TYPING_ABOVE_60}
</details>
<summary>Performance Results</summary>
{PERFORMANCE_OUTPUT}
</details>
9 changes: 6 additions & 3 deletions .wp-env.override.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
"plugins": [
"."
],
"themes": [ "./test/emptytheme" ],
"mappings": {
"wp-content/mu-plugins": "./node_modules/@wordpress/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "./node_modules/@wordpress/e2e-tests/plugins",
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip"
"wp-content/mu-plugins": "./packages/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "./packages/e2e-tests/plugins",
"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip"
}
}
}
Expand Down
Loading

0 comments on commit 60129ef

Please sign in to comment.