Skip to content

Commit 4dec064

Browse files
committed
Main cypress script open now opens launchpad unless --e2e or --ct are used (if LAUNCHPAD=1)
1 parent f90d4d7 commit 4dec064

File tree

5 files changed

+23
-31
lines changed

5 files changed

+23
-31
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"precypress:open:debug": "yarn ensure-deps",
2828
"cypress:open:debug": "node ./scripts/debug.js cypress:open",
2929
"precypress:run": "yarn ensure-deps",
30-
"cypress:run": "cypress run-ct --dev",
30+
"cypress:run": "cypress run --dev",
3131
"precypress:run:debug": "yarn ensure-deps",
3232
"cypress:run:debug": "node ./scripts/debug.js cypress:run",
3333
"cypress:verify": "cypress verify --dev",

packages/server/lib/gui/windows.ts

-19
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { BrowserWindow } from 'electron'
55
import Debug from 'debug'
66
import cwd from '../cwd'
77
import savedState from '../saved_state'
8-
import { getPathToDesktopIndex } from '@packages/resolve-dist'
98

109
const debug = Debug('cypress:server:windows')
1110

@@ -18,20 +17,6 @@ export type WindowOptions = Electron.BrowserWindowConstructorOptions & {
1817
let windows = {}
1918
let recentlyCreatedWindow = false
2019

21-
const getUrl = function (type) {
22-
switch (type) {
23-
case 'INDEX':
24-
if (process.env.LAUNCHPAD) {
25-
return getPathToDesktopIndex('launchpad')
26-
}
27-
28-
return getPathToDesktopIndex('desktop-gui')
29-
30-
default:
31-
throw new Error(`No acceptable window type found for: '${type}'`)
32-
}
33-
}
34-
3520
const getByType = (type) => {
3621
return windows[type]
3722
}
@@ -248,10 +233,6 @@ export function open (projectRoot, options: WindowOptions = {}, newBrowserWindow
248233
},
249234
})
250235

251-
if (!options.url) {
252-
options.url = getUrl(options.type)
253-
}
254-
255236
win = create(projectRoot, options, newBrowserWindow)
256237

257238
debug('creating electron window with options %o', options)

packages/server/lib/modes/index.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ module.exports = (mode, options) => {
77
return require('./smoke_test').run(options)
88
}
99

10-
if (mode === 'run' && options.testingType === 'e2e') {
10+
if (mode === 'run') {
11+
if (options.testingType === 'component') {
12+
return require('./run-ct').run(options)
13+
}
14+
1115
return require('./run-e2e').run(options)
1216
}
1317

14-
if (mode === 'run' && options.testingType === 'component') {
15-
return require('./run-ct').run(options)
16-
}
18+
if (mode === 'interactive') {
19+
if (options.testingType === 'component') {
20+
return require('./interactive-ct').run(options)
21+
}
1722

18-
if (mode === 'interactive' && options.testingType === 'e2e') {
23+
// Either launchpad or straight to e2e tests
1924
return require('./interactive-e2e').run(options)
2025
}
21-
22-
if (mode === 'interactive' && options.testingType === 'component') {
23-
return require('./interactive-ct').run(options)
24-
}
2526
}

packages/server/lib/modes/interactive-e2e.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,26 @@ const menu = require('../gui/menu')
99
const Events = require('../gui/events')
1010
const Windows = require('../gui/windows')
1111

12+
const { getPathToDesktopIndex } = require('@packages/resolve-dist')
13+
1214
const isDev = () => {
1315
return process.env['CYPRESS_INTERNAL_ENV'] === 'development'
1416
}
1517

18+
const getUrl = function (type) {
19+
if (type === 'e2e' || !process.env.LAUNCHPAD) {
20+
return getPathToDesktopIndex('desktop-gui')
21+
}
22+
23+
return getPathToDesktopIndex('launchpad')
24+
}
25+
1626
module.exports = {
1727
isMac () {
1828
return os.platform() === 'darwin'
1929
},
2030

21-
getWindowArgs (state) {
31+
getWindowArgs (state, options) {
2232
// Electron Window's arguments
2333
// These options are passed to Electron's BrowserWindow
2434
const minWidth = Math.round(/* 13" MacBook Air */ 1792 / 3) // Thirds
@@ -97,6 +107,7 @@ module.exports = {
97107
onClose () {
98108
app.quit()
99109
},
110+
url: getUrl(options.testingType),
100111
}
101112

102113
return _.extend(common, this.platformArgs())

packages/server/lib/util/args.js

-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ module.exports = {
211211
// set in case we
212212
// bypassed the cli
213213
cwd: process.cwd(),
214-
testingType: 'e2e',
215214
})
216215
.mapValues(coerceUtil.coerce)
217216
.value()

0 commit comments

Comments
 (0)