Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into issue-1096-firefox…
Browse files Browse the repository at this point in the history
…-support
  • Loading branch information
kuceb committed Jan 14, 2020
2 parents 099ac58 + d513144 commit 145c1ac
Show file tree
Hide file tree
Showing 45 changed files with 2,149 additions and 1,241 deletions.
13 changes: 7 additions & 6 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<!-- Is this a question? Don't open an issue. Ask in our chat https://on.cypress.io/chat -->
<!-- Is this a question? Questions WILL BE CLOSED. Ask in our chat https://on.cypress.io/chat -->

### Current behavior:

<!-- images, stack traces, etc -->
<!-- A description including screenshots, stack traces, DEBUG logs, etc -->

### Desired behavior:

<!-- A clear concise description of what you want to happen -->
<!-- A clear description of what you want to happen -->

### Steps to reproduce: (app code and test code)
### Test code to reproduce

<!-- Issues without reproducible steps WILL BE CLOSED -->
<!-- If we cannot fully run the tests as provided the issue WILL BE CLOSED -->
<!-- Issues without a reproducible example WILL BE CLOSED -->

<!-- You can fork https://github.com/cypress-io/cypress-test-tiny repo, set up a failing test, then tell us the repo/branch to try. -->
<!-- You can fork https://github.com/cypress-io/cypress-test-tiny repo, set up a failing test, then link to your fork -->

### Versions

Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.0.0
12.8.1
1 change: 1 addition & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ In the following instructions, "X.Y.Z" is used to denote the version of Cypress
12. Update the releases in [ZenHub](https://app.zenhub.com/workspaces/test-runner-5c3ea3baeb1e75374f7b0708/reports/release):
- Close the current release in ZenHub.
- Create a new patch release (and a new minor release, if this is a minor release) in ZenHub, and schedule them both to be completed 2 weeks from the current date.
- Move all issues that are still open from the current release to the appropriate future release.
13. Bump `version` in [`package.json`](package.json) and commit it to `develop` using a commit message like `release X.Y.Z [skip ci]`
14. Tag this commit with `vX.Y.Z` and push that tag up.
15. Merge `develop` into `master` and push that branch up.
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branches:
# https://www.appveyor.com/docs/lang/nodejs-iojs/
environment:
# use matching version of Node.js
nodejs_version: "12.0.0"
nodejs_version: "12.8.1"
# encode secure variables which will NOT be used
# in pull requests
# https://www.appveyor.com/docs/build-configuration/#secure-variables
Expand Down
18 changes: 14 additions & 4 deletions cli/lib/tasks/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,21 @@ const getDistDir = () => {
return path.join(__dirname, '..', '..', 'dist')
}

/**
* Returns full filename to the file that keeps the Test Runner verification state as JSON text.
* Note: the binary state file will be stored one level up from the given binary folder.
* @param {string} binaryDir - full path to the folder holding the binary.
*/
const getBinaryStatePath = (binaryDir) => {
return path.join(binaryDir, 'binary_state.json')
return path.join(binaryDir, '..', 'binary_state.json')
}

const getBinaryStateContentsAsync = (binaryDir) => {
return fs.readJsonAsync(getBinaryStatePath(binaryDir))
const fullPath = getBinaryStatePath(binaryDir)

return fs.readJsonAsync(fullPath)
.catch({ code: 'ENOENT' }, SyntaxError, () => {
debug('could not read binary_state.json file')
debug('could not read binary_state.json file at "%s"', fullPath)

return {}
})
Expand All @@ -132,7 +139,10 @@ const clearBinaryStateAsync = (binaryDir) => {
}

/**
* @param {boolean} verified
* Writes the new binary status.
* @param {boolean} verified The new test runner state after smoke test
* @param {string} binaryDir Folder holding the binary
* @returns {Promise<void>} returns a promise
*/
const writeBinaryVerifiedAsync = (verified, binaryDir) => {
return getBinaryStateContentsAsync(binaryDir)
Expand Down
1 change: 1 addition & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"commander": "2.15.1",
"common-tags": "1.8.0",
"debug": "3.2.6",
"eventemitter2": "4.1.2",
"execa": "0.10.0",
"executable": "4.1.1",
"extract-zip": "1.6.7",
Expand Down
16 changes: 10 additions & 6 deletions cli/test/lib/tasks/state_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,18 @@ describe('lib/tasks/state', function () {
})

it('can accept custom binaryDir', function () {
const customBinaryDir = '/custom/binary/dir'
// note how the binary state file is in the runner's parent folder
const customBinaryDir = '/custom/binary/1.2.3/runner'
const binaryStatePath = '/custom/binary/1.2.3/binary_state.json'

sinon
.stub(fs, 'pathExistsAsync')
.withArgs('/custom/binary/dir/binary_state.json')
.resolves({ verified: true })
.withArgs(binaryStatePath)
.resolves(true)

sinon
.stub(fs, 'readJsonAsync')
.withArgs('/custom/binary/dir/binary_state.json')
.withArgs(binaryStatePath)
.resolves({ verified: true })

return state
Expand All @@ -200,6 +202,8 @@ describe('lib/tasks/state', function () {
})

context('.writeBinaryVerified', function () {
const binaryStateFilename = path.join(versionDir, 'binary_state.json')

beforeEach(() => {
mockfs({})
})
Expand All @@ -216,7 +220,7 @@ describe('lib/tasks/state', function () {
.then(
() => {
return expect(fs.outputJsonAsync).to.be.calledWith(
path.join(binaryDir, 'binary_state.json'),
binaryStateFilename,
{ verified: true }
)
},
Expand All @@ -231,7 +235,7 @@ describe('lib/tasks/state', function () {
.writeBinaryVerifiedAsync(false, binaryDir)
.then(() => {
return expect(fs.outputJsonAsync).to.be.calledWith(
path.join(binaryDir, 'binary_state.json'),
binaryStateFilename,
{ verified: false },
{ spaces: 2 }
)
Expand Down
22 changes: 19 additions & 3 deletions cli/test/lib/tasks/verify_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require('../../spec_helper')

const path = require('path')
const _ = require('lodash')
const os = require('os')
const cp = require('child_process')
Expand All @@ -23,7 +24,7 @@ const snapshot = require('../../support/snapshot')
const packageVersion = '1.2.3'
const cacheDir = '/cache/Cypress'
const executablePath = '/cache/Cypress/1.2.3/Cypress.app/Contents/MacOS/Cypress'
const binaryStatePath = '/cache/Cypress/1.2.3/Cypress.app/binary_state.json'
const binaryStatePath = '/cache/Cypress/1.2.3/binary_state.json'

let stdout
let spawnedProcess
Expand Down Expand Up @@ -747,9 +748,24 @@ context('lib/tasks/verify', () => {

// TODO this needs documentation with examples badly.
function createfs ({ alreadyVerified, executable, packageVersion, customDir }) {
if (!customDir) {
customDir = '/cache/Cypress/1.2.3/Cypress.app'
}

// binary state is stored one folder higher than the runner itself
// see https://github.com/cypress-io/cypress/issues/6089
const binaryStateFolder = path.join(customDir, '..')

const binaryState = {
verified: alreadyVerified,
}
const binaryStateText = JSON.stringify(binaryState)

let mockFiles = {
[customDir ? customDir : '/cache/Cypress/1.2.3/Cypress.app']: {
'binary_state.json': `{"verified": ${alreadyVerified}}`,
[binaryStateFolder]: {
'binary_state.json': binaryStateText,
},
[customDir]: {
Contents: {
MacOS: executable
? {
Expand Down
5 changes: 5 additions & 0 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ declare module 'cypress' {
totalPassed: number
totalPending: number
totalSkipped: number
/**
* If Cypress test run is being recorded, full url will be provided.
* @see https://on.cypress.io/dashboard-introduction
*/
runUrl?: string
runs: RunResult[]
browserPath: string
browserName: string
Expand Down
13 changes: 11 additions & 2 deletions cli/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
// hmm, how to load it better?
/// <reference path="./cypress-npm-api.d.ts" />

// Cypress, cy, Log inherits EventEmitter.
type EventEmitter2 = import("eventemitter2").EventEmitter2

interface EventEmitter extends EventEmitter2 {
proxyTo: (cy: Cypress.cy) => null
emitMap: (eventName: string, args: any[]) => Array<(...args: any[]) => any>
emitThen: (eventName: string, args: any[]) => Bluebird.BluebirdStatic
}

// Cypress adds chai expect and assert to global
declare const expect: Chai.ExpectStatic
declare const assert: Chai.AssertStatic
Expand Down Expand Up @@ -4524,7 +4533,7 @@ cy.get('button').click()
cy.get('.result').contains('Expected text')
```
*/
declare const cy: Cypress.cy
declare const cy: Cypress.cy & EventEmitter

/**
* Global variable `Cypress` holds common utilities and constants.
Expand All @@ -4536,4 +4545,4 @@ Cypress.version // => "1.4.0"
Cypress._ // => Lodash _
```
*/
declare const Cypress: Cypress.Cypress
declare const Cypress: Cypress.Cypress & EventEmitter
1 change: 1 addition & 0 deletions cli/types/tests/cypress-npm-api-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cypress.run().then(results => {
results // $ExpectType CypressRunResult
results.failures // $ExpectType number | undefined
results.message // $ExpectType string | undefined
results.runUrl // $ExpectType string | undefined
})
cypress.open() // $ExpectType Promise<void>
cypress.run() // $ExpectType Promise<CypressRunResult>
Expand Down
21 changes: 14 additions & 7 deletions cli/types/tests/kitchen-sink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ stub()
expect(stub).to.have.been.calledOnce
cy.wrap(stub).should('have.been.calledOnce')

// window:confirm stubbing
Cypress.on('window:confirm', () => { })
Cypress.on('window:confirm', cy.spy())
Cypress.on('window:confirm', cy.stub())
cy.on('window:confirm', () => { })
cy.on('window:confirm', cy.spy())
cy.on('window:confirm', cy.stub())
namespace EventInterfaceTests {
// window:confirm stubbing
Cypress.on('window:confirm', () => { })
Cypress.on('window:confirm', cy.spy())
Cypress.on('window:confirm', cy.stub())
cy.on('window:confirm', () => { })
cy.on('window:confirm', cy.spy())
cy.on('window:confirm', cy.stub())

Cypress.removeListener('fail', () => {})
Cypress.removeAllListeners('fail')
cy.removeListener('fail', () => {})
cy.removeAllListeners('fail')
}

// specifying HTTP method directly in the options object
cy.request({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "3.8.1",
"version": "3.8.2",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
Expand Down Expand Up @@ -171,7 +171,7 @@
"vinyl-paths": "2.1.0"
},
"engines": {
"node": "12.0.0"
"node": "12.8.1"
},
"productName": "Cypress",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"env": {
"browser": true
}
},
"parser": "@typescript-eslint/parser"
}
Loading

1 comment on commit 145c1ac

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 145c1ac Jan 14, 2020

Choose a reason for hiding this comment

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

Circle has built the linux 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.

export CYPRESS_INSTALL_BINARY=https://cdn.cypress.io/beta/binary/3.8.3/linux-x64/circle-issue-1096-firefox-support-145c1ac13926e97e05f11b55da6de0b5170de427-231331/cypress.zip
npm install https://cdn.cypress.io/beta/npm/3.8.3/circle-issue-1096-firefox-support-145c1ac13926e97e05f11b55da6de0b5170de427-231324/cypress.tgz

Please sign in to comment.