Skip to content

Commit

Permalink
add warnings to unsupported commands
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Sep 8, 2022
1 parent ca82602 commit 156ae42
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions packages/driver/cypress/e2e/webkit.cy.ts
@@ -0,0 +1,31 @@
describe('WebKit-specific behavior', { browser: 'webkit' }, () => {
it('cy.origin() is disabled', (done) => {
cy.on('fail', (err) => {
expect(err.message).to.equal('`cy.origin()` is not currently supported in experimental WebKit.')
expect(err.docsUrl).to.equal('https://on.cypress.io/webkit-experiment')
done()
})

cy.origin('foo', () => {})
})

it('cy.session() is disabled', (done) => {
cy.on('fail', (err) => {
expect(err.message).to.equal('`cy.session()` is not currently supported in experimental WebKit.')
expect(err.docsUrl).to.equal('https://on.cypress.io/webkit-experiment')
done()
})

cy.session('foo', () => {})
})

it('cy.session() is disabled', (done) => {
cy.on('fail', (err) => {
expect(err.message).to.include('`forceNetworkError` was passed, but it is not currently supported in experimental WebKit.')
expect(err.docsUrl).to.equal('https://on.cypress.io/intercept')
done()
})

cy.intercept('http://foo.com', { forceNetworkError: true })
})
})
4 changes: 4 additions & 0 deletions packages/driver/src/cy/commands/origin/index.ts
Expand Up @@ -54,6 +54,10 @@ export default (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy, state: State

Commands.addAll({
origin<T> (urlOrDomain: string, optionsOrFn: { args: T } | (() => {}), fn?: (args?: T) => {}) {
if (Cypress.isBrowser('webkit')) {
return $errUtils.throwErrByPath('webkit.origin')
}

const userInvocationStack = state('current').get('userInvocationStack')

// store the invocation stack in the case that `cy.origin` errors
Expand Down
4 changes: 4 additions & 0 deletions packages/driver/src/cy/commands/sessions/index.ts
Expand Up @@ -53,6 +53,10 @@ export default function (Commands, Cypress, cy) {

Commands.addAll({
session (id, setup?: Function, options: { validate?: Function } = {}) {
if (Cypress.isBrowser('webkit')) {
return $errUtils.throwErrByPath('webkit.session')
}

throwIfNoSessionSupport()

if (!id || !_.isString(id) && !_.isObject(id)) {
Expand Down
4 changes: 4 additions & 0 deletions packages/driver/src/cy/net-stubbing/static-response-utils.ts
Expand Up @@ -24,6 +24,10 @@ export function validateStaticResponse (cmd: string, staticResponse: StaticRespo
err('`forceNetworkError`, if passed, must be the only option in the StaticResponse.')
}

if (forceNetworkError && Cypress.isBrowser('webkit')) {
err('`forceNetworkError` was passed, but it is not currently supported in experimental WebKit.')
}

if (body && fixture) {
err('`body` and `fixture` cannot both be set, pick one.')
}
Expand Down
6 changes: 6 additions & 0 deletions packages/driver/src/cypress/error_messages.ts
Expand Up @@ -2297,6 +2297,12 @@ export default {
},
},

webkit: {
docsUrl: 'https://on.cypress.io/webkit-experiment',
origin: '`cy.origin()` is not currently supported in experimental WebKit.',
session: '`cy.session()` is not currently supported in experimental WebKit.',
},

window: {
iframe_doc_undefined: 'The remote iframe\'s document is `undefined`',
iframe_undefined: 'The remote iframe is `undefined`',
Expand Down

2 comments on commit 156ae42

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 156ae42 Sep 8, 2022

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.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/linux-x64/webkit-experimental-156ae42e1cbd38db3232600168fb54ff35d1cf88/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 156ae42 Sep 8, 2022

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 arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.8.0/linux-arm64/webkit-experimental-156ae42e1cbd38db3232600168fb54ff35d1cf88/cypress.tgz

Please sign in to comment.