Skip to content

Commit 22c5e78

Browse files
committed
use CYPRESS_FORCE_BROWSER_SCALE to force standard resolution
1 parent 92a8ca5 commit 22c5e78

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/server/lib/browsers/chrome.coffee

+13
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,19 @@ _connectToChromeRemoteInterface = (port) ->
159159
debug("received wsUrl %s for port %d", wsUrl, port)
160160

161161
CriClient.create(wsUrl)
162+
.then (client) ->
163+
if process.env.CYPRESS_FORCE_BROWSER_SCALE
164+
client.send('Emulation.setDeviceMetricsOverride', {
165+
width: 1280,
166+
height: 720,
167+
deviceScaleFactor: 1,
168+
mobile: false,
169+
screenWidth: 1280,
170+
screenHeight: 720,
171+
}).then ->
172+
client
173+
174+
client
162175

163176
_maybeRecordVideo = (options) ->
164177
return (client) ->

packages/server/lib/cypress.coffee

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = {
5656
## then display a warning to the user
5757
if not options.invokedFromCli
5858
warning("INVOKED_BINARY_OUTSIDE_NPM_MODULE")
59-
59+
6060
## just run the gui code directly here
6161
## and pass our options directly to main
6262
debug("running Electron currently")
@@ -131,7 +131,7 @@ module.exports = {
131131

132132
options = require("./util/args").toObject(argv)
133133

134-
if options.runProject and not options.headed
134+
if (options.runProject and not options.headed) or process.env.CYPRESS_FORCE_BROWSER_SCALE
135135
# scale the electron browser window
136136
# to force retina screens to not
137137
# upsample their images when offscreen

packages/server/test/support/helpers/e2e.coffee

+2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ module.exports = {
210210
## can take a long time (5-15 secs)
211211
@timeout(human("2 minutes"))
212212

213+
process.env.CYPRESS_FORCE_BROWSER_SCALE = '1'
214+
213215
Fixtures.scaffold()
214216

215217
sinon.stub(process, "exit")

0 commit comments

Comments
 (0)