Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed issue with CT + electron + run mode not exiting properly #25585

Merged
merged 6 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E and CT should be closing the browser equivalently so this removal looks good to me!

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