diff --git a/tests/e2e/specs/setup-mc/step-4-complete-campaign.test.js b/tests/e2e/specs/setup-mc/step-4-complete-campaign.test.js index 0046273e56..4f9594f7f2 100644 --- a/tests/e2e/specs/setup-mc/step-4-complete-campaign.test.js +++ b/tests/e2e/specs/setup-mc/step-4-complete-campaign.test.js @@ -61,6 +61,12 @@ test.describe( 'Complete your campaign', () => { // Mock Merchant Center as connected completeCampaign.mockMCConnected(), + // Mock Google Ads as not yet connected. + setupAdsAccountPage.mockAdsAccountDisconnected(), + + // Mock there is no existing Google Ads account. + setupAdsAccountPage.mockAdsAccountsResponse( [] ), + // Mock MC step as paid_ads completeCampaign.mockMCSetup( 'incomplete', 'paid_ads' ), @@ -79,6 +85,40 @@ test.describe( 'Complete your campaign', () => { completeCampaign.fulfillSyncableProductsCountRequest( { count: 1024, } ), + + // The following mocks are requests will happen after completing the onboarding + completeCampaign.mockSuccessfulSettingsSyncRequest(), + + completeCampaign.fulfillProductStatisticsRequest( { + timestamp: 1695011644, + statistics: { + active: 0, + expiring: 0, + pending: 0, + disapproved: 0, + not_synced: 1137, + }, + scheduled_sync: 1, + } ), + + completeCampaign.fulfillAccountIssuesRequest( { + issues: [], + page: 1, + total: 0, + } ), + + completeCampaign.fulfillProductIssuesRequest( { + issues: [], + page: 1, + total: 0, + } ), + + completeCampaign.fulfillMCReview( { + cooldown: 0, + issues: [], + reviewEligibleRegions: [], + status: 'ONBOARDING', + } ), ] ); await completeCampaign.goto(); @@ -127,124 +167,63 @@ test.describe( 'Complete your campaign', () => { } ); } ); - test.describe( 'Click "Skip this step for now"', () => { - test.beforeAll( async () => { - await Promise.all( [ - // Mock settings sync request - completeCampaign.mockSuccessfulSettingsSyncRequest(), - - // Mock product statistics request - completeCampaign.fulfillProductStatisticsRequest( { - timestamp: 1695011644, - statistics: { - active: 0, - expiring: 0, - pending: 0, - disapproved: 0, - not_synced: 1137, - }, - scheduled_sync: 1, - } ), - ] ); - await completeCampaign.clickSkipStepButton(); - } ); - - test( 'should see the setup success modal', async () => { - const setupSuccessModal = page - .locator( '.components-modal__content' ) - .filter( { - hasText: - 'You’ve successfully set up Google Listings & Ads!', - } ); - await expect( setupSuccessModal ).toBeVisible(); - } ); - - test( 'should see the url contains product-feed', async () => { - expect( page.url() ).toMatch( /path=%2Fgoogle%2Fproduct-feed/ ); - } ); - } ); - - test.describe( 'Set up paid ads', () => { - test.beforeAll( async () => { - await Promise.all( [ - // Mock settings sync request - completeCampaign.mockSuccessfulSettingsSyncRequest(), - - // Mock product statistics request - completeCampaign.fulfillProductStatisticsRequest( { - timestamp: 1695011644, - statistics: { - active: 0, - expiring: 0, - pending: 0, - disapproved: 0, - not_synced: 1137, - }, - scheduled_sync: 1, - } ), - ] ); - await completeCampaign.goto(); - } ); - - test( 'should see the "Create a paid ad campaign" button is enabled', async () => { - const button = completeCampaign.getCreatePaidAdButton(); - await expect( button ).toBeVisible(); - await expect( button ).toBeEnabled(); - } ); - - test.describe( 'Click "Create a paid ad campaign" button', () => { - test.beforeAll( async () => { - await completeCampaign.clickCreatePaidAdButton(); - await setupAdsAccountPage.mockAdsAccountsResponse( [] ); + test.describe( 'Google Ads', () => { + test.describe( 'Google Ads section', () => { + test.beforeEach( async () => { + await completeCampaign.goto(); } ); - test( 'should see "Complete setup" button is disabled', async () => { - const completeSetupButton = - completeCampaign.getCompleteSetupButton(); - await expect( completeSetupButton ).toBeVisible(); - await expect( completeSetupButton ).toBeDisabled(); + test( 'should see Google Ads section', async () => { + const section = completeCampaign.getAdsAccountSection(); + await expect( section ).toBeVisible(); } ); - test( 'should see "Skip paid ads creation" button is enabled', async () => { - const skipPaidAdsCreationButton = - completeCampaign.getSkipPaidAdsCreationButton(); - await expect( skipPaidAdsCreationButton ).toBeVisible(); - await expect( skipPaidAdsCreationButton ).toBeEnabled(); - } ); - - test( 'should see "Google Ads" section is enabled', async () => { - const googleAdsSection = - completeCampaign.getAdsAccountSection(); - await expect( googleAdsSection ).toBeVisible(); + test( 'should only see non-budget related items and no footer buttons in the Features section when not yet connected', async () => { + const section = completeCampaign.getPaidAdsFeaturesSection(); + const items = section.locator( + '.gla-paid-ads-features-section__feature-list > div' + ); + await expect( items ).toHaveCount( 1 ); + await expect( items ).toContainText( 'Promote your products' ); - // Cannot use toBeEnabled() because
is not a native control element - // such as