Skip to content

Commit

Permalink
fix: migrate multiples projects when in global mode (#21458)
Browse files Browse the repository at this point in the history
* fix: migrate multiples projects when in global mode

* Add test

* Update test
  • Loading branch information
estrada9166 committed May 13, 2022
1 parent 3a3aa10 commit dcb4a61
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/data-context/src/actions/MigrationActions.ts
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
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

3 comments on commit dcb4a61

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dcb4a61 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/linux-x64/10.0-release-dcb4a61b4e522c676e8078732634972fe64afe5f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dcb4a61 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/darwin-x64/10.0-release-dcb4a61b4e522c676e8078732634972fe64afe5f/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on dcb4a61 May 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.0.0/win32-x64/10.0-release-dcb4a61b4e522c676e8078732634972fe64afe5f/cypress.tgz

Please sign in to comment.