Skip to content

Commit

Permalink
fix: Include run.stats.skipped in results (#27695)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Schile <mschile@cypress.io>
  • Loading branch information
chrisbreiding and mschile committed Aug 30, 2023
1 parent 05afa1e commit cbf266c
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 20 deletions.
6 changes: 5 additions & 1 deletion cli/CHANGELOG.md
Expand Up @@ -5,7 +5,11 @@ _Released 09/12/2023 (PENDING)_

**Features:**

- Introduce a status icon representing the `latest` test run in the Sidebar for the Runs Page. Addresses [#27206](https://github.com/cypress-io/cypress/issues/27206).
- Introduces a status icon representing the `latest` test run in the Sidebar for the Runs Page. Addresses [#27206](https://github.com/cypress-io/cypress/issues/27206).

**Bugfixes:**

- Fixed a regression introduced in Cypress [13.0.0](#13-0-0) where the [Module API](https://docs.cypress.io/guides/guides/module-api), [`after:run`](https://docs.cypress.io/api/plugins/after-run-api), and [`after:spec`](https://docs.cypress.io/api/plugins/after-spec-api) results did not include the `stats.skipped` field for each run result. Fixes [#27694](https://github.com/cypress-io/cypress/issues/27694). Addressed in [#27695](https://github.com/cypress-io/cypress/pull/27695).

## 13.0.0

Expand Down
1 change: 1 addition & 0 deletions cli/types/cypress-npm-api.d.ts
Expand Up @@ -246,6 +246,7 @@ declare namespace CypressCommandLine {
failures: number
passes: number
pending: number
skipped: number
startedAt: dateTimeISO
suites: number
tests: number
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/cypress/e2e/e2e/dom_hitbox.cy.js
Expand Up @@ -84,7 +84,7 @@ describe('rect highlight', { browser: '!webkit' }, () => {
})

const ensureCorrectTargetPosition = (sel) => {
return cy.wrap(null, { timeout: 400 }).should(() => {
return cy.wrap(null, { timeout: 4000 }).should(() => {
const target = cy.$$('div[data-highlight-hitbox]')[0].getBoundingClientRect()

const dims = {
Expand All @@ -101,7 +101,7 @@ const ensureCorrectTargetPosition = (sel) => {
}

const ensureCorrectHighlightPositions = (sel) => {
return cy.wrap(null, { timeout: 400 }).should(() => {
return cy.wrap(null, { timeout: 4000 }).should(() => {
const els = {
content: cy.$$('div[data-layer=Content]'),
padding: cy.$$('div[data-layer=Padding]'),
Expand Down
1 change: 1 addition & 0 deletions packages/server/lib/modes/results.ts
Expand Up @@ -134,6 +134,7 @@ const createPublicRun = (run: RunResult): CypressCommandLine.RunResult => ({
failures: run.stats.failures,
passes: run.stats.passes,
pending: run.stats.pending,
skipped: run.stats.skipped,
startedAt: run.stats.wallClockStartedAt,
suites: run.stats.suites,
tests: run.stats.tests,
Expand Down
109 changes: 93 additions & 16 deletions system-tests/__snapshots__/results_spec.ts.js
Expand Up @@ -153,6 +153,7 @@ exports['module api and after:run results'] = `
"failures": 1,
"passes": 2,
"pending": 0,
"skipped": 0,
"startedAt": "2015-03-18T00:00:00.000Z",
"suites": 1,
"tests": 3
Expand Down Expand Up @@ -210,11 +211,11 @@ exports['module api and after:run results'] = `
"error": null,
"reporter": "spec",
"reporterStats": {
"suites": 1,
"tests": 2,
"suites": 2,
"tests": 4,
"passes": 1,
"pending": 0,
"failures": 1,
"failures": 2,
"start": "2015-03-18T00:00:00.000Z",
"end": "2015-03-18T00:00:00.000Z",
"duration": 100
Expand Down Expand Up @@ -254,6 +255,13 @@ exports['module api and after:run results'] = `
"path": "/path/to/path",
"takenAt": "2015-03-18T00:00:00.000Z",
"width": 1000
},
{
"height": 720,
"name": null,
"path": "/path/to/path",
"takenAt": "2015-03-18T00:00:00.000Z",
"width": 1280
}
],
"spec": {
Expand All @@ -266,12 +274,13 @@ exports['module api and after:run results'] = `
"stats": {
"duration": 100,
"endedAt": "2015-03-18T00:00:00.000Z",
"failures": 1,
"failures": 2,
"passes": 1,
"pending": 0,
"skipped": 1,
"startedAt": "2015-03-18T00:00:00.000Z",
"suites": 1,
"tests": 2
"suites": 2,
"tests": 4
},
"tests": [
{
Expand Down Expand Up @@ -304,19 +313,49 @@ exports['module api and after:run results'] = `
"results spec 1",
"test 2"
]
},
{
"attempts": [
{
"state": "failed"
}
],
"displayError": ""Error: failure in beforeEach\\n\\nBecause this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`has skipped tests\`\\n <stack lines>"
"duration": 100,
"state": "failed",
"title": [
"results spec 1",
"has skipped tests",
"will be skipped #1"
]
},
{
"attempts": [
{
"state": "skipped"
}
],
"displayError": null,
"duration": 100,
"state": "skipped",
"title": [
"results spec 1",
"has skipped tests",
"will be skipped #2"
]
}
],
"video": null
}
],
"startedTestsAt": "2015-03-18T00:00:00.000Z",
"totalDuration": 100,
"totalFailed": 2,
"totalFailed": 3,
"totalPassed": 3,
"totalPending": 0,
"totalSkipped": 0,
"totalSuites": 2,
"totalTests": 5
"totalSkipped": 1,
"totalSuites": 3,
"totalTests": 7
}
`

Expand All @@ -333,11 +372,11 @@ exports['after:spec results'] = `
"error": null,
"reporter": "spec",
"reporterStats": {
"suites": 1,
"tests": 2,
"suites": 2,
"tests": 4,
"passes": 1,
"pending": 0,
"failures": 1,
"failures": 2,
"start": "2015-03-18T00:00:00.000Z",
"end": "2015-03-18T00:00:00.000Z",
"duration": 100
Expand Down Expand Up @@ -377,6 +416,13 @@ exports['after:spec results'] = `
"path": "/path/to/path",
"takenAt": "2015-03-18T00:00:00.000Z",
"width": 1000
},
{
"height": 720,
"name": null,
"path": "/path/to/path",
"takenAt": "2015-03-18T00:00:00.000Z",
"width": 1280
}
],
"spec": {
Expand All @@ -389,12 +435,13 @@ exports['after:spec results'] = `
"stats": {
"duration": 100,
"endedAt": "2015-03-18T00:00:00.000Z",
"failures": 1,
"failures": 2,
"passes": 1,
"pending": 0,
"skipped": 1,
"startedAt": "2015-03-18T00:00:00.000Z",
"suites": 1,
"tests": 2
"suites": 2,
"tests": 4
},
"tests": [
{
Expand Down Expand Up @@ -427,6 +474,36 @@ exports['after:spec results'] = `
"results spec 1",
"test 2"
]
},
{
"attempts": [
{
"state": "failed"
}
],
"displayError": ""Error: failure in beforeEach\\n\\nBecause this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`has skipped tests\`\\n <stack lines>"
"duration": 100,
"state": "failed",
"title": [
"results spec 1",
"has skipped tests",
"will be skipped #1"
]
},
{
"attempts": [
{
"state": "skipped"
}
],
"displayError": null,
"duration": 100,
"state": "skipped",
"title": [
"results spec 1",
"has skipped tests",
"will be skipped #2"
]
}
],
"video": null
Expand Down
9 changes: 9 additions & 0 deletions system-tests/projects/results/cypress/e2e/spec-2.cy.js
Expand Up @@ -17,4 +17,13 @@ describe('results spec 1', () => {
cy.log('test 2')
cy.screenshot('test 2 screenshot')
})

describe('has skipped tests', { retries: 0 }, () => {
beforeEach(() => {
throw new Error('failure in beforeEach')
})

it('will be skipped #1', () => {})
it('will be skipped #2', () => {})
})
})
2 changes: 1 addition & 1 deletion system-tests/test/results_spec.ts
Expand Up @@ -46,7 +46,7 @@ describe('module api, after:spec, and after:run results', () => {
project: 'results',
browser: 'electron',
outputPath,
expectedExitCode: 2,
expectedExitCode: 3,
config: {
retries: 2,
},
Expand Down

4 comments on commit cbf266c

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cbf266c Aug 30, 2023

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.1.0/linux-x64/develop-cbf266c05eb1e5e88d5432ebc131b3743174aaed/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cbf266c Aug 30, 2023

Choose a reason for hiding this comment

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

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.1.0/linux-arm64/develop-cbf266c05eb1e5e88d5432ebc131b3743174aaed/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cbf266c Aug 30, 2023

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.1.0/darwin-x64/develop-cbf266c05eb1e5e88d5432ebc131b3743174aaed/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on cbf266c Aug 30, 2023

Choose a reason for hiding this comment

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

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.1.0/win32-x64/develop-cbf266c05eb1e5e88d5432ebc131b3743174aaed/cypress.tgz

Please sign in to comment.