Skip to content

Commit

Permalink
[e2e] Verify link targets: Provide type of financial institution
Browse files Browse the repository at this point in the history
  • Loading branch information
meissadia committed Jan 3, 2025
1 parent 5ad2913 commit a654cd0
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
18 changes: 18 additions & 0 deletions e2e/pages/filing-app/filing-home/VerifyLinkTargets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ test('Start filing', async ({ page, navigateToFilingHome }) => {
await expectLinkOpensNewTab(readAboutFiling);
});

test('Provide type of financial institution', async ({
page,
navigateToProvideTypeOfFinancialInstitution,
}) => {
navigateToProvideTypeOfFinancialInstitution;
await page.goto('/filing');

const fig = await page.getByRole('link', {
name: 'filing instructions guide for small business lending data',
});
await expectLinkOpensNewTab(fig);

const readAboutFiling = await page.getByRole('link', {
name: 'Read about the filing process',
});
await expectLinkOpensNewTab(readAboutFiling);
});

test('Upload file', async ({ page, navigateToUploadFile }) => {
navigateToUploadFile;
await page.goto('/filing');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { test } from '../../../fixtures/testFixture';
import {
expectLinkOpensNewTab,
expectLinkOpensSameTab,
} from '../../../utils/openLink';

test('Verify link targets: Provide Type of Financial Institution', async ({
page,
navigateToProvideTypeOfFinancialInstitution,
}) => {
navigateToProvideTypeOfFinancialInstitution;
// New tab
await test.step(`New tab: iRegs links`, async () => {
const indexRegLinks = await page.locator('a:has-text("§")').all();

for (const [index, indexRegPage] of indexRegLinks.entries()) {
// eslint-disable-next-line no-await-in-loop
const title = await indexRegPage.textContent();
// eslint-disable-next-line no-await-in-loop
await test.step(`iRegs link #${index + 1}: ${title}`, async () => {
await expectLinkOpensNewTab(indexRegPage);
});
}
});

// Same tab
await test.step(`Same tab: Nav bar links`, async () => {
const navContainer = page.locator('nav#nav-links');

const home = await navContainer.getByRole('link', { name: 'Home' });
await expectLinkOpensSameTab(home);

const filing = await navContainer.getByRole('link', { name: 'Filing' });
await expectLinkOpensSameTab(filing);

const userProfile = await page.locator('.nav-item.profile');
await expectLinkOpensSameTab(userProfile);

const logout = await navContainer.getByRole('button', {
name: 'LOG OUT',
});
await expectLinkOpensSameTab(logout);
});

await test.step(`Same tab: Update financial profile links`, async () => {
const updateFinancialProfileLinks = await page
.getByRole('link', {
name: 'update your financial institution profile',
})
.all();

for (const [
index,
updateProfile,
] of updateFinancialProfileLinks.entries()) {
// eslint-disable-next-line no-await-in-loop
await test.step(`Update financial profile #${index + 1}`, async () => {
await expectLinkOpensSameTab(updateProfile);
});
}
});
});

0 comments on commit a654cd0

Please sign in to comment.