Skip to content

Commit 2eb8ef1

Browse files
Merge branch 'develop' into fix-driver-retries
2 parents 66c2fd8 + fe4ede0 commit 2eb8ef1

File tree

6 files changed

+113
-7
lines changed

6 files changed

+113
-7
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,35 @@ cypress.zip
1313
Cached Theme.pak
1414
Cached Theme Material Design.pak
1515

16+
# from data-context, compiled .js files
17+
packages/data-context/src/**/*.js
18+
1619
# from desktop-gui
1720
packages/desktop-gui/cypress/videos
1821
packages/desktop-gui/src/jsconfig.json
1922

23+
2024
# from driver
2125
packages/driver/cypress/videos
2226
packages/driver/cypress/screenshots
2327

28+
# from launcher, compiled .js files
29+
packages/launcher/index.js
30+
packages/launcher/lib/**/*.js
31+
32+
# from network, compiled .js files
33+
packages/network/lib/**/*.js
34+
35+
# from net-stubbing, compiled .js files
36+
packages/net-stubbing/lib/**/*.js
37+
2438
# from runner
2539
packages/runner/cypress/videos
2640
packages/runner/cypress/screenshots
2741

42+
# from proxy, compiled .js files
43+
packages/proxy/lib/**/*.js
44+
2845
# npm packages
2946
npm/**/cypress/screenshots
3047

@@ -33,13 +50,20 @@ packages/example/app
3350
packages/example/build
3451
packages/example/cypress/integration
3552

53+
# from frontend-shared
54+
packages/frontend-shared/cypress/e2e/.projects
55+
packages/frontend-shared/src/public/shiki/themes/cypress.theme.json
56+
3657
# from server
3758
packages/server/.cy
3859
packages/server/.projects
3960
packages/server/support
4061
packages/server/test/support/fixtures/server/imgs
4162
packages/server/test/support/fixtures/server/libs
4263

64+
# from socket, dist built files
65+
packages/socket/lib/*.js
66+
4367
# from system-tests
4468
system-tests/.projects
4569
system-tests/fixtures/large-img
@@ -57,6 +81,10 @@ system-tests/fixtures/large-img
5781
# from runner-ct
5882
/packages/runner-ct/cypress/screenshots
5983

84+
# graphql, auto-generated
85+
/packages/launchpad/src/generated
86+
/packages/app/src/generated
87+
6088
# from npm/create-cypress-tests
6189
/npm/create-cypress-tests/initial-template
6290
/npm/create-cypress-tests/src/test-output
@@ -343,3 +371,7 @@ $RECYCLE.BIN/
343371

344372
# Circle cache artifacts
345373
globbed_node_modules
374+
375+
# Autogenerated files, typically from graphql-code-generator
376+
*.gen.ts
377+
*.gen.json

npm/react/plugins/next/getRunWebpackSpan.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ import type { Span } from 'next/dist/telemetry/trace/trace'
33
// Starting with v11.1.1, a trace is required.
44
// 'next/dist/telemetry/trace/trace' only exists since v10.0.9
55
// and our peerDeps support back to v8 so try-catch this import
6+
// Starting from 12.0 trace is now located in 'next/dist/trace/trace'
67
export async function getRunWebpackSpan (): Promise<{ runWebpackSpan?: Span }> {
78
let trace: (name: string) => Span
89

910
try {
10-
trace = await import('next/dist/telemetry/trace/trace').then((m) => m.trace)
11+
try {
12+
trace = await import('next/dist/telemetry/trace/trace').then((m) => m.trace)
1113

12-
return { runWebpackSpan: trace('cypress') }
14+
return { runWebpackSpan: trace('cypress') }
15+
} catch (_) {
16+
// @ts-ignore
17+
trace = await import('next/dist/trace/trace').then((m) => m.trace)
18+
19+
return { runWebpackSpan: trace('cypress') }
20+
}
1321
} catch (_) {
1422
return {}
1523
}

packages/electron/README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Electron
1+
# @packages/electron
22

33
This is the lib responsible for installing + building Electron. This enables us to develop with the Electron shell that will match how the final compiled Cypress binary looks 1:1.
44

5-
It does this by using `symlinks` while in development.
5+
It does this by using symlinks while in development.
66

77
## Building
88

@@ -19,3 +19,33 @@ yarn workspace @packages/electron test
1919
yarn workspace @packages/electron test-debug
2020
yarn workspace @packages/electron test-watch
2121
```
22+
23+
## Upgrading Electron
24+
25+
The version of `electron` that is bundled with Cypress should be kept as up-to-date as possible with the [stable Electron releases](https://www.electronjs.org/releases/stable). Many users expect the bundled Chromium and Node.js to be relatively recent. Also, historically, it has been extremely difficult to upgrade over multiple major versions of Electron at once, because of all the breaking changes in Electron and Node.js that impact Cypress.
26+
27+
28+
Upgrading `electron` involves more than just bumping this package's `package.json`. Here are additional tasks to check off when upgrading Electron:
29+
30+
- [ ] **Write accurate changelog items.** The "User-facing changelog" for an Electron upgrade should mention the new Node.js and Chromium versions bundled.
31+
- For example:
32+
- Upgraded `electron` from `12.0.0-beta.14` to `13.1.7`.
33+
- Upgraded bundled Node.js version from `14.6.0` to `14.17.0`.
34+
- Upgraded bundled Chromium version from 89.0.0.1234 to 91.0.0.2345.
35+
- [ ] **Determine if the Electron upgrade is a breaking change.** Electron upgrades constitute "breaking changes" in Cypress if:
36+
- the major version number of Node.js changes, since users rely on the bundled Node.js to load plugins and `.js` fixtures, or
37+
- there are changes to Electron that require new shared libraries to be installed on Linux, breaking existing CI setups, or
38+
- there is some other change that would break existing usage of Cypress (for example, a Web API feature being removed/added to the bundled Chromium)
39+
- [ ] **Create and publish Docker `base` and `browsers` family images matching the Node.js and Chromium versions in Electron.** The `browsers` image will be used for CI and the `base` will be used for any new `included` family images.
40+
- See [`cypress-docker-images`](https://github.com/cypress-io/cypress-docker-images/).
41+
- [ ] **Ensure that a matching Node.js version is enforced in the monorepo for local development and CI.** When Electron is upgraded, oftentimes, the bundled Node.js version that comes with Electron is updated as well. Because all unit and integration tests run in normal Node.js (not Electron's Node.js), it's important for this Node.js version to be synced with the monorepo. There are a few places where this needs to be done:
42+
- [ ] [`/.node-version`](../../.node-version) - used by `nvm` and other Node version managers
43+
- [ ] [`/appveyor.yml`](../../appveyor.yml) - update the `nodejs_version`
44+
- [ ] [`/package.json`](../../package.json) - update `engines`
45+
- [ ] [`/scripts/run-docker-local.sh`](../../scripts/run-docker-local.sh) - update Docker image to the new matching `browsers` image
46+
- [ ] [`/circle.yml`](../../circle.yml)
47+
- Update the Docker `image`s to the new matching `browsers` image.
48+
- Update the `xcode` version to one with the same major Node.js version bundled. There is usually not an exact match, this is ok as long as the major version number as the same.
49+
- [ ] Do a global search for the old Node.js version to identify any new areas that may need updating/unification, and update those locations (and this document!)
50+
- [ ] **Manually smoke test `cypress open`.** Upgrading Electron can break the `desktop-gui` in unexpected ways. Since testing in this area is weak, double-check that things like launching `cypress open`, signing into the Dashboard, and launching Electron tests still work.
51+
- [ ] **Fix failing tests.** Usually, these are due to breaking changes in either Node.js or Electron. Check the changelogs of both to find relevant changes.

packages/runner-ct/cypress/component/RunnerCt.spec.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ interface Overrides {
2020
const noop = () => {}
2121

2222
class FakeEventManager {
23+
reporterBus: { on: () => void }
2324
constructor (overrides: Overrides = {}) {
2425
this.saveState = overrides.saveState || noop
26+
this.reporterBus = { on: noop }
2527
}
2628

2729
start = noop
@@ -132,4 +134,29 @@ describe('RunnerCt', () => {
132134
cy.get(selectors.noSpecSelectedReporter).should('exist')
133135
})
134136
})
137+
138+
context('current spec is deleted', () => {
139+
it('removes selection', () => {
140+
const state = makeState({
141+
spec: { relative: '/test.js', absolute: 'root/test.js', name: 'test.js' },
142+
specs: [
143+
{ relative: '/test2.js', absolute: 'root/test2.js', name: 'test2.js' },
144+
{ relative: '/test.js', absolute: 'root/test.js', name: 'test.js' },
145+
],
146+
})
147+
148+
mount(<RunnerCt
149+
state={state}
150+
// @ts-ignore - this is difficult to stub. Real one breaks things.
151+
eventManager={new FakeEventManager()}
152+
config={fakeConfig}
153+
/>)
154+
155+
cy.contains('Your tests are loading').then(() => {
156+
state.setSpecs([{ relative: '/test2.js', absolute: 'root/test2.js', name: 'test2.js' }])
157+
})
158+
159+
cy.contains('No spec selected')
160+
})
161+
})
135162
})

packages/runner-shared/src/store.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ export abstract class BaseStore {
2525
this.specRunId = nanoid()
2626
}
2727

28+
@action checkCurrentSpecStillExists (specs: Cypress.Cypress['spec'][]) {
29+
const newSpecsAbsolutes = new Set(specs.map((spec) => spec.absolute))
30+
31+
this.specs.forEach((oldSpec) => {
32+
if (!newSpecsAbsolutes.has(oldSpec.absolute) && this.spec?.absolute === oldSpec.absolute) {
33+
this.spec = undefined
34+
}
35+
})
36+
}
37+
2838
@action setSpecs (specs: Cypress.Cypress['spec'][]) {
39+
this.checkCurrentSpecStillExists(specs)
40+
2941
this.specs = specs
3042
}
3143

system-tests/test/screenshots_spec.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ describe('e2e screenshots', () => {
9797
.then((sizes) => {
9898
// make sure all of the values are unique
9999
expect(sizes).to.deep.eq(_.uniq(sizes))
100-
101-
// png1 should not be within 1k of png2
102-
expect(sizes[0]).not.to.be.closeTo(sizes[1], 1000)
103100
}).then(() => {
104101
return Promise.all([
105102
sizeOf(screenshot1),

0 commit comments

Comments
 (0)