Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable flaky tests reporter bot in PRs #35029

Merged
merged 2 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/contributors/code/testing-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ See [Chrome docs: emulateNetworkConditions](https://chromedevtools.github.io/dev

Every core block is required to have at least one set of fixture files for its main save function and one for each deprecation. These fixtures test the parsing and serialization of the block. See [the integration tests fixtures readme](https://github.com/wordpress/gutenberg/blob/HEAD/test/integration/fixtures/blocks/README.md) for more information and instructions.

### Flaky Tests

A test is considered to be **flaky** when it can pass and fail across multiple retry attempts without any code changes. We auto retry failed tests at most **twice** on CI to detect and report them to GitHub issues automatically under the [`[Type] Flaky Test`](https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22%5BType%5D+Flaky+Test%22) label via [`report-flaky-tests`](https://github.com/WordPress/gutenberg/blob/trunk/.github/report-flaky-tests/index.js) GitHub action. Note that a test that failed three times in a row is not counted as a flaky test and will not be reported to an issue.

## PHP Testing

Tests for PHP use [PHPUnit](https://phpunit.de/) as the testing framework. If you're using the built-in [local environment](/docs/contributors/code/getting-started-with-code-contribution.md#local-environment), you can run the PHP tests locally using this command:
Expand Down
3 changes: 1 addition & 2 deletions packages/e2e-tests/config/setup-test-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ jest.setTimeout( PUPPETEER_TIMEOUT || 100000 );
// Retry failed tests at most 2 times in CI.
// This enables `flaky-tests-reporter` and `report-flaky-tests` GitHub action
// to mark test as flaky and automatically create a tracking issue about it.
// Currently it will only run on trunk but will roll out to all PRs when mature.
if ( process.env.CI && process.env.GITHUB_EVENT_NAME !== 'pull_request' ) {
if ( process.env.CI ) {
jest.retryTimes( 2 );
}

Expand Down
5 changes: 1 addition & 4 deletions packages/e2e-tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ module.exports = {
reporters: [
...baseConfig.reporters,
// Report flaky tests results into artifacts for used in `report-flaky-tests` action.
// Currently it will only run on trunk but will roll out to all PRs when mature.
process.env.CI &&
process.env.GITHUB_EVENT_NAME !== 'pull_request' &&
'<rootDir>/config/flaky-tests-reporter.js',
process.env.CI && '<rootDir>/config/flaky-tests-reporter.js',
].filter( Boolean ),
};