-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix rerun before/after hooks on top navigation (#7035)
* cleanup code, add better e2e tests * fix before/after hooks incorrect test reference * cleanup, add test for root after hook and test:after:run event * fix typo * add link to issue Co-authored-by: Jennifer Shehane <jennifer@cypress.io>
- Loading branch information
Showing
11 changed files
with
398 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
exports['e2e issue 1987 / can reload during spec run'] = ` | ||
==================================================================================================== | ||
(Run Starting) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (beforehook-and-test-navigation.js) │ | ||
│ Searched: cypress/integration/beforehook-and-test-navigation.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
Running: beforehook-and-test-navigation.js (1 of 1) | ||
suite | ||
✓ test | ||
✓ causes domain navigation | ||
2 passing | ||
(Results) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 2 │ | ||
│ Passing: 2 │ | ||
│ Failing: 0 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: beforehook-and-test-navigation.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
(Video) | ||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /XXX/XXX/XXX/cypress/videos/beforehook-and-test-navigation. (X second) | ||
js.mp4 | ||
==================================================================================================== | ||
(Run Finished) | ||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✔ beforehook-and-test-navigation.js XX:XX 2 2 - - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✔ All specs passed! XX:XX 2 2 - - - | ||
` | ||
|
||
exports['e2e issue 1987 / can run proper amount of hooks'] = ` | ||
==================================================================================================== | ||
(Run Starting) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Cypress: 1.2.3 │ | ||
│ Browser: FooBrowser 88 │ | ||
│ Specs: 1 found (afterhooks.spec.js) │ | ||
│ Searched: cypress/integration/afterhooks.spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
──────────────────────────────────────────────────────────────────────────────────────────────────── | ||
Running: afterhooks.spec.js (1 of 1) | ||
suite 1 | ||
✓ test 1 | ||
✓ test 2 | ||
✓ test 3 | ||
✓ test 4 | ||
suite 2 | ||
✓ s2t1 | ||
suite 3 | ||
✓ s3t1 | ||
6 passing | ||
(Results) | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ Tests: 6 │ | ||
│ Passing: 6 │ | ||
│ Failing: 0 │ | ||
│ Pending: 0 │ | ||
│ Skipped: 0 │ | ||
│ Screenshots: 0 │ | ||
│ Video: true │ | ||
│ Duration: X seconds │ | ||
│ Spec Ran: afterhooks.spec.js │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
(Video) | ||
- Started processing: Compressing to 32 CRF | ||
- Finished processing: /XXX/XXX/XXX/cypress/videos/afterhooks.spec.js.mp4 (X second) | ||
==================================================================================================== | ||
(Run Finished) | ||
Spec Tests Passing Failing Pending Skipped | ||
┌────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
│ ✔ afterhooks.spec.js XX:XX 6 6 - - - │ | ||
└────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
✔ All specs passed! XX:XX 6 6 - - - | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const e2e = require('../support/helpers/e2e') | ||
const Fixtures = require('../support/helpers/fixtures') | ||
|
||
describe('e2e issue 1987', () => { | ||
e2e.setup({ | ||
servers: [{ | ||
port: 3434, | ||
static: true, | ||
}, | ||
{ | ||
port: 4545, | ||
static: true, | ||
}], | ||
}) | ||
|
||
// https://github.com/cypress-io/cypress/issues/1987 | ||
// before/after hooks should not be rerun on top navigation | ||
e2e.it('can reload during spec run', { | ||
project: Fixtures.projectPath('hooks-after-rerun'), | ||
spec: 'beforehook-and-test-navigation.js', | ||
snapshot: true, | ||
}) | ||
|
||
e2e.it('can run proper amount of hooks', { | ||
project: Fixtures.projectPath('hooks-after-rerun'), | ||
spec: 'afterhooks.spec.js', | ||
snapshot: true, | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/server/test/support/fixtures/projects/hooks-after-rerun/cypress.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.
5fadc9c
There was a problem hiding this comment.
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
):In PowerShell:
In Git Bash:
Using
cross-env
:If the above commands do not work for you, you can also try using
cross-env
:5fadc9c
There was a problem hiding this comment.
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
):In PowerShell:
In Git Bash:
Using
cross-env
:If the above commands do not work for you, you can also try using
cross-env
: