mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-26 00:49:05 -06:00
set remote to primary domain when app is reserved in e2e testing mode
This commit is contained in:
@@ -11,6 +11,7 @@ import { codeGenerator, SpecOptions } from '../codegen'
|
||||
import templates from '../codegen/templates'
|
||||
import { insertValuesInConfigFile } from '../util'
|
||||
import { getError } from '@packages/errors'
|
||||
import type { RemoteStates } from '@packages/server/lib/remote_states'
|
||||
|
||||
export interface ProjectApiShape {
|
||||
/**
|
||||
@@ -30,6 +31,7 @@ export interface ProjectApiShape {
|
||||
clearAllProjectPreferences(): Promise<unknown>
|
||||
closeActiveProject(shouldCloseBrowser?: boolean): Promise<unknown>
|
||||
getConfig(): ReceivedCypressOptions | undefined
|
||||
getRemoteStates(): RemoteStates | undefined
|
||||
getCurrentBrowser: () => Cypress.Browser | undefined
|
||||
getCurrentProjectSavedState(): {} | undefined
|
||||
setPromptShown(slug: string): void
|
||||
|
||||
@@ -67,6 +67,16 @@ export class HtmlDataSource {
|
||||
...fieldsFromLegacyCfg,
|
||||
}
|
||||
|
||||
// for project-base config, the remote state we wish to convey should be whatever top is set to, also known as the primary domain
|
||||
// whenever the app is served/re-served
|
||||
if (this.ctx.coreData.currentTestingType === 'e2e') {
|
||||
const remoteStates = this.ctx._apis.projectApi.getRemoteStates()
|
||||
|
||||
if (remoteStates) {
|
||||
cfg.remote = remoteStates.getPrimary()
|
||||
}
|
||||
}
|
||||
|
||||
cfg.browser = this.ctx._apis.projectApi.getCurrentBrowser()
|
||||
|
||||
return {
|
||||
|
||||
@@ -469,6 +469,16 @@ type Query {
|
||||
id: ID!
|
||||
): Node
|
||||
|
||||
"""
|
||||
Returns a list of cloud nodes, by ID. Max 100 nodes per batch
|
||||
"""
|
||||
cloudNodesByIds(
|
||||
"""
|
||||
A list of IDs for a Node, conforming to the Relay spec
|
||||
"""
|
||||
ids: [ID!]!
|
||||
): [Node]
|
||||
|
||||
"""
|
||||
Lookup an individual project by the slug
|
||||
"""
|
||||
|
||||
@@ -1157,6 +1157,12 @@ type Query {
|
||||
id: ID!
|
||||
): Node
|
||||
|
||||
"""Returns a list of cloud nodes, by ID. Max 100 nodes per batch"""
|
||||
cloudNodesByIds(
|
||||
"""A list of IDs for a Node, conforming to the Relay spec"""
|
||||
ids: [ID!]!
|
||||
): [Node]
|
||||
|
||||
"""Lookup an individual project by the slug"""
|
||||
cloudProjectBySlug(slug: String!): CloudProjectResult
|
||||
|
||||
|
||||
@@ -133,6 +133,9 @@ export function makeDataContext (options: MakeDataContextOptions): DataContext {
|
||||
getConfig () {
|
||||
return openProject.getConfig()
|
||||
},
|
||||
getRemoteStates () {
|
||||
return openProject.getRemoteStates()
|
||||
},
|
||||
getCurrentProjectSavedState () {
|
||||
// TODO: See if this is the best way we should be getting this config,
|
||||
// shouldn't we have this already in the DataContext?
|
||||
|
||||
@@ -39,6 +39,10 @@ export class OpenProject {
|
||||
return this.projectBase?.getConfig()
|
||||
}
|
||||
|
||||
getRemoteStates () {
|
||||
return this.projectBase?.remoteStates
|
||||
}
|
||||
|
||||
getProject () {
|
||||
return this.projectBase
|
||||
}
|
||||
|
||||
@@ -130,6 +130,10 @@ export class ProjectBase<TServer extends Server> extends EE {
|
||||
return this.cfg.state
|
||||
}
|
||||
|
||||
get remoteStates () {
|
||||
return this._server?.remoteStates
|
||||
}
|
||||
|
||||
injectCtSpecificConfig (cfg) {
|
||||
cfg.resolved.testingType = { value: 'component' }
|
||||
|
||||
@@ -484,8 +488,7 @@ export class ProjectBase<TServer extends Server> extends EE {
|
||||
|
||||
return {
|
||||
...this._cfg,
|
||||
// for project-base config, the remote state we wish to convey should be whatever top is set to, also known as the primary domain
|
||||
remote: this._server?.remoteStates.getPrimary() ?? {} as Cypress.RemoteState,
|
||||
remote: this.remoteStates?.current() ?? {} as Cypress.RemoteState,
|
||||
browser: this.browser,
|
||||
testingType: this.ctx.coreData.currentTestingType ?? 'e2e',
|
||||
specs: [],
|
||||
|
||||
Reference in New Issue
Block a user