diff --git a/client/landing/stepper/declarative-flow/site-migration-flow.ts b/client/landing/stepper/declarative-flow/site-migration-flow.ts index 63bcc14e50a93..d6452e4c23d55 100644 --- a/client/landing/stepper/declarative-flow/site-migration-flow.ts +++ b/client/landing/stepper/declarative-flow/site-migration-flow.ts @@ -311,6 +311,19 @@ const siteMigration: Flow = { // Do it for me option. if ( providedDependencies?.how === HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME ) { + if ( config.isEnabled( 'automated-migration/collect-credentials' ) ) { + return navigate( + addQueryArgs( + { + siteSlug, + from: fromQueryParam, + siteId, + }, + STEPS.SITE_MIGRATION_CREDENTIALS.slug + ) + ); + } + return navigate( STEPS.SITE_MIGRATION_ASSISTED_MIGRATION.slug, { siteId, siteSlug, diff --git a/client/landing/stepper/declarative-flow/test/hosted-site-migration-flow.tsx b/client/landing/stepper/declarative-flow/test/hosted-site-migration-flow.tsx index 8eab4609657b3..117006ea3b0b4 100644 --- a/client/landing/stepper/declarative-flow/test/hosted-site-migration-flow.tsx +++ b/client/landing/stepper/declarative-flow/test/hosted-site-migration-flow.tsx @@ -1,6 +1,7 @@ /** * @jest-environment jsdom */ +import config from '@automattic/calypso-config'; import { PLAN_MIGRATION_TRIAL_MONTHLY } from '@automattic/calypso-products'; import { isCurrentUserLoggedIn } from '@automattic/data-stores/src/user/selectors'; import { waitFor } from '@testing-library/react'; @@ -180,6 +181,7 @@ describe( 'Hosted site Migration Flow', () => { } ); it( 'migrate redirects from the how-to-migrate (do it for me) page to assisted migration page', () => { + config.disable( 'automated-migration/collect-credentials' ); const { runUseStepNavigationSubmit } = renderFlow( hostedSiteMigrationFlow ); runUseStepNavigationSubmit( { @@ -196,6 +198,24 @@ describe( 'Hosted site Migration Flow', () => { siteSlug: 'example.wordpress.com', }, } ); + config.enable( 'automated-migration/collect-credentials' ); + } ); + + it( 'migrate redirects from the how-to-migrate (do it for me) page to credential collection step', () => { + const { runUseStepNavigationSubmit } = renderFlow( hostedSiteMigrationFlow ); + + runUseStepNavigationSubmit( { + currentStep: STEPS.SITE_MIGRATION_HOW_TO_MIGRATE.slug, + dependencies: { + destination: 'migrate', + how: HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME, + }, + } ); + + expect( getFlowLocation() ).toEqual( { + path: `/${ STEPS.SITE_MIGRATION_CREDENTIALS.slug }?siteSlug=example.wordpress.com`, + state: null, + } ); } ); it( 'migrate redirects from the how-to-migrate (upgrade needed) page to site-migration-upgrade-plan step', () => { diff --git a/client/landing/stepper/declarative-flow/test/site-migration-flow.tsx b/client/landing/stepper/declarative-flow/test/site-migration-flow.tsx index 6d7358500421b..f97eb38ad263f 100644 --- a/client/landing/stepper/declarative-flow/test/site-migration-flow.tsx +++ b/client/landing/stepper/declarative-flow/test/site-migration-flow.tsx @@ -224,6 +224,7 @@ describe( 'Site Migration Flow', () => { } ); it( 'migrate redirects from the how-to-migrate (do it for me) page to assisted migration page', () => { + config.disable( 'automated-migration/collect-credentials' ); const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow ); runUseStepNavigationSubmit( { @@ -240,6 +241,24 @@ describe( 'Site Migration Flow', () => { siteSlug: 'example.wordpress.com', }, } ); + config.enable( 'automated-migration/collect-credentials' ); + } ); + + it( 'migrate redirects from the how-to-migrate (do it for me) page to credential collection step', () => { + const { runUseStepNavigationSubmit } = renderFlow( siteMigrationFlow ); + + runUseStepNavigationSubmit( { + currentStep: STEPS.SITE_MIGRATION_HOW_TO_MIGRATE.slug, + dependencies: { + destination: 'migrate', + how: HOW_TO_MIGRATE_OPTIONS.DO_IT_FOR_ME, + }, + } ); + + expect( getFlowLocation() ).toEqual( { + path: `/${ STEPS.SITE_MIGRATION_CREDENTIALS.slug }?siteSlug=example.wordpress.com`, + state: null, + } ); } ); it( 'migrate redirects from the how-to-migrate (upgrade needed) page to site-migration-upgrade-plan step', () => {