mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-30 19:18:45 -06:00
* electron@7.x * node12.8.1-chrome78-ff70 * Revert "node12.8.1-chrome78-ff70" for now This reverts commitdb2d521994. * update sendCommand to log on all sendcommands * promisification in 6.x * Revert "Revert "node12.8.1-chrome78-ff70" for now" This reverts commit57fe764098. * fix sendcommand * fix cdp in electron * fix desktop-gui test * skip tests that will be fixed by #4973 * bump MAX_ALLOWED_FILE_SIZE :/ * update electron browser spec * make new dialog code null-proof * add failing e2e test for issue 5475 * bump electron packager * add e2e snapshot * update deprecated electron getters/setters https://github.com/electron/electron/blob/7-1-x/docs/api/modernization/property-updates.md * build and test on Mac * use electron-builder 20.41.0 that adds an option to use hardened Mac OS, which is necessary for code notarization later. See https://github.com/electron-userland/electron-builder/releases/tag/v20.41.0 and https://github.com/electron-userland/electron-builder/pull/3858 * electron-builder and pass hardenedRuntime: true * uncomment build * upload built binary on mac * back to 20.41.0, trying after sign hook without success * use current electron-builder alias instead of build * retry smoke test on first failure * testing * trying to notarize signed app (that does not have node_modules yet) * env variable names * copy node_modules ourselves * build and bundle binary on mac on circle, inject new context * enable build steps before electron build * increase mac build timeout * update build folder on mac * uncomment actual electron build command * set linux target to zip * set zip as target for all platforms * updated steps * put notarization hook back * tweaks for icons * remove dist electron before code sign * icons per platform * make node_modules copy path platform-specific * fix linux build unpacked folder * build mac * fix lint * test new mac binary against kitchensink * working on Linux build * try building entire thing on Linux * removing correct electron dist folder * increase zip size limit for now * add folder rename on Linux from linux-unpacked to Cypress * print file sizes before zipping * move linux-unpacked to build dir function * try deleting second electron file, but code signing probably would not work * test windows build [build binary] * ignore tsc errors * windows build path * windows [build binary] * update windows build folder * increase binary build timeout on Mac * no need to pass our dist folder * adding explicit list of additional binaries to code sign on mac * yarn lock * uncomment necessary build steps * electron dir for Linux * yarn lock again * back to execa v3 * use execa v4 in packages launcher * yarn lock again and again * updated tests that use execa * print build folder * add executable name on Linux * get rid of execa.shell in build scripts * remove old and commented out code * need to test building binary on Windows * throw error from after sign hook if fails * use execa to zip * yarn lock * fix after merge variable * update test * add nohoist ffmpeg installer * patch * yarn types pass * yarn lock has binary Co-authored-by: Zach Bloomquist <github@chary.us> Co-authored-by: Brian Mann <brian.mann86@gmail.com>
141 lines
3.9 KiB
CoffeeScript
141 lines
3.9 KiB
CoffeeScript
_ = require("lodash")
|
|
fse = require("fs-extra")
|
|
cp = require("child_process")
|
|
execa = require('execa')
|
|
path = require("path")
|
|
Promise = require("bluebird")
|
|
os = require("os")
|
|
verify = require("../../cli/lib/tasks/verify")
|
|
Fixtures = require("../../packages/server/test/support/helpers/fixtures")
|
|
|
|
fs = Promise.promisifyAll(fse)
|
|
|
|
canRecordVideo = () ->
|
|
os.platform() != "win32"
|
|
|
|
shouldSkipProjectTest = () ->
|
|
os.platform() == "win32"
|
|
|
|
runSmokeTest = (buildAppExecutable, timeoutSeconds = 30) ->
|
|
rand = String(_.random(0, 1000))
|
|
console.log("executable path #{buildAppExecutable}")
|
|
console.log("timeout #{timeoutSeconds} seconds")
|
|
|
|
hasRightResponse = (stdout) ->
|
|
# there could be more debug lines in the output, so find 1 line with
|
|
# expected random value
|
|
lines = stdout.split('\n').map((s) -> s.trim())
|
|
return lines.includes(rand)
|
|
|
|
args = []
|
|
if verify.needsSandbox()
|
|
args.push("--no-sandbox")
|
|
|
|
# separate any Electron command line arguments from Cypress args
|
|
args.push("--")
|
|
args.push("--smoke-test")
|
|
args.push("--ping=#{rand}")
|
|
|
|
options = {
|
|
timeout: timeoutSeconds * 1000
|
|
}
|
|
execa "#{buildAppExecutable}", args, options
|
|
.catch (err) ->
|
|
console.error("smoke test failed with error %s", err.message)
|
|
throw err
|
|
.then ({stdout}) ->
|
|
stdout = stdout.replace(/\s/, "")
|
|
if !hasRightResponse(stdout)
|
|
throw new Error("Stdout: '#{stdout}' did not match the random number: '#{rand}'")
|
|
console.log("smoke test response", stdout)
|
|
console.log("smokeTest passes")
|
|
|
|
runProjectTest = (buildAppExecutable, e2e) ->
|
|
if shouldSkipProjectTest()
|
|
console.log("skipping project test")
|
|
return Promise.resolve()
|
|
|
|
new Promise (resolve, reject) ->
|
|
env = _.omit(process.env, "CYPRESS_INTERNAL_ENV")
|
|
|
|
if !canRecordVideo()
|
|
console.log("cannot record video on this platform yet, disabling")
|
|
env.CYPRESS_VIDEO_RECORDING = "false"
|
|
|
|
args = [
|
|
"--run-project=#{e2e}",
|
|
"--spec=#{e2e}/cypress/integration/simple_passing_spec.coffee"
|
|
]
|
|
if verify.needsSandbox()
|
|
args.push("--no-sandbox")
|
|
options = {
|
|
stdio: "inherit", env: env
|
|
}
|
|
console.log("running project test")
|
|
console.log(buildAppExecutable, args.join(" "))
|
|
|
|
cp.spawn(buildAppExecutable, args, options)
|
|
.on "exit", (code) ->
|
|
if code is 0
|
|
resolve()
|
|
else
|
|
reject(new Error("running project tests failed with: '#{code}' errors."))
|
|
|
|
runFailingProjectTest = (buildAppExecutable, e2e) ->
|
|
if shouldSkipProjectTest()
|
|
console.log("skipping failing project test")
|
|
return Promise.resolve()
|
|
|
|
console.log("running failing project test")
|
|
|
|
verifyScreenshots = ->
|
|
screenshot1 = path.join(e2e, "cypress", "screenshots", "simple_failing_spec.coffee", "simple failing spec -- fails1 (failed).png")
|
|
screenshot2 = path.join(e2e, "cypress", "screenshots", "simple_failing_spec.coffee", "simple failing spec -- fails2 (failed).png")
|
|
|
|
Promise.all([
|
|
fs.statAsync(screenshot1)
|
|
fs.statAsync(screenshot2)
|
|
])
|
|
|
|
spawn = ->
|
|
new Promise (resolve, reject) ->
|
|
env = _.omit(process.env, "CYPRESS_INTERNAL_ENV")
|
|
|
|
args = [
|
|
"--run-project=#{e2e}",
|
|
"--spec=#{e2e}/cypress/integration/simple_failing_spec.coffee"
|
|
]
|
|
if verify.needsSandbox()
|
|
args.push("--no-sandbox")
|
|
|
|
options = {
|
|
stdio: "inherit",
|
|
env
|
|
}
|
|
cp.spawn(buildAppExecutable, args, options)
|
|
.on "exit", (code) ->
|
|
if code is 2
|
|
resolve()
|
|
else
|
|
reject(new Error("running project tests failed with: '#{code}' errors."))
|
|
|
|
spawn()
|
|
.then(verifyScreenshots)
|
|
|
|
test = (buildAppExecutable) ->
|
|
Fixtures.scaffold()
|
|
|
|
e2e = Fixtures.projectPath("e2e")
|
|
|
|
runSmokeTest(buildAppExecutable)
|
|
.then ->
|
|
runProjectTest(buildAppExecutable, e2e)
|
|
.then ->
|
|
runFailingProjectTest(buildAppExecutable, e2e)
|
|
.then ->
|
|
Fixtures.remove()
|
|
|
|
module.exports = {
|
|
test
|
|
}
|