Skip to content

Commit

Permalink
chore: refactor cy funcs (#19080)
Browse files Browse the repository at this point in the history
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: David Munechika <david@cypress.io>
  • Loading branch information
3 people authored Dec 8, 2021
1 parent 3a21ee4 commit d18878f
Show file tree
Hide file tree
Showing 6 changed files with 1,090 additions and 1,124 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash'
import $Command from '../../../src/cypress/command'
import $CommandQueue from '../../../src/cypress/command_queue'
import { CommandQueue } from '../../../src/cypress/command_queue'

const createCommand = (props = {}) => {
return $Command.create(_.extend({
Expand All @@ -23,14 +23,14 @@ const log = (props = {}) => {
describe('src/cypress/command_queue', () => {
let queue
const state = () => {}
const timeouts = { timeout () {} }
const stability = { whenStable () {} }
const timeout = () => {}
const whenStable = () => {}
const cleanup = () => {}
const fail = () => {}
const isCy = () => {}

beforeEach(() => {
queue = $CommandQueue.create(state, timeouts, stability, cleanup, fail, isCy)
queue = new CommandQueue(state, timeout, whenStable, cleanup, fail, isCy)

queue.add(createCommand({
name: 'get',
Expand Down
4 changes: 2 additions & 2 deletions packages/driver/cypress/integration/util/queue_spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Bluebird from 'bluebird'

import $Queue from '../../../src/util/queue'
import { Queue } from '../../../src/util/queue'

const ids = (queueables) => queueables.map((q) => q.id)

describe('src/util/queue', () => {
let queue

beforeEach(() => {
queue = $Queue.create([
queue = new Queue([
{ id: '1' },
{ id: '2' },
{ id: '3' },
Expand Down
8 changes: 2 additions & 6 deletions packages/driver/src/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import browserInfo from './cypress/browser'
import $scriptUtils from './cypress/script_utils'

import $Commands from './cypress/commands'
import $Cy from './cypress/cy'
import { $Cy } from './cypress/cy'
import $dom from './dom'
import $Downloads from './cypress/downloads'
import $errorMessages from './cypress/error_messages'
Expand Down Expand Up @@ -209,12 +209,8 @@ class $Cypress {
// or parsed. we have not received any custom commands
// at this point
onSpecWindow (specWindow, scripts) {
const logFn = (...args) => {
return this.log.apply(this, args)
}

// create cy and expose globally
this.cy = $Cy.create(specWindow, this, this.Cookies, this.state, this.config, logFn)
this.cy = new $Cy(specWindow, this, this.Cookies, this.state, this.config)
window.cy = this.cy
this.isCy = this.cy.isCy
this.log = $Log.create(this, this.cy, this.state, this.config)
Expand Down
Loading

3 comments on commit d18878f

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d18878f Dec 8, 2021

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/9.1.2/circle-develop-d18878feea20a8aa8a1fff63d93b1fabc39ecd40/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d18878f Dec 8, 2021

Choose a reason for hiding this comment

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

Circle has built the win32 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/9.1.2/circle-develop-d18878feea20a8aa8a1fff63d93b1fabc39ecd40/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d18878f Dec 8, 2021

Choose a reason for hiding this comment

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

Circle has built the darwin 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/9.1.2/circle-develop-d18878feea20a8aa8a1fff63d93b1fabc39ecd40/cypress.tgz

Please sign in to comment.