From 6abb2ace63e26953a4660850a0b73bb5bff7fab1 Mon Sep 17 00:00:00 2001 From: Narendra122812 Date: Sat, 18 Jan 2025 03:09:50 +0530 Subject: [PATCH] Manage script Formatting --- tests/Iframes/Iframes.spec.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/Iframes/Iframes.spec.js b/tests/Iframes/Iframes.spec.js index 87de761..cde6af6 100644 --- a/tests/Iframes/Iframes.spec.js +++ b/tests/Iframes/Iframes.spec.js @@ -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); });