Skip to content

Commit

Permalink
fix: fixed issue with CT + electron + run mode not exiting properly (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mschile committed Jan 25, 2023
1 parent 8d3a6ee commit 2cbc2ff
Show file tree
Hide file tree
Showing 14 changed files with 794 additions and 6 deletions.
4 changes: 3 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ _Released 01/31/2023 (PENDING)_

**Bugfixes:**

- Fixed a regression from Cypress 12.4.0 where Cypress was not exiting properly when running multiple Component Testing specs in `electron` in `run` mode.
Fixes [#25568](https://github.com/cypress-io/cypress/issues/25568).
- Fixed an issue where alternative Microsoft Edge Beta and Canary binary names were not being discovered by Cypress.
Fixes [#25455](https://github.com/cypress-io/cypress/issues/25455).

Expand Down Expand Up @@ -79,4 +81,4 @@ _Released 1/24/2023_

- Video output link in `cypress run` mode has been added to it's own line to
make the video output link more easily clickable in the terminal. Addresses
[#23913](https://github.com/cypress-io/cypress/issues/23913).
[#23913](https://github.com/cypress-io/cypress/issues/23913).
6 changes: 1 addition & 5 deletions packages/server/lib/modes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function screenshotMetadata (data, resp) {
async function runSpecs (options: { config: Cfg, browser: Browser, sys: any, headed: boolean, outputPath: string, specs: SpecWithRelativeRoot[], specPattern: string | RegExp | string[], beforeSpecRun?: BeforeSpecRun, afterSpecRun?: AfterSpecRun, runUrl?: string, parallel?: boolean, group?: string, tag?: string, testingType: TestingType, quiet: boolean, project: Project, onError: (err: Error) => void, exit: boolean, socketId: string, webSecurity: boolean, projectRoot: string } & Pick<Cfg, 'video' | 'videoCompression' | 'videosFolder' | 'videoUploadOnPasses'>) {
if (globalThis.CY_TEST_MOCK?.runSpecs) return globalThis.CY_TEST_MOCK.runSpecs

const { config, browser, sys, headed, outputPath, specs, specPattern, beforeSpecRun, afterSpecRun, runUrl, parallel, group, tag, testingType } = options
const { config, browser, sys, headed, outputPath, specs, specPattern, beforeSpecRun, afterSpecRun, runUrl, parallel, group, tag } = options

const isHeadless = !headed

Expand Down Expand Up @@ -814,10 +814,6 @@ async function runSpecs (options: { config: Cfg, browser: Browser, sys: any, hea
})),
})

if (testingType === 'component') {
await openProject.closeBrowser()
}

await runEvents.execute('after:run', config, moduleAPIResults)
await writeOutput(outputPath, moduleAPIResults)

Expand Down
10 changes: 10 additions & 0 deletions system-tests/projects/vite-simple/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'cypress'

export default defineConfig({
component: {
devServer: {
framework: 'react',
bundler: 'vite',
},
},
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { mount } from 'cypress/react18'

Cypress.Commands.add('mount', mount)
13 changes: 13 additions & 0 deletions system-tests/projects/vite-simple/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
19 changes: 19 additions & 0 deletions system-tests/projects/vite-simple/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "vite-simple",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^3.0.1",
"vite": "^4.0.4"
},
"type": "module"
}
7 changes: 7 additions & 0 deletions system-tests/projects/vite-simple/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function App () {
return (
<h1>Hello World</h1>
)
}

export default App
9 changes: 9 additions & 0 deletions system-tests/projects/vite-simple/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
9 changes: 9 additions & 0 deletions system-tests/projects/vite-simple/src/one.cy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import App from './App'

describe('<App />', () => {
it('renders', () => {
cy.mount(<App />)
cy.contains('h1', 'Hello World')
})
})
9 changes: 9 additions & 0 deletions system-tests/projects/vite-simple/src/two.cy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import App from './App'

describe('<App />', () => {
it('renders', () => {
cy.mount(<App />)
cy.contains('h1', 'Hello World')
})
})
6 changes: 6 additions & 0 deletions system-tests/projects/vite-simple/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
plugins: [react()],
})
Loading

5 comments on commit 2cbc2ff

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2cbc2ff Jan 25, 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/12.4.1/linux-arm64/develop-2cbc2ff71e93f20d504c8cb5018f4bbf980aa135/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2cbc2ff Jan 25, 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/12.4.1/linux-x64/develop-2cbc2ff71e93f20d504c8cb5018f4bbf980aa135/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2cbc2ff Jan 25, 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/12.4.1/darwin-arm64/develop-2cbc2ff71e93f20d504c8cb5018f4bbf980aa135/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2cbc2ff Jan 25, 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/12.4.1/darwin-x64/develop-2cbc2ff71e93f20d504c8cb5018f4bbf980aa135/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 2cbc2ff Jan 26, 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/12.4.1/win32-x64/develop-2cbc2ff71e93f20d504c8cb5018f4bbf980aa135/cypress.tgz

Please sign in to comment.