Merge branch 'develop' into feature-multidomain

This commit is contained in:
Matt Schile
2022-04-21 09:53:49 -06:00
30 changed files with 738 additions and 2111 deletions

View File

@@ -1,4 +1,4 @@
{
"chrome:beta": "101.0.4951.26",
"chrome:stable": "100.0.4896.88"
"chrome:beta": "101.0.4951.41",
"chrome:stable": "100.0.4896.127"
}

View File

@@ -32,6 +32,7 @@ exports['errors individual has the following errors 1'] = [
"childProcessKilled",
"failedDownload",
"failedUnzip",
"failedUnzipWindowsMaxPathLength",
"incompatibleHeadlessFlags",
"invalidCacheDirectory",
"invalidCypressEnv",

View File

@@ -1,4 +1,4 @@
exports['unzip error 1'] = `
exports['lib/tasks/unzip throws when cannot unzip 1'] = `
Error: The Cypress App could not be unzipped.
Search for an existing issue or open a GitHub issue at
@@ -15,3 +15,21 @@ Platform: darwin-x64 (Foo-OsVersion)
Cypress Version: 1.2.3
`
exports['lib/tasks/unzip throws max path length error when cannot unzip due to realpath ENOENT on windows 1'] = `
Error: The Cypress App could not be unzipped.
This is most likely because the maximum path length is being exceeded on your system.
Read here for solutions to this problem: https://on.cypress.io/win-max-path-length-error
----------
Error: failed
----------
Platform: win32-x64 (Foo-OsVersion)
Cypress Version: 1.2.3
`

View File

@@ -58,6 +58,13 @@ const failedUnzip = {
solution: genericErrorSolution,
}
const failedUnzipWindowsMaxPathLength = {
description: 'The Cypress App could not be unzipped.',
solution: `This is most likely because the maximum path length is being exceeded on your system.
Read here for solutions to this problem: https://on.cypress.io/win-max-path-length-error`,
}
const missingApp = (binaryDir) => {
return {
description: `No version of Cypress is installed in: ${chalk.cyan(
@@ -404,6 +411,7 @@ module.exports = {
unexpected,
failedDownload,
failedUnzip,
failedUnzipWindowsMaxPathLength,
invalidCypressEnv,
invalidCacheDirectory,
CYPRESS_RUN_BINARY,

View File

@@ -195,7 +195,11 @@ const unzip = ({ zipFilePath, installDir, progress }) => {
})
}
const start = ({ zipFilePath, installDir, progress }) => {
function isMaybeWindowsMaxPathLengthError (err) {
return os.platform() === 'win32' && err.code === 'ENOENT' && err.syscall === 'realpath'
}
const start = async ({ zipFilePath, installDir, progress }) => {
la(is.unemptyString(installDir), 'missing installDir')
if (!progress) {
progress = { onProgress: () => {
@@ -203,18 +207,23 @@ const start = ({ zipFilePath, installDir, progress }) => {
} }
}
return fs.pathExists(installDir)
.then((exists) => {
if (exists) {
try {
const installDirExists = await fs.pathExists(installDir)
if (installDirExists) {
debug('removing existing unzipped binary', installDir)
return fs.removeAsync(installDir)
await fs.removeAsync(installDir)
}
})
.then(() => {
return unzip({ zipFilePath, installDir, progress })
})
.catch(throwFormErrorText(errors.failedUnzip))
await unzip({ zipFilePath, installDir, progress })
} catch (err) {
const errorTemplate = isMaybeWindowsMaxPathLengthError(err) ?
errors.failedUnzipWindowsMaxPathLength
: errors.failedUnzip
await throwFormErrorText(errorTemplate)(err)
}
}
module.exports = {

View File

@@ -30,26 +30,44 @@ describe('lib/tasks/unzip', function () {
afterEach(function () {
stdout.restore()
// return fs.removeAsync(installationDir)
})
it('throws when cannot unzip', function () {
const ctx = this
return unzip
.start({
zipFilePath: path.join('test', 'fixture', 'bad_example.zip'),
installDir,
})
.then(() => {
throw new Error('should have failed')
})
.catch((err) => {
it('throws when cannot unzip', async function () {
try {
await unzip.start({
zipFilePath: path.join('test', 'fixture', 'bad_example.zip'),
installDir,
})
} catch (err) {
logger.error(err)
snapshot('unzip error 1', normalize(ctx.stdout.toString()))
})
return snapshot(normalize(this.stdout.toString()))
}
throw new Error('should have failed')
})
it('throws max path length error when cannot unzip due to realpath ENOENT on windows', async function () {
const err = new Error('failed')
err.code = 'ENOENT'
err.syscall = 'realpath'
os.platform.returns('win32')
sinon.stub(fs, 'ensureDirAsync').rejects(err)
try {
await unzip.start({
zipFilePath: path.join('test', 'fixture', 'bad_example.zip'),
installDir,
})
} catch (err) {
logger.error(err)
return snapshot(normalize(this.stdout.toString()))
}
throw new Error('should have failed')
})
it('can really unzip', function () {

View File

@@ -175,40 +175,6 @@
"@cypress/react@file:../../dist":
version "0.0.0"
"@oozcitak/dom@1.15.8":
version "1.15.8"
resolved "https://registry.yarnpkg.com/@oozcitak/dom/-/dom-1.15.8.tgz#0c0c7bb54cfdaadc07fd637913e706101721d15d"
integrity sha512-MoOnLBNsF+ok0HjpAvxYxR4piUhRDCEWK0ot3upwOOHYudJd30j6M+LNcE8RKpwfnclAX9T66nXXzkytd29XSw==
dependencies:
"@oozcitak/infra" "1.0.8"
"@oozcitak/url" "1.0.4"
"@oozcitak/util" "8.3.8"
"@oozcitak/infra@1.0.8":
version "1.0.8"
resolved "https://registry.yarnpkg.com/@oozcitak/infra/-/infra-1.0.8.tgz#b0b089421f7d0f6878687608301fbaba837a7d17"
integrity sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==
dependencies:
"@oozcitak/util" "8.3.8"
"@oozcitak/url@1.0.4":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@oozcitak/url/-/url-1.0.4.tgz#ca8b1c876319cf5a648dfa1123600a6aa5cda6ba"
integrity sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==
dependencies:
"@oozcitak/infra" "1.0.8"
"@oozcitak/util" "8.3.8"
"@oozcitak/util@8.3.8":
version "8.3.8"
resolved "https://registry.yarnpkg.com/@oozcitak/util/-/util-8.3.8.tgz#10f65fe1891fd8cde4957360835e78fd1936bfdd"
integrity sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==
"@types/node@14.6.2":
version "14.6.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.6.2.tgz#264b44c5a28dfa80198fc2f7b6d3c8a054b9491f"
integrity sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==
"@types/parse-json@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
@@ -269,10 +235,10 @@ ajv@^6.12.3:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^3.2.1:
version "3.2.1"
@@ -288,13 +254,6 @@ ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
dependencies:
sprintf-js "~1.0.2"
array-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
@@ -399,6 +358,11 @@ chalk@^2.0.0:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
charenc@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
@@ -476,6 +440,11 @@ cosmiconfig@^6.0.0:
path-type "^4.0.0"
yaml "^1.7.2"
crypt@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
css-tree@^1.0.0-alpha.39:
version "1.0.0-alpha.39"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.39.tgz#2bff3ffe1bb3f776cf7eefd91ee5cba77a149eeb"
@@ -501,14 +470,6 @@ cssstyle@^2.0.0:
dependencies:
cssom "~0.3.6"
cypress-circleci-reporter@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/cypress-circleci-reporter/-/cypress-circleci-reporter-0.2.0.tgz#a3e1571694f4e21649a6af4d508e68948d23622d"
integrity sha512-uhqcJwvtKJ7Bw3RHVBTqUH9GP2L6jq+qLp/+/Jh3/OSe5Af6H7RxIARhvawsvbPrg9lMWdW/jCezjeUcXrl9uA==
dependencies:
strip-ansi "^6.0.0"
xmlbuilder2 "^2.1.1"
dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
@@ -530,7 +491,7 @@ dateformat@^3.0.3:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==
debug@2.6.9:
debug@2.6.9, debug@^2.2.0:
version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
@@ -630,7 +591,7 @@ escodegen@^1.11.1:
optionalDependencies:
source-map "~0.6.1"
esprima@^4.0.0, esprima@^4.0.1:
esprima@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
@@ -880,6 +841,11 @@ is-arrayish@^0.2.1:
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=
is-buffer@~1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
@@ -895,14 +861,6 @@ js-tokens@^4.0.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
js-yaml@3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482"
integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
jsbn@~0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
@@ -971,11 +929,25 @@ lodash.sortby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
lodash@^4.17.15:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
lodash@^4.17.19:
version "4.17.20"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
md5@^2.1.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==
dependencies:
charenc "0.0.2"
crypt "0.0.2"
is-buffer "~1.1.6"
mdn-data@2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.6.tgz#852dc60fcaa5daa2e8cf6c9189c440ed3e042978"
@@ -1013,10 +985,10 @@ mime@1.6.0:
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==
minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
minimist@^1.2.5, minimist@^1.2.6:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
mkdirp@^0.5.1:
version "0.5.5"
@@ -1025,6 +997,32 @@ mkdirp@^0.5.1:
dependencies:
minimist "^1.2.5"
mkdirp@~0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
dependencies:
minimist "^1.2.6"
mocha-junit-reporter@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-2.0.2.tgz#d521689b651dc52f52044739f8ffb368be415731"
integrity sha512-vYwWq5hh3v1lG0gdQCBxwNipBfvDiAM1PHroQRNp96+2l72e9wEUTw+mzoK+O0SudgfQ7WvTQZ9Nh3qkAYAjfg==
dependencies:
debug "^2.2.0"
md5 "^2.1.0"
mkdirp "~0.5.1"
strip-ansi "^6.0.1"
xml "^1.0.0"
mocha-multi-reporters@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/mocha-multi-reporters/-/mocha-multi-reporters-1.5.1.tgz#c73486bed5519e1d59c9ce39ac7a9792600e5676"
integrity sha512-Yb4QJOaGLIcmB0VY7Wif5AjvLMUFAdV57D2TWEva1Y0kU/3LjKpeRVmlMIfuO1SVbauve459kgtIizADqxMWPg==
dependencies:
debug "^4.1.1"
lodash "^4.17.15"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
@@ -1297,11 +1295,6 @@ source-map@^0.6.1, source-map@~0.6.1:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
sshpk@^1.7.0:
version "1.16.1"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877"
@@ -1332,12 +1325,12 @@ stealthy-require@^1.1.1:
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
integrity sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=
strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==
strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.0"
ansi-regex "^5.0.1"
supports-color@^5.3.0:
version "5.5.0"
@@ -1522,16 +1515,10 @@ xml-name-validator@^3.0.0:
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==
xmlbuilder2@^2.1.1:
version "2.4.0"
resolved "https://registry.yarnpkg.com/xmlbuilder2/-/xmlbuilder2-2.4.0.tgz#fb6c5171bef1bcb984c88cfef5210e17b7b841cd"
integrity sha512-KrOVUGD65xTQ7ZA+GMQGdBSpe1Ufu5ylCQSYVk6QostySDkxPmAQ0WWIu7dR3JjLfVbF22RFQX7KyrZ6VTLcQg==
dependencies:
"@oozcitak/dom" "1.15.8"
"@oozcitak/infra" "1.0.8"
"@oozcitak/util" "8.3.8"
"@types/node" "14.6.2"
js-yaml "3.14.0"
xml@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=
xmlchars@^2.1.1:
version "2.2.0"

View File

@@ -37,7 +37,6 @@
"ensure-deps": "./scripts/ensure-dependencies.sh",
"get-next-version": "node scripts/get-next-version.js",
"postinstall": "patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && ./scripts/run-if-not-ci.sh yarn build",
"jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json .",
"lint-changed": "lint-changed",
"prepare-release-artifacts": "node ./scripts/prepare-release-artifacts.js",
@@ -74,12 +73,10 @@
"devDependencies": {
"@aws-sdk/credential-providers": "3.53.0",
"@cypress/commit-message-install": "3.1.3",
"@cypress/env-or-json-file": "2.0.0",
"@cypress/github-commit-status-check": "1.5.0",
"@cypress/questions-remain": "1.0.1",
"@cypress/request": "2.88.10",
"@cypress/request-promise": "4.2.6",
"@fellow/eslint-plugin-coffee": "0.4.13",
"@percy/cli": "1.0.0-beta.48",
"@percy/cypress": "^3.1.0",
"@semantic-release/changelog": "5.0.1",
@@ -105,11 +102,9 @@
"@typescript-eslint/eslint-plugin": "4.18.0",
"@typescript-eslint/parser": "4.18.0",
"arg": "4.1.2",
"ascii-table": "0.0.9",
"aws-sdk": "2.814.0",
"babel-eslint": "10.1.0",
"bluebird": "3.5.3",
"bluebird-retry": "0.11.0",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chalk": "2.4.2",
@@ -147,10 +142,6 @@
"inquirer": "3.3.0",
"inquirer-confirm": "2.0.3",
"jest": "24.9.0",
"js-codemod": "cpojer/js-codemod",
"jscodemods": "cypress-io/jscodemods#01b546e",
"jscodeshift": "0.7.0",
"konfig": "0.2.1",
"lazy-ass": "1.6.0",
"lerna": "3.20.2",
"lint-staged": "11.1.2",
@@ -163,11 +154,8 @@
"mocha-multi-reporters": "1.1.7",
"mock-fs": "5.1.1",
"patch-package": "6.4.7",
"plist": "3.0.5",
"pluralize": "8.0.0",
"postinstall-postinstall": "2.0.0",
"prefixed-list": "1.0.1",
"pretty-ms": "7.0.0",
"print-arch": "1.0.0",
"proxyquire": "2.1.3",
"semantic-release": "17.2.3",
@@ -182,7 +170,6 @@
"strip-ansi": "6.0.0",
"term-to-html": "1.2.0",
"terminal-banner": "1.1.0",
"through": "2.3.8",
"ts-node": "8.3.0",
"typescript": "^4.4.4",
"yarn-deduplicate": "3.1.0"

View File

@@ -447,6 +447,7 @@ describe('Settings', () => {
cy.get('.settings-record-key')
.contains(`cypress run --record --key ${this.keys[0].id}`)
cy.ensureAnimationsFinished()
cy.percySnapshot()
})

View File

@@ -1,44 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>DOM Fixture</title>
<script type="text/javascript" src="/node_modules/sinon/dist/sinon.js"></script>
<script type="text/javascript" src="/node_modules/jquery/dist/jquery.js"></script>
</head>
<body>
<div id="background">
<link rel="stylesheet" href="/node_modules/@cypress/bower-kendo-ui/styles/kendo.common.min.css">
<link rel="stylesheet" href="/node_modules/@cypress/bower-kendo-ui/styles/kendo.default.min.css">
<style>
#background {
position: fixed;
background-color: gray;
width: 100%;
height: 100%;
}
</style>
<input id="dropdown" />
<script type="text/javascript" src="/node_modules/@cypress/bower-kendo-ui/js/kendo.ui.core.min.js"></script>
<script type="text/javascript">
$(function(){
$("#dropdown").kendoDropDownList({
optionLabel: "--Select--",
dataTextField: "t",
dataValueField: "v",
dataSource: [
{v: 1, t: "Apples"},
{v: 2, t: "Bananas"},
{v: 3, t: "Pears"},
{v: 4, t: "Watermelon"},
{v: 5, t: "Grapes"},
{v: 6, t: "Strawberries"}
]
})
})
</script>
</div>
</body>
</html>

View File

@@ -1,32 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>DOM Fixture</title>
<script type="text/javascript" src="/node_modules/sinon/dist/sinon.js"></script>
<script type="text/javascript" src="/node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="/node_modules/bootstrap/dist/js/bootstrap.js"></script>
</head>
<body>
<div id="clicks">
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.css">
<style>
body {
padding-top: 70px;
}
#clicks {
min-height: 2000px;
}
</style>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">Brand</a>
</div>
</div>
</nav>
<div class="container">
<button class="btn btn-primary">click me</button>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,244 @@
const {
getSessionDetails,
getConsoleProps,
navigateAboutBlank,
} = require('@packages/driver/src/cy/commands/sessions/utils')
describe('src/cy/commands/sessions/utils.ts', () => {
describe('.getSessionDetails', () => {
it('for one domain with neither cookies or local storage set', () => {
const sessionState = {
id: 'session1',
}
const details = getSessionDetails(sessionState)
expect(details.id).to.eq('session1')
expect(Object.keys(details.data)).to.have.length(0)
})
it('for one domain with only cookies set', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
}
const details = getSessionDetails(sessionState)
expect(details.id).to.eq('session1')
expect(Object.keys(details.data)).to.have.length(1)
expect(details.data).to.have.property('localhost')
expect(details.data.localhost).to.deep.eq({
cookies: 1,
})
})
it('for one domain with only local storage set', () => {
const sessionState = {
id: 'session1',
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
}
const details = getSessionDetails(sessionState)
expect(details.id).to.eq('session1')
expect(Object.keys(details.data)).to.have.length(1)
expect(details.data).to.have.property('localhost')
expect(details.data.localhost).to.deep.eq({
localStorage: 1,
})
})
it('for one domain with both cookies and localStorage', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
}
const details = getSessionDetails(sessionState)
expect(details.id).to.eq('session1')
expect(Object.keys(details.data)).to.have.length(1)
expect(details.data).to.have.property('localhost')
expect(details.data.localhost).to.deep.eq({
cookies: 1,
localStorage: 1,
})
})
it('for multiple domains', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
{ name: 'bar', value: 'b', path: '/', domain: 'localhost', secure: false, httpOnly: false, expiry: 456 },
],
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
{ origin: 'http://example.com', value: { 'random': 'hi' } },
],
}
const details = getSessionDetails(sessionState)
expect(details.id).to.eq('session1')
expect(Object.keys(details.data)).to.have.length(2)
expect(details.data).to.have.property('localhost')
expect(details.data.localhost).to.deep.eq({
cookies: 2,
localStorage: 1,
})
expect(details.data).to.have.property('example.com')
expect(details.data['example.com']).to.deep.eq({
localStorage: 1,
})
})
})
describe('.getConsoleProps', () => {
it('for one domain with neither cookies or localStorage set', () => {
const sessionState = {
id: 'session1',
}
const consoleProps = getConsoleProps(sessionState)
expect(consoleProps.id).to.eq('session1')
expect(consoleProps.table).to.have.length(0)
})
it('for one domain with only cookies set', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
}
const consoleProps = getConsoleProps(sessionState)
expect(consoleProps.id).to.eq('session1')
expect(consoleProps.table).to.have.length(1)
const cookiesTable = consoleProps.table[0]()
expect(cookiesTable.name).to.contain('Cookies - localhost (1)')
expect(cookiesTable.data).to.deep.eq(sessionState.cookies)
})
it('for one domain with only localStorage set', () => {
const sessionState = {
id: 'session1',
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
}
const consoleProps = getConsoleProps(sessionState)
expect(consoleProps.id).to.eq('session1')
expect(consoleProps.table).to.have.length(1)
const localStorageTable = consoleProps.table[0]()
expect(localStorageTable.name).to.contain('Storage - localhost (1)')
expect(localStorageTable.data).to.have.length(1)
expect(localStorageTable.data).to.deep.eq([{ key: 'stor-foo', value: 's-f' }])
})
it('for one domain with both cookies and localStorage set', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
}
const consoleProps = getConsoleProps(sessionState)
expect(consoleProps.id).to.eq('session1')
expect(consoleProps.table).to.have.length(2)
let table = consoleProps.table[0]()
expect(table.name).to.contain('Cookies - localhost (1)')
expect(table.data).to.have.length(1)
expect(table.data).to.deep.eq(sessionState.cookies)
table = consoleProps.table[1]()
expect(table.name).to.contain('Storage - localhost (1)')
expect(table.data).to.have.length(1)
expect(table.data).to.deep.eq([{ key: 'stor-foo', value: 's-f' }])
})
it('for multiple domains', () => {
const sessionState = {
id: 'session1',
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
{ name: 'bar', value: 'b', path: '/', domain: 'localhost', secure: false, httpOnly: false, expiry: 456 },
],
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
{ origin: 'http://example.com', value: { 'random': 'hi' } },
],
}
const consoleProps = getConsoleProps(sessionState)
expect(consoleProps.id).to.eq('session1')
expect(consoleProps.table).to.have.length(3)
let table = consoleProps.table[0]()
expect(table.name).to.contain('Cookies - localhost (2)')
expect(table.data).to.have.length(2)
expect(table.data).to.deep.eq(sessionState.cookies)
table = consoleProps.table[1]()
expect(table.name).to.contain('Storage - localhost (1)')
expect(table.data).to.have.length(1)
expect(table.data).to.deep.eq([{ key: 'stor-foo', value: 's-f' }])
table = consoleProps.table[2]()
expect(table.name).to.contain('Storage - example.com (1)')
expect(table.data).to.have.length(1)
expect(table.data).to.deep.eq([{ key: 'random', value: 'hi' }])
})
})
describe('.navigateAboutBlank', () => {
it('triggers session blank page visit', () => {
const stub = cy.stub(Cypress, 'action').log(false)
.callThrough()
.withArgs('cy:visit:blank')
cy.then(() => {
navigateAboutBlank()
navigateAboutBlank(true)
expect(stub).to.have.been.calledTwice
expect(stub.args[0]).to.deep.eq(['cy:visit:blank', { type: 'session' }])
expect(stub.args[1]).to.deep.eq(['cy:visit:blank', { type: 'session' }])
})
})
it('triggers session-lifecycle blank page visit', () => {
const stub = cy.stub(Cypress, 'action').log(false)
.callThrough()
.withArgs('cy:visit:blank')
cy.then(() => {
navigateAboutBlank(false)
expect(stub).to.have.been.calledWith('cy:visit:blank', { type: 'session-lifecycle' })
})
})
})
})

View File

@@ -14,20 +14,17 @@
"dependencies": {},
"devDependencies": {
"@babel/code-frame": "7.8.3",
"@cypress/bower-kendo-ui": "0.0.2",
"@cypress/sinon-chai": "2.9.1",
"@cypress/unique-selector": "0.4.4",
"@cypress/webpack-preprocessor": "0.0.0-development",
"@cypress/what-is-circular": "1.0.1",
"@packages/config": "0.0.0-development",
"@packages/network": "0.0.0-development",
"@packages/resolve-dist": "0.0.0-development",
"@packages/runner": "0.0.0-development",
"@packages/runner-shared": "0.0.0-development",
"@packages/server": "0.0.0-development",
"@packages/socket": "0.0.0-development",
"@packages/ts": "0.0.0-development",
"@rollup/plugin-node-resolve": "^13.0.4",
"@sinonjs/fake-timers": "8.1.0",
"@types/chalk": "^2.2.0",
"@types/common-tags": "^1.8.0",
@@ -40,12 +37,9 @@
"blob-util": "2.0.2",
"bluebird": "3.5.3",
"body-parser": "1.19.0",
"bootstrap": "4.4.1",
"bytes": "3.1.0",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"chai-subset": "1.6.0",
"chokidar-cli": "2.1.0",
"clone": "2.1.2",
"compression": "1.7.4",
"cookie-parser": "1.4.5",
@@ -62,7 +56,6 @@
"is-valid-hostname": "1.0.1",
"jquery": "3.1.1",
"js-cookie": "2.2.1",
"jsdom": "14.1.0",
"json-stable-stringify": "1.0.1",
"lodash": "^4.17.21",
"md5": "2.3.0",
@@ -70,9 +63,7 @@
"methods": "1.1.2",
"mime-types": "2.1.27",
"minimatch": "3.0.4",
"minimist": "1.2.6",
"mocha": "7.0.1",
"morgan": "1.9.1",
"multer": "1.4.2",
"ordinal": "1.0.3",
"react-15.6.1": "npm:react@15.6.1",

View File

@@ -174,6 +174,8 @@ export default function (Commands, Cypress, cy, state, config) {
}
const type = function () {
const isFirefoxBefore98 = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() < 98
const simulateSubmitHandler = function () {
const form = options.$el.parents('form')
@@ -231,11 +233,11 @@ export default function (Commands, Cypress, cy, state, config) {
return
}
// In Firefox, submit event is automatically fired
// Before Firefox 98, submit event is automatically fired
// when we send {Enter} KeyboardEvent to the input fields.
// Because of that, we don't have to click the submit buttons.
// Otherwise, we trigger submit events twice.
if (!Cypress.isBrowser('firefox')) {
if (!isFirefoxBefore98) {
// issue the click event to the 'default button' of the form
// we need this to be synchronous so not going through our
// own click command
@@ -274,7 +276,6 @@ export default function (Commands, Cypress, cy, state, config) {
const isContentEditable = $elements.isContentEditable(options.$el.get(0))
const isTextarea = $elements.isTextarea(options.$el.get(0))
const isFirefoxBefore98 = Cypress.isBrowser('firefox') && Cypress.browserMajorVersion() < 98
const fireClickEvent = (el) => {
const ctor = $dom.getDocumentFromElement(el).defaultView!.PointerEvent

View File

@@ -1,10 +1,16 @@
import _ from 'lodash'
import $ from 'jquery'
import { $Location } from '../../cypress/location'
import $errUtils from '../../cypress/error_utils'
import { $Location } from '../../../cypress/location'
import $errUtils from '../../../cypress/error_utils'
import stringifyStable from 'json-stable-stringify'
import $stackUtils from '../../cypress/stack_utils'
import Bluebird from 'bluebird'
import $stackUtils from '../../../cypress/stack_utils'
import {
getSessionDetails,
getCurrentOriginStorage,
setPostMessageLocalStorage,
getConsoleProps,
getPostMessageLocalStorage,
navigateAboutBlank,
} from './utils'
const currentTestRegisteredSessions = new Map()
type ActiveSessions = Cypress.Commands.Session.ActiveSessions
@@ -18,193 +24,6 @@ type SessionData = Cypress.Commands.Session.SessionData
* therefore session data should be cleared with spec browser launch
*/
const getSessionDetails = (sessState: SessionData) => {
return {
id: sessState.id,
data: _.merge(
_.mapValues(_.groupBy(sessState.cookies, 'domain'), (v) => ({ cookies: v.length })),
..._.map(sessState.localStorage, (v) => ({ [$Location.create(v.origin).hostname]: { localStorage: Object.keys(v.value).length } })),
) }
}
const getSessionDetailsForTable = (sessState: SessionData) => {
return _.merge(
_.mapValues(_.groupBy(sessState.cookies, 'domain'), (v) => ({ cookies: v })),
..._.map(sessState.localStorage, (v) => ({ [$Location.create(v.origin).hostname]: { localStorage: v } })),
)
}
const isSecureContext = (url: string) => url.startsWith('https:')
const getCurrentOriginStorage = () => {
// localStorage.length property is not always accurate, we must stringify to check for entries
// for ex) try setting localStorage.key = 'val' and reading localStorage.length, may be 0.
const _localStorageStr = JSON.stringify(window.localStorage)
const _localStorage = _localStorageStr.length > 2 && JSON.parse(_localStorageStr)
const _sessionStorageStr = JSON.stringify(window.sessionStorage)
const _sessionStorage = _sessionStorageStr.length > 2 && JSON.parse(JSON.stringify(window.sessionStorage))
const value = {} as any
if (_localStorage) {
value.localStorage = _localStorage
}
if (_sessionStorage) {
value.sessionStorage = _sessionStorage
}
return value
}
const setPostMessageLocalStorage = async (specWindow, originOptions) => {
const origins = originOptions.map((v) => v.origin) as string[]
const iframes: JQuery<HTMLElement>[] = []
const $iframeContainer = $(`<div style="display:none"></div>`).appendTo($('body', specWindow.document))
// if we're on an https domain, there is no way for the secure context to access insecure origins from iframes
// since there is no way for the app to access localStorage on insecure contexts, we don't have to clear any localStorage on http domains.
if (isSecureContext(specWindow.location.href)) {
_.remove(origins, (v) => !isSecureContext(v))
}
if (!origins.length) return []
_.each(origins, (u) => {
const $iframe = $(`<iframe src="${`${u}/__cypress/automation/setLocalStorage?${u}`}"></iframe>`)
$iframe.appendTo($iframeContainer)
iframes.push($iframe)
})
let onPostMessage
const successOrigins = [] as string[]
return new Bluebird((resolve) => {
onPostMessage = (event) => {
const data = event.data
if (data.type === 'set:storage:load') {
if (!event.source) {
throw new Error('failed to get localStorage')
}
const opts = _.find(originOptions, { origin: event.origin })!
event.source.postMessage({ type: 'set:storage:data', data: opts }, '*')
} else if (data.type === 'set:storage:complete') {
successOrigins.push(event.origin)
if (successOrigins.length === origins.length) {
resolve()
}
}
}
specWindow.addEventListener('message', onPostMessage)
})
// timeout just in case something goes wrong and the iframe never loads in
.timeout(2000)
.finally(() => {
specWindow.removeEventListener('message', onPostMessage)
$iframeContainer.remove()
})
.catch(() => {
Cypress.log({
name: 'warning',
message: `failed to access session localStorage data on origin(s): ${_.xor(origins, successOrigins).join(', ')}`,
})
})
}
const getConsoleProps = (sessState: SessionData) => {
const sessionDetails = getSessionDetailsForTable(sessState)
const tables = _.flatMap(sessionDetails, (val, domain) => {
const cookiesTable = () => {
return {
name: `🍪 Cookies - ${domain} (${val.cookies.length})`,
data: val.cookies,
}
}
const localStorageTable = () => {
return {
name: `📁 Storage - ${domain} (${_.keys(val.localStorage.value).length})`,
data: _.map(val.localStorage.value, (value, key) => {
return {
key,
value,
}
}),
}
}
return [
val.cookies && cookiesTable,
val.localStorage && localStorageTable,
]
})
return {
id: sessState.id,
table: _.compact(tables),
}
}
const getPostMessageLocalStorage = (specWindow, origins): Promise<any[]> => {
const results = [] as any[]
const iframes: JQuery<HTMLElement>[] = []
let onPostMessage
const successOrigins = [] as string[]
const $iframeContainer = $(`<div style="display:none"></div>`).appendTo($('body', specWindow.document))
_.each(origins, (u) => {
const $iframe = $(`<iframe src="${`${u}/__cypress/automation/getLocalStorage`}"></iframe>`)
$iframe.appendTo($iframeContainer)
iframes.push($iframe)
})
return new Bluebird((resolve) => {
// when the cross-origin iframe for each origin is loaded
// we can only communicate through postmessage
onPostMessage = ((event) => {
const data = event.data
if (data.type !== 'localStorage') return
const value = data.value
results.push([event.origin, value])
successOrigins.push(event.origin)
if (successOrigins.length === origins.length) {
resolve(results)
}
})
specWindow.addEventListener('message', onPostMessage)
})
// timeout just in case something goes wrong and the iframe never loads in
.timeout(2000)
.finally(() => {
specWindow.removeEventListener('message', onPostMessage)
$iframeContainer.remove()
})
.catch((err) => {
Cypress.log({
name: 'warning',
message: `failed to access session localStorage data on origin(s): ${_.xor(origins, successOrigins).join(', ')}`,
})
return []
})
}
export default function (Commands, Cypress, cy) {
const { Promise } = Cypress
@@ -871,9 +690,3 @@ export default function (Commands, Cypress, cy) {
Cypress.session = sessions
}
function navigateAboutBlank (session = true) {
Cypress.action('cy:url:changed', '')
return Cypress.action('cy:visit:blank', { type: session ? 'session' : 'session-lifecycle' }) as unknown as Promise<void>
}

View File

@@ -0,0 +1,208 @@
import _ from 'lodash'
import $ from 'jquery'
import { $Location } from '../../../cypress/location'
import Bluebird from 'bluebird'
type SessionData = Cypress.Commands.Session.SessionData
const getSessionDetails = (sessState: SessionData) => {
return {
id: sessState.id,
data: _.merge(
_.mapValues(_.groupBy(sessState.cookies, 'domain'), (v) => ({ cookies: v.length })),
..._.map(sessState.localStorage, (v) => ({ [$Location.create(v.origin).hostname]: { localStorage: Object.keys(v.value).length } })),
) }
}
const getSessionDetailsForTable = (sessState: SessionData) => {
return _.merge(
_.mapValues(_.groupBy(sessState.cookies, 'domain'), (v) => ({ cookies: v })),
..._.map(sessState.localStorage, (v) => ({ [$Location.create(v.origin).hostname]: { localStorage: v } })),
)
}
const isSecureContext = (url: string) => url.startsWith('https:')
const getCurrentOriginStorage = () => {
// localStorage.length property is not always accurate, we must stringify to check for entries
// for ex) try setting localStorage.key = 'val' and reading localStorage.length, may be 0.
const _localStorageStr = JSON.stringify(window.localStorage)
const _localStorage = _localStorageStr.length > 2 && JSON.parse(_localStorageStr)
const _sessionStorageStr = JSON.stringify(window.sessionStorage)
const _sessionStorage = _sessionStorageStr.length > 2 && JSON.parse(JSON.stringify(window.sessionStorage))
const value = {} as any
if (_localStorage) {
value.localStorage = _localStorage
}
if (_sessionStorage) {
value.sessionStorage = _sessionStorage
}
return value
}
const setPostMessageLocalStorage = async (specWindow, originOptions) => {
const origins = originOptions.map((v) => v.origin) as string[]
const iframes: JQuery<HTMLElement>[] = []
const $iframeContainer = $(`<div style="display:none"></div>`).appendTo($('body', specWindow.document))
// if we're on an https domain, there is no way for the secure context to access insecure origins from iframes
// since there is no way for the app to access localStorage on insecure contexts, we don't have to clear any localStorage on http domains.
if (isSecureContext(specWindow.location.href)) {
_.remove(origins, (v) => !isSecureContext(v))
}
if (!origins.length) return []
_.each(origins, (u) => {
const $iframe = $(`<iframe src="${`${u}/__cypress/automation/setLocalStorage?${u}`}"></iframe>`)
$iframe.appendTo($iframeContainer)
iframes.push($iframe)
})
let onPostMessage
const successOrigins = [] as string[]
return new Bluebird((resolve) => {
onPostMessage = (event) => {
const data = event.data
if (data.type === 'set:storage:load') {
if (!event.source) {
throw new Error('failed to get localStorage')
}
const opts = _.find(originOptions, { origin: event.origin })!
event.source.postMessage({ type: 'set:storage:data', data: opts }, '*')
} else if (data.type === 'set:storage:complete') {
successOrigins.push(event.origin)
if (successOrigins.length === origins.length) {
resolve()
}
}
}
specWindow.addEventListener('message', onPostMessage)
})
// timeout just in case something goes wrong and the iframe never loads in
.timeout(2000)
.finally(() => {
specWindow.removeEventListener('message', onPostMessage)
$iframeContainer.remove()
})
.catch(() => {
Cypress.log({
name: 'warning',
message: `failed to access session localStorage data on origin(s): ${_.xor(origins, successOrigins).join(', ')}`,
})
})
}
const getConsoleProps = (sessState: SessionData) => {
const sessionDetails = getSessionDetailsForTable(sessState)
const tables = _.flatMap(sessionDetails, (val, domain) => {
const cookiesTable = () => {
return {
name: `🍪 Cookies - ${domain} (${val.cookies.length})`,
data: val.cookies,
}
}
const localStorageTable = () => {
return {
name: `📁 Storage - ${domain} (${_.keys(val.localStorage.value).length})`,
data: _.map(val.localStorage.value, (value, key) => {
return {
key,
value,
}
}),
}
}
return [
val.cookies && cookiesTable,
val.localStorage && localStorageTable,
]
})
return {
id: sessState.id,
table: _.compact(tables),
}
}
const getPostMessageLocalStorage = (specWindow, origins): Promise<any[]> => {
const results = [] as any[]
const iframes: JQuery<HTMLElement>[] = []
let onPostMessage
const successOrigins = [] as string[]
const $iframeContainer = $(`<div style="display:none"></div>`).appendTo($('body', specWindow.document))
_.each(origins, (u) => {
const $iframe = $(`<iframe src="${`${u}/__cypress/automation/getLocalStorage`}"></iframe>`)
$iframe.appendTo($iframeContainer)
iframes.push($iframe)
})
return new Bluebird((resolve) => {
// when the cross-domain iframe for each domain is loaded
// we can only communicate through postmessage
onPostMessage = ((event) => {
const data = event.data
if (data.type !== 'localStorage') return
const value = data.value
results.push([event.origin, value])
successOrigins.push(event.origin)
if (successOrigins.length === origins.length) {
resolve(results)
}
})
specWindow.addEventListener('message', onPostMessage)
})
// timeout just in case something goes wrong and the iframe never loads in
.timeout(2000)
.finally(() => {
specWindow.removeEventListener('message', onPostMessage)
$iframeContainer.remove()
})
.catch((err) => {
Cypress.log({
name: 'warning',
message: `failed to access session localStorage data on origin(s): ${_.xor(origins, successOrigins).join(', ')}`,
})
return []
})
}
function navigateAboutBlank (session: boolean = true) {
Cypress.action('cy:url:changed', '')
return Cypress.action('cy:visit:blank', { type: session ? 'session' : 'session-lifecycle' }) as unknown as Promise<void>
}
export {
getSessionDetails,
getCurrentOriginStorage,
setPostMessageLocalStorage,
getConsoleProps,
getPostMessageLocalStorage,
navigateAboutBlank,
}

View File

@@ -23,7 +23,7 @@
"minimist": "1.2.6"
},
"devDependencies": {
"electron": "15.3.5",
"electron": "15.5.1",
"electron-packager": "15.4.0",
"execa": "4.1.0",
"mocha": "3.5.3"

View File

@@ -25,7 +25,6 @@
"@types/chai": "4.2.15",
"@types/mocha": "8.2.2",
"@types/node": "14.14.31",
"@types/pixelmatch": "^5.2.4",
"@types/pngjs": "^6.0.1",
"@types/strip-ansi": "^5.2.1",
"ansi-styles": "^5",

View File

@@ -23,13 +23,10 @@
"@cypress/icons": "0.7.0",
"@packages/socket": "0.0.0-development",
"chai": "3.5.0",
"coffeescript": "1.12.7",
"cross-env": "6.0.3",
"eol": "0.9.1",
"fs-extra": "9.1.0",
"gulp": "4.0.2",
"gulp-clean": "0.4.0",
"gulp-rename": "1.4.0",
"mocha": "3.5.3",
"mock-require": "3.0.3",
"rimraf": "3.0.2",

View File

@@ -24,7 +24,6 @@
"@packages/ts": "0.0.0-development",
"chai": "3.5.0",
"chai-as-promised": "7.1.1",
"cross-env": "6.0.3",
"mocha": "3.5.3",
"shelljs": "0.8.5",
"sinon": "^10.0.0",

View File

@@ -18,7 +18,6 @@
"throttle": "^1.0.3"
},
"devDependencies": {
"bin-up": "1.2.0",
"chai": "4.2.0",
"mocha": "7.1.2"
},

View File

@@ -16,14 +16,10 @@
"@fontsource/open-sans": "4.3.0",
"@fortawesome/fontawesome-free": "5.11.2",
"@packages/driver": "0.0.0-development",
"@packages/resolve-dist": "0.0.0-development",
"@packages/socket": "0.0.0-development",
"@packages/web-config": "0.0.0-development",
"@reach/dialog": "0.10.5",
"@reach/visually-hidden": "0.10.4",
"classnames": "2.3.1",
"css-element-queries": "1.2.3",
"cypress-multi-reporters": "1.4.0",
"cypress-real-events": "1.4.0",
"lodash": "^4.17.21",
"markdown-it": "11.0.0",
@@ -34,8 +30,7 @@
"react": "16.8.6",
"react-dom": "16.8.6",
"sinon": "7.5.0",
"webpack": "4.35.3",
"webpack-cli": "3.3.2"
"webpack": "4.35.3"
},
"files": []
}

View File

@@ -23,7 +23,6 @@
"@cypress/request-promise": "4.2.6",
"@types/parse5-html-rewriting-stream": "5.1.1",
"fs-extra": "9.1.0",
"nock": "12.0.3",
"sinon": "9.0.2",
"sinon-chai": "3.5.0",
"snap-shot-it": "7.9.3"

View File

@@ -31,7 +31,6 @@
"react-dom": "16.8.6",
"react-popper": "2.2.5",
"react-shadow-dom-retarget-events": "1.0.11",
"sinon": "7.5.0",
"sinon-chai": "3.3.0"
"sinon": "7.5.0"
}
}

View File

@@ -16,14 +16,10 @@
"test-watch": "yarn test-unit --watch",
"watch": "webpack --watch --progress"
},
"dependencies": {
"fs-extra": "9.1.0"
},
"devDependencies": {
"@cypress/design-system": "0.0.0-development",
"@cypress/icons": "0.7.0",
"@cypress/react-tooltip": "0.5.3",
"@cypress/webpack-preprocessor": "0.0.0-development",
"@fontsource/mulish": "4.3.0",
"@fontsource/open-sans": "4.3.0",
"@fortawesome/fontawesome-free": "5.12.1",
@@ -31,8 +27,6 @@
"@packages/reporter": "0.0.0-development",
"@packages/socket": "0.0.0-development",
"@packages/web-config": "0.0.0-development",
"@reach/dialog": "0.10.5",
"@reach/visually-hidden": "0.10.4",
"babel-plugin-prismjs": "1.0.2",
"bluebird": "3.5.3",
"chai": "4.2.0",
@@ -45,7 +39,6 @@
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
"jquery": "3.1.1",
"jsdom": "14.1.0",
"lodash": "^4.17.21",
"mobx": "5.15.4",
"mobx-react": "6.1.8",
@@ -55,10 +48,8 @@
"react": "16.8.6",
"react-dom": "16.8.6",
"sinon": "7.5.0",
"sinon-chai": "3.3.0",
"snap-shot-core": "10.2.1",
"webpack": "4.35.3",
"webpack-cli": "3.3.2"
"webpack": "4.35.3"
},
"files": [
"dist"

View File

@@ -15,8 +15,7 @@
"test": "node ./test/scripts/run.js",
"test-integration": "node ./test/scripts/run.js --glob-in-dir=test/integration",
"test-performance": "node ./test/scripts/run.js --glob-in-dir=test/performance",
"test-unit": "node ./test/scripts/run.js --glob-in-dir=test/unit",
"test-watch": "./test/support/watch test"
"test-unit": "node ./test/scripts/run.js --glob-in-dir=test/unit"
},
"dependencies": {
"@babel/parser": "7.13.0",
@@ -30,7 +29,6 @@
"@cypress/webpack-batteries-included-preprocessor": "0.0.0-development",
"@cypress/webpack-preprocessor": "0.0.0-development",
"@ffmpeg-installer/ffmpeg": "1.1.0",
"ansi_up": "5.0.0",
"ast-types": "0.13.3",
"black-hole-stream": "0.0.1",
"bluebird": "3.7.2",
@@ -114,7 +112,6 @@
"tree-kill": "1.2.2",
"ts-node": "8.5.4",
"tsconfig-paths": "3.10.1",
"tslib": "2.3.0",
"underscore.string": "3.3.5",
"url-parse": "1.5.9",
"uuid": "8.3.2",
@@ -128,7 +125,6 @@
"@cypress/debugging-proxy": "2.0.1",
"@cypress/json-schemas": "5.39.0",
"@cypress/sinon-chai": "2.9.1",
"@ffprobe-installer/ffprobe": "1.1.0",
"@packages/config": "0.0.0-development",
"@packages/desktop-gui": "0.0.0-development",
"@packages/electron": "0.0.0-development",
@@ -138,7 +134,6 @@
"@packages/launcher": "0.0.0-development",
"@packages/net-stubbing": "0.0.0-development",
"@packages/network": "0.0.0-development",
"@packages/reporter": "0.0.0-development",
"@packages/resolve-dist": "0.0.0-development",
"@packages/root": "0.0.0-development",
"@packages/socket": "0.0.0-development",
@@ -148,23 +143,15 @@
"@types/chrome": "0.0.101",
"@types/http-proxy": "1.17.4",
"@types/node": "14.14.31",
"awesome-typescript-loader": "5.2.1",
"babel-loader": "8.1.0",
"body-parser": "1.19.0",
"chai-as-promised": "7.1.1",
"chai-subset": "1.6.0",
"chai-uuid": "1.0.6",
"chokidar-cli": "2.1.0",
"chrome-har-capturer": "0.13.4",
"cors": "2.8.5",
"cross-env": "6.0.3",
"devtools-protocol": "0.0.839267",
"eol": "0.9.1",
"eventsource": "1.0.7",
"express-session": "1.16.1",
"express-useragent": "1.0.15",
"https-proxy-agent": "3.0.1",
"istanbul": "0.4.5",
"mocha": "7.1.0",
"mocha-banner": "1.1.2",
"mochawesome-1.5.2": "npm:mochawesome@1.5.2",
@@ -173,21 +160,15 @@
"mock-fs": "5.1.1",
"mocked-env": "1.2.4",
"mockery": "2.1.0",
"multer": "1.4.2",
"nock": "12.0.2",
"proxyquire": "2.1.3",
"react": "16.8.6",
"repl.history": "0.1.4",
"sinon": "5.1.1",
"snap-shot-it": "7.9.3",
"ssestream": "1.0.1",
"supertest": "4.0.2",
"supertest-session": "4.0.0",
"through2": "2.0.5",
"ts-loader": "7.0.4",
"webpack": "4.43.0",
"ws": "5.2.3",
"xvfb": "cypress-io/node-xvfb#22e3783c31d81ebe64d8c0df491ea00cdc74726a",
"xvfb-maybe": "0.2.1"
},
"files": [

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
CMD="$1"
ARGS="$2"
npm run --silent $CMD $ARGS & \
chokidar 'test/**/*' 'lib/**/*' \
-c "yarn --silent $CMD $ARGS" \
--polling \
--poll-interval=250

View File

@@ -28,7 +28,6 @@
"browser-logos": "github:alrra/browser-logos",
"chai-subset": "1.6.0",
"classnames": "2.3.1",
"cypress-multi-reporters": "1.4.0",
"file-loader": "4.3.0",
"lodash": "^4.17.19",
"mobx": "5.15.4",
@@ -36,7 +35,6 @@
"prop-types": "15.7.2",
"react": "16.8.6",
"react-dom": "16.8.6",
"webpack": "4.41.6",
"webpack-cli": "3.3.11"
"webpack": "4.41.6"
}
}
}

View File

@@ -26,7 +26,6 @@
"copy-webpack-plugin": "5.1.2",
"css-loader": "2.1.1",
"css-modules-typescript-loader": "4.0.1",
"execa": "^5.0.0",
"extract-text-webpack-plugin": "4.0.0-beta.0",
"file-loader": "4.3.0",
"html-webpack-plugin": "4.5.2",

1741
yarn.lock

File diff suppressed because it is too large Load Diff