Skip to content

Commit

Permalink
Increase timeouts and ensure selector accuracy in Playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-ai-integration[bot] committed Jul 25, 2024
1 parent a60c7d4 commit 0503446
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/e2e/homepage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const BASE_URL = process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:3000'
test.describe('Homepage tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto(BASE_URL);
await page.waitForSelector('main', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('main', { state: 'visible', timeout: 30000 }); // Increased timeout
});

test('navigate to the homepage', async ({ page }) => {
Expand All @@ -16,7 +16,7 @@ test.describe('Homepage tests', () => {

test('check if main content is present', async ({ page }) => {
try {
await page.waitForSelector('main', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('main', { state: 'visible', timeout: 30000 }); // Increased timeout
const mainContent = await page.$('main');
expect(mainContent).not.toBeNull();
} catch (error) {
Expand All @@ -27,7 +27,7 @@ test.describe('Homepage tests', () => {

test('check if navigation menu is present', async ({ page }) => {
try {
await page.waitForSelector('nav', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('nav', { state: 'visible', timeout: 30000 }); // Increased timeout
const navMenu = await page.$('nav');
expect(navMenu).not.toBeNull();
} catch (error) {
Expand All @@ -38,7 +38,7 @@ test.describe('Homepage tests', () => {

test('check if event cards are present', async ({ page }) => {
try {
await page.waitForSelector('article[data-testid="event-card"]', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('article[data-testid="event-card"]', { state: 'visible', timeout: 30000 }); // Increased timeout
const eventCards = await page.$$('article[data-testid="event-card"]');
expect(eventCards.length).toBeGreaterThan(0);
} catch (error) {
Expand All @@ -49,7 +49,7 @@ test.describe('Homepage tests', () => {

test('check if "Publicar" option is present in the menu', async ({ page }) => {
try {
await page.waitForSelector('nav', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('nav', { state: 'visible', timeout: 30000 }); // Increased timeout
const publicarOption = await page.$('nav >> text=Publicar');
expect(publicarOption).not.toBeNull();
} catch (error) {
Expand All @@ -70,13 +70,13 @@ test.describe('Homepage tests', () => {
for (const size of viewports) {
try {
await page.setViewportSize(size);
await page.waitForSelector('main', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('main', { state: 'visible', timeout: 30000 }); // Increased timeout
const mainContent = await page.$('main');
expect(mainContent).not.toBeNull();
await page.waitForSelector('nav', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('nav', { state: 'visible', timeout: 30000 }); // Increased timeout
const navMenu = await page.$('nav');
expect(navMenu).not.toBeNull();
await page.waitForSelector('article[data-testid="event-card"]', { state: 'visible', timeout: 20000 }); // Increased timeout
await page.waitForSelector('article[data-testid="event-card"]', { state: 'visible', timeout: 30000 }); // Increased timeout
const eventCards = await page.$$('article[data-testid="event-card"]');
expect(eventCards.length).toBeGreaterThan(0);
} catch (error) {
Expand Down

0 comments on commit 0503446

Please sign in to comment.