You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if the user selects test. only test spec file and then execute a particular spec file then it should be a display test. only test case in UI mode.
Example
For example if the user selects test. only test cases and execute UI mode using the command line should display only selected cases the user selects. as per the mentioned code block below:
import{test,expect}from"@playwright/test";import{globalSetup}from"../utils/globalSetup.js";constwebUrl=process.env.WEB_URL?.split(",")[1];test.beforeEach(async({ page })=>{awaitpage.goto(webUrl);constpassword=page.locator("#password");awaitpassword.fill(process.env.SITE_PWD);awaitpage.getByRole("button",{name: "Enter"}).click();});test.afterEach(async({ page })=>{awaitpage.close();});test.describe("CSS Testcases for whatsapp contact app",()=>{test("Check WhatsAPP ICON is visible in desktop view",async({ page })=>{page.setViewportSize({width: 1920,height: 1080});constwhatsAppLocator=page.locator("#mainiconbtn");awaitexpect(whatsAppLocator).toBeVisible();});test("Check WhatsAPP ICON is visible in mobile view",async({ page })=>{page.setViewportSize({width: 360,height: 640});constwhatsAppLocator=page.locator("#mainiconbtn");consttextlocator=page.locator("#whatsappText");awaitexpect(whatsAppLocator).toBeInViewport();awaitexpect(textlocator).toBeHidden();});test("Check WhatsAPP ICON Hover Text",async({ page })=>{page.setViewportSize({width: 1920,height: 1080});consttextlocator=page.locator("#whatsappText");constwhatsAppLocator=page.locator("#mainiconbtn");awaitwhatsAppLocator.hover();awaitexpect(textlocator).toBeVisible();expect(awaittextlocator.textContent()).toBe("Get In Touch");});test("Check WhatsAPP ICON background color in desktop view",async({
page,})=>{page.setViewportSize({width: 1920,height: 1080});letrgbColor=convertHexToRGB("#4cc759");constselector=awaitpage.waitForSelector("#mainiconbtn");constcomputedStyle=awaitselector.evaluate(()=>{constelement=document.querySelector("#mainiconbtn");returngetComputedStyle(element).backgroundColor;});expect(computedStyle).toBe(rgbColor);});test("Check WhatsAPP ICON background color in Mobile view",async({
page,})=>{page.setViewportSize({width: 360,height: 640});letrgbColor=convertHexToRGB("#4cc759");constselector=awaitpage.waitForSelector("#mainiconbtn");constcomputedStyle=awaitselector.evaluate(()=>{constelement=document.querySelector("#mainiconbtn");returngetComputedStyle(element).backgroundColor;});expect(computedStyle).toBe(rgbColor);});test("Check WhatsAPP Icon color in desktop view",async({ page })=>{page.setViewportSize({width: 1920,height: 1080});letrgbColor=convertHexToRGB("#f03838");constselector=awaitpage.waitForSelector("i.fa.fa-whatsapp");constcomputedStyle=awaitselector.evaluate(()=>{constelement=document.querySelector("i.fa.fa-whatsapp");returngetComputedStyle(element).color;});expect(computedStyle).toBe(rgbColor);});test("Check WhatsAPP Icon color in Mobile view",async({ page })=>{page.setViewportSize({width: 360,height: 640});letrgbColor=convertHexToRGB("#f03838");constselector=awaitpage.waitForSelector("i.fa.fa-whatsapp");constcomputedStyle=awaitselector.evaluate(()=>{constelement=document.querySelector("i.fa.fa-whatsapp");returngetComputedStyle(element).color;});expect(computedStyle).toBe(rgbColor);});test("Check Close button ICON visible or not in desktop view",async({
page,})=>{page.setViewportSize({width: 1920,height: 1080});constselector=page.locator("i.fa.fa-close");awaitexpect(selector).toBeVisible();});test("Check Close button ICON visible or not in Mobile view",async({
page,})=>{page.setViewportSize({width: 360,height: 640});constselector=page.locator("i.fa.fa-close");awaitexpect(selector).toBeVisible();});test("Check Close button ICON Click in desktop view",async({ page })=>{page.setViewportSize({width: 1920,height: 1080});constselector=page.locator("i.fa.fa-close");awaitexpect(selector).toBeVisible();});test("Check Close button ICON Click in Mobile view",async({ page })=>{page.setViewportSize({width: 360,height: 640});constselector=page.locator("i.fa.fa-close");awaitexpect(selector).toBeVisible();});test.only("Check Whatsapp Box Visible or not in desktop view",async({
page,})=>{page.setViewportSize({width: 1920,height: 1080});constselector=page.locator("#btnbox");awaitexpect(selector).toBeVisible();});test.only("Check Whatsapp Box Visible or not in Mobile view",async({
page,})=>{page.setViewportSize({width: 360,height: 640});constselector=page.locator("#btnbox");awaitexpect(selector).toBeVisible();});test.only("Check Whatsapp Box close button is Clickable or not in desktop view",async({
page,})=>{page.setViewportSize({width: 1920,height: 1080});constselector=page.locator("#btnbox");awaitselector.click()});test.only("Check Whatsapp Box close button is Clickable or not in Mobile view",async({
page,})=>{page.setViewportSize({width: 360,height: 640});constselector=page.locator("#btnbox");awaitselector.click()});});
npx playwright test example.spec.ts --ui
Motivation
It would be helpful for better understanding because the user only runs those tests that are selected by her/him.
This is my suggestion. I want to contribute more to the playwright community in the Future.
Happy Playwright Testing !!!
Thanks!!!
The text was updated successfully, but these errors were encountered:
test.describe.only('focused group',()=>{test('in the focused group',async({ page })=>{// This test will run});});test('not in the focused group',async({ page })=>{// This test will not run});
I have also suggest UI mode should work with test.describe.only function group test as well. when user switching on UI mode for group test. If feasible.
馃殌 Feature Request
if the user selects test. only test spec file and then execute a particular spec file then it should be a display test. only test case in UI mode.
Example
For example if the user selects test. only test cases and execute UI mode using the command line should display only selected cases the user selects. as per the mentioned code block below:
npx playwright test example.spec.ts --ui
Motivation
It would be helpful for better understanding because the user only runs those tests that are selected by her/him.
This is my suggestion. I want to contribute more to the playwright community in the Future.
Happy Playwright Testing !!!
Thanks!!!
The text was updated successfully, but these errors were encountered: