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

isolated runner changes #6799

Merged
merged 126 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
0760a06
isolated runner changes
kuceb Mar 20, 2020
491b2e8
more fixes for isolated runner, get runner.spec passing
kuceb Mar 23, 2020
b648a8a
fix prev commit add untracked files
kuceb Mar 23, 2020
70923b4
add server reporter.spec.js for testing mocha output
kuceb Mar 23, 2020
ca9a146
fix has-binary yarn.lock
kuceb Mar 23, 2020
6161320
fix spec expected error message
kuceb Mar 23, 2020
8fcbf78
cleanup snapshot utility - use chai assert fn, add test to runner.spe…
kuceb Mar 24, 2020
2ba4fe9
remove test-retries related tests
kuceb Mar 24, 2020
13f1d01
small cleanup diff utility
kuceb Mar 26, 2020
363c898
move runner.spec to packages/runner
kuceb Mar 26, 2020
4c5a757
fix requiring missing file
kuceb Mar 27, 2020
8031a43
fix circle.yml runner-integration-tests
kuceb Mar 27, 2020
5606edf
Merge branch 'feature-test-retries' into isolated-runner-fixes
kuceb Mar 30, 2020
9c794a8
update readme
kuceb Mar 31, 2020
b4d895e
finish refactor of helpers for isolated runner-integration tests
kuceb Apr 1, 2020
683a5da
Merge branch 'feature-test-retries' into isolated-runner-fixes
kuceb Apr 3, 2020
b2b9449
restore runner/test/eslintrc
kuceb Apr 3, 2020
62d14b8
fix .eslintignore
kuceb Apr 6, 2020
e152091
temp 04/09/20 [skip ci]
kuceb Apr 9, 2020
45c8b59
Update readme to reflect how to start server for cypress tests
jennifer-shehane Apr 16, 2020
8e95c5e
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Apr 24, 2020
2dd7b41
try 2: fix rerun before/after hooks
kuceb Apr 27, 2020
f73126c
Merge remote-tracking branch 'origin/isolated-runner-fixes' into isol…
kuceb Apr 27, 2020
750571e
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Apr 27, 2020
f2dc852
Merge branch 'fix-rerun-hooks-on-navigation' into isolated-runner-fixes
kuceb Apr 27, 2020
9bd0a55
temp 04/29/20 [skip ci]
kuceb Apr 29, 2020
44c69ff
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Apr 29, 2020
e282289
backport changes from test-retries
kuceb Apr 29, 2020
85503d3
change logic to rerun before hooks after top navigation
kuceb Apr 30, 2020
46c116d
fix windowSize for browser e2e test
kuceb May 4, 2020
590a573
fix windowSize for xvfb chrome in e2e test
kuceb May 4, 2020
22d2780
ok fine, just disable screenshots
kuceb May 4, 2020
c82fb41
Merge branch '2-fix-rerun-hooks-on-navigation' into isolated-runner-f…
kuceb May 4, 2020
1d54dbd
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 4, 2020
4c88619
fix after merge: decaffed navigation.js
kuceb May 4, 2020
edbf156
update server/unit test snapshots
kuceb May 5, 2020
b13b9de
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 5, 2020
e7068e1
fix after merge: decaffed aliases.js
kuceb May 5, 2020
98408a4
fix usage of cypress --parallel flag in circle.yml
kuceb May 5, 2020
8ea4bbc
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 6, 2020
8d30b64
fix circle.yml integration-tests jobs
kuceb May 6, 2020
63c61a2
fix decaf related typo
kuceb May 6, 2020
aacc763
fix circle.yml separate command for runner-integration-tests
kuceb May 6, 2020
7777d5a
update runner/integration tests + snapshot after error improvements
kuceb May 7, 2020
f0e0cd6
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 7, 2020
8acbd6d
fix runner/integration snapshots for chrome/ff stacktrace differences
kuceb May 7, 2020
f82be9e
rerun ci
kuceb May 7, 2020
d3ed77d
fix passing --parallel to runner-integration tests
kuceb May 7, 2020
6d1451d
Merge remote-tracking branch 'origin/develop' into 2-fix-rerun-hooks-…
kuceb May 7, 2020
ec77ac3
perf: faster lookup for hooks without runnables
kuceb May 7, 2020
751e752
Merge remote-tracking branch 'origin/develop' into 2-fix-rerun-hooks-…
kuceb May 8, 2020
6790888
fix afterAll hook switch logic
kuceb May 8, 2020
2f06046
backport to before/after fix
kuceb May 20, 2020
75bf3bf
Merge remote-tracking branch 'origin/develop' into 2-fix-rerun-hooks-…
kuceb May 20, 2020
d230c17
backport to before/after fix 2
kuceb May 20, 2020
fe79190
Merge remote-tracking branch 'origin/2-fix-rerun-hooks-on-navigation'…
kuceb May 12, 2020
2e3993c
cleanup from decaf, fix ui/package.json
kuceb May 20, 2020
52d7166
update helpers, simplify runner.spec
kuceb May 20, 2020
73ee906
fix lint-types errors, flaky spec
kuceb May 20, 2020
f2977b7
fix noExit passed to e2e test inline options
kuceb May 22, 2020
836fc0a
Merge remote-tracking branch 'origin/develop' into 2-fix-rerun-hooks-…
kuceb May 22, 2020
70b9b09
Merge remote-tracking branch 'origin/2-fix-rerun-hooks-on-navigation'…
kuceb May 22, 2020
16be5c2
cleanup snapshot utility - refactor to use util file
kuceb May 22, 2020
bee8408
remove before/after changes
kuceb May 26, 2020
2a1fc2a
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 26, 2020
d82f8b4
make cy obj a class instance
kuceb May 26, 2020
90ba8ba
cleanup/unmerge before/after fixes PR...
kuceb May 26, 2020
6500edc
more cleanup
kuceb May 26, 2020
156d51b
add comment
kuceb May 28, 2020
5a8e064
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb May 28, 2020
e57b576
fix runner.spec
kuceb Jun 1, 2020
a77a0b6
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Jun 3, 2020
93943e5
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Jun 4, 2020
ece0481
cleanup snapshot utility more, cleanup reporter.spec
kuceb Jun 4, 2020
aaf657f
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Jun 8, 2020
230ffef
minor rename variable
kuceb Jun 8, 2020
1378233
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Jun 8, 2020
edd75b0
fix specName in reporterHeader, spec_helper require
kuceb Jun 8, 2020
9143eef
replace reporter specPath usages with spec object from config
kuceb Jun 8, 2020
1348b35
cleanup, fix specs, fix types tests
kuceb Jun 8, 2020
87db3c8
Merge branch 'chore-refactor-specpath-reporter-use' into isolated-run…
kuceb Jun 9, 2020
1ab5d71
fix config spec paths in isolated runner, fix snapshot plugin button
kuceb Jun 9, 2020
9211e53
combine runner.spec.js and runner_spec.js
kuceb Jun 9, 2020
5a9a7a8
fix incorrect merge
kuceb Jun 9, 2020
fec95de
minor minor cleanup
kuceb Jun 9, 2020
0872413
rename driver/test/cypress to driver/test
kuceb Jun 9, 2020
f658ea6
use yarn workspace over lerna for individual package commands
kuceb Jun 9, 2020
042b9bb
Merge branch 'chore-use-yarn-workspaces-over-lerna' into chore-move-d…
kuceb Jun 9, 2020
18239dd
add error message to driver start
kuceb Jun 9, 2020
ffd7875
remove usage of wait-on
kuceb Jun 9, 2020
b696f6b
update <reference types/>, import string
kuceb Jun 10, 2020
72a3fce
Merge remote-tracking branch 'origin/develop' into chore-move-driver-…
kuceb Jun 10, 2020
3888716
fix driver/readme
kuceb Jun 10, 2020
ab57cdc
fix readmes after regex replace
kuceb Jun 10, 2020
ca20729
Merge remote-tracking branch 'origin/develop' into chore-use-yarn-wor…
kuceb Jun 10, 2020
3c2927b
Merge branch 'chore-use-yarn-workspaces-over-lerna' into chore-move-d…
kuceb Jun 10, 2020
6de684c
revert wait-on changes
kuceb Jun 10, 2020
fc56b8e
Merge branch 'chore-use-yarn-workspaces-over-lerna' into chore-move-d…
kuceb Jun 10, 2020
930b718
Revert "revert wait-on changes"
kuceb Jun 10, 2020
f2b8c4e
update yarn.lock
kuceb Jun 10, 2020
e6bcb4f
fix broken path in spec
kuceb Jun 10, 2020
55a16cb
fix broken paths in specs with @packages/driver
kuceb Jun 10, 2020
df9d0d4
move runner/test/cypress into runner/cypress
kuceb Jun 10, 2020
7d736cc
Merge branch 'chore-move-driver-tests-into-parent' into isolated-runn…
kuceb Jun 10, 2020
002d037
start server in pluginsFile in runner/cypress tests
kuceb Jun 10, 2020
1f78711
fix more broken spec paths
kuceb Jun 10, 2020
35619a7
Merge branch 'chore-move-driver-tests-into-parent' into isolated-runn…
kuceb Jun 10, 2020
6d5d32e
fix broken paths after runner/cypress folder move
kuceb Jun 10, 2020
cd7b49f
Merge remote-tracking branch 'origin/chore-use-yarn-workspaces-over-l…
kuceb Jun 10, 2020
8fc44d2
Merge remote-tracking branch 'origin/develop' into chore-move-driver-…
kuceb Jun 10, 2020
748b9a7
Merge branch 'chore-move-driver-tests-into-parent' into isolated-runn…
kuceb Jun 10, 2020
f1f9dde
move type definition loading for driver/cypress into dedicated file
kuceb Jun 10, 2020
b696fbb
move internal-types to "types" folder, fix driver/index.d.ts
kuceb Jun 10, 2020
c091b20
Merge branch 'develop' into isolated-runner-fixes
brian-mann Jun 11, 2020
0c7dffa
Merge branch 'develop' into chore-move-driver-tests-into-parent
brian-mann Jun 11, 2020
8882130
fix type-check in packages/runner. not exactly sure why
kuceb Jun 11, 2020
096bbf9
fix runner type-check by excluding test folder in tsconfig
kuceb Jun 11, 2020
e3257bf
bump timeout on e2e/8_error_ui_spec
kuceb Jun 11, 2020
f5bc2ed
update snapshot utility, rename tests in runner/runner.spec, fix READ…
kuceb Jun 11, 2020
5597ec4
Merge branch 'chore-move-driver-tests-into-parent' into isolated-runn…
kuceb Jun 11, 2020
fe5ece1
Merge remote-tracking branch 'origin/develop' into chore-move-driver-…
kuceb Jun 11, 2020
3f4d7df
Merge branch 'chore-move-driver-tests-into-parent' into isolated-runn…
kuceb Jun 11, 2020
c19f6c2
fix snapshot naming, remove redundant test in reporter_spec
kuceb Jun 12, 2020
489be5d
rename runner snapshot file
kuceb Jun 15, 2020
4ea9cbe
address feedback: move server reporter snapshot specs out
kuceb Jun 16, 2020
1a0ac78
address feedback: add comment about exposing globals
kuceb Jun 16, 2020
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
1 change: 1 addition & 0 deletions packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"parse-domain": "bahmutov/parse-domain#fb60bd4",
"setimmediate": "1.0.5",
"sinon": "8.1.1",
"snap-shot-core": "^7.4.0",
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
"text-mask-addons": "3.8.0",
"underscore": "1.9.1",
"underscore.string": "3.3.5",
Expand Down
14 changes: 7 additions & 7 deletions packages/driver/src/cy/aliases.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ validateAlias = (alias) ->
if alias in blacklist
$errUtils.throwErrByPath "as.reserved_word", { args: { alias } }

create = (state) ->
create = (cy) ->
addAlias = (ctx, aliasObj) ->
{ alias, subject } = aliasObj

aliases = state("aliases") ? {}
aliases = cy.state("aliases") ? {}
aliases[alias] = aliasObj
state("aliases", aliases)
cy.state("aliases", aliases)

remoteSubject = cy.getRemotejQueryInstance(subject)

## assign the subject to our runnable ctx
ctx[alias] = remoteSubject ? subject

getNextAlias = ->
next = state("current").get("next")
next = cy.state("current").get("next")

if next and next.get("name") is "as"
next.get("args")[0]

getAlias = (name, cmd, log) ->
aliases = state("aliases") ? {}
aliases = cy.state("aliases") ? {}

## bail if the name doesnt reference an alias
return if not aliasRe.test(name)
Expand All @@ -64,7 +64,7 @@ create = (state) ->
return alias

getAvailableAliases = ->
return [] if not aliases = state("aliases")
return [] if not aliases = cy.state("aliases")

_.keys(aliases)

Expand All @@ -80,7 +80,7 @@ create = (state) ->
args: { name, displayName }
}

cmd ?= log and log.get("name") or state("current").get("name")
cmd ?= log and log.get("name") or cy.state("current").get("name")
displayName = aliasDisplayName(name)

errPath = if availableAliases.length
Expand Down
27 changes: 13 additions & 14 deletions packages/driver/src/cy/assertions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global cy Cypress */
const _ = require('lodash')
const Promise = require('bluebird')

Expand Down Expand Up @@ -70,14 +69,14 @@ const parseValueActualAndExpected = (value, actual, expected) => {
return obj
}

const create = function (state, queue, retryFn) {
const create = function (Cypress, cy) {
const getUpcomingAssertions = () => {
const index = state('index') + 1
const index = cy.state('index') + 1

const assertions = []

// grab the rest of the queue'd commands
for (let cmd of queue.slice(index).get()) {
for (let cmd of cy.queue.slice(index).get()) {
// don't break on utilities, just skip over them
if (cmd.is('utility')) {
continue
Expand Down Expand Up @@ -112,7 +111,7 @@ const create = function (state, queue, retryFn) {
cmd.set('assertionIndex', 0)

return cmd.get('fn').originalFn.apply(
state('ctx'),
cy.state('ctx'),
[subject].concat(cmd.get('args')),
)
})
Expand All @@ -135,7 +134,7 @@ const create = function (state, queue, retryFn) {
const verifyUpcomingAssertions = function (subject, options = {}, callbacks = {}) {
const cmds = getUpcomingAssertions()

state('upcomingAssertions', cmds)
cy.state('upcomingAssertions', cmds)

// we're applying the default assertion in the
// case where there are no upcoming assertion commands
Expand Down Expand Up @@ -228,7 +227,7 @@ const create = function (state, queue, retryFn) {
}

if (_.isFunction(onRetry)) {
return retryFn(onRetry, options)
return cy.retry(onRetry, options)
}
}

Expand Down Expand Up @@ -258,7 +257,7 @@ const create = function (state, queue, retryFn) {
}

// when we do immediately unbind this function
state('onBeforeLog', null)
cy.state('onBeforeLog', null)

const insertNewLog = (log) => {
cmd.log(log)
Expand Down Expand Up @@ -341,7 +340,7 @@ const create = function (state, queue, retryFn) {
return insertNewLog(log)
}

state('onBeforeLog', setCommandLog)
cy.state('onBeforeLog', setCommandLog)

// send verify=true as the last arg
return assertFn.apply(this, args.concat(true))
Expand Down Expand Up @@ -381,16 +380,16 @@ const create = function (state, queue, retryFn) {
}

const restore = () => {
state('upcomingAssertions', [])
cy.state('upcomingAssertions', [])

// no matter what we need to
// restore the assert fn
return state('overrideAssert', undefined)
return cy.state('overrideAssert', undefined)
}

// store this in case our test ends early
// and we reset between tests
state('overrideAssert', overrideAssert)
cy.state('overrideAssert', overrideAssert)

return Promise
.reduce(fns, assertions, [subject])
Expand Down Expand Up @@ -459,7 +458,7 @@ const create = function (state, queue, retryFn) {
// if our current command is an assertion type
isAssertionType(current) ||
// are we currently verifying assertions?
(state('upcomingAssertions') && state('upcomingAssertions').length > 0) ||
(cy.state('upcomingAssertions') && cy.state('upcomingAssertions').length > 0) ||
// did the function have arguments
functionHadArguments(current)
}
Expand Down Expand Up @@ -503,7 +502,7 @@ const create = function (state, queue, retryFn) {
const assert = function (...args) {
// if we've temporarily overriden assertions
// then just bail early with this function
const fn = state('overrideAssert') || assertFn
const fn = cy.state('overrideAssert') || assertFn

return fn.apply(this, args)
}
Expand Down
8 changes: 7 additions & 1 deletion packages/driver/src/cy/commands/agents.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ onInvoke = (Cypress, obj, args) ->
error: obj.error
type: "parent"
end: true
snapshot: true
snapshot: !agent._noSnapshot
event: true
consoleProps: ->
consoleObj = {}
Expand Down Expand Up @@ -187,6 +187,12 @@ module.exports = (Commands, Cypress, cy, state, config) ->

return agent

## disable DOM snapshots during log for this agent
agent.snapshot = (bool = true) ->
agent._noSnapshot = !bool

return agent

agent.as = (alias) ->
cy.validateAlias(alias)
cy.addAlias(ctx, {
Expand Down
10 changes: 5 additions & 5 deletions packages/driver/src/cy/commands/navigation.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ specifyFileByRelativePath = (url, log) ->
}
})

aboutBlank = (win) ->
aboutBlank = (cy, win) ->
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
new Promise (resolve) ->
cy.once("window:load", resolve)

Expand Down Expand Up @@ -173,7 +173,7 @@ formSubmitted = (Cypress, e) ->
}
})

pageLoading = (bool, state) ->
pageLoading = (bool, Cypress, state) ->
return if state("pageLoading") is bool

state("pageLoading", bool)
Expand All @@ -187,15 +187,15 @@ stabilityChanged = (Cypress, state, config, stable, event) ->
## if we're currently visiting about blank
## and becoming unstable for the first time
## notifiy that we're page loading
pageLoading(true, state)
pageLoading(true, Cypress, state)
return
else
## else wait until after we finish visiting
## about blank
return

## let the world know that the app is page:loading
pageLoading(!stable, state)
pageLoading(!stable, Cypress, state)

## if we aren't becoming unstable
## then just return now
Expand Down Expand Up @@ -825,7 +825,7 @@ module.exports = (Commands, Cypress, cy, state, config) ->
hasVisitedAboutBlank = true
currentlyVisitingAboutBlank = true

aboutBlank(win)
aboutBlank(cy, win)
.then ->
currentlyVisitingAboutBlank = false

Expand Down
44 changes: 25 additions & 19 deletions packages/driver/src/cypress/cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Promise = require('bluebird')

const $dom = require('../dom')
const $utils = require('./utils')
const $selection = require('../dom/selection')
const $errUtils = require('./error_utils')
const $Chai = require('../cy/chai')
const $Xhrs = require('../cy/xhrs')
Expand All @@ -24,7 +25,6 @@ const $Timers = require('../cy/timers')
const $Timeouts = require('../cy/timeouts')
const $Retries = require('../cy/retries')
const $Stability = require('../cy/stability')
const $selection = require('../dom/selection')
const $Snapshots = require('../cy/snapshots')
const $CommandQueue = require('./command_queue')
const $VideoRecorder = require('../cy/video-recorder')
Expand Down Expand Up @@ -72,25 +72,31 @@ const setTopOnError = function (cy) {

curCy = cy

const onTopError = function () {
return curCy.onUncaughtException.apply(curCy, arguments)
}
// prevent overriding top.onerror twice when loading more than one
// instance of test runner.
if (!top.__cypress__onerror) {
top.__cypress__onerror = true
const onTopError = function () {
return curCy.onUncaughtException.apply(curCy, arguments)
}

top.onerror = onTopError
top.onerror = onTopError

// Prevent Mocha from setting top.onerror which would override our handler
// Since the setter will change which event handler gets invoked, we make it a noop
return Object.defineProperty(top, 'onerror', {
set () {},
get () {
return onTopError
},
configurable: false,
enumerable: true,
})
// Prevent Mocha from setting top.onerror which would override our handler
// Since the setter will change which event handler gets invoked, we make it a noop
return Object.defineProperty(top, 'onerror', {
set () {},
get () {
return onTopError
},
configurable: false,
enumerable: true,
})
}
jennifer-shehane marked this conversation as resolved.
Show resolved Hide resolved
}

const create = function (specWindow, Cypress, Cookies, state, config, log) {
let cy = {}
let stopped = false
const commandFns = {}

Expand Down Expand Up @@ -124,7 +130,7 @@ const create = function (specWindow, Cypress, Cookies, state, config, log) {
const timeouts = $Timeouts.create(state)
const stability = $Stability.create(Cypress, state)
const retries = $Retries.create(Cypress, state, timeouts.timeout, timeouts.clearTimeout, stability.whenStable, onFinishAssertions)
const assertions = $Assertions.create(state, queue, retries.retry)
const assertions = $Assertions.create(Cypress, cy)

const jquery = $jQuery.create(state)
const location = $Location.create(state)
Expand All @@ -136,7 +142,7 @@ const create = function (specWindow, Cypress, Cookies, state, config, log) {
const { expect } = $Chai.create(specWindow, assertions.assert)

const xhrs = $Xhrs.create(state)
const aliases = $Aliases.create(state)
const aliases = $Aliases.create(cy)

const errors = $Errors.create(state, config, log)
const ensures = $Ensures.create(state, expect)
Expand Down Expand Up @@ -734,7 +740,7 @@ const create = function (specWindow, Cypress, Cookies, state, config, log) {
return finish(err)
}

const cy = {
_.extend(cy, {
id: _.uniqueId('cy'),

// synchrounous querying
Expand Down Expand Up @@ -1328,7 +1334,7 @@ const create = function (specWindow, Cypress, Cookies, state, config, log) {
}
}
},
}
})

_.each(privateProps, (obj, key) => {
return Object.defineProperty(cy, key, {
Expand Down
Loading