Skip to content

Commit

Permalink
Add tests for links on the setup accounts page
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlin committed Sep 6, 2023
1 parent 2388e29 commit d5ef12d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/e2e/specs/setup-mc/step-1-accounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,4 +553,32 @@ test.describe( 'Set up accounts', () => {
);
} );
} );

test.describe( 'Links', () => {
test( 'should contain the correct URL for "Google Merchant Center Help" link', async () => {
await setUpAccountsPage.goto();
const link = setUpAccountsPage.getMCHelpLink();
await expect( link ).toBeVisible();
await expect( link ).toHaveAttribute(
'href',
'https://support.google.com/merchants/topic/9080307'
);
} );

test( 'should contain the correct URL for CSS Partners link', async () => {
const cssPartersLink =
'https://comparisonshoppingpartners.withgoogle.com/find_a_partner/';
const link = setUpAccountsPage.getCSSPartnersLink();
await expect( link ).toBeVisible();
await expect( link ).toHaveAttribute( 'href', cssPartersLink );

const faqTitle2 = setUpAccountsPage.getFAQPanelTitle().nth( 1 );
await faqTitle2.click();
const linkInFAQ = setUpAccountsPage.getCSSPartnersLink(
'Please find more information here'
);
await expect( linkInFAQ ).toBeVisible();
await expect( linkInFAQ ).toHaveAttribute( 'href', cssPartersLink );
} );
} );
} );
26 changes: 26 additions & 0 deletions tests/e2e/utils/pages/setup-mc/step-1-set-up-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,4 +377,30 @@ export default class SetUpAccountsPage extends MockRequests {
getFAQPanelRow() {
return this.getFAQPanel().locator( '.components-panel__row' );
}

/**
* Get link of Google Merchant Center Help.
*
* @return {import('@playwright/test').Locator} Get link of Google Merchant Center Help.
*/
getMCHelpLink() {
return this.page.getByRole( 'link', {
name: 'Google Merchant Center Help',
exact: true,
} );
}

/**
* Get link of CSS partners.
*
* @param {string} name
*
* @return {import('@playwright/test').Locator} Get link of CSS partners.
*/
getCSSPartnersLink( name = 'here' ) {
return this.page.getByRole( 'link', {
name,
exact: true,
} );
}
}

0 comments on commit d5ef12d

Please sign in to comment.