chore: Update more driver tests from js to ts (#31169)

* Convert sessions.cy.js file

* convert utils to ts

* update some more types

* update eq call

* fix test
This commit is contained in:
Jennifer Shehane
2025-02-26 20:26:10 -05:00
committed by GitHub
parent 290638acd1
commit 0d50a5d52f
10 changed files with 133 additions and 58 deletions
+4 -1
View File
@@ -2571,7 +2571,9 @@ declare namespace Cypress {
*/
withArgs(...args: any[]): Omit<A, 'withArgs'> & Agent<A>
callsFake(func: (...args: any[]) => any): Omit<A, 'withArgs'> & Agent<A>
callsFake(func: (...args: any[]) => any): Agent<A>
callThroughWithNew(): Agent<A>
}
type Agent<T extends sinon.SinonSpy> = SinonSpyAgent<T> & T
@@ -6446,6 +6448,7 @@ declare namespace Cypress {
}
interface Log {
id: string
end(): Log
error(error: Error): Log
finish(): void
@@ -1,4 +1,4 @@
const { assertLogLength } = require('../../support/utils')
import { assertLogLength } from '../../support/utils'
const { _ } = Cypress
@@ -72,6 +72,7 @@ describe('src/cy/commands/agents', () => {
},
}
// @ts-expect-error TODO: deprecated: Figure out how to handle types here
cy.stub(this.obj, 'bar', 'baz')
this.replacementCalled = false
@@ -124,6 +125,7 @@ describe('src/cy/commands/agents', () => {
return obj
.foo()
// @ts-expect-error TODO: Figure out how to handle types here
.delay(1)
})
})
@@ -340,6 +342,7 @@ describe('src/cy/commands/agents', () => {
_.each([null, undefined, {}, [], 123], (value) => {
it(`throws when passed: ${value}`, () => {
expect(() => {
// @ts-expect-error Testing invalid inputs
cy.stub().as(value)
}).to.throw('`cy.as()` can only accept a string.')
})
@@ -417,6 +420,7 @@ describe('src/cy/commands/agents', () => {
_.each([null, undefined, {}, [], 123], (value) => {
it(`throws when passed: ${value}`, () => {
expect(() => {
// @ts-expect-error Testing invalid inputs
cy.stub().as(value)
}).to.throw('`cy.as()` can only accept a string.')
})
@@ -1,4 +1,4 @@
const { assertLogLength } = require('../../support/utils')
import { assertLogLength } from '../../support/utils'
const { _ } = Cypress
describe('src/cy/commands/aliasing', () => {
@@ -40,13 +40,15 @@ describe('src/cy/commands/aliasing', () => {
const li = cy.$$('#list li').eq(0)
cy.get('#list li').eq(0).as('firstLi').then(($li) => {
expect($li).to.match(li)
expect($li[0]).to.eq(li[0])
})
})
it('retries previous commands invoked inside custom commands', () => {
Cypress.Commands.add('get2', (selector) => cy.get(selector))
// @ts-expect-error TODO: add types need updating to not error with string here
Cypress.Commands.add('get2', (selector: string) => cy.get(selector))
// @ts-expect-error - we are testing custom command, ignore types for now
cy.get2('body').children('div').as('divs')
cy.visit('/fixtures/dom.html')
@@ -54,7 +56,7 @@ describe('src/cy/commands/aliasing', () => {
})
it('retries primitives and assertions', () => {
const obj = {}
const obj: any = {}
cy.on('command:retry', _.after(2, () => {
obj.foo = 'bar'
@@ -105,8 +107,10 @@ describe('src/cy/commands/aliasing', () => {
})
it('retries previous commands invoked inside custom commands', () => {
Cypress.Commands.add('get2', (selector) => cy.get(selector))
// @ts-expect-error TODO: add types need updating to not error with string here
Cypress.Commands.add('get2', (selector: string) => cy.get(selector))
// @ts-expect-error - we are testing custom command, ignore types for now
cy.get2('body').children('div').as('divs')
cy.visit('/fixtures/dom.html')
@@ -120,6 +124,7 @@ describe('src/cy/commands/aliasing', () => {
afterEach(function () {
if (!this.foo) {
// @ts-expect-error TODO: mocha Runnable is not expecting error here
this.test.error(new Error('this.foo not defined'))
}
})
@@ -140,10 +145,12 @@ describe('src/cy/commands/aliasing', () => {
describe('nested hooks', () => {
afterEach(function () {
if (!this.bar) {
// @ts-expect-error TODO: mocha Runnable is not expecting error here
this.test.error(new Error('this.bar not defined'))
}
if (!this.foo) {
// @ts-expect-error TODO: mocha Runnable is not expecting error here
this.test.error(new Error('this.foo not defined'))
}
})
@@ -162,6 +169,7 @@ describe('src/cy/commands/aliasing', () => {
afterEach(function () {
if (!this.quux) {
// @ts-expect-error TODO: mocha Runnable is not expecting error here
this.test.error(new Error('this.quux not defined'))
}
})
@@ -195,6 +203,7 @@ describe('src/cy/commands/aliasing', () => {
done()
})
// @ts-expect-error - testing invalid value
cy.get('div:first').as(value)
})
})
@@ -259,6 +268,7 @@ describe('src/cy/commands/aliasing', () => {
done()
})
// @ts-expect-error - testing invalid options
cy.wrap({}).as('value', 'wut?')
})
@@ -270,6 +280,7 @@ describe('src/cy/commands/aliasing', () => {
done()
})
// @ts-expect-error - testing invalid options
cy.wrap({}).as('value', { type: 'wut?' })
})
})
@@ -309,13 +320,14 @@ describe('src/cy/commands/aliasing', () => {
const cmd = Cypress.log({})
cy.get('ul:first li', { log: false }).first({ log: false }).then(($li) => {
cmd.snapshot().end()
cmd?.snapshot().end()
return undefined
})
},
})
// @ts-expect-error - testing custom command so not worried about types here
cy.foo().as('foo').then(function () {
const { lastLog } = this
@@ -436,6 +448,7 @@ describe('src/cy/commands/aliasing', () => {
it('works with .then function overwrite', () => {
// use explicit arguments and Function.prototype.call
Cypress.Commands.overwrite('then', function (originalCommand, subject, fn, options = {}) {
// @ts-expect-error TODO: not expecting 4 args here
return originalCommand.call(null, subject, options, fn)
})
@@ -1,14 +1,14 @@
const baseUrl = Cypress.config('baseUrl')
before(() => {
before(async () => {
// sessions has logic built in to persists sessions on UI refresh
Cypress.session.clearAllSavedSessions()
await Cypress.session.clearAllSavedSessions()
})
const expectCurrentSessionData = async (obj) => {
return Cypress.session.getCurrentSessionData()
.then((result) => {
expect(result.cookies.map((v) => v.name)).members(obj.cookies || [])
expect(result.cookies?.map((v) => v.name)).members(obj.cookies || [])
expect(result.localStorage).deep.members(obj.localStorage || [])
expect(result.sessionStorage).deep.members(obj.sessionStorage || [])
})
@@ -99,6 +99,7 @@ describe('cy.session', { retries: 0 }, () => {
it('clears the browser cookie after each run', () => {
cy.window()
.then((win) => {
// @ts-expect-error TODO: cookie doesn't exist on win, usually cookie is set on document
win.cookie = 'key=value; SameSite=Strict; Secure; Path=/fixtures'
})
.then(async () => {
@@ -113,6 +114,7 @@ describe('cy.session', { retries: 0 }, () => {
it('does not clear the browser cookie after each run if the next test has test isolation off', () => {
cy.window()
.then((win) => {
// @ts-expect-error TODO: cookie doesn't exist on win, usually cookie is set on document
win.cookie = 'key=value; SameSite=Strict; Secure; Path=/fixtures'
})
.then(async () => {
@@ -169,7 +171,7 @@ describe('cy.session', { retries: 0 }, () => {
})
describe('session flows', () => {
let logs = []
let logs: Cypress.Log[] = []
let clearPageCount = 0
let sessionGroupId
let setup
@@ -305,7 +307,12 @@ describe('cy.session', { retries: 0 }, () => {
})
it('has session details in the consoleProps', () => {
const consoleProps = logs[0].get('consoleProps')()
let consoleProps
const getConsoleProps = logs[0].get('consoleProps')
if (getConsoleProps) {
consoleProps = getConsoleProps()
}
expect(consoleProps.name).to.eq('session')
expect(consoleProps.type).to.eq('command')
@@ -620,7 +627,7 @@ describe('cy.session', { retries: 0 }, () => {
return Promise.reject(false)
}
handleValidate()
return handleValidate()
})
})
@@ -686,7 +693,7 @@ describe('cy.session', { retries: 0 }, () => {
})
// this error is associated with the group since the validation rejected
expect(logs[4].get('error').message).to.contain('This error occurred while validating the restored session')
expect(logs[4].get('error')?.message).to.contain('This error occurred while validating the restored session')
expect(logs[6].get()).to.contain({
name: 'Clear page',
@@ -793,7 +800,7 @@ describe('cy.session', { retries: 0 }, () => {
})
// this error is associated with the group since the validation rejected
expect(logs[4].get('error').message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[4].get('error')?.message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[6].get()).to.contain({
name: 'Clear page',
@@ -860,7 +867,8 @@ describe('cy.session', { retries: 0 }, () => {
expect(Cypress.action).not.to.be.calledWith('cy:url:changed')
expect(Cypress.action).not.to.be.calledWith('cy:visit:blank')
})
.url('/fixtures/form.html')
cy.url().should('include', '/fixtures/form.html')
})
it('does not clear session data before each run', async () => {
@@ -888,6 +896,7 @@ describe('cy.session', { retries: 0 }, () => {
it('does not clear the browser context before each run', () => {
cy.window()
.then((win) => {
// @ts-expect-error TODO: cookie doesn't exist on win, usually cookie is set on document
win.cookie = 'key=value; SameSite=Strict; Secure; Path=/fixtures'
win.localStorage.setItem('animal', 'bear')
win.sessionStorage.setItem('food', 'burgers')
@@ -911,7 +920,7 @@ describe('cy.session', { retries: 0 }, () => {
})
describe('session flows', () => {
let logs = []
let logs: Cypress.Log[] = []
let clearPageCount = 0
let sessionGroupId
let setup
@@ -1047,7 +1056,12 @@ describe('cy.session', { retries: 0 }, () => {
})
it('has session details in the consoleProps', () => {
const consoleProps = logs[0].get('consoleProps')()
let consoleProps
const getConsoleProps = logs[0].get('consoleProps')
if (getConsoleProps) {
consoleProps = getConsoleProps()
}
expect(consoleProps.name).to.eq('session')
expect(consoleProps.type).to.eq('command')
@@ -1130,7 +1144,12 @@ describe('cy.session', { retries: 0 }, () => {
})
it('has session details in the consoleProps', () => {
const consoleProps = logs[0].get('consoleProps')()
let consoleProps
const getConsoleProps = logs[0].get('consoleProps')
if (getConsoleProps) {
consoleProps = getConsoleProps()
}
expect(consoleProps.name).to.eq('session')
expect(consoleProps.type).to.eq('command')
@@ -1353,7 +1372,7 @@ describe('cy.session', { retries: 0 }, () => {
return Promise.reject(false)
}
handleValidate()
return handleValidate()
})
})
@@ -1413,7 +1432,7 @@ describe('cy.session', { retries: 0 }, () => {
})
// this error is associated with the group since the validation rejected
expect(logs[3].get('error').message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[3].get('error')?.message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[5].get()).to.contain({
displayName: 'Clear cookies, localStorage and sessionStorage',
@@ -1505,7 +1524,7 @@ describe('cy.session', { retries: 0 }, () => {
})
// this error is associated with the group since the validation rejected
expect(logs[3].get('error').message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[3].get('error')?.message).to.contain('Your `cy.session` **validate** promise rejected with false.')
expect(logs[5].get()).to.contain({
displayName: 'Clear cookies, localStorage and sessionStorage',
@@ -1548,9 +1567,9 @@ describe('cy.session', { retries: 0 }, () => {
})
describe('errors', () => {
let lastLog = null
let lastSessionLog = null
const handleAddLog = (attrs, log) => {
let lastLog: Cypress.Log | null = null
let lastSessionLog: Cypress.Log | null = null
const handleAddLog = (attrs, log: Cypress.Log) => {
lastLog = log
if (attrs.name === 'session') {
lastSessionLog = log
@@ -1570,91 +1589,97 @@ describe('cy.session', { retries: 0 }, () => {
it('throws when sessionId argument was not provided', function (done) {
cy.once('fail', (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('`cy.session()` was passed an invalid argument. The first argument `id` must be an string or serializable object.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session()
})
it('throws when setup function is not provided', function (done) {
cy.once('fail', (err) => {
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('In order to use `cy.session()`, provide a `setup` as the second argument:\n\n`cy.session(id, setup)`')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session('some-session')
})
it('throws when sessionId argument is not an object', function (done) {
cy.once('fail', (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('`cy.session()` was passed an invalid argument. The first argument `id` must be an string or serializable object.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session(1)
})
it('throws when options argument is provided and is not an object', function (done) {
cy.once('fail', (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('`cy.session()` was passed an invalid argument. The optional third argument `options` must be an object.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session('some-session', () => {}, 'invalid_arg')
})
it('throws when options argument has an invalid option', function (done) {
cy.once('fail', (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('`cy.session()` was passed an invalid option: **invalid_key**\nAvailable options are: `validate`')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session('some-session', () => {}, { invalid_key: 2 })
})
it('throws when options argument has an option with an invalid type', function (done) {
cy.once('fail', (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('`cy.session()` was passed an invalid option value. **validate** must be of type **function** but was **number**.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
done()
})
// @ts-expect-error - testing invalid arg
cy.session('some-session', () => {}, { validate: 2 })
})
it('throws when multiple session calls with same sessionId but different setup', function (done) {
cy.once('fail', async (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('This session already exists. You may not create a new session with a previously used identifier. If you want to create a new session with a different setup function, please call `cy.session()` with a unique identifier other than **duplicate-session**.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
@@ -1683,8 +1708,8 @@ describe('cy.session', { retries: 0 }, () => {
it('throws when multiple session calls with same sessionId but different validate opt', function (done) {
cy.once('fail', async (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('This session already exists. You may not create a new session with a previously used identifier. If you want to create a new session with a different validate function, please call `cy.session()` with a unique identifier other than **duplicate-sess**.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
@@ -1699,8 +1724,8 @@ describe('cy.session', { retries: 0 }, () => {
it('throws when multiple session calls with same sessionId but different cacheAcrossSpec opt', function (done) {
cy.once('fail', async (err) => {
expect(lastSessionLog).to.eq(lastLog)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.eq('This session already exists. You may not create a new session with a previously used identifier. If you want to create a new session with a different persistence, please call `cy.session()` with a unique identifier other than **duplicate-sess**.')
expect(err.docsUrl).to.eq('https://on.cypress.io/session')
@@ -1715,10 +1740,10 @@ describe('cy.session', { retries: 0 }, () => {
describe('setup function failures', () => {
it('throws when setup function has a failing Cypress command', function (done) {
cy.once('fail', (err) => {
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')
expect(lastLog?.get('error')).to.eq(err)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.contain('This error occurred while creating the session. Because the session setup failed, we failed the test.')
expect(lastSessionLog.get('state')).to.eq('failed')
expect(lastSessionLog?.get('state')).to.eq('failed')
done()
})
@@ -1729,10 +1754,10 @@ describe('cy.session', { retries: 0 }, () => {
it('throws when setup function has a failing assertion', function (done) {
cy.once('fail', (err) => {
expect(err.message).to.contain(lastLog.get('error').message)
expect(lastLog.get('state')).to.eq('failed')
expect(err.message).to.contain(lastLog?.get('error')?.message)
expect(lastLog?.get('state')).to.eq('failed')
expect(err.message).to.contain('This error occurred while creating the session. Because the session setup failed, we failed the test.')
expect(lastSessionLog.get('state')).to.eq('failed')
expect(lastSessionLog?.get('state')).to.eq('failed')
done()
})
@@ -1845,6 +1870,7 @@ describe('cy.session', { retries: 0 }, () => {
cy.session(['mock-session', 'Chainer<false>'], () => {
cy.log('setup')
}, {
// @ts-expect-error - testing invalid arg
validate () {
return cy.wrap(false)
},
@@ -1,7 +1,7 @@
const {
import {
getConsoleProps,
navigateAboutBlank,
} = require('@packages/driver/src/cy/commands/sessions/utils')
} from '../../../../src/cy/commands/sessions/utils'
describe('src/cy/commands/sessions/utils.ts', () => {
const logForDebugging = (consoleProps) => {
@@ -17,6 +17,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for one domain with neither cookies or localStorage set', () => {
const sessionState = {
id: 'session1',
hydrated: false,
cacheAcrossSpecs: false,
setup: () => {},
}
const consoleProps = getConsoleProps(sessionState)
@@ -30,6 +33,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for one domain with only cookies set', () => {
const sessionState = {
id: 'session1',
hydrated: true,
cacheAcrossSpecs: false,
setup: () => {},
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
@@ -55,6 +61,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for one domain with only localStorage set', () => {
const sessionState = {
id: 'session1',
hydrated: true,
cacheAcrossSpecs: false,
setup: () => {},
localStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
@@ -79,6 +88,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for one domain with only sessionStorage set', () => {
const sessionState = {
id: 'session1',
hydrated: true,
cacheAcrossSpecs: false,
setup: () => {},
sessionStorage: [
{ origin: 'localhost', value: { 'stor-foo': 's-f' } },
],
@@ -103,6 +115,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for one domain with both cookies and localStorage set', () => {
const sessionState = {
id: 'session1',
hydrated: true,
cacheAcrossSpecs: false,
setup: () => {},
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
],
@@ -135,6 +150,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
it('for multiple domains', () => {
const sessionState = {
id: 'session1',
hydrated: true,
cacheAcrossSpecs: false,
setup: () => {},
cookies: [
{ name: 'foo', value: 'f', path: '/', domain: 'localhost', secure: true, httpOnly: true, expiry: 123 },
{ name: 'bar', value: 'b', path: '/', domain: 'localhost', secure: false, httpOnly: false, expiry: 456 },
@@ -145,6 +163,7 @@ describe('src/cy/commands/sessions/utils.ts', () => {
],
}
// @ts-expect-error TODO: sessionState needs more accurate types or this test data needs updating.
const consoleProps = getConsoleProps(sessionState)
logForDebugging(consoleProps)
@@ -180,9 +199,9 @@ describe('src/cy/commands/sessions/utils.ts', () => {
const spy = cy.spy(Cypress, 'action').log(false)
.withArgs('cy:visit:blank')
cy.then(() => {
navigateAboutBlank()
navigateAboutBlank(true)
cy.then(async () => {
await navigateAboutBlank()
await navigateAboutBlank({ inBetweenTestsAndNextTestHasTestIsolationOn: true })
expect(spy).to.have.been.calledTwice
expect(spy.args[0]).to.deep.eq(['cy:visit:blank', { testIsolation: true }])
expect(spy.args[1]).to.deep.eq(['cy:visit:blank', { testIsolation: true }])
+2 -2
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"target": "es2020",
"lib": ["es2020", "dom"],
"types": [
"cypress",
"node"
+1 -1
View File
@@ -29,7 +29,7 @@ export const create = (cy: $Cy) => ({
ctx[alias] = cy.getSubjectFromChain(aliasObj.subjectChain)
},
getAlias (name, cmd, log) {
getAlias (name: string, cmd?: string, log?: any) {
const aliases = cy.state('aliases') || {}
// bail if the name doesn't reference an alias
+8
View File
@@ -26,6 +26,14 @@ declare namespace Cypress {
}
type ConsoleProps = {
name?: string
type?: string
error?: Error
snapshot?: string
args?: any
groups?: any
table?: any
props?: any
Command?: string
Snapshot?: string
Elements?: number
+1
View File
@@ -47,6 +47,7 @@ declare namespace Cypress {
/**
* If `as` is chained to the current command, return the alias name used.
*/
getAlias: IAliases['getAlias']
getNextAlias: IAliases['getNextAlias']
noop: <T>(v?: T) => Cypress.Chainable<T>
now: <T>(string, v: T) => Cypress.Chainable<T>
+1
View File
@@ -66,6 +66,7 @@ declare namespace Cypress {
interface CypressUtils {
getDistanceBetween: (point1: { x: number, y: number }, point2: { x: number, y: number }) => number
isInstanceOf: (instance: any, constructor: any) => boolean
throwErrByPath: (path: string, obj?: { args: object }) => void
warnByPath: (path: string, obj?: { args: object }) => void
warning: (message: string) => void