Skip to content

Commit fc4e769

Browse files
chore: add CYPRESS_INTERNAL_SIMULATE_OPEN_MODE to simulate running Cypress tests in open mode (#32114)
1 parent 7e2d1c4 commit fc4e769

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

.circleci/workflows.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ mainBuildFilters: &mainBuildFilters
3838
- /^release\/\d+\.\d+\.\d+$/
3939
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
4040
- 'update-v8-snapshot-cache-on-develop'
41-
- 'update-chrome-stable-from-136.0.7103.113-beta-from-137.0.7151.40'
4241
- 'feat/cy-prompt'
42+
- 'ryanm/chore/enable-open-mode-simuation'
4343

4444
# usually we don't build Mac app - it takes a long time
4545
# but sometimes we want to really confirm we are doing the right thing
@@ -51,11 +51,7 @@ macWorkflowFilters: &darwin-workflow-filters
5151
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
5252
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
5353
- equal: [ 'feat/cy-prompt', << pipeline.git.branch >> ]
54-
- equal:
55-
[
56-
'update-chrome-stable-from-136.0.7103.113-beta-from-137.0.7151.40',
57-
<< pipeline.git.branch >>
58-
]
54+
- equal: [ 'ryanm/chore/enable-open-mode-simuation', << pipeline.git.branch >> ]
5955
- matches:
6056
pattern: /^release\/\d+\.\d+\.\d+$/
6157
value: << pipeline.git.branch >>
@@ -67,11 +63,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
6763
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
6864
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
6965
- equal: [ 'feat/cy-prompt', << pipeline.git.branch >> ]
70-
- equal:
71-
[
72-
'update-chrome-stable-from-136.0.7103.113-beta-from-137.0.7151.40',
73-
<< pipeline.git.branch >>
74-
]
66+
- equal: [ 'ryanm/chore/enable-open-mode-simuation', << pipeline.git.branch >> ]
7567
- matches:
7668
pattern: /^release\/\d+\.\d+\.\d+$/
7769
value: << pipeline.git.branch >>
@@ -95,11 +87,7 @@ windowsWorkflowFilters: &windows-workflow-filters
9587
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
9688
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
9789
- equal: [ 'feat/cy-prompt', << pipeline.git.branch >> ]
98-
- equal:
99-
[
100-
'update-chrome-stable-from-136.0.7103.113-beta-from-137.0.7151.40',
101-
<< pipeline.git.branch >>
102-
]
90+
- equal: [ 'ryanm/chore/enable-open-mode-simuation', << pipeline.git.branch >> ]
10391
- matches:
10492
pattern: /^release\/\d+\.\d+\.\d+$/
10593
value: << pipeline.git.branch >>
@@ -173,7 +161,7 @@ commands:
173161
name: Set environment variable to determine whether or not to persist artifacts
174162
command: |
175163
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
176-
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "update-chrome-stable-from-136.0.7103.113-beta-from-137.0.7151.40" && "$CIRCLE_BRANCH" != "feat/cy-prompt" ]]; then
164+
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "ryanm/chore/enable-open-mode-simuation" && "$CIRCLE_BRANCH" != "feat/cy-prompt" ]]; then
177165
export SHOULD_PERSIST_ARTIFACTS=true
178166
fi' >> "$BASH_ENV"
179167
# You must run `setup_should_persist_artifacts` command and be using bash before running this command

packages/data-context/src/sources/HtmlDataSource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class HtmlDataSource {
120120
<body>
121121
<script>
122122
window.__RUN_MODE_SPECS__ = ${JSON.stringify(this.ctx.project.specs)}
123-
window.__CYPRESS_MODE__ = ${JSON.stringify(this.ctx.isRunMode ? 'run' : 'open')};
123+
window.__CYPRESS_MODE__ = ${JSON.stringify(this.ctx.isRunMode && !process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE ? 'run' : 'open')};
124124
window.__CYPRESS_CONFIG__ = ${JSON.stringify(serveConfig)};
125125
window.__CYPRESS_TESTING_TYPE__ = '${this.ctx.coreData.currentTestingType}'
126126
window.__CYPRESS_BROWSER__ = ${JSON.stringify(this.ctx.coreData.activeBrowser)}

packages/driver/src/cypress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class $Cypress {
235235
// not we're in a text terminal, but we keep this
236236
// as a separate property so we can potentially
237237
// slice up the behavior
238-
config.isInteractive = !config.isTextTerminal
238+
config.isInteractive = !config.isTextTerminal || config.env.INTERNAL_SIMULATE_OPEN_MODE
239239

240240
// true if this Cypress belongs to a cross origin spec bridge
241241
this.isCrossOriginSpecBridge = config.isCrossOriginSpecBridge || false

packages/reporter/src/commands/command-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export default class Command extends Instrument {
131131
get isCyPrompt () {
132132
// @ts-expect-error - experimentalPromptCommand is not typed until we
133133
// release the feature
134-
return Cypress.config('experimentalPromptCommand') && !Cypress.config('isTextTerminal') && this.name === 'prompt'
134+
return Cypress.config('experimentalPromptCommand') && Cypress.config('isInteractive') && this.name === 'prompt'
135135
}
136136

137137
constructor (props: CommandProps) {

packages/server/lib/project-base.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,9 @@ export class ProjectBase extends EE {
709709
const isDefaultProtocolEnabled = this._protocolManager?.isProtocolEnabled ?? false
710710

711711
const hideRunnerUi = (
712-
this.options?.args?.runnerUi === false ||
713-
(isDefaultProtocolEnabled && this._cfg.isTextTerminal && !this.options?.args?.runnerUi)
712+
(this.options?.args?.runnerUi === false ||
713+
(isDefaultProtocolEnabled && this._cfg.isTextTerminal && !this.options?.args?.runnerUi)) &&
714+
!process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE
714715
)
715716

716717
// hide the command log if explicitly requested or if we are hiding the runner

0 commit comments

Comments
 (0)