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

breaking: no longer inject document.domain by default #30770

Open
wants to merge 88 commits into
base: release/14.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
5b42419
remove experimentalSkipDomainInjection, add and deprecate injectDocum…
cacieprins Oct 17, 2024
151952d
remove experimentalSkipDomainInjection, add injectDocumentDomain
cacieprins Oct 17, 2024
dc4fb0b
begin rethreading domain injection
cacieprins Oct 18, 2024
330adc4
complete document domain transition
cacieprins Oct 21, 2024
2000405
move some cookie specs to separate test run
cacieprins Oct 22, 2024
0f822b5
origin and privileged commands with default docdom inject
cacieprins Oct 23, 2024
8275e4d
fix privileged channel when injecting document domain
cacieprins Oct 23, 2024
4a52817
rm unnecessary .getOrigin abstraction in cors lib
cacieprins Oct 23, 2024
b3b60a1
move remote-states in prep for refactor Replace Conditional with Poly…
cacieprins Oct 23, 2024
a8f6406
refactor remote states to strategy pattern
cacieprins Oct 24, 2024
c54224b
cookie commands work as expected w cross origin bridge on different o…
cacieprins Oct 28, 2024
110996b
some origin tests updated
cacieprins Oct 30, 2024
4895219
run tests with document domain enabled
cacieprins Oct 30, 2024
33d33cd
run tests actually
cacieprins Oct 30, 2024
1d348c9
use correct config, swap conditional
cacieprins Oct 30, 2024
8b943d0
check-ts
cacieprins Oct 30, 2024
1166858
inject documetn domain for webkit tests
cacieprins Oct 30, 2024
25c3ac7
do not exec injectDocumetnDomain in parallel
cacieprins Oct 30, 2024
b4c0be3
fix ServerBase construction in tests to include cfg now
cacieprins Oct 31, 2024
3e613f0
pass cfg to ServerBase
cacieprins Oct 31, 2024
b6090f7
improved integration tests
cacieprins Oct 31, 2024
4da149d
remove document domain checks for all server integration specs - will…
cacieprins Nov 1, 2024
9bcc1f3
tests for injecting document domain when configured to
cacieprins Nov 1, 2024
e8ccb4d
square away server integration tests
cacieprins Nov 5, 2024
db047b7
ensure cookies are set correctly, potentially
cacieprins Nov 7, 2024
55fa5b1
errors pkg snapshots
cacieprins Nov 7, 2024
018816c
fix config tests
cacieprins Nov 8, 2024
5622cc5
fixing config tests
cacieprins Nov 8, 2024
b01df45
somewhat improves tests for cors policies in packages/network
cacieprins Nov 12, 2024
03f34bb
fix ts err in server-base
cacieprins Nov 12, 2024
c3ac388
Merge branch 'release/14.0.0' into cacie/29590/document-domain-subdom…
cacieprins Nov 12, 2024
376627b
enable injectDocumentDomain for cy in cy tests
cacieprins Nov 13, 2024
52156bf
fix Policy type ref
cacieprins Nov 13, 2024
18ae100
refactor cypress-schematic ct spec to be less prone to timeouts
cacieprins Nov 14, 2024
e66d194
run vite-dev-server tests with injectDocumentDomain
cacieprins Nov 14, 2024
19ce24e
rm document domain assertion from page_loading system test
cacieprins Nov 14, 2024
3d2a0c1
add system tests that test with injectDocumentDomain and others that …
cacieprins Nov 15, 2024
edbdb36
fix results_spec snapshot
cacieprins Nov 15, 2024
dd9a50d
update experimentalSkipDomainInjection system test
cacieprins Nov 18, 2024
70c0a8f
different behavior for certain net_stubbing tests based on injectDocu…
cacieprins Nov 19, 2024
29110af
fix ts
cacieprins Nov 19, 2024
e1e0829
extract origin key logic from remote states, for now
cacieprins Nov 21, 2024
ec669b8
move server-base and response-middleware over to new pattern
cacieprins Nov 21, 2024
e448022
WIP - reentry
cacieprins Nov 22, 2024
e19fb59
Merge branch 'release/14.0.0' into cacie/29590/document-domain-subdom…
cacieprins Dec 4, 2024
9a1c30e
fix build, remove console.log
cacieprins Dec 4, 2024
e97d548
check-ts
cacieprins Dec 4, 2024
941701f
fix spec frame injection
cacieprins Dec 5, 2024
e651ef6
remove injection for localhost
cacieprins Dec 5, 2024
0ec1b12
mostly fix vite-dev-server app integration tests
cacieprins Dec 6, 2024
5de96f0
fix codeframe in certain cases in chrome
cacieprins Dec 9, 2024
0d6b14d
drop internal stack frames from stacks intended for determining code …
cacieprins Dec 10, 2024
5afda0f
some improvements to vite ct error codeframes
cacieprins Dec 13, 2024
6cde8b9
fix proxy unit tests to use document domain injection util class
cacieprins Dec 13, 2024
69b7f6b
rm .only
cacieprins Dec 13, 2024
ddce890
fix all vite ct error specs
cacieprins Dec 13, 2024
a6b486f
rm console.log
cacieprins Dec 13, 2024
a857a38
slight refactor to util class to make easier to test
cacieprins Dec 16, 2024
ec653df
fix refactor - missing rename in files.js
cacieprins Dec 16, 2024
81cacf8
several tests do not set testingtype in config, so just check against…
cacieprins Dec 16, 2024
125b41e
revert changes to getInvocationDetails to see if that breaks tests
cacieprins Dec 17, 2024
1dcc5ab
re-enable stack stripping in invocation details for chrome
cacieprins Dec 18, 2024
7378f8e
new snapshots with more accurate invocation details
cacieprins Dec 18, 2024
af8f2a7
test for same-site cross-origin cookie behavior
cacieprins Dec 18, 2024
40ea65a
ignore window.top ts errors
cacieprins Dec 18, 2024
e4cdd85
Merge branch 'release/14.0.0' into cacie/29590/document-domain-subdom…
cacieprins Dec 18, 2024
361b066
revert forcing injectDocumentDomain in vite-dev-server cy config
cacieprins Dec 18, 2024
3de7b83
fix normalized whitespace for firefox "loading_failed" error
cacieprins Dec 18, 2024
b560617
always trim trailing wsp from stack before appending additional content
cacieprins Dec 19, 2024
3966f54
force normalization of whitespace to three \n when adding additional …
cacieprins Dec 19, 2024
b8cfc70
normalize wsp between stack and additional stack to "\n \n" in firefox
cacieprins Dec 19, 2024
0300676
remove stack_utils attempt at normalizing wsp
cacieprins Dec 19, 2024
4e090de
various cleanup: remove commented console logs, add more detailed com…
cacieprins Dec 20, 2024
58db915
add on links to error messages
cacieprins Dec 20, 2024
728e4bf
remove experimentalSkipDomainInjection from exported type defs
cacieprins Dec 20, 2024
bed8fb3
Update system-tests/test/experimental_skip_domain_injection_spec.ts
cacieprins Dec 20, 2024
a0a151a
Update packages/driver/cypress/e2e/e2e/origin/cookie_misc.cy.ts
cacieprins Dec 20, 2024
6c52c93
no need to coerce a boolean value to a booleanc
cacieprins Dec 20, 2024
34e0573
export base config from primary cypress config in driver for use in i…
cacieprins Dec 20, 2024
c03e62b
lift experimentalSkipDomainInjection breaking option to root
cacieprins Dec 20, 2024
0539a72
rollback config/options changes
cacieprins Dec 20, 2024
a8f0663
rm invalid comment
cacieprins Dec 20, 2024
fb1219c
use hostname instead of origin to create cookie from automation cookie
cacieprins Dec 20, 2024
ea57654
clarify stack regex in results_spec
cacieprins Dec 20, 2024
b86bd00
lint
cacieprins Dec 20, 2024
a20a34e
Merge branch 'release/14.0.0' into cacie/29590/document-domain-subdom…
jennifer-shehane Dec 23, 2024
1bece96
take a stab at the changelog entries for this
jennifer-shehane Dec 23, 2024
8ce3f5e
Merge branch 'cacie/29590/document-domain-subdomains' of https://gith…
jennifer-shehane Dec 23, 2024
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
62 changes: 59 additions & 3 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mainBuildFilters: &mainBuildFilters
- 'update-v8-snapshot-cache-on-develop'
- 'chore/update_vue_test_utils'
- 'publish-binary'
- 'cacie/29590/document-domain-subdomains'

# usually we don't build Mac app - it takes a long time
# but sometimes we want to really confirm we are doing the right thing
Expand Down Expand Up @@ -573,6 +574,11 @@ commands:
description: chrome channel to install
type: string
default: ''
inject-document-domain:
description: run subset of tests with injectDocumentDomain config enabled
type: boolean
default: false

steps:
- restore_cached_workspace
- when:
Expand All @@ -594,11 +600,20 @@ commands:
echo Current working directory is $PWD
echo Total containers $CIRCLE_NODE_TOTAL


if << parameters.inject-document-domain >> ; then
YARN_CMD="cypress:run:inject-document-domain"
PARALLEL=""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can't be parallel because it ends up with the same build id but a different set of specs from the run without injectDocumentDomain

else
YARN_CMD="cypress:run"
PARALLEL="--parallel --group 5x-driver-<<parameters.browser>>"
fi

if [[ -v MAIN_RECORD_KEY ]]; then
# internal PR
CYPRESS_RECORD_KEY=$MAIN_RECORD_KEY \
CYPRESS_INTERNAL_ENABLE_TELEMETRY="true" \
yarn cypress:run --record --parallel --group 5x-driver-<<parameters.browser>> --browser <<parameters.browser>> --runner-ui
yarn $YARN_CMD --record $PARALLEL --browser <<parameters.browser>> --runner-ui
else
# external PR
TESTFILES=$(circleci tests glob "cypress/e2e/**/*.cy.*" | circleci tests split --total=$CIRCLE_NODE_TOTAL)
Expand All @@ -607,7 +622,7 @@ commands:
if [[ -z "$TESTFILES" ]]; then
echo "Empty list of test files"
fi
yarn cypress:run --browser <<parameters.browser>> --spec $TESTFILES --runner-ui
yarn $YARN_CMD --browser <<parameters.browser>> --spec $TESTFILES --runner-ui
fi
working_directory: packages/driver
- verify-mocha-results
Expand Down Expand Up @@ -2002,6 +2017,16 @@ jobs:
- run-driver-integration-tests:
browser: chrome
install-chrome-channel: stable

driver-integration-tests-chrome-inject-document-domain:
<<: *defaults
parallelism: 5
resource_class: medium+
steps:
- run-driver-integration-tests:
browser: chrome
install-chrome-channel: stable
inject-document-domain: true

driver-integration-tests-chrome-beta:
<<: *defaults
Expand All @@ -2012,6 +2037,16 @@ jobs:
browser: chrome:beta
install-chrome-channel: beta

driver-integration-tests-chrome-beta-inject-document-domain:
<<: *defaults
resource_class: medium+
parallelism: 5
steps:
- run-driver-integration-tests:
browser: chrome:beta
install-chrome-channel: beta
inject-document-domain: true

driver-integration-tests-firefox:
<<: *defaults
resource_class: medium+
Expand All @@ -2034,6 +2069,8 @@ jobs:
steps:
- run-driver-integration-tests:
browser: webkit
# inject document domain must be true for webkit, as cy.origin is not supported
inject-document-domain: true

run-reporter-component-tests-chrome:
<<: *defaults
Expand Down Expand Up @@ -2816,7 +2853,8 @@ linux-x64-workflow: &linux-x64-workflow
- run-vite-dev-server-integration-tests
- driver-integration-tests-firefox
- driver-integration-tests-chrome
- driver-integration-tests-chrome-beta
- driver-integration-tests-chrome-inject-document-domain
- driver-integration-tests-chrome-beta-inject-document-domain
- driver-integration-tests-electron
- driver-integration-tests-webkit
- driver-integration-memory-tests
Expand Down Expand Up @@ -2873,10 +2911,18 @@ linux-x64-workflow: &linux-x64-workflow
context: test-runner:cypress-record-key
requires:
- build
- driver-integration-tests-chrome-inject-document-domain:
context: test-runner:cypress-record-key
requires:
- build
- driver-integration-tests-chrome-beta:
context: test-runner:cypress-record-key
requires:
- build
- driver-integration-tests-chrome-beta-inject-document-domain:
context: test-runner:cypress-record-key
requires:
- build
- driver-integration-tests-firefox:
context: test-runner:cypress-record-key
requires:
Expand Down Expand Up @@ -3000,6 +3046,8 @@ linux-x64-workflow: &linux-x64-workflow
- driver-integration-tests-firefox
- driver-integration-tests-chrome
- driver-integration-tests-chrome-beta
- driver-integration-tests-chrome-inject-document-domain
- driver-integration-tests-chrome-beta-inject-document-domain
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding firefox and electron to this mix was going to be pretty cumbersome - I'd like to refactor workflows.yml to use matrix parameters, which would make all of this so much easier.

- driver-integration-tests-electron
- driver-integration-tests-webkit
- driver-integration-memory-tests
Expand Down Expand Up @@ -3234,10 +3282,18 @@ linux-x64-contributor-workflow: &linux-x64-contributor-workflow
context: test-runner:cypress-record-key
requires:
- contributor-pr
- driver-integration-tests-chrome-inject-document-domain:
context: test-runner:cypress-record-key
requires:
- contributor-pr
- driver-integration-tests-chrome-beta:
context: test-runner:cypress-record-key
requires:
- contributor-pr
- driver-integration-tests-chrome-beta-inject-document-domain:
context: test-runner:cypress-record-key
requires:
- contributor-pr
- driver-integration-tests-firefox:
context: test-runner:cypress-record-key
requires:
Expand Down
4 changes: 4 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ _Released 1/7/2024 (PENDING)_
- Upgraded bundled Node.js version from `18.17.0` to `20.18.1`. Addresses [#29547](https://github.com/cypress-io/cypress/issues/29547).
- Prebuilt binaries for Linux are no longer compatible with Linux distributions based on glibc <2.28, for example: Ubuntu 14-18, RHEL 7, CentOS 7, Amazon Linux 2. Addresses [#29601](https://github.com/cypress-io/cypress/issues/29601).
- Cypress now only officially supports the latest 3 major versions of Chrome, Firefox, and Edge - older browser versions may still work, but we recommend keeping your browsers up to date to ensure compatibility with Cypress. A warning will no longer be displayed on browser selection in the Launchpad for any 'unsupported' browser versions. Additionally, the undocumented `minSupportedVersion` property has been removed from `Cypress.browser`. Addressed in [#30462](https://github.com/cypress-io/cypress/pull/30462).
- The `cy.origin()` command must now be used when navigating between subdomains. Because this is a fairly disruptive change for users who frequently navigate between subdomains, a new configuration option is being introduced. `injectDocumentDomain` can be set to `true` in order to re-enable the injection of `document.domain` setters in Cypress. This configuration option is marked as deprecated and you'll receive a warning when Cypress is launched with this option set to `true`. It will be removed in Cypress 15. Addressed in [#30770](https://github.com/cypress-io/cypress/pull/30770).
- The `experimentalSkipDomainInjection` configuration has been removed and replaced with an `injectDocumentDomain` configuration. Addressed in [#30770](https://github.com/cypress-io/cypress/pull/30770).
- It is no longer possible to make a `fetch` or `XMLHttpRequest` request from the `about:blank` page in Electron (i.e. `cy.window().then((win) => win.fetch('<some-url>')`). You must use `cy.request` instead or perform some form of initial navigation via `cy.visit()`. Addressed in [#29547](https://github.com/cypress-io/cypress/pull/30394).
- The `experimentalJustInTimeCompile` configuration option for component testing has been replaced with a `justInTimeCompile` option that is `true` by default. This option will only compile resources directly related to your spec, compiling them 'just-in-time' before spec execution. This should result in improved memory management and performance for component tests in `cypress open` and `cypress run` modes, in particular for large component testing suites. `justInTimeCompile` is now only supported for [`webpack`](https://www.npmjs.com/package/webpack). Addresses [#30234](https://github.com/cypress-io/cypress/issues/30234). Addressed in [#30402](https://github.com/cypress-io/cypress/pull/30402).
- Cypress Component Testing no longer supports:
Expand All @@ -35,9 +37,11 @@ _Released 1/7/2024 (PENDING)_

- The `resourceType` option on `cy.intercept` has been deprecated. We anticipate the resource types to change or be completely removed in the future. Our intention is to replace essential functionality dependent on the `resourceType` within Cypress in a future version (like hiding network logs that are not fetch/xhr). Please leave feedback on any essential uses of `resourceType`
in this [GitHub issue](https://github.com/cypress-io/cypress/issues/30447). Addresses [#30433](https://github.com/cypress-io/cypress/issues/30433).
- The new `injectDocumentDomain` configuration option is released as deprecated. It will be removed in Cypress 15. Addressed in [#30770](https://github.com/cypress-io/cypress/pull/30770).

**Features:**

- `injectDocumentDomain`, a new configuration option, can be set to `true` in order to re-enable the injection of `document.domain` setters in Cypress. Addressed in [#30770](https://github.com/cypress-io/cypress/pull/30770).
- Cypress Component Testing now supports:
- `Next.js` version >=15.0.4. Versions 15.0.0 - 15.0.3 depend on the React 19 Release Candidate and are not officially supported by Cypress, but should still work. Addresses [#30445](https://github.com/cypress-io/cypress/issues/30445).
- `React` version 19. Addresses [#29470](https://github.com/cypress-io/cypress/issues/29470).
Expand Down
21 changes: 10 additions & 11 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ declare namespace Cypress {
strategy: 'file' | 'http'
origin: string
fileServer: string | null
props: Record<string, any>
visiting: string
props: Record<string, any> | null
Copy link
Contributor Author

Choose a reason for hiding this comment

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

visiting was never used or set internally that I could find, and props not being nullable was inconsistent with the implementation. Potential improvement: import this type directly from packages/server/lib/remote_states so it stays consistent with the implementation

}

interface Backend {
Expand Down Expand Up @@ -3103,16 +3102,16 @@ declare namespace Cypress {
*/
experimentalModifyObstructiveThirdPartyCode: boolean
/**
* Disables setting document.domain to the applications super domain on injection.
* This experiment is to be used for sites that do not work with setting document.domain
* due to cross-origin issues. Enabling this option no longer allows for default subdomain
* navigations, and will require the use of cy.origin(). This option takes an array of
* strings/string globs.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/domain
* @see https://on.cypress.io/experiments#Experimental-Skip-Domain-Injection
* @default null
* Enables setting document.domain to the superdomain on code injection. This option is
* disabled by default. Enabling this option allows for navigating between subdomains in
* the same test without the use of cy.origin(). Setting document.domain is deprecated in Chrome.
* Enabling this may result in incompatibilities with sites that leverage origin-agent-cluster
* headers. Enabling this when a browser does not support setting document.domain will not result
* in the browser allowing document.domain to be set. In these cases, this configuration option
* must be set to false, to allow cy.origin() to be used on subdomains.
* @default false
*/
experimentalSkipDomainInjection: string[] | null
injectDocumentDomain: boolean
/**
* Enables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm.
* @default false
Expand Down
63 changes: 32 additions & 31 deletions npm/cypress-schematic/src/ct.spec.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
import { describe, it } from 'vitest'
import { describe, it, beforeEach, afterEach } from 'vitest'
import Fixtures, { ProjectFixtureDir } from '@tooling/system-tests'
import * as FixturesScaffold from '@tooling/system-tests/lib/dep-installer'
import execa from 'execa'
import path from 'path'
import * as fs from 'fs-extra'

const scaffoldAngularProject = async (project: string) => {
const projectPath = Fixtures.projectPath(project)

Fixtures.removeProject(project)
await Fixtures.scaffoldProject(project)
await FixturesScaffold.scaffoldProjectNodeModules({ project })
await fs.remove(path.join(projectPath, 'cypress.config.ts'))
await fs.remove(path.join(projectPath, 'cypress'))

return projectPath
}

const runCommandInProject = (command: string, projectPath: string) => {
const [ex, ...args] = command.split(' ')

Expand All @@ -38,25 +26,38 @@ const cypressSchematicPackagePath = path.join(__dirname, '..')

const ANGULAR_PROJECTS: ProjectFixtureDir[] = ['angular-18', 'angular-19']

describe('ng add @cypress/schematic / e2e and ct', { timeout: 1000 * 60 * 5 }, function () {
for (const project of ANGULAR_PROJECTS) {
it('should install ct files with option and no component specs', async () => {
const projectPath = await scaffoldAngularProject(project)
const timeout = 1000 * 60 * 5

await runCommandInProject(`yarn add @cypress/schematic@file:${cypressSchematicPackagePath}`, projectPath)
await runCommandInProject('yarn ng add @cypress/schematic --e2e --component', projectPath)
await copyAngularMount(projectPath)
await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/app.component.cy.ts', projectPath)
})

it('should generate component alongside component spec', async () => {
const projectPath = await scaffoldAngularProject(project)

await runCommandInProject(`yarn add @cypress/schematic@file:${cypressSchematicPackagePath}`, projectPath)
await runCommandInProject('yarn ng add @cypress/schematic --e2e --component', projectPath)
await copyAngularMount(projectPath)
await runCommandInProject('yarn ng generate c foo', projectPath)
await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/foo/foo.component.cy.ts', projectPath)
describe('ng add @cypress/schematic / e2e and ct', function () {
for (const project of ANGULAR_PROJECTS) {
describe(project, () => {
const projectPath: string = Fixtures.projectPath(project)

beforeEach(async () => {
await Fixtures.scaffoldProject(project)
await FixturesScaffold.scaffoldProjectNodeModules({ project })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moving the scaffoldAngularProject function inline into a beforeEach here keeps the DRY while improving the readability of the spec

Copy link
Contributor

Choose a reason for hiding this comment

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

should we consider moving these changes into its own PR for a quick review and to reduce changeset here?

Copy link
Contributor Author

@cacieprins cacieprins Dec 20, 2024

Choose a reason for hiding this comment

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

I think so - This refactor was done to help understand why the tests were failing, and don't actually change the nature of the tests other than clarification of stdout.

await fs.remove(path.join(projectPath, 'cypress.config.ts'))
await fs.remove(path.join(projectPath, 'cypress'))

await runCommandInProject(`yarn add @cypress/schematic@file:${cypressSchematicPackagePath}`, projectPath)
}, timeout)

afterEach(() => {
Fixtures.removeProject(project)
}, timeout)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving the cleanup to an afterEach ensures that the project is removed after the last it(), rather than left in place


it('should install ct files with option and no component specs', async () => {
await runCommandInProject('yarn ng add @cypress/schematic --e2e --component', projectPath)
await copyAngularMount(projectPath)
await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/app.component.cy.ts', projectPath)
}, timeout)

it('should generate component alongside component spec', async () => {
await runCommandInProject('yarn ng add @cypress/schematic --e2e --component', projectPath)
await copyAngularMount(projectPath)
await runCommandInProject('yarn ng generate c foo', projectPath)
await runCommandInProject('yarn ng run angular:ct --watch false --spec src/app/foo/foo.component.cy.ts', projectPath)
}, timeout)
})
}
})
8 changes: 1 addition & 7 deletions npm/vite-dev-server/src/plugins/cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,7 @@ export const Cypress = (
},
configureServer: async (server: ViteDevServer) => {
server.middlewares.use(`${base}index.html`, async (req, res) => {
let transformedIndexHtml = await server.transformIndexHtml(base, '')
const viteImport = `<script type="module" src="${options.cypressConfig.devServerPublicPathRoute}/@vite/client"></script>`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because document.domain is no longer injected by default in cy, it doesn't need to be set in vite-dev-server for the sake of cy-in-cy tests!


// If we're doing cy-in-cy, we need to be able to access the Cypress instance from the parent frame.
if (process.env.CYPRESS_INTERNAL_VITE_OPEN_MODE_TESTING) {
transformedIndexHtml = transformedIndexHtml.replace(viteImport, `<script>document.domain = 'localhost';</script>${viteImport}`)
}
const transformedIndexHtml = await server.transformIndexHtml(base, '')

return res.end(transformedIndexHtml)
})
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,6 @@
"devtools-protocol": "0.0.1346313",
"sharp": "0.29.3",
"vue-template-compiler": "2.6.12"
}
},
"packageManager": "[email protected]+sha512.ff4579ab459bb25aa7c0ff75b62acebe576f6084b36aa842971cf250a5d8c6cd3bc9420b22ce63c7f93a0857bc6ef29291db39c3e7a23aab5adfd5a4dd6c5d71"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using yarn in conjunction with corepack added this line

Copy link
Contributor

Choose a reason for hiding this comment

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

I think develop is on 1.22.22 which gets set via yarn set version. We might need to merge develop into 14 which I can look into shortly

}
3 changes: 3 additions & 0 deletions packages/config/__snapshots__/index.spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exports['config/src/index .getDefaultValues returns list of public config keys 1
'experimentalRunAllSpecs': false,
'experimentalMemoryManagement': false,
'experimentalModifyObstructiveThirdPartyCode': false,
'injectDocumentDomain': false,
'experimentalSkipDomainInjection': null,
'experimentalOriginDependencies': false,
'experimentalSourceRewriting': false,
Expand Down Expand Up @@ -131,6 +132,7 @@ exports['config/src/index .getDefaultValues returns list of public config keys f
'experimentalRunAllSpecs': false,
'experimentalMemoryManagement': false,
'experimentalModifyObstructiveThirdPartyCode': false,
'injectDocumentDomain': false,
'experimentalSkipDomainInjection': null,
'experimentalOriginDependencies': false,
'experimentalSourceRewriting': false,
Expand Down Expand Up @@ -218,6 +220,7 @@ exports['config/src/index .getPublicConfigKeys returns list of public config key
'experimentalRunAllSpecs',
'experimentalMemoryManagement',
'experimentalModifyObstructiveThirdPartyCode',
'injectDocumentDomain',
'experimentalSkipDomainInjection',
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be removed from the snapshots

Suggested change
'experimentalSkipDomainInjection',
'',

'experimentalOriginDependencies',
'experimentalSourceRewriting',
Expand Down
Loading
Loading