Skip to content

Commit

Permalink
move majority of multidomain entry point into driver
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding committed May 21, 2021
1 parent d7ced23 commit 2aafbb9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 40 deletions.
48 changes: 48 additions & 0 deletions packages/driver/src/multidomain/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import $Cypress from '../cypress'
import $Cy from '../cypress/cy'
import $Commands from '../cypress/commands'
import $Log from '../cypress/log'

export const initialize = (autWindow) => {
const specWindow = {
Error,
}
const Cypress = $Cypress.create({
browser: {
channel: 'stable',
displayName: 'Chrome',
family: 'chromium',
isChosen: true,
isHeaded: true,
isHeadless: false,
majorVersion: 90,
name: 'chrome',
path: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
version: '90.0.4430.212',
},
})
const log = (...args) => {
return Cypress.log.apply(Cypress, args)
}
const cy = $Cy.create(specWindow, Cypress, Cypress.Cookies, Cypress.state, Cypress.config, log)

Cypress.log = $Log.create(Cypress, cy, Cypress.state, Cypress.config)
Cypress.runner = {
addLog () {},
}

Cypress.state('window', autWindow)
Cypress.state('document', autWindow.document)
Cypress.state('runnable', {
ctx: {},
clearTimeout () {},
resetTimeout () {},
timeout () {},
})

$Commands.create(Cypress, cy, Cypress.state)

return {
cy,
}
}
42 changes: 2 additions & 40 deletions packages/runner/multidomain/index.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,8 @@
import $Cypress from '@packages/driver/src/cypress'
import $Cy from '@packages/driver/src/cypress/cy'
import $Commands from '@packages/driver/src/cypress/commands'
import $Log from '@packages/driver/src/cypress/log'
import { initialize } from '@packages/driver/src/multidomain'

const autWindow = window.parent.frames[0]
const specWindow = {
Error,
}
const Cypress = $Cypress.create({
browser: {
channel: 'stable',
displayName: 'Chrome',
family: 'chromium',
isChosen: true,
isHeaded: true,
isHeadless: false,
majorVersion: 90,
name: 'chrome',
path: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
version: '90.0.4430.212',
},
})
const log = (...args) => {
return Cypress.log.apply(this, args)
}
const cy = $Cy.create(specWindow, Cypress, Cypress.Cookies, Cypress.state, Cypress.config, log)

Cypress.log = $Log.create(Cypress, cy, Cypress.state, Cypress.config)
Cypress.runner = {
addLog () {},
}

Cypress.state('window', autWindow)
Cypress.state('document', autWindow.document)
Cypress.state('runnable', {
ctx: {},
clearTimeout () {},
resetTimeout () {},
timeout () {},
})

$Commands.create(Cypress, cy, Cypress.state)
const { cy } = initialize(autWindow)

autWindow.onReady = () => {
cy.now('get', 'p').then(($el) => {
Expand Down

0 comments on commit 2aafbb9

Please sign in to comment.