Skip to content

Commit

Permalink
Manage script Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
NarendraCodeHub committed Jan 17, 2025
1 parent abbeba8 commit 6abb2ac
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tests/Iframes/Iframes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ const { test, expect } = require('@playwright/test');
test('Verify functionality inside the iframe', async ({ page }) => {

// Define for selectors
const targetURL = 'https://qa-practice.netlify.app/iframe';
const iframeSelector = '#iframe-checkboxes';
const learnMoreBtn = '#learn-more';
const showTextMessage = '#show-text';
const expectedText = `This text appears when you click the "Learn more" button`;
const targetURL = 'https://qa-practice.netlify.app/iframe';
const iframeSelector = '#iframe-checkboxes';
const learnMoreBtn = '#learn-more';
const showTextMessage = '#show-text';
const expectedText = `This text appears when you click the "Learn more" button`;

// Navigate to the target URL
await page.goto(targetURL);
// Navigate to the target URL
await page.goto(targetURL);

// Wait for iframe and switch context
const frame = page.frameLocator(iframeSelector);
// Wait for iframe and switch context
const frame = page.frameLocator(iframeSelector);

// Ensure the 'Learn More' button is visible and click it
const learnMoreButton = frame.locator(learnMoreBtn);
await learnMoreButton.waitFor({ state: 'visible' });
await learnMoreButton.click();
// Ensure the 'Learn More' button is visible and click it
const learnMoreButton = frame.locator(learnMoreBtn);
await learnMoreButton.waitFor({ state: 'visible' });
await learnMoreButton.click();

// Verify the success message
const successMessage = frame.locator(showTextMessage);
await expect(successMessage).toBeVisible();
await expect(successMessage).toHaveText(expectedText);
// Verify the success message
const successMessage = frame.locator(showTextMessage);
await expect(successMessage).toBeVisible();
await expect(successMessage).toHaveText(expectedText);

});

0 comments on commit 6abb2ac

Please sign in to comment.