Skip to content

Commit 6a614c3

Browse files
authored
fix: Issue 23486 (#23595)
1 parent 3c2fea2 commit 6a614c3

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

packages/app/cypress/e2e/cypress-in-cypress.cy.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,42 @@ describe('Cypress in Cypress', { viewportWidth: 1500, defaultCommandTimeout: 100
253253
cy.findByTestId('reporter-panel').should('not.be.visible')
254254
cy.findByTestId('sidebar').should('be.visible')
255255
})
256+
257+
it(`checks that specs load when devServer configuration is not set in open mode for ${testingType}`, () => {
258+
cy.scaffoldProject('cypress-in-cypress')
259+
cy.findBrowsers()
260+
cy.openProject('cypress-in-cypress')
261+
cy.startAppServer()
262+
cy.visitApp()
263+
cy.contains('dom-content.spec').should('exist')
264+
cy.withCtx(async (ctx, o) => {
265+
ctx.coreData.app.browserStatus = 'open'
266+
267+
let config = await ctx.actions.file.readFileInProject('cypress.config.js')
268+
269+
let oldFramework = `framework: 'react',`
270+
let oldBundler = `bundler: 'webpack',`
271+
let oldWebPackConfig = `webpackConfig: require('./webpack.config.js'),`
272+
273+
config = config.replace(oldFramework, ``).replace(oldBundler, ``).replace(oldWebPackConfig, ``).replace(`devServer: {`, ``).replace(/},/i, ``)
274+
275+
await ctx.actions.file.writeFileInProject('cypress.config.js', config)
276+
277+
o.sinon.stub(ctx.actions.browser, 'closeBrowser')
278+
o.sinon.stub(ctx.actions.browser, 'relaunchBrowser')
279+
})
280+
281+
cy.get('[data-cy="loading-spinner"]').should('be.visible')
282+
cy.get('[data-cy="loading-spinner"]').should('not.exist')
283+
284+
// We navigate to another page to ensure the specs page re-renders with the updated changes in cypress config
285+
// so we can assert on an up to date specs page when we navigate back to it.
286+
287+
cy.get('[href="#/runs"]').click()
288+
cy.location('hash').should('eq', '#/runs')
289+
cy.get('[href="#/specs"').click()
290+
cy.contains('accounts_list.spec').should('be.visible')
291+
})
256292
})
257293

258294
it('restarts browser if there is a change on the config file affecting the browser', () => {
@@ -265,6 +301,7 @@ describe('Cypress in Cypress', { viewportWidth: 1500, defaultCommandTimeout: 100
265301
let config = await ctx.actions.file.readFileInProject('cypress.config.js')
266302

267303
config = config.replace(`e2e: {`, `e2e: {\n chromeWebSecurity: false,\n`)
304+
268305
await ctx.actions.file.writeFileInProject('cypress.config.js', config)
269306

270307
o.sinon.stub(ctx.actions.browser, 'closeBrowser')

packages/data-context/src/actions/ProjectActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export class ProjectActions {
526526
const config = this.ctx.lifecycleManager.loadedConfigFile
527527

528528
// If devServer is a function, they are using a custom dev server.
529-
if (typeof config?.component?.devServer === 'function') {
529+
if (!config?.component?.devServer || typeof config?.component?.devServer === 'function') {
530530
return undefined
531531
}
532532

packages/graphql/schemas/cloud.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,10 +668,14 @@ type Mutation {
668668
Create a project in the dashboard and return its object
669669
"""
670670
cloudProjectCreate(
671+
campaign: String
671672
ciProviders: [String!]
673+
cohort: String
674+
medium: String
672675
name: String!
673676
orgId: ID!
674677
public: Boolean!
678+
source: String
675679
): CloudProject
676680

677681
"""

packages/graphql/schemas/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ type Mutation {
11881188
closeBrowser: Boolean
11891189

11901190
"""Create a project in the dashboard and return its object"""
1191-
cloudProjectCreate(ciProviders: [String!], name: String!, orgId: ID!, public: Boolean!): CloudProject
1191+
cloudProjectCreate(campaign: String, ciProviders: [String!], cohort: String, medium: String, name: String!, orgId: ID!, public: Boolean!, source: String): CloudProject
11921192

11931193
"""Request access to an organization from a projectId"""
11941194
cloudProjectRequestAccess(projectSlug: String!): CloudProjectResult

0 commit comments

Comments
 (0)