Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into refactor/e2e-inserter-utility
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Dec 16, 2022
2 parents 8dd3806 + 47cb546 commit 4ddaff9
Show file tree
Hide file tree
Showing 310 changed files with 9,582 additions and 4,259 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const restrictedImports = [
'every',
'extend',
'filter',
'find',
'findIndex',
'findKey',
'findLast',
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/end2end-test-playwright.yml

This file was deleted.

97 changes: 94 additions & 3 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ concurrency:
cancel-in-progress: true

jobs:
admin:
name: Admin - ${{ matrix.part }}
e2e-puppeteer:
name: Puppeteer - ${{ matrix.part }}
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
Expand Down Expand Up @@ -60,6 +60,97 @@ jobs:
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report-${{ matrix.part }}
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

e2e-playwright:
name: Playwright
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
run: |
npm ci
npm run build
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Install WordPress and start the server
run: |
npm run wp-env start
- name: Run the tests
run: |
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- npm run test:e2e:playwright
- name: Archive debug artifacts (screenshots, traces)
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: failures-artifacts
path: artifacts/test-results
if-no-files-found: ignore

- name: Archive flaky tests report
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
if: always()
with:
name: flaky-tests-report
path: flaky-tests
if-no-files-found: ignore

report-to-issues:
name: Report to GitHub
needs: [e2e-puppeteer, e2e-playwright]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
# Checkout defaults to using the branch which triggered the event, which
# isn't necessarily `trunk` (e.g. in the case of a merge).
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
with:
ref: trunk

- uses: actions/download-artifact@v3
id: download_artifact
# Don't fail the job if there isn't any flaky tests report.
continue-on-error: true
with:
name: flaky-tests-report
path: flaky-tests

- name: Use desired version of NodeJS
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version-file: '.nvmrc'
cache: npm

- name: Npm install and build
if: ${{ steps.download_artifact.outcome == 'success' }}
# TODO: We don't have to build the entire project, just the action itself.
run: |
npm ci
npm run build:packages
- name: Report flaky tests
if: ${{ steps.download_artifact.outcome == 'success' }}
uses: ./packages/report-flaky-tests
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
label: '[Type] Flaky Test'
artifact-path: flaky-tests
38 changes: 0 additions & 38 deletions .github/workflows/flaky-tests.yml

This file was deleted.

16 changes: 16 additions & 0 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const config = require( '../config' );
* @property {number[]} firstContentfulPaint Represents the time when the browser first renders any text or media.
* @property {number[]} firstBlock Represents the time when Puppeteer first sees a block selector in the DOM.
* @property {number[]} type Average type time.
* @property {number[]} typeContainer Average type time within a container.
* @property {number[]} focus Average block selection time.
* @property {number[]} inserterOpen Average time to open global inserter.
* @property {number[]} inserterSearch Average time to search the inserter.
Expand All @@ -56,6 +57,9 @@ const config = require( '../config' );
* @property {number=} type Average type time.
* @property {number=} minType Minimum type time.
* @property {number=} maxType Maximum type time.
* @property {number=} typeContainer Average type time within a container.
* @property {number=} minTypeContainer Minimum type time within a container.
* @property {number=} maxTypeContainer Maximum type time within a container.
* @property {number=} focus Average block selection time.
* @property {number=} minFocus Min block selection time.
* @property {number=} maxFocus Max block selection time.
Expand Down Expand Up @@ -129,6 +133,9 @@ function curateResults( results ) {
type: average( results.type ),
minType: Math.min( ...results.type ),
maxType: Math.max( ...results.type ),
typeContainer: average( results.typeContainer ),
minTypeContainer: Math.min( ...results.typeContainer ),
maxTypeContainer: Math.max( ...results.typeContainer ),
focus: average( results.focus ),
minFocus: Math.min( ...results.focus ),
maxFocus: Math.max( ...results.focus ),
Expand Down Expand Up @@ -393,6 +400,15 @@ async function runPerformanceTests( branches, options ) {
type: rawResults.map( ( r ) => r[ branch ].type ),
minType: rawResults.map( ( r ) => r[ branch ].minType ),
maxType: rawResults.map( ( r ) => r[ branch ].maxType ),
typeContainer: rawResults.map(
( r ) => r[ branch ].typeContainer
),
minTypeContainer: rawResults.map(
( r ) => r[ branch ].minTypeContainer
),
maxTypeContainer: rawResults.map(
( r ) => r[ branch ].maxTypeContainer
),
focus: rawResults.map( ( r ) => r[ branch ].focus ),
minFocus: rawResults.map( ( r ) => r[ branch ].minFocus ),
maxFocus: rawResults.map( ( r ) => r[ branch ].maxFocus ),
Expand Down
Loading

1 comment on commit 4ddaff9

@github-actions
Copy link

@github-actions github-actions bot commented on 4ddaff9 Dec 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3713945766
📝 Reported issues:

Please sign in to comment.