Skip to content

Commit

Permalink
feat: Improve CLOUD_PARALLEL_GROUP_PARAMS_MISMATCH error message (#24799
Browse files Browse the repository at this point in the history
)

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
  • Loading branch information
estrada9166 and emilyrohrbough authored Dec 12, 2022
1 parent eb76b57 commit 7154fc8
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 7 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 32 additions & 2 deletions packages/errors/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,37 @@ export const AllCypressErrors = {
https://on.cypress.io/parallel-disallowed`
},
CLOUD_PARALLEL_GROUP_PARAMS_MISMATCH: (arg1: {runUrl: string, parameters: any}) => {
CLOUD_PARALLEL_GROUP_PARAMS_MISMATCH: (arg1: {runUrl: string, parameters: any, payload: any }) => {
let params: any = arg1.parameters

if (arg1.payload?.differentParams) {
params = {}

_.map(arg1.parameters, (value, key) => {
if (key === 'specs' && arg1.payload.differentSpecs?.length) {
const addedSpecs: string[] = []
const missingSpecs: string[] = []

_.forEach(arg1.payload.differentSpecs, (s) => {
if (value.includes(s)) {
addedSpecs.push(s)
} else {
missingSpecs.push(s)
}
})

params['differentSpecs'] = {
added: addedSpecs,
missing: missingSpecs,
}
} else if (arg1.payload.differentParams[key]?.expected) {
params[key] = `${value}.... (Expected: ${(arg1.payload.differentParams[key].expected)})`
} else {
params[key] = value
}
})
}

return errTemplate`\
You passed the ${fmt.flag(`--parallel`)} flag, but we do not parallelize tests across different environments.
Expand All @@ -299,7 +329,7 @@ export const AllCypressErrors = {
This machine sent the following parameters:
${fmt.meta(arg1.parameters)}
${fmt.meta(params)}
https://on.cypress.io/parallel-group-params-mismatch`
},
Expand Down
34 changes: 34 additions & 0 deletions packages/errors/test/unit/visualSnapshotErrors_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,40 @@ describe('visual error templates', () => {
'cypress/integration/app_spec.js',
],
},
payload: {},
},
],
differentParams: [
{
group: 'foo',
runUrl: 'https://cloud.cypress.io/project/abcd/runs/1',
ciBuildId: 'test-ciBuildId-123',
parameters: {
osName: 'darwin',
osVersion: 'v1',
browserName: 'Electron',
browserVersion: '59.1.2.3',
specs: [
'cypress/integration/app_spec.js',
'cypress/integration/foo_spec.js',
'cypress/integration/bar_spec.js',
],
},
payload: {
differentParams: {
browserName: {
detected: 'Chrome',
expected: 'Electron',
},
browserVersion: {
detected: '65',
expected: '64',
},
},
differentSpecs: [
'cypress/integration/foo_spec.js',
],
},
},
],
}
Expand Down
13 changes: 8 additions & 5 deletions packages/server/__snapshots__/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,14 @@ This machine sent the following parameters:
{
"osName": "darwin",
"osVersion": "v1",
"browserName": "Electron",
"browserVersion": "59.1.2.3",
"specs": [
"cypress/e2e/app.cy.js"
]
"browserName": "Electron.... (Expected: Electron)",
"browserVersion": "59.1.2.3.... (Expected: 64)",
"differentSpecs": {
"added": [],
"missing": [
"cypress/integration/foo_spec.js"
]
}
}
https://on.cypress.io/parallel-group-params-mismatch
Expand Down
1 change: 1 addition & 0 deletions packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ const createRun = Promise.method((options = {}) => {
browserVersion,
specs,
},
payload,
})
}
case 'PARALLEL_DISALLOWED':
Expand Down
13 changes: 13 additions & 0 deletions packages/server/test/integration/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,19 @@ describe('lib/cypress', () => {
code: 'PARALLEL_GROUP_PARAMS_MISMATCH',
payload: {
runUrl: 'https://cloud.cypress.io/runs/12345',
differentParams: {
browserName: {
detected: 'Chrome',
expected: 'Electron',
},
browserVersion: {
detected: '65',
expected: '64',
},
},
differentSpecs: [
'cypress/integration/foo_spec.js',
],
},
}

Expand Down

5 comments on commit 7154fc8

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7154fc8 Dec 12, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.1.0/linux-arm64/develop-7154fc8dcd7abbef7feb0c0fdacaef31174bc672/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7154fc8 Dec 12, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.1.0/linux-x64/develop-7154fc8dcd7abbef7feb0c0fdacaef31174bc672/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7154fc8 Dec 12, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.1.0/darwin-x64/develop-7154fc8dcd7abbef7feb0c0fdacaef31174bc672/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7154fc8 Dec 12, 2022

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 platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.1.0/win32-x64/develop-7154fc8dcd7abbef7feb0c0fdacaef31174bc672/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 7154fc8 Dec 12, 2022

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 arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.1.0/darwin-arm64/develop-7154fc8dcd7abbef7feb0c0fdacaef31174bc672/cypress.tgz

Please sign in to comment.