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

feat: support test retries #3968

Merged
merged 395 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 94 commits
Commits
Show all changes
395 commits
Select commit Hold shift + click to select a range
6344281
add retries e2e test
kuceb Apr 3, 2020
3523fc8
Merge branch 'server-e2e-tests-allow-watch' into test-retries
kuceb Apr 3, 2020
683a5da
Merge branch 'feature-test-retries' into isolated-runner-fixes
kuceb Apr 3, 2020
140e75d
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Apr 3, 2020
b2b9449
restore runner/test/eslintrc
kuceb Apr 3, 2020
852a36c
use mocha pass event, move runner.spec to runner package
kuceb Apr 3, 2020
62d14b8
fix .eslintignore
kuceb Apr 6, 2020
33ec46b
remove npmInstall logic in helper/e2e script, force custom reporters …
kuceb Apr 6, 2020
e152091
temp 04/09/20 [skip ci]
kuceb Apr 9, 2020
44fdc3b
add retries output to server/reporter, fix mocha pass event order, cl…
kuceb Apr 15, 2020
341cd97
e2e tests - dont run electron tests in other browsers
kuceb Apr 15, 2020
0e21e7a
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Apr 15, 2020
45c8b59
Update readme to reflect how to start server for cypress tests
jennifer-shehane Apr 16, 2020
e85fc68
Merge remote-tracking branch 'origin/develop' into server-e2e-tests-a…
kuceb Apr 20, 2020
a2c40a1
Merge remote-tracking branch 'origin/develop' into server-e2e-tests-a…
kuceb Apr 22, 2020
bd478ed
fix after merge
kuceb Apr 22, 2020
d930174
Merge branch 'server-e2e-tests-allow-watch' into test-retries
kuceb Apr 22, 2020
a0b53ed
fix .coffee -> .js after merge
kuceb Apr 22, 2020
e87d68f
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Apr 22, 2020
a2e00ad
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Apr 23, 2020
5d7f946
fix attempt.tsx
kuceb Apr 23, 2020
fcdc714
fix runnable titles emitted to terminal reporters
kuceb Apr 23, 2020
189948d
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Apr 23, 2020
45e1abc
fix more tests: update snapshots, fix 7_record_spec, 8_reporters_spec
kuceb Apr 23, 2020
d05d907
remove styling for 'attempt-error-region' so it's not indented
jennifer-shehane Apr 24, 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
6888b20
fix runner with only, runner snapshots, lint fixes
kuceb Apr 28, 2020
5611d2e
Merge remote-tracking branch 'origin/test-retries' into test-retries
kuceb Apr 28, 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
e1bc067
Merge remote-tracking branch 'origin/2-fix-rerun-hooks-on-navigation'…
kuceb May 12, 2020
fcca3fd
Merge branch 'isolated-runner-fixes' into test-retries
kuceb May 15, 2020
71e2189
simplify mocha prototype patches
kuceb May 16, 2020
fbbf67f
fix decaf utils.coffee after merge
kuceb May 16, 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
1f529df
Merge commit '73ee90675' into test-retries
kuceb May 21, 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
dd827ee
fix after merge
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
afb2185
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Jun 8, 2020
3d3da8a
fix after merge: decaffed files
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
0cb50b3
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Jun 11, 2020
c4bc864
delete old spec
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
2ec185f
fix file renames after merge
kuceb Jun 12, 2020
6b655e9
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Jun 12, 2020
40682e5
rename runner/ snapshot
kuceb Jun 12, 2020
a715439
update server/unit/reporter_spec snapshot
kuceb Jun 12, 2020
9a74188
update runner/runner_spec snapshot
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
5726ec9
fix test-retries after merging isolated-runner
kuceb Jun 16, 2020
af6ddd4
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Jun 16, 2020
f2ad5cb
fix runner/test helper, update snapshot
kuceb Jun 16, 2020
121fafb
Merge remote-tracking branch 'origin/develop' into isolated-runner-fixes
kuceb Jun 16, 2020
2952a78
Merge branch 'isolated-runner-fixes' into test-retries
kuceb Jun 16, 2020
09ca4a0
address feedback: split out runner/retries spec, move reporter/ui tes…
kuceb Jun 17, 2020
91fbf66
fix scrolling, attempt opening, update snapshots
kuceb Jun 19, 2020
952189b
fix e2e support file
kuceb Jun 22, 2020
e7a4ab7
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jun 22, 2020
d198a69
fix 5_spec_isolation
kuceb Jun 22, 2020
2a8d06d
fix mislabeling attempt screenshots
kuceb Jun 22, 2020
367132a
only add test results prevAttempts if exists
kuceb Jun 22, 2020
8ac878a
fix reporter/unit tests, server/unit tests
kuceb Jun 23, 2020
f97a85c
remove dead code, fix test isOpen
kuceb Jun 24, 2020
bc6b9f4
update snapshots for retries.mochaEvents, fix snapshot error in state…
kuceb Jun 24, 2020
691eafc
new moduleAPI schema using attempts array, fix wrapping errors from h…
kuceb Jun 25, 2020
04bd5ef
add displayError, null out fields in moduleAPI schema
kuceb Jun 25, 2020
a51669d
change default retries to {runMode:2, openMode:0}
kuceb Jun 25, 2020
48ebd4f
fix reporter type-check
kuceb Jun 25, 2020
1dd04da
upgrade json-schemas, update snapshots
kuceb Jun 25, 2020
8723bb7
reformat error.stack to be only stacktrace, update snapshots
kuceb Jun 26, 2020
ec379d3
fix stacktrace replacing in 5_spec_isolation
kuceb Jun 26, 2020
11dc267
fix navigation error causing infinite reloading, bump timeout on e2e/…
kuceb Jun 26, 2020
278d92a
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jun 26, 2020
4b39bd7
fix server/unit tests for new schema
kuceb Jun 26, 2020
0dc2a2a
fix reporter/unit tests
kuceb Jun 26, 2020
de651fa
fix reporting duplicate screenshots using cy.screenshot during test r…
kuceb Jun 27, 2020
755080d
update snapshot for 6_uncaught_support_file_spec
kuceb Jun 27, 2020
37ca121
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jul 6, 2020
b6d63ba
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Jul 6, 2020
b990060
bump x-route-version: 3
kuceb Jul 6, 2020
e95cf9a
fix test.tsx collapsible content, css, fix e2e/8_error_ui, e2e projec…
kuceb Jul 7, 2020
126bc9e
fix css, fix padding in runnable-instruments, fix runner/integration …
kuceb Jul 9, 2020
14be2ec
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jul 9, 2020
7cdcaf3
fixup after merge
kuceb Jul 9, 2020
73c7b08
fix reporter/runner to work with split hooks
kuceb Jul 10, 2020
846449d
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jul 10, 2020
d66b04d
update api tests, runner/cypress tests, reporter
kuceb Jul 13, 2020
0b515b1
Merge remote-tracking branch 'origin/develop' into test-retries
kuceb Jul 13, 2020
fbb02a2
fix 5_spec_isolation snapshots, fix runner/cypress errors.spec, fix n…
kuceb Jul 13, 2020
b5bf523
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Jul 13, 2020
91afb75
fix e2e/non_root spec, fix type_check, fix reporter/unit tests
kuceb Jul 14, 2020
0d4650b
setup percy snapshots in runner/cypress, fix driver/runner test:after…
kuceb Jul 15, 2020
3152e3e
add customPercySnapshot
kuceb Jul 15, 2020
3ecb65e
fix circle.yml
kuceb Jul 15, 2020
7c1ee28
fix circle.yml 2
kuceb Jul 15, 2020
e3ec883
fix circle.yml 3
kuceb Jul 15, 2020
b248010
add warning for incompatible retries plugin
kuceb Jul 16, 2020
f692bc5
add more percy snapshots
kuceb Jul 17, 2020
fabced7
fix firefox screenshot resolution in e2e test
kuceb Jul 17, 2020
8b3ba9c
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Jul 17, 2020
c43d39f
Fix testConfigOverrides not affecting viewport (#8006)
kuceb Jul 17, 2020
87eec3e
finish adding percy snapshots to runner/cypress retries spec, update …
kuceb Jul 17, 2020
4a74890
Merge branch 'v5.0-release' into test-retries
brian-mann Jul 20, 2020
e5d1626
remove .only
brian-mann Jul 20, 2020
1bc7c3c
Merge branch 'v5.0-release' into test-retries
brian-mann Jul 20, 2020
342bb14
fixing missing repo argument
brian-mann Jul 20, 2020
a947761
fix testConfigOverrides usage with retries, fix test
kuceb Jul 20, 2020
f570157
fix issues from previous merge
kuceb Jul 20, 2020
87aae16
add script that can query CircleCI workflow status
bahmutov Jul 21, 2020
c59ae4e
add circleci job to poll
bahmutov Jul 21, 2020
6d9d376
add retries
bahmutov Jul 21, 2020
638345d
try yarn lock
bahmutov Jul 21, 2020
f17560c
retry, percy finalize
bahmutov Jul 21, 2020
b21494a
check for current running job
bahmutov Jul 21, 2020
a415fd1
do not swallow request error
bahmutov Jul 21, 2020
85cac6f
better print
bahmutov Jul 21, 2020
c57775c
use job name from circle environment
bahmutov Jul 21, 2020
97b3190
use debug instead
bahmutov Jul 21, 2020
3d53bd8
renamed circle polling script
brian-mann Jul 21, 2020
305a7bc
refactor circle to conditionally run percy-finalize when env var is a…
brian-mann Jul 21, 2020
2f26f8d
use multi-line strings and quote --job-names
brian-mann Jul 21, 2020
8b7ee59
add comment
bahmutov Jul 21, 2020
b708502
Merge branch 'test-retries' of github.com:cypress-io/cypress into tes…
bahmutov Jul 21, 2020
bb02f65
only poll until the jobs to wait for are blocked or running
bahmutov Jul 21, 2020
4c42a44
fix running hooks at correct depth after attempt fails from hook and …
kuceb Jul 22, 2020
4ac06f4
fix reporter/unit tests, remove unused toggleOpen code
kuceb Jul 22, 2020
8510ea6
move custom percy command into @packages/ui-components and apply them…
brian-mann Jul 22, 2020
19d4a8b
halt percy finalize job if env variable is not set
bahmutov Jul 22, 2020
748d6f4
if only I could code
bahmutov Jul 22, 2020
88c535a
update runner/cypress mochaEvent snapshots, fix e2e firefox resolution
kuceb Jul 22, 2020
f80325f
fix css for attempt border-left, fix attempt-tag open/close icon, add…
kuceb Jul 22, 2020
8ec9c11
try percy set viewport width
kuceb Jul 22, 2020
e8f5487
set default retries back to {runMode:0, openMode:0}
kuceb Jul 23, 2020
0ca34aa
formatting: add backticks to warning message
kuceb Jul 23, 2020
f5bb489
write explicit test for screenshot overwriting behavior, fix snapshot…
kuceb Jul 23, 2020
518e730
fix e2e.it.only`
kuceb Jul 23, 2020
00e7698
cleanup whitespace
kuceb Jul 23, 2020
44e3e90
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Jul 23, 2020
7d7f723
update snapshots
kuceb Jul 24, 2020
dd6ea92
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Jul 31, 2020
c5f2b04
fix cypress module API types for new result schema
kuceb Aug 4, 2020
ad4dc55
build and upload binary for test-retries branch too (linux)
bahmutov Aug 4, 2020
3be9ff8
add pre-release PR comment
kuceb Aug 4, 2020
dff06aa
fix pre-release commit comment
kuceb Aug 4, 2020
c150111
rename runner/cypress test
kuceb Aug 7, 2020
2fb38df
update retries.ui.spec test titles
kuceb Aug 10, 2020
cd1119b
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Aug 10, 2020
df26592
fix after merge: use most recent attempt for before/after hooks
kuceb Aug 10, 2020
608fd72
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Aug 10, 2020
6988ef0
add suite title to hook error in runner/cypress tests
kuceb Aug 10, 2020
b0e7db2
Merge remote-tracking branch 'origin/v5.0-release' into test-retries
kuceb Aug 10, 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
20 changes: 17 additions & 3 deletions cli/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2536,8 +2536,22 @@ declare namespace Cypress {
disableTimersAndAnimations: boolean
padding: Padding
scale: boolean
beforeScreenshot(doc: Document): void
afterScreenshot(doc: Document): void
beforeScreenshot: ($el: JQuery<HTMLElement>) => void
afterScreenshot: ($el: JQuery<HTMLElement>, props: {
path: string,
size: 12,
dimensions: {
width: number,
height: number
},
multipart: boolean,
pixelRatio: number,
takenAt: string,
name: string,
blackout: string[],
duration: number,
testAttemptIndex: number
}) => void
}

interface ScreenshotDefaultsOptions extends ScreenshotOptions {
Expand Down Expand Up @@ -4739,7 +4753,7 @@ declare namespace Cypress {
name: string
/** Override *name* for display purposes only */
displayName: string
message: any[]
message: any[] | string
/** Return an object that will be printed in the dev tools console */
consoleProps(): ObjectLike
}
Expand Down
5 changes: 5 additions & 0 deletions packages/driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"@packages/coffee": "*",
"@packages/runner": "*",
"@packages/ts": "*",
"@types/chalk": "^2.2.0",
"@types/common-tags": "^1.8.0",
"@types/lodash": "^4.14.123",
"@types/mocha": "^5.2.6",
"angular": "1.7.9",
"backbone": "1.4.0",
"basic-auth": "2.0.1",
Expand Down Expand Up @@ -56,6 +60,7 @@
"parse-domain": "bahmutov/parse-domain#fb60bd4",
"setimmediate": "1.0.5",
"sinon": "8.1.1",
"snap-shot-core": "^7.4.0",
"text-mask-addons": "3.8.0",
"underscore": "1.9.1",
"underscore.string": "3.3.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/src/cy/aliases.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ validateAlias = (alias) ->
if alias in blacklist
$errUtils.throwErrByPath "as.reserved_word", { args: { alias } }

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

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

remoteSubject = cy.getRemotejQueryInstance(subject)
remoteSubject = getRemotejQueryInstance(subject)

## assign the subject to our runnable ctx
ctx[alias] = remoteSubject ? subject
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

Copy link
Member

@brian-mann brian-mann Mar 20, 2020

Choose a reason for hiding this comment

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

this can already be done by cy.stub(...).log(false)

agent.as = (alias) ->
cy.validateAlias(alias)
cy.addAlias(ctx, {
Expand Down
19 changes: 9 additions & 10 deletions packages/driver/src/cy/commands/commands.coffee
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
_ = require("lodash")

$Chainer = require("../../cypress/chainer")
$errUtils = require("../../cypress/error_utils")
$utils = require("../../cypress/utils")

command = (ctx, name, args...) ->
if not ctx[name]
cmds = "\`#{_.keys($Chainer.prototype).join("`, `")}\`"
$errUtils.throwErrByPath("miscellaneous.invalid_command", {
args: { name, cmds }
})
module.exports = (Commands, Cypress, cy, state, config) ->
command = (ctx, name, args...) ->
if not ctx[name]
cmds = "\`#{_.keys($Chainer.prototype).join("`, `")}\`"
$errUtils.throwErrByPath("miscellaneous.invalid_command", {
args: { name, cmds }
})

ctx[name].apply(ctx, args)
ctx[name].apply(ctx, args)

module.exports = (Commands, Cypress, cy, state, config) ->
Commands.addChainer({
command: (chainer, args) ->
command(chainer, args...)
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) ->
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
3 changes: 3 additions & 0 deletions packages/driver/src/cy/commands/screenshot.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ automateScreenshot = (state, options = {}) ->
props = _.extend({
titles
testId: runnable.id
testAttemptIndex: $utils.getTestFromRunnable(runnable)._currentRetry
takenPaths: state("screenshotPaths")
}, _.omit(options, "runnable", "timeout", "log", "subject"))

Expand Down Expand Up @@ -245,6 +246,7 @@ takeScreenshot = (Cypress, state, screenshotConfig, options = {}) ->
getOptions = (isOpen) ->
{
id: runnable.id
testAttemptIndex: $utils.getTestFromRunnable(runnable)._currentRetry
isOpen: isOpen
appOnly: isAppOnly(screenshotConfig)
scale: getShouldScale(screenshotConfig)
Expand Down Expand Up @@ -304,6 +306,7 @@ takeScreenshot = (Cypress, state, screenshotConfig, options = {}) ->
else
automateScreenshot(state, automationOptions)
.then (props) ->

onAfterScreenshot and onAfterScreenshot.call(state("ctx"), $el, props)

$Screenshot.onAfterScreenshot($el, props)
Expand Down
30 changes: 22 additions & 8 deletions packages/driver/src/cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,6 @@ class $Cypress {

break

case 'runner:set:runnable':
// when there is a hook / test (runnable) that
// is about to be invoked
return this.cy.setRunnable(...args)

case 'runner:suite:start':
// mocha runner started processing a suite
if (this.config('isTextTerminal')) {
Expand Down Expand Up @@ -310,6 +305,8 @@ class $Cypress {

case 'runner:pass':
// mocha runner calculated a pass
// this is delayed from when mocha would normally fire it
// since we fire it after all afterEach hooks have ran
if (this.config('isTextTerminal')) {
return this.emit('mocha', 'pass', ...args)
}
Expand Down Expand Up @@ -346,15 +343,32 @@ class $Cypress {

break
}
// retry event only fired in mocha version 6+
// https://github.com/mochajs/mocha/commit/2a76dd7589e4a1ed14dd2a33ab89f182e4c4a050
case 'runner:retry': {
// mocha runner calculated a pass
if (this.config('isTextTerminal')) {
this.emit('mocha', 'retry', ...args)
}

break
}

case 'mocha:runnable:run':
return this.runner.onRunnableRun(...args)
// case 'mocha:runnable:run':
// return this.runner.onRunnableRun(...args)

case 'runner:test:before:run':
// get back to a clean slate
this.cy.reset()

return this.emit('test:before:run', ...args)
if (this.config('isTextTerminal')) {
// needed for handling test retries
this.emit('mocha', 'test:before:run', args[0])
}

this.emit('test:before:run', ...args)

break

case 'runner:test:before:run:async':
// TODO: handle timeouts here? or in the runner?
Expand Down
39 changes: 39 additions & 0 deletions packages/driver/src/cypress/chai_factory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const _ = require('lodash')
const chai = require('chai')
const utils = require('chai/lib/chai/utils')
const Assertion = require('chai/lib/chai/assertion')
const Core = require('chai/lib/chai/core/assertions')
const Expect = require('chai/lib/chai/interface/expect')
const Should = require('chai/lib/chai/interface/should')
const Assert = require('chai/lib/chai/interface/assert')

const CHAI_STATIC_PROPS = ['config', 'version', 'use', 'util', 'AssertionError']

const create = () => {
const used = []

const obj = _.pick(chai, CHAI_STATIC_PROPS)

obj.use = function (fn) {
if (!~used.indexOf(fn)) {
fn(this, obj.util)
used.push(fn)
}

return this
}

Assertion(obj, obj.util)
Core(obj, obj.util)
Expect(obj, obj.util)
Should(obj, obj.util)
Assert(obj, obj.util)

return obj
}

module.exports = {
utils,

create,
}
Loading