mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-22 07:00:22 -05:00
Fix beforeSpecRun is not a function error (#2419)
* check beforeSpecRun is maybe a function for #2401 * override parallel to be false when a forked pr run
This commit is contained in:
committed by
Jennifer Shehane
parent
3b804cd09c
commit
622ddef78e
+5
-1
@@ -186,7 +186,11 @@ This outputs a lot of debugging lines. To focus on an individual module, run wit
|
||||
|
||||
When running `npm start` this routes through the CLI and eventually calls `npm run dev` with the proper arguments. This enables Cypress day-to-day development to match the logic of the built binary + CLI integration.
|
||||
|
||||
If you want to bypass the CLI entirely, you can use the `npm run dev` task and pass arguments directly.
|
||||
If you want to bypass the CLI entirely, you can use the `npm run dev` task and pass arguments directly. For example to headlessly run a project in a given folder, while trying to record to the Dashboard
|
||||
|
||||
```text
|
||||
npm run dev -- --run-project /project/folder --record --key <key>
|
||||
```
|
||||
|
||||
#### Tasks
|
||||
|
||||
|
||||
@@ -1436,3 +1436,72 @@ StatusCodeError: 500 - "Internal Server Error"
|
||||
|
||||
|
||||
`
|
||||
|
||||
exports['e2e record recordKey warns but does not exit when is forked pr and parallel 1'] = `
|
||||
Warning: It looks like you are trying to record this run from a forked PR.
|
||||
|
||||
The 'Record Key' is missing. Your CI provider is likely not passing private environment variables to builds from forks.
|
||||
|
||||
These results will not be recorded.
|
||||
|
||||
This error will not alter the exit code.
|
||||
|
||||
====================================================================================================
|
||||
|
||||
(Run Starting)
|
||||
|
||||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ Cypress: 1.2.3 │
|
||||
│ Browser: FooBrowser 88 │
|
||||
│ Specs: 1 found (record_pass_spec.coffee) │
|
||||
│ Searched: cypress/integration/record_pass* │
|
||||
└────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Running: record_pass_spec.coffee... (1 of 1)
|
||||
|
||||
|
||||
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 │
|
||||
│ Spec Ran: record_pass_spec.coffee │
|
||||
└───────────────────────────────────────┘
|
||||
|
||||
|
||||
(Screenshots)
|
||||
|
||||
- /foo/bar/.projects/e2e/cypress/screenshots/record_pass_spec.coffee/yay it passes.png (202x1002)
|
||||
|
||||
|
||||
====================================================================================================
|
||||
|
||||
(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 -
|
||||
|
||||
|
||||
`
|
||||
|
||||
@@ -448,7 +448,9 @@ createRunAndRecordSpecs = (options = {}) ->
|
||||
})
|
||||
.then (resp) ->
|
||||
if not resp
|
||||
runAllSpecs()
|
||||
## if a forked run, can't record and can't be parallel
|
||||
## because the necessary env variables aren't present
|
||||
runAllSpecs({}, false)
|
||||
else
|
||||
{ runUrl, runId, machineId, groupId } = resp
|
||||
|
||||
@@ -529,7 +531,7 @@ createRunAndRecordSpecs = (options = {}) ->
|
||||
instanceId
|
||||
})
|
||||
|
||||
runAllSpecs(beforeSpecRun, afterSpecRun, runUrl)
|
||||
runAllSpecs({ beforeSpecRun, afterSpecRun, runUrl })
|
||||
|
||||
module.exports = {
|
||||
createRun
|
||||
|
||||
@@ -7,6 +7,7 @@ human = require("human-interval")
|
||||
debug = require("debug")("cypress:server:run")
|
||||
Promise = require("bluebird")
|
||||
logSymbols = require("log-symbols")
|
||||
|
||||
recordMode = require("./record")
|
||||
errors = require("../errors")
|
||||
Project = require("../project")
|
||||
@@ -949,14 +950,14 @@ module.exports = {
|
||||
if not specs.length
|
||||
errors.throw('NO_SPECS_FOUND', config.integrationFolder, specPattern)
|
||||
|
||||
runAllSpecs = (beforeSpecRun, afterSpecRun, runUrl) =>
|
||||
runAllSpecs = ({ beforeSpecRun, afterSpecRun, runUrl }, parallelOverride = parallel) =>
|
||||
@runSpecs({
|
||||
beforeSpecRun
|
||||
afterSpecRun
|
||||
projectRoot
|
||||
specPattern
|
||||
socketId
|
||||
parallel
|
||||
parallel: parallelOverride
|
||||
browser
|
||||
project
|
||||
runUrl
|
||||
@@ -992,7 +993,8 @@ module.exports = {
|
||||
runAllSpecs
|
||||
})
|
||||
else
|
||||
runAllSpecs()
|
||||
## not recording, can't be parallel
|
||||
runAllSpecs({}, false)
|
||||
|
||||
run: (options) ->
|
||||
electronApp
|
||||
|
||||
@@ -505,6 +505,24 @@ describe "e2e record", ->
|
||||
.then ->
|
||||
expect(getRequestUrls()).to.be.empty
|
||||
|
||||
it "warns but does not exit when is forked pr and parallel", ->
|
||||
process.env.CIRCLECI = "1"
|
||||
process.env.CIRCLE_WORKFLOW_ID = "123"
|
||||
process.env.CIRCLE_PR_NUMBER = "123"
|
||||
process.env.CIRCLE_PR_USERNAME = "brian-mann"
|
||||
process.env.CIRCLE_PR_REPONAME = "cypress"
|
||||
process.env.CYPRESS_INTERNAL_E2E_TESTS = "0"
|
||||
|
||||
e2e.exec(@, {
|
||||
spec: "record_pass*"
|
||||
record: true
|
||||
parallel: true
|
||||
snapshot: true
|
||||
expectedExitCode: 0
|
||||
})
|
||||
.then ->
|
||||
expect(getRequestUrls()).to.be.empty
|
||||
|
||||
context "video recording", ->
|
||||
setup(defaultRoutes, {
|
||||
video: false
|
||||
|
||||
Reference in New Issue
Block a user