Skip to content

Commit

Permalink
Fix linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
asvinb committed Sep 30, 2024
1 parent 15baeb2 commit aa4329c
Showing 1 changed file with 56 additions and 63 deletions.
119 changes: 56 additions & 63 deletions tests/e2e/specs/setup-mc/step-4-complete-campaign.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,81 +281,74 @@ test.describe( 'Complete your campaign', () => {
} );
} );

test.describe(
'Ask user for confirmation when clicking "Skip this step for now"',
() => {
test.describe( 'User skips paid ads creation', () => {
test.beforeAll( async () => {
// Reset the showing status for the "Set up paid ads" section.
await page.evaluate( () => window.sessionStorage.clear() );
await setupAdsAccountPage.mockAdsAccountIncomplete();
await completeCampaign.goto();
await completeCampaign.clickSkipPaidAdsCreationButton();
} );
test.describe( 'Ask user for confirmation when clicking "Skip this step for now"', () => {
test.describe( 'User skips paid ads creation', () => {
test.beforeAll( async () => {
// Reset the showing status for the "Set up paid ads" section.
await page.evaluate( () => window.sessionStorage.clear() );
await setupAdsAccountPage.mockAdsAccountIncomplete();
await completeCampaign.goto();
await completeCampaign.clickSkipPaidAdsCreationButton();
} );

test( 'should see the modal', async () => {
const skipPaidAdsModal =
completeCampaign.getSkipPaidAdsCreationModal();
await expect( skipPaidAdsModal ).toBeVisible();
} );
test( 'should see the modal', async () => {
const skipPaidAdsModal =
completeCampaign.getSkipPaidAdsCreationModal();
await expect( skipPaidAdsModal ).toBeVisible();
} );

test( 'should see the url contains product-feed if the user skips', async () => {
await completeCampaign.clickCompleteSetupModalButton();
await page.waitForURL( /path=%2Fgoogle%2Fproduct-feed/ );
expect( page.url() ).toMatch(
/path=%2Fgoogle%2Fproduct-feed/
);
} );
test( 'should see the url contains product-feed if the user skips', async () => {
await completeCampaign.clickCompleteSetupModalButton();
await page.waitForURL( /path=%2Fgoogle%2Fproduct-feed/ );
expect( page.url() ).toMatch( /path=%2Fgoogle%2Fproduct-feed/ );
} );

test( 'should see the setup success modal', async () => {
const setupSuccessModal =
completeCampaign.getSetupSuccessModal();
await expect( setupSuccessModal ).toBeVisible();
} );
test( 'should see the setup success modal', async () => {
const setupSuccessModal =
completeCampaign.getSetupSuccessModal();
await expect( setupSuccessModal ).toBeVisible();
} );

test( 'should see buttons on Dashboard for Google Ads onboarding', async () => {
await page.keyboard.press( 'Escape' );
await page
.getByRole( 'tab', { name: 'Dashboard' } )
.click();
test( 'should see buttons on Dashboard for Google Ads onboarding', async () => {
await page.keyboard.press( 'Escape' );
await page.getByRole( 'tab', { name: 'Dashboard' } ).click();

const buttons = page.getByRole( 'button', {
name: 'Add paid campaign',
} );

await expect( buttons ).toHaveCount( 2 );
for ( const button of await buttons.all() ) {
await expect( button ).toBeVisible();
await expect( button ).toBeEnabled();
}
const buttons = page.getByRole( 'button', {
name: 'Add paid campaign',
} );

await expect( buttons ).toHaveCount( 2 );
for ( const button of await buttons.all() ) {
await expect( button ).toBeVisible();
await expect( button ).toBeEnabled();
}
} );
} );

test.describe( 'User does not skip paid ads creation', () => {
test.beforeAll( async () => {
// Reset the showing status for the "Set up paid ads" section.
await page.evaluate( () => window.sessionStorage.clear() );
await setupAdsAccountPage.mockAdsAccountIncomplete();
await completeCampaign.goto();
await completeCampaign.clickSkipPaidAdsCreationButton();
} );
test.describe( 'User does not skip paid ads creation', () => {
test.beforeAll( async () => {
// Reset the showing status for the "Set up paid ads" section.
await page.evaluate( () => window.sessionStorage.clear() );
await setupAdsAccountPage.mockAdsAccountIncomplete();
await completeCampaign.goto();
await completeCampaign.clickSkipPaidAdsCreationButton();
} );

test( 'should no longer see the confirmation modal', async () => {
await completeCampaign.clickCancelModalButton();
test( 'should no longer see the confirmation modal', async () => {
await completeCampaign.clickCancelModalButton();

const skipPaidAdsModal =
completeCampaign.getSkipPaidAdsCreationModal();
await expect( skipPaidAdsModal ).not.toBeVisible();
} );
const skipPaidAdsModal =
completeCampaign.getSkipPaidAdsCreationModal();
await expect( skipPaidAdsModal ).not.toBeVisible();
} );

test( 'user should stay on the same page', async () => {
await expect( page.url() ).toMatch(
/path=%2Fgoogle%2Fsetup-mc&google-mc=connected/
);
} );
test( 'user should stay on the same page', async () => {
await expect( page.url() ).toMatch(
/path=%2Fgoogle%2Fsetup-mc&google-mc=connected/
);
} );
}
);
} );
} );

test.describe( 'Free Ad Credit', () => {
test( 'should not see the Free Ad Credit section if the account is not eligible', async () => {
Expand Down

0 comments on commit aa4329c

Please sign in to comment.