-
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.
* decaffeinate: Rename browser.coffee from .coffee to .js * decaffeinate: Convert browser.coffee to JS * decaffeinate: Run post-processing cleanups on browser.coffee * temp 02/14/20 [skip ci] * add beforeEachRestoreRunner to select specs, remove support file hook * temp 03/03/20 [skip ci] * fix more specs due to support file change * fix errored spec * add isInteractive config to many specs * update yarn.lock * use yarn.lock from develop * fix nested suite configurations * fix nested suite configurations 2 * force isInteractive in driver/support file * update more specs to use test config format * update more specs to use test config format 2 * update more specs to use test config format 3 * update more specs to use test config format 4 * update more specs to use test config format 5 * fix cli/types tests, unit tests * cleanup * allow .isBrowser to support array, use .isBrowser for per-test-config * allow null browser test/suite config value * temp 04/10/20 [skip ci] * restore test originalTitle when skip due to browser * add tests for per-test-config baseUrl * update .isBrowser error message * fix rerunning hooks on top navigation * rename duplicate issue number * up timeout for server/integration test * change test to be more specific * rename TestOptions, add baseUrl test, override xit xdescribe methods * add tests for xit/xdescribe * disable video for flaky e2e test * fix lint-types, e2e snapshot * try 2: fix rerun before/after hooks * temp 04/29/20 [skip ci] * change logic to rerun before hooks after top navigation * fix windowSize for browser e2e test * fix windowSize for xvfb chrome in e2e test * ok fine, just disable screenshots * perf: faster lookup for hooks without runnables * fix afterAll hook switch logic * backport to before/after fix * backport to before/after fix 2 * fix noExit passed to e2e test inline options * remove extra root afterhook check * add issue link..twice * cleanup function to arrows * remove Cypress object proxying related code for certain utils * use getTest() as we did previously * remove Cypress object proxying related code for certain utils * fix Cypress._RESUMED_AT_TEST access * fix Cypress._RESUMED_AT_TEST access 2 * fix runner.getResumedAtTestIndex, state accesses * fix firefoxgcinterval access * fix arrow function * fix firefoxgcinterval access * try a simpler way to fix afterAll hook issue * fix decaf after merge * cleanup internal-types.d.ts * fix internal-types * fix comment, getTestFromRunnable signature * remove unneeded lastTestInSuiteLogic * fix after merge: many decaffed specs, typedefs * minor cleanup * fix typedefs: add taskTimeout * minor typedef fix, fix more specs modifying config() * fix e2e snapshot * fix flake: waiting_spec cancel outstanding XHR between tests * fix flake * change config mutation logic, add tests, update typedefs * add env support to testConfigOverride * fix specs: remove isInteractive override, add to beforeEach * move testConfigOverride to file * finish moving local config logic to cy.js * fix typedefs cypress.d.ts * fix minor minor dtslint * minor spec cleanup * chunk: typescript spec fixes, bind Cypress.$ * apply chunk: typescript spec fixes, bind Cypress.$ * fix stop-only * fix stop-only 2 * extend the jqueryProxyFn in the constructor * remove experimental code * rename spec files for overrides, cleanup * rename snapshots + tests to match updated test config overrides * fix firefox flake: navigation_spec Co-authored-by: Brian Mann <brian.mann86@gmail.com>
- Loading branch information
1 parent
128f2eb
commit 4cfcae2
Showing
48 changed files
with
1,285 additions
and
374 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
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,76 @@ | ||
const _ = require('lodash') | ||
|
||
function mutateConfiguration (testConfigOverride, config, env) { | ||
const globalConfig = _.clone(config()) | ||
const globalEnv = _.clone(env()) | ||
|
||
delete testConfigOverride.browser | ||
config(testConfigOverride) | ||
|
||
const localTestConfig = config() | ||
const localTestConfigBackup = _.clone(localTestConfig) | ||
|
||
if (testConfigOverride.env) { | ||
env(testConfigOverride.env) | ||
} | ||
|
||
const localTestEnv = env() | ||
const localTestEnvBackup = _.clone(localTestEnv) | ||
|
||
// we restore config back to what it was before the test ran | ||
// UNLESS the user mutated config with Cypress.config, in which case | ||
// we apply those changes to the global config | ||
// TODO: (NEXT_BREAKING) always restore configuration | ||
// do not allow global mutations inside test | ||
const restoreConfigFn = function () { | ||
_.each(localTestConfig, (val, key) => { | ||
if (localTestConfigBackup[key] !== val) { | ||
globalConfig[key] = val | ||
} | ||
}) | ||
|
||
_.each(localTestEnv, (val, key) => { | ||
if (localTestEnvBackup[key] !== val) { | ||
globalEnv[key] = val | ||
} | ||
}) | ||
|
||
config.reset() | ||
config(globalConfig) | ||
env.reset() | ||
env(globalEnv) | ||
} | ||
|
||
return restoreConfigFn | ||
} | ||
|
||
function getResolvedTestConfigOverride (test) { | ||
let curParent = test.parent | ||
|
||
const cfgs = [test.cfg] | ||
|
||
while (curParent) { | ||
if (curParent.cfg) { | ||
cfgs.push(curParent.cfg) | ||
} | ||
|
||
curParent = curParent.parent | ||
} | ||
|
||
return _.reduceRight(cfgs, (acc, cfg) => _.extend(acc, cfg), {}) | ||
} | ||
|
||
class TestConfigOverride { | ||
private restoreTestConfigFn: Nullable<() => void> = null | ||
restoreAndSetTestConfigOverrides (test, config, env) { | ||
if (this.restoreTestConfigFn) this.restoreTestConfigFn() | ||
|
||
const resolvedTestConfig = getResolvedTestConfigOverride(test) | ||
|
||
this.restoreTestConfigFn = mutateConfiguration(resolvedTestConfig, config, env) | ||
} | ||
} | ||
|
||
export function create () { | ||
return new TestConfigOverride() | ||
} |
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
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
Oops, something went wrong.
4cfcae2
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
:4cfcae2
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
: