Skip to content

Commit

Permalink
fix: Update error message for new error thrown when free plan limit e…
Browse files Browse the repository at this point in the history
…xceeded (#8409)
  • Loading branch information
jennifer-shehane authored Aug 27, 2020
1 parent 1d7abce commit eb28cff
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 10 deletions.
90 changes: 86 additions & 4 deletions packages/server/__snapshots__/7_record_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,9 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing
exports['e2e record api interaction warnings create run warnings grace period - over tests limit warns when over test recordings 1'] = `
You've exceeded the limit of test recordings under your free plan this month. The limit is 500 test recordings.
Your plan is now in a grace period, which means your tests will still be recorded until 2999-12-31. Please upgrade your plan to continue recording tests on the Cypress Dashboard in the future.
Your plan is now in a grace period, which means you will have the full benefits of your current plan until 2999-12-31.
Please visit your billing to upgrade your plan.
https://on.cypress.io/dashboard/organizations/org-id-1234/billing
Expand Down Expand Up @@ -1917,9 +1919,9 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing
`

exports['e2e record api interaction warnings create run warnings paid plan - over private tests limit warns when over private test recordings 1'] = `
You've exceeded the limit of private test recordings under your current billing plan this month. The limit is 500 private test recordings.
You've exceeded the limit of test recordings under your current billing plan this month. The limit is 500 private test recordings.
To upgrade your account, please visit your billing to upgrade to another billing plan.
To continue getting the full benefits of your current plan, please visit your billing to upgrade.
https://on.cypress.io/dashboard/organizations/org-id-1234/billing
Expand Down Expand Up @@ -1999,7 +2001,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing
exports['e2e record api interaction warnings create run warnings paid plan - over tests limit warns when over test recordings 1'] = `
You've exceeded the limit of test recordings under your current billing plan this month. The limit is 500 test recordings.
To upgrade your account, please visit your billing to upgrade to another billing plan.
To continue getting the full benefits of your current plan, please visit your billing to upgrade.
https://on.cypress.io/dashboard/organizations/org-id-1234/billing
Expand Down Expand Up @@ -2424,3 +2426,83 @@ exports['e2e record passing passes 2'] = [
}
}
]

exports['e2e record api interaction warnings create run warnings free plan - over tests limit v2 warns when over test recordings 1'] = `
You've exceeded the limit of test recordings under your free billing plan this month. The limit is 500 test recordings.
To continue getting the full benefits of your current plan, please visit your billing to upgrade.
https://on.cypress.io/dashboard/organizations/org-id-1234/billing
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 1.2.3 │
│ Browser: FooBrowser 88 │
│ Specs: 1 found (record_pass_spec.coffee) │
│ Searched: cypress/integration/record_pass* │
│ Params: Tag: false, Group: false, Parallel: false │
│ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: record_pass_spec.coffee (1 of 1)
Estimated: 8 seconds
record pass
✓ passes
- is pending
1 passing
1 pending
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 2 │
│ Passing: 1 │
│ Failing: 0 │
│ Pending: 1 │
│ Skipped: 0 │
│ Screenshots: 1 │
│ Video: true │
│ Duration: X seconds │
│ Estimated: 8 seconds │
│ Spec Ran: record_pass_spec.coffee │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
(Screenshots)
- /XXX/XXX/XXX/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
(Uploading Results)
- Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png
====================================================================================================
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ record_pass_spec.coffee XX:XX 2 1 - 1 - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! XX:XX 2 1 - 1 -
───────────────────────────────────────────────────────────────────────────────────────────────────────
Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12
`
10 changes: 6 additions & 4 deletions packages/server/lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,16 @@ const getMsgByType = function (type, arg1 = {}, arg2, arg3) {
return stripIndent`\
You've exceeded the limit of test recordings under your free plan this month. ${arg1.usedTestsMessage}
Your plan is now in a grace period, which means your tests will still be recorded until ${arg1.gracePeriodMessage}. Please upgrade your plan to continue recording tests on the Cypress Dashboard in the future.
Your plan is now in a grace period, which means you will have the full benefits of your current plan until ${arg1.gracePeriodMessage}.
Please visit your billing to upgrade your plan.
${arg1.link}`
case 'PAID_PLAN_EXCEEDS_MONTHLY_TESTS':
case 'PLAN_EXCEEDS_MONTHLY_TESTS':
return stripIndent`\
You've exceeded the limit of test recordings under your current billing plan this month. ${arg1.usedTestsMessage}
You've exceeded the limit of test recordings under your ${arg1.planType} billing plan this month. ${arg1.usedTestsMessage}
To upgrade your account, please visit your billing to upgrade to another billing plan.
To continue getting the full benefits of your current plan, please visit your billing to upgrade.
${arg1.link}`
case 'FREE_PLAN_IN_GRACE_PERIOD_PARALLEL_FEATURE':
Expand Down
12 changes: 10 additions & 2 deletions packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,21 @@ const createRun = Promise.method((options = {}) => {
gracePeriodMessage: gracePeriodMessage(warning.gracePeriodEnds),
link: billingLink(warning.orgId),
})
case 'FREE_PLAN_EXCEEDS_MONTHLY_TESTS_V2':
return errors.warning('PLAN_EXCEEDS_MONTHLY_TESTS', {
planType: 'free',
usedTestsMessage: usedTestsMessage(warning.limit, 'test'),
link: billingLink(warning.orgId),
})
case 'PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS':
return errors.warning('PAID_PLAN_EXCEEDS_MONTHLY_PRIVATE_TESTS', {
return errors.warning('PLAN_EXCEEDS_MONTHLY_TESTS', {
planType: 'current',
usedTestsMessage: usedTestsMessage(warning.limit, 'private test'),
link: billingLink(warning.orgId),
})
case 'PAID_PLAN_EXCEEDS_MONTHLY_TESTS':
return errors.warning('PAID_PLAN_EXCEEDS_MONTHLY_TESTS', {
return errors.warning('PLAN_EXCEEDS_MONTHLY_TESTS', {
planType: 'current',
usedTestsMessage: usedTestsMessage(warning.limit, 'test'),
link: billingLink(warning.orgId),
})
Expand Down
39 changes: 39 additions & 0 deletions packages/server/test/e2e/7_record_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,45 @@ describe('e2e record', () => {
})
})

describe('free plan - over tests limit v2', () => {
const routes = defaultRoutes.slice()

routes[0] = {
method: 'post',
url: '/runs',
req: '[email protected]',
resSchema: '[email protected]',
res (req, res) {
return res.status(200).json({
runId,
groupId,
machineId,
runUrl,
tags,
warnings: [{
name: 'FreePlanExceedsMonthlyTests',
message: 'Warning from Cypress Dashboard: Organization with free plan has exceeded monthly test recordings limit.',
code: 'FREE_PLAN_EXCEEDS_MONTHLY_TESTS_V2',
used: 700,
limit: 500,
orgId: 'org-id-1234',
}],
})
},
}

setup(routes)

it('warns when over test recordings', function () {
return e2e.exec(this, {
key: 'f858a2bc-b469-4e48-be67-0876339ee7e1',
spec: 'record_pass*',
record: true,
snapshot: true,
})
})
})

describe('unknown warning', () => {
const routes = defaultRoutes.slice()

Expand Down

4 comments on commit eb28cff

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on eb28cff Aug 27, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/linux-x64/circle-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-432660/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/circle-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-432651/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on eb28cff Aug 27, 2020

Choose a reason for hiding this comment

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

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

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-x64/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.1/win32-x64/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-x64/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-x64/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on eb28cff Aug 27, 2020

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

Instructions are included below, depending on the shell you are using.

In Command Prompt (cmd.exe):

set CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-ia32/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

In PowerShell:

$env:CYPRESS_INSTALL_BINARY = https://cdn.cypress.io/beta/binary/5.0.1/win32-ia32/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

In Git Bash:

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-ia32/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

Using cross-env:

If the above commands do not work for you, you can also try using cross-env:

npm i -g cross-env
cross-env CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/win32-ia32/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.zip npm install https://cdn.cypress.io/beta/npm/5.0.1/appveyor-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-34877354/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on eb28cff Aug 27, 2020

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.

You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.

You will need to use custom CYPRESS_INSTALL_BINARY url and install Cypress using an url instead of the version.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/5.0.1/darwin-x64/circle-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-432807/cypress.zip
npm install https://cdn.cypress.io/beta/npm/5.0.1/circle-develop-eb28cff076403c41fe2d5e07a0a4b0597f69a6dc-432727/cypress.tgz

Please sign in to comment.