Skip to content

Commit

Permalink
chore: fix problem with single tab run mode introduced by #27786 (#28032
Browse files Browse the repository at this point in the history
)

* chore: fix problem introduced by <pr>

* Update packages/server/lib/modes/run.ts
  • Loading branch information
ryanthemanuel committed Oct 11, 2023
1 parent 093d78a commit 5efecf9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/server/lib/modes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@ function waitForSocketConnection (project: Project, id: string) {
})
}

async function waitForTestsToFinishRunning (options: { project: Project, screenshots: ScreenshotMetadata[], videoCompression: number | boolean, exit: boolean, spec: SpecWithRelativeRoot, estimated: number, quiet: boolean, config: Cfg, shouldKeepTabOpen: boolean, testingType: TestingType, videoRecording?: VideoRecording, protocolManager?: ProtocolManager }) {
async function waitForTestsToFinishRunning (options: { project: Project, screenshots: ScreenshotMetadata[], videoCompression: number | boolean, exit: boolean, spec: SpecWithRelativeRoot, estimated: number, quiet: boolean, config: Cfg, shouldKeepTabOpen: boolean, isLastSpec: boolean, testingType: TestingType, videoRecording?: VideoRecording, protocolManager?: ProtocolManager }) {
if (globalThis.CY_TEST_MOCK?.waitForTestsToFinishRunning) return Promise.resolve(globalThis.CY_TEST_MOCK.waitForTestsToFinishRunning)

const { project, screenshots, videoRecording, videoCompression, exit, spec, estimated, quiet, config, shouldKeepTabOpen, testingType, protocolManager } = options
const { project, screenshots, videoRecording, videoCompression, exit, spec, estimated, quiet, config, shouldKeepTabOpen, isLastSpec, testingType, protocolManager } = options

const results = await listenForProjectEnd(project, exit)

Expand Down Expand Up @@ -644,12 +644,12 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
// @ts-expect-error experimentalSingleTabRunMode only exists on the CT-specific config type
const usingExperimentalSingleTabMode = testingType === 'component' && config.experimentalSingleTabRunMode

if (usingExperimentalSingleTabMode) {
if (usingExperimentalSingleTabMode && !isLastSpec) {
await project.server.destroyAut()
}

// we do not support experimentalSingleTabRunMode for e2e
if (!usingExperimentalSingleTabMode) {
// we do not support experimentalSingleTabRunMode for e2e. We always want to close the tab on the last spec to ensure that things get cleaned up properly at the end of the run
if (!usingExperimentalSingleTabMode || isLastSpec) {
debug('attempting to close the browser tab')

await openProject.resetBrowserTabsForNextTest(shouldKeepTabOpen)
Expand Down Expand Up @@ -920,6 +920,7 @@ async function runSpec (config, spec: SpecWithRelativeRoot, options: { project:
videoCompression: options.videoCompression,
quiet: options.quiet,
shouldKeepTabOpen: !isLastSpec,
isLastSpec,
protocolManager: options.protocolManager,
}),
waitForBrowserToConnect({
Expand Down

5 comments on commit 5efecf9

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5efecf9 Oct 11, 2023

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 arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-arm64/develop-5efecf9a4a72fbb0199a23917623218b843bd97c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5efecf9 Oct 11, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/linux-x64/develop-5efecf9a4a72fbb0199a23917623218b843bd97c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5efecf9 Oct 11, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-x64/develop-5efecf9a4a72fbb0199a23917623218b843bd97c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5efecf9 Oct 11, 2023

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 arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/darwin-arm64/develop-5efecf9a4a72fbb0199a23917623218b843bd97c/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 5efecf9 Oct 11, 2023

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.3.1/win32-x64/develop-5efecf9a4a72fbb0199a23917623218b843bd97c/cypress.tgz

Please sign in to comment.