Skip to content

Commit

Permalink
Add - helper for repetitive clicks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTheTestStrategist committed Feb 27, 2025
1 parent 5d66b6e commit eda4e14
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions helpers/dynamicClick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
async performClicks(page) {
// Click on the first set of elements
await expect(page.getByText('This example demonstrates the')).toBeVisible();
await expect(page.getByText('To make some of the content')).toBeVisible();
await expect(page.getByText('Accusantium eius ut')).toBeVisible();

await page.getByText('Omnis fugiat porro vero quas').click();
await page.getByText('Nihil eos ipsam architecto').click();
await page.getByRole('link', { name: 'click here' }).click();
await expect(page.getByText('Accusantium eius ut')).toBeVisible();

// Click on the second set of elements
await page.getByText('Omnis fugiat porro vero quas').click();
await page.getByText('Maiores autem magnam impedit').click();
await page.getByRole('link', { name: 'click here' }).click();
await expect(page.getByText('Accusantium eius ut')).toBeVisible();

// Click on the third set of elements
await page.getByText('Omnis fugiat porro vero quas').click();
await page.getByText('Non est molestiae aut et').click();
await page.getByRole('link', { name: 'click here' }).click();
await expect(page.getByText('Accusantium eius ut')).toBeVisible();

// Click on additional elements
await page.locator('div:nth-child(4)').click();
await expect(page.getByText('Omnis fugiat porro vero quas')).toBeVisible();
await page.getByText('Ducimus sed ut minus velit').click();
}
};

0 comments on commit eda4e14

Please sign in to comment.