Skip to content

Commit

Permalink
Merge branch '10.0-release' into chore/update-vite-2.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaSachs committed Mar 18, 2022
2 parents 1f8b730 + e73cc80 commit fecccf4
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 14 deletions.
2 changes: 1 addition & 1 deletion browser-versions.json
@@ -1,4 +1,4 @@
{
"chrome:beta": "100.0.4896.30",
"chrome:stable": "99.0.4844.51"
"chrome:stable": "99.0.4844.74"
}
1 change: 0 additions & 1 deletion npm/vue/docs/manual-install.md
Expand Up @@ -32,5 +32,4 @@ import '@cypress/vue/dist/support'
"component": {
"specPattern": "src/**/*.cy.jsx"
}
}
```
57 changes: 55 additions & 2 deletions packages/driver/cypress/e2e/cypress/proxy-logging.cy.ts
Expand Up @@ -102,8 +102,8 @@ describe('Proxy Logging', () => {
})
})

// @see https://github.com/cypress-io/cypress/issues/17656
it('xhr log has response body/status code', (done) => {
// @see https://github.com/cypress-io/cypress/issues/18757 and https://github.com/cypress-io/cypress/issues/17656
it('xhr log has response body/status code when xhr response is logged first', (done) => {
cy.window()
.then({ timeout: 10000 }, (win) => {
cy.on('log:changed', (log) => {
Expand Down Expand Up @@ -132,6 +132,59 @@ describe('Proxy Logging', () => {
}
})

const oldUpdateRequestWithResponse = Cypress.ProxyLogging.updateRequestWithResponse

cy.stub(Cypress.ProxyLogging, 'updateRequestWithResponse').log(false).callsFake(function (...args) {
setTimeout(() => {
oldUpdateRequestWithResponse.call(this, ...args)
}, 500)
})

const xhr = new win.XMLHttpRequest()

xhr.open('GET', '/some-url')
xhr.send()
})
})

// @see https://github.com/cypress-io/cypress/issues/18757 and https://github.com/cypress-io/cypress/issues/17656
it('xhr log has response body/status code when xhr response is logged second', (done) => {
cy.window()
.then({ timeout: 10000 }, (win) => {
cy.on('log:changed', (log) => {
try {
expect(log.snapshots.map((v) => v.name)).to.deep.eq(['request', 'response'])
expect(log.consoleProps['Response Headers']).to.include({
'x-powered-by': 'Express',
})

expect(log.consoleProps['Response Body']).to.include('Cannot GET /some-url')
expect(log.consoleProps['Response Status Code']).to.eq(404)

expect(log.renderProps).to.include({
indicator: 'bad',
message: 'GET 404 /some-url',
})

expect(Object.keys(log.consoleProps)).to.deep.eq(
['Event', 'Resource Type', 'Method', 'URL', 'Request went to origin?', 'XHR', 'groups', 'Request Headers', 'Response Status Code', 'Response Headers', 'Response Body'],
)

done()
} catch (err) {
// eslint-disable-next-line no-console
console.log('assertion error, retrying', err)
}
})

const oldOnload = cy.state('server').options.onLoad

cy.stub(cy.state('server').options, 'onLoad').log(false).callsFake(function (...args) {
setTimeout(() => {
oldOnload.call(this, ...args)
}, 500)
})

const xhr = new win.XMLHttpRequest()

xhr.open('GET', '/some-url')
Expand Down
8 changes: 6 additions & 2 deletions packages/driver/src/cypress/log.ts
Expand Up @@ -382,9 +382,13 @@ class Log {
}

end () {
// dont set back to passed
// if we've already ended
// dont set back to passed if we've already ended
if (this.get('ended')) {
// we do need to trigger the change event since
// xhr onLoad and proxy-logging updateRequestWithResponse can sometimes
// happen in a different order and the log data in each is different
this.fireChangeEvent(this)

return
}

Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"chai": "3.5.0",
"cross-env": "6.0.3",
"cypress-example-kitchensink": "https://github.com/cypress-io/cypress-example-kitchensink.git#8bd82de1729999cc0c1a6cb5dc2c9dd7ec2d2f0b",
"cypress-example-kitchensink": "https://github.com/cypress-io/cypress-example-kitchensink.git#5d3e5b54a56d88322f85247de63ffe5abe6d7d4d",
"gulp": "4.0.2",
"gulp-clean": "0.4.0",
"gulp-gh-pages": "0.6.0-6",
Expand Down
10 changes: 10 additions & 0 deletions packages/reporter/cypress/e2e/shortcuts.cy.ts
Expand Up @@ -151,5 +151,15 @@ describe('shortcuts', function () {
cy.get('button.stop').trigger('mouseover')
cy.get('.cy-tooltip').should('have.text', 'Stop Running S')
})

it('does not run shortcut if modifier keys are pressed', () => {
['{ctrl+f}', '{alt+f}', '{shift+f}', '{meta+f}'].forEach((text) => {
cy.get('body').type(text)
})

cy.then(() => {
expect(runner.emit).not.to.have.been.calledWith('focus:tests')
})
})
})
})
7 changes: 5 additions & 2 deletions packages/reporter/src/lib/shortcuts.ts
@@ -1,5 +1,5 @@
// @ts-ignore
import dom from '@packages/driver/src/dom'
import $dom from '@packages/driver/src/dom'
import events from './events'
import appState from './app-state'
import { action } from 'mobx'
Expand All @@ -16,7 +16,10 @@ class Shortcuts {
_handleKeyDownEvent (event: KeyboardEvent) {
// if typing into an input, textarea, etc, don't trigger any shortcuts
// @ts-ignore
if (dom.isTextLike(event.target)) return
const isTextLike = $dom.isTextLike(event.target)
const isAnyModifierKeyPressed = event.altKey || event.ctrlKey || event.shiftKey || event.metaKey

if (isAnyModifierKeyPressed || isTextLike) return

switch (event.key) {
case 'r': !appState.studioActive && events.emit('restart')
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Expand Up @@ -84,7 +84,7 @@
"lockfile": "1.0.4",
"lodash": "^4.17.21",
"log-symbols": "2.2.0",
"marionette-client": "https://github.com/cypress-io/marionette-client.git#2cddf7d791cca7be5191d7fe103d58be7283957d",
"marionette-client": "https://github.com/cypress-io/marionette-client.git#5fc10cdf6c02627e9a2add98ca52de4d0c2fe74d",
"md5": "2.3.0",
"mime": "2.4.4",
"mime-db": "1.45.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -18194,9 +18194,9 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=

"cypress-example-kitchensink@https://github.com/cypress-io/cypress-example-kitchensink.git#8bd82de1729999cc0c1a6cb5dc2c9dd7ec2d2f0b":
"cypress-example-kitchensink@https://github.com/cypress-io/cypress-example-kitchensink.git#5d3e5b54a56d88322f85247de63ffe5abe6d7d4d":
version "0.0.0-development"
resolved "https://github.com/cypress-io/cypress-example-kitchensink.git#8bd82de1729999cc0c1a6cb5dc2c9dd7ec2d2f0b"
resolved "https://github.com/cypress-io/cypress-example-kitchensink.git#5d3e5b54a56d88322f85247de63ffe5abe6d7d4d"
dependencies:
npm-run-all "^4.1.2"
serve "11.3.0"
Expand Down Expand Up @@ -29745,9 +29745,9 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

"marionette-client@https://github.com/cypress-io/marionette-client.git#2cddf7d791cca7be5191d7fe103d58be7283957d":
"marionette-client@https://github.com/cypress-io/marionette-client.git#5fc10cdf6c02627e9a2add98ca52de4d0c2fe74d":
version "1.9.5"
resolved "https://github.com/cypress-io/marionette-client.git#2cddf7d791cca7be5191d7fe103d58be7283957d"
resolved "https://github.com/cypress-io/marionette-client.git#5fc10cdf6c02627e9a2add98ca52de4d0c2fe74d"
dependencies:
debug "^4.0.1"
find-port "1.0.1"
Expand Down

0 comments on commit fecccf4

Please sign in to comment.