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

fix: Issue 23486 #23595

Merged
merged 7 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/app/cypress/e2e/cypress-in-cypress.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 allow enough time for the specs page to re-render with the updated changes in cypress config
amehta265 marked this conversation as resolved.
Show resolved Hide resolved
// 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', () => {
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion packages/data-context/src/actions/ProjectActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,6 @@ export class ProjectActions {
}

// @ts-ignore - because of the conditional above, we know that devServer isn't a function
return WIZARD_FRAMEWORKS.find((framework) => framework.configFramework === config?.component?.devServer.framework)
return WIZARD_FRAMEWORKS.find((framework) => framework.configFramework === config?.component?.devServer?.framework)
amehta265 marked this conversation as resolved.
Show resolved Hide resolved
}
}
4 changes: 4 additions & 0 deletions packages/graphql/schemas/cloud.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/schemas/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down