Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions packages/data-context/src/actions/MigrationActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,11 @@ export class MigrationActions {
throw error
})

// @ts-ignore configFile needs to be updated with the new one, so it finds the correct one
// with the new file, instead of the deleted one which is not supported anymore
this.ctx.modeOptions.configFile = this.ctx.migration.configFileNameAfterMigration
if (this.ctx.modeOptions.configFile) {
// @ts-ignore configFile needs to be updated with the new one, so it finds the correct one
// with the new file, instead of the deleted one which is not supported anymore
this.ctx.modeOptions.configFile = this.ctx.migration.configFileNameAfterMigration
}
}

async setLegacyConfigForMigration (config: LegacyCypressConfigJson) {
Expand Down
45 changes: 45 additions & 0 deletions packages/launchpad/cypress/e2e/migration.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,51 @@ function renameSupport (lang: 'js' | 'ts' | 'coffee' = 'js') {
}, { lang })
}

describe('global mode', () => {
it('migrates 2 projects in global mode', () => {
cy.openGlobalMode()
cy.addProject('migration-e2e-export-default')
cy.addProject('migration-e2e-custom-integration-with-projectId')
cy.visitLaunchpad()

cy.withCtx((ctx, o) => {
o.sinon.stub(ctx.actions.migration, 'locallyInstalledCypressVersion').returns('10.0.0')
})

cy.contains('migration-e2e-export-default').click()
// rename integration->e2e
cy.get(renameAutoStep).should('exist')
cy.get(renameManualStep).should('not.exist')

// cypress/support/index.ts -> cypress/support/e2e.ts
cy.get(renameSupportStep).should('exist')
// no component specs
cy.get(setupComponentStep).should('not.exist')

cy.get(configFileStep).should('exist')

runAutoRename()
renameSupport('ts')
migrateAndVerifyConfig('cypress.config.ts')
checkOutcome()

cy.contains('Projects').click()
cy.contains('migration-e2e-custom-integration-with-projectId').click()
// default testFiles but custom integration - can rename automatically
cy.get(renameAutoStep).should('not.exist')
// no CT
cy.get(renameManualStep).should('not.exist')
// supportFile is false - cannot migrate
cy.get(renameSupportStep).should('exist')
cy.get(setupComponentStep).should('not.exist')
cy.get(configFileStep).should('exist')

renameSupport()
migrateAndVerifyConfig()
checkOutcome()
})
})

describe('Opening unmigrated project', () => {
it('legacy project with --e2e', () => {
cy.scaffoldProject('migration')
Expand Down