Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browser-versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"chrome:beta": "95.0.4638.40",
"chrome:stable": "94.0.4606.71"
"chrome:stable": "94.0.4606.81"
}
8 changes: 8 additions & 0 deletions npm/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# [@cypress/react-v5.10.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.10.0...@cypress/react-v5.10.1) (2021-10-04)


### Bug Fixes

* configure proper pages directory for next application ([#18009](https://github.com/cypress-io/cypress/issues/18009)) ([70c7c36](https://github.com/cypress-io/cypress/commit/70c7c3678180d5408c144fa37f94ba5f5f8ceeb8))
* next trace error ([#18189](https://github.com/cypress-io/cypress/issues/18189)) ([db6f909](https://github.com/cypress-io/cypress/commit/db6f9096bd6668db1937d0e38d3928866f6cd5df))

# [@cypress/react-v5.10.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.9.4...@cypress/react-v5.10.0) (2021-09-10)


Expand Down
9 changes: 9 additions & 0 deletions npm/vite-dev-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# [@cypress/vite-dev-server-v2.1.1](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.1.0...@cypress/vite-dev-server-v2.1.1) (2021-10-04)


### Bug Fixes

* **vite-dev-server:** remove base and root from inlineVitConfig types ([#17180](https://github.com/cypress-io/cypress/issues/17180)) ([07e7d0e](https://github.com/cypress-io/cypress/commit/07e7d0ed252bf1a2bd3224f617e1fc2e64f19a06))
* **vite-dev-server:** replace UserConfig with InlineConfig to allow correct `configFile` types ([#18167](https://github.com/cypress-io/cypress/issues/18167)) ([6e0c2c1](https://github.com/cypress-io/cypress/commit/6e0c2c1af81be750a74bad0528d52de45746a453))
* **vite-dev-server:** windows `supportFile` + preserve optimize entries ([#18286](https://github.com/cypress-io/cypress/issues/18286)) ([ea2f6a4](https://github.com/cypress-io/cypress/commit/ea2f6a45c7057e51b2fc879ff70da75538fa1002))

# [@cypress/vite-dev-server-v2.1.0](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.0.8...@cypress/vite-dev-server-v2.1.0) (2021-09-10)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress",
"version": "8.5.0",
"version": "8.6.0",
"description": "Cypress.io end to end testing tool",
"private": true,
"scripts": {
Expand Down
27 changes: 27 additions & 0 deletions packages/driver/cypress/integration/commands/debugging_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,32 @@ describe('src/cy/commands/debugging', () => {
expect(cy.state('onPaused')).to.be.null
})
})

it('can pause in run mode with --headed and --no-exit', function () {
let didPause = false

Cypress.config('isInteractive', false)
Cypress.config('browser').isHeaded = true
Cypress.config('exit', false)

cy.once('paused', (name) => {
cy.once('paused', (name) => {
didPause = true

// resume the rest of the commands so this
// test ends
Cypress.emit('resume:all')
})

Cypress.emit('resume:next')
})

cy.pause().wrap({}).should('deep.eq', {}).then(function () {
expect(didPause).to.be.true

// should no longer have onPaused
expect(cy.state('onPaused')).to.be.null
})
})
})
})
4 changes: 2 additions & 2 deletions packages/driver/src/cy/commands/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default (Commands, Cypress, cy, state, config) => {
// pause should indefinitely pause until the user
// presses a key or clicks in the UI to continue
pause (subject, options = {}) {
// bail if we're headless
if (!config('isInteractive')) {
// bail if we're in run mode, unless --headed and --no-exit flags are passed
if (!config('isInteractive') && (!config('browser').isHeaded || config('exit'))) {
return subject
}

Expand Down
3 changes: 3 additions & 0 deletions packages/runner-shared/src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export const logger = {
// _.trim([]) returns '' but we want to log empty arrays, so account for that
if (_.isString(value) && _.trim(value) === '') return

// Skip trim if we know value is an object
if (typeof value !== 'object' && _.trim(value) === '' && !_.isArray(value)) return

this.log(`%c${key}`, 'font-weight: bold', value)
})
},
Expand Down
39 changes: 33 additions & 6 deletions packages/runner-shared/src/logger.spec.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
const sinon = require('sinon')
const { logger } = require('./logger')
import _ from 'lodash'

describe('logger', () => {
let spyLog = sinon.spy(logger, 'log')

afterEach(() => {
// reset after each unit test
spyLog.resetHistory()
})

// https://github.com/cypress-io/cypress/issues/17542
it('cy.log() shows all arguments in each line when there are multiple args', () => {
const spy = sinon.spy(logger, 'log')

logger.logFormatted({ args: [1, 2, 3] })

expect(spy).to.have.been.calledWith(`%cArgs:`, 'font-weight: bold')
expect(spy).to.have.been.calledWith(`%c [0]:`, 'font-weight: bold', 1)
expect(spy).to.have.been.calledWith(`%c [1]:`, 'font-weight: bold', 2)
expect(spy).to.have.been.calledWith(`%c [2]:`, 'font-weight: bold', 3)
expect(spyLog).to.have.been.calledWith(`%cArgs:`, 'font-weight: bold')
expect(spyLog).to.have.been.calledWith(`%c [0]:`, 'font-weight: bold', 1)
expect(spyLog).to.have.been.calledWith(`%c [1]:`, 'font-weight: bold', 2)
expect(spyLog).to.have.been.calledWith(`%c [2]:`, 'font-weight: bold', 3)
})

describe('_logValues', () => {
let spyTrim = sinon.spy(_, 'trim')

afterEach(() => {
// reset after each unit test
spyTrim.resetHistory()
})

it('should not call trim', () => {
logger._logValues({})
logger._logValues({ test: {} })
logger._logValues(null)
logger._logValues(undefined)

expect(spyTrim.getCalls()).to.have.length(0)
})

// The positive unit tests to capture if log has been called are already written in
// the 'cy.log() shows all arguments in each line when there are multiple args' unit test.
})
})
5 changes: 3 additions & 2 deletions packages/server/lib/controllers/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const _serveNonProxiedError = (res: Response) => {
})
}

export interface ServeOptions extends Pick<InitializeRoutes, 'getSpec' | 'config' | 'getCurrentBrowser' | 'getRemoteState' | 'specsStore'> {
export interface ServeOptions extends Pick<InitializeRoutes, 'getSpec' | 'config' | 'getCurrentBrowser' | 'getRemoteState' | 'specsStore' | 'exit'> {
testingType: Cypress.TestingType
}

Expand All @@ -47,7 +47,7 @@ export const runner = {
return _serveNonProxiedError(res)
}

let { config, getRemoteState, getCurrentBrowser, getSpec, specsStore } = options
let { config, getRemoteState, getCurrentBrowser, getSpec, specsStore, exit } = options

config = _.clone(config)
// at any given point, rather than just arbitrarily modifying it.
Expand All @@ -72,6 +72,7 @@ export const runner = {
config.spec = getSpec() ?? null
config.specs = specsStore.specFiles
config.browser = getCurrentBrowser()
config.exit = exit ?? true

debug('serving runner index.html with config %o',
_.pick(config, 'version', 'platform', 'arch', 'projectName'))
Expand Down
2 changes: 2 additions & 0 deletions packages/server/lib/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type ReceivedCypressOptions =
export interface Cfg extends ReceivedCypressOptions {
projectRoot: string
proxyServer?: Cypress.RuntimeConfigOptions['proxyUrl']
exit?: boolean
state?: {
firstOpened?: number
lastOpened?: number
Expand Down Expand Up @@ -206,6 +207,7 @@ export class ProjectBase<TServer extends Server> extends EE {
const [port, warning] = await this._server.open(cfg, {
getCurrentBrowser: () => this.browser,
getSpec: () => this.spec,
exit: this.options.args?.exit,
onError: this.options.onError,
onWarning: this.options.onWarning,
shouldCorrelatePreRequests: this.shouldCorrelatePreRequests,
Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface InitializeRoutes {
getRemoteState: () => Cypress.RemoteState
onError: (...args: unknown[]) => any
testingType: Cypress.TestingType
exit?: boolean
}

function replaceBody (ctx: DataContextShell) {
Expand All @@ -44,6 +45,7 @@ export const createCommonRoutes = ({
getRemoteState,
nodeProxy,
ctx,
exit,
}: InitializeRoutes) => {
const makeServeConfig = (options: Partial<ServeOptions>) => {
const config = {
Expand Down Expand Up @@ -175,6 +177,7 @@ export const createCommonRoutes = ({
getCurrentBrowser,
getRemoteState,
specsStore,
exit,
})
})

Expand Down
3 changes: 3 additions & 0 deletions packages/server/lib/server-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface OpenServerOptions {
testingType: Cypress.TestingType
onError: any
onWarning: any
exit?: boolean
getCurrentBrowser: () => Browser
getSpec: () => Cypress.Cypress['spec'] | null
shouldCorrelatePreRequests: () => boolean
Expand Down Expand Up @@ -178,6 +179,7 @@ export abstract class ServerBase<TSocket extends SocketE2E | SocketCt> {
specsStore,
testingType,
SocketCtor,
exit,
}: OpenServerOptions) {
debug('server open')

Expand Down Expand Up @@ -222,6 +224,7 @@ export abstract class ServerBase<TSocket extends SocketE2E | SocketCt> {
getSpec,
getCurrentBrowser,
testingType,
exit,
}

const runnerSpecificRouter = testingType === 'e2e'
Expand Down
16 changes: 16 additions & 0 deletions packages/server/test/integration/http_requests_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe('Routes', () => {
specsStore: new SpecsStore({}, 'e2e'),
createRoutes,
testingType: 'e2e',
exit: false,
})
.spread(async (port) => {
const automationStub = {
Expand Down Expand Up @@ -377,6 +378,21 @@ describe('Routes', () => {
})
})
})

it('sends exit config', function () {
return this.setup({ baseUrl: 'http://localhost:9999/app' })
.then(() => {
return this.rp('http://localhost:9999/__')
.then((res) => {
expect(res.statusCode).to.eq(200)

const base64Config = /Runner\.start\(.*, "(.*)"\)/.exec(res.body)[1]
const configStr = Buffer.from(base64Config, 'base64').toString()

expect(configStr).to.include('"exit":false')
})
})
})
})

context('GET /__cypress/runner/*', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface LaunchArgs {
testingType: Cypress.TestingType
invokedFromCli: boolean
os: PlatformName
exit?: boolean

onFocusTests?: () => any
}
Expand Down