fix: Issue 23486 (#23595)

This commit is contained in:
amehta265
2022-08-29 17:04:13 -04:00
committed by GitHub
parent 3c2fea216b
commit 6a614c312e
4 changed files with 43 additions and 2 deletions

View File

@@ -253,6 +253,42 @@ describe('Cypress in Cypress', { viewportWidth: 1500, defaultCommandTimeout: 100
cy.findByTestId('reporter-panel').should('not.be.visible')
cy.findByTestId('sidebar').should('be.visible')
})
it(`checks that specs load when devServer configuration is not set in open mode for ${testingType}`, () => {
cy.scaffoldProject('cypress-in-cypress')
cy.findBrowsers()
cy.openProject('cypress-in-cypress')
cy.startAppServer()
cy.visitApp()
cy.contains('dom-content.spec').should('exist')
cy.withCtx(async (ctx, o) => {
ctx.coreData.app.browserStatus = 'open'
let config = await ctx.actions.file.readFileInProject('cypress.config.js')
let oldFramework = `framework: 'react',`
let oldBundler = `bundler: 'webpack',`
let oldWebPackConfig = `webpackConfig: require('./webpack.config.js'),`
config = config.replace(oldFramework, ``).replace(oldBundler, ``).replace(oldWebPackConfig, ``).replace(`devServer: {`, ``).replace(/},/i, ``)
await ctx.actions.file.writeFileInProject('cypress.config.js', config)
o.sinon.stub(ctx.actions.browser, 'closeBrowser')
o.sinon.stub(ctx.actions.browser, 'relaunchBrowser')
})
cy.get('[data-cy="loading-spinner"]').should('be.visible')
cy.get('[data-cy="loading-spinner"]').should('not.exist')
// We navigate to another page to ensure the specs page re-renders with the updated changes in cypress config
// so we can assert on an up to date specs page when we navigate back to it.
cy.get('[href="#/runs"]').click()
cy.location('hash').should('eq', '#/runs')
cy.get('[href="#/specs"').click()
cy.contains('accounts_list.spec').should('be.visible')
})
})
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
let config = await ctx.actions.file.readFileInProject('cypress.config.js')
config = config.replace(`e2e: {`, `e2e: {\n chromeWebSecurity: false,\n`)
await ctx.actions.file.writeFileInProject('cypress.config.js', config)
o.sinon.stub(ctx.actions.browser, 'closeBrowser')

View File

@@ -526,7 +526,7 @@ export class ProjectActions {
const config = this.ctx.lifecycleManager.loadedConfigFile
// If devServer is a function, they are using a custom dev server.
if (typeof config?.component?.devServer === 'function') {
if (!config?.component?.devServer || typeof config?.component?.devServer === 'function') {
return undefined
}

View File

@@ -668,10 +668,14 @@ type Mutation {
Create a project in the dashboard and return its object
"""
cloudProjectCreate(
campaign: String
ciProviders: [String!]
cohort: String
medium: String
name: String!
orgId: ID!
public: Boolean!
source: String
): CloudProject
"""

View File

@@ -1188,7 +1188,7 @@ type Mutation {
closeBrowser: Boolean
"""Create a project in the dashboard and return its object"""
cloudProjectCreate(ciProviders: [String!], name: String!, orgId: ID!, public: Boolean!): CloudProject
cloudProjectCreate(campaign: String, ciProviders: [String!], cohort: String, medium: String, name: String!, orgId: ID!, public: Boolean!, source: String): CloudProject
"""Request access to an organization from a projectId"""
cloudProjectRequestAccess(projectSlug: String!): CloudProjectResult