<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pragya Singh on Medium]]></title>
        <description><![CDATA[Stories by Pragya Singh on Medium]]></description>
        <link>https://medium.com/@pragyas215?source=rss-907037c19270------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*PluxJSIppbeoRxur</url>
            <title>Stories by Pragya Singh on Medium</title>
            <link>https://medium.com/@pragyas215?source=rss-907037c19270------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:32:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pragyas215/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Role of LLM, Agents & MCP in Playwright Test Automation]]></title>
            <link>https://medium.com/@pragyas215/role-of-llm-agents-mcp-in-playwright-test-automation-b6189683428c?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6189683428c</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Mon, 04 May 2026 10:57:35 GMT</pubDate>
            <atom:updated>2026-05-04T10:57:35.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s5AQ5Lz1V8wLhvT7x_c-Sw.png" /></figure><p>Traditional test automation is evolving fast.</p><p>Frameworks like Playwright are no longer just about writing scripts. When combined with Large Language Models (LLMs), autonomous agents, and Model Context Protocol (MCP), they become powerful systems capable of reasoning, decision-making, and self-healing.</p><p>This shift isn’t incremental — it’s transformational.</p><p>Let’s break down how LLMs, agents, and MCP are reshaping the future of test automation.</p><ol><li><strong>LLM </strong>(<strong>Large Language Models</strong>) — It is a smart brain that understands natural language. It understands user stories, writes code , understand code but it cannot perform any action like clicking, running browser. It is like having brain without body.</li></ol><p><strong>What LLM can do:</strong></p><ul><li>Answers questions</li><li>Generate Code</li><li>Write emails</li><li>chat like humans</li></ul><p>It trained on massive datasets to predict the next word in a sequence.</p><p>Think of LLM as a brain that knows language, but it doesn’t act on its own. LLM can generate code but cannot perform actions.</p><p>Example — <strong>GPT-4, claude</strong></p><p><strong>2. Agents </strong>— It is a autonomous assistant that uses LLM as its brain. AI Agent makes decisions and carries out the tasks using LLM’s output.</p><p><strong>LLM+tools to take actions and achieve goals.</strong></p><p>Example — <strong>Auto-GPT, langchain</strong></p><p><strong>“Book me a flight”</strong></p><p><strong>An agent could search flights, compare prices, and make the booking.</strong></p><p><strong>3. MCP(Model context protocol)</strong> — A bridge between LLM/ agent and real-world tools &amp; browsers. It lets LLM sends commands to external resources like browsers, databases, or APIs.</p><p><strong>Example </strong>— MCP can open a browser , navigate to URL, fill form or query database actions an LLM cannot perform.</p><p>It is introduced by <strong>Anthropic</strong></p><p>It is actually a unified interface between LLMs and external systems. It is like bridge between thoughts and actions.</p><p>MCP is like communication protocol making sure instructions become actions.</p><p>LLM provides intelligence but need a way to act. Agent uses LLM to plan tasks and MCP lets them executes tasks.</p><pre><br>User request<br>   ↓<br>Agent (planner + tools)<br>   ↓<br>LLM (reasoning)<br>   ↓<br>MCP (connects to tools/data)<br>   ↓<br>Real-world action</pre><p><strong>Simple analogy:</strong></p><ul><li>LLM = a smart chef</li><li>Agent = the chef + kitchen + ability to cook meals</li><li>MCP = the standardized kitchen setup that lets the chef use any appliance easily</li></ul><p>I hope this helps to understand the simple concepts of LLM, agents and MCP for Test Automation.</p><p>Happy Reading…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6189683428c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most Asked Playwright Interview Questions]]></title>
            <link>https://medium.com/@pragyas215/most-asked-playwright-interview-questions-7b78924fb343?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b78924fb343</guid>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Fri, 06 Mar 2026 11:30:51 GMT</pubDate>
            <atom:updated>2026-03-06T11:30:51.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*1r96ZzCa25pdnLWX" /></figure><ol><li>What are the different types of locators in playwright?</li></ol><pre>Playwright supports many locator strategies:<br><br>Built-in Locators (Recommended)<br><br>getByRole()<br><br>getByText()<br><br>getByLabel()<br><br>getByPlaceholder()<br><br>getByAltText()<br><br>getByTitle()<br><br>getByTestId()<br><br>Generic Locators<br><br>page.locator(&#39;css-selector&#39;)<br>page.locator(&#39;xpath&#39;)</pre><p>2. How to switch tabs in playwright?</p><p>Playwright don’t have any exclusive method for handling window</p><pre> test(&#39;handle a single new window/tab&#39;, async ({ page }) =&gt; {<br>  await page.goto(&#39;https://www.lambdatest.com/selenium-playground/window-popup-modal-demo&#39;);<br><br>  // Start waiting for the popup before the action that triggers it<br>  const [newWindow] = await Promise.all([<br>    page.waitForEvent(&#39;popup&#39;), // Waits for the &#39;popup&#39; event<br>    page.locator(&quot;text=&#39;Follow On Twitter&#39;&quot;).click() // Clicks the link to open the new window<br>  ]);<br><br>  // &#39;newWindow&#39; is a new Page object, you can interact with it normally<br>  await newWindow.waitForLoadState();<br>  console.log(await newWindow.title()); // Prints the title of the new page<br>  await expect(newWindow).toHaveURL(/twitter/);<br><br>  // You can go back to the original page at any time<br>  await page.bringToFront();<br>  console.log(await page.title()); // Prints the title of the original page<br><br>  // Close the new window if needed<br>  await newWindow.close();<br>});</pre><p>3. How to run tests parallely in playwright?</p><pre>// In config.ts file, add<br><br>workers: 4<br><br><br>// In spec file<br>test.describe.configure({mode: parallel} =&gt; {<br>   ...<br>});<br></pre><p>4. What are the types of Hooks in playwright?</p><pre>beforeAll<br>afterAll<br>beforeEach<br>afterEach</pre><p>5. How to create functions in playwright?</p><pre>async function login(page, username, password) {<br>  await page.goto(&#39;https://example.com/login&#39;);<br>  await page.fill(&#39;#username&#39;, username);<br>  await page.fill(&#39;#password&#39;, password);<br>  await page.click(&#39;button[type=&quot;submit&quot;]&#39;);<br>}<br><br><br>import { test } from &#39;@playwright/test&#39;;<br><br>test(&#39;login test&#39;, async ({ page }) =&gt; {<br>  await login(page, &#39;testuser&#39;, &#39;password123&#39;);<br>});</pre><p>6. Why we use async/await in playwright?</p><ul><li>In <strong>Playwright</strong>, we use <strong>async/await</strong> because most Playwright operations are <strong>asynchronous</strong>. Actions like clicking, navigation, waiting for elements, or fetching page content take <strong>time to complete</strong>, so they return <strong>Promises</strong>.</li><li>async/await ensures that the <strong>test waits for each step to finish before moving to the next step</strong>, preventing flaky or unpredictable tests.</li></ul><p>7. How to run tests serially in playwright?</p><pre>we can run serially by using:<br><br>test.describe.serial(() =&gt; {<br>   test(&#39;A&#39;, async ({ page }) =&gt; {});<br>   test(&#39;B&#39;, async ({ page }) =&gt; {});<br>});<br><br><br>Meaning:<br><br>Tests run one after another<br><br>If Test A fails → Test B is skipped<br><br>They share the same worker, but not the same context<br><br>Use this when:<br><br>Test B depends on A<br><br>You want sequential execution</pre><p>8. What is the command use to run tests in playwright?</p><ul><li>npx playwright test</li><li>npx playwright test — headed</li><li>npx playwright test tests/flipkart.spec.ts — ui</li></ul><p>9. How to handle frames in playwright?</p><ul><li>Use await page.frameLocator(‘#frame’).locator(‘#button’).click()</li></ul><p>10. How to skip a test in playwright?</p><ul><li>Use test.skip to skip tests in playwright</li></ul><p>11. How to run a single test in playwright?</p><ul><li>Use test.only to run single test in playwright</li></ul><p>12. How to perform tagging in playwright?</p><ul><li>test(@Regression @Smoke ‘login into application’, ({page}) =&gt; { })</li></ul><p>13. How to take screenshots in playwright?</p><ul><li>await page.screenshot(‘path of folder ‘, fullpage:true)</li><li>await page.screenshot(‘page of folder’);</li><li>await page.locator(‘#button’).screenshot(‘path of screenshot folder’)</li></ul><p>14. How to press Enter in playwright?</p><ul><li>Use await page.locator(‘#button’).press(‘Enter’)</li></ul><p>15. How to select a option from a dropdown in playwright?</p><pre>Use selectOption() for selecting value from dropdown<br>Eg:<br><br>await page.getByRole(&#39;select&#39;, { name: &#39;country&#39;}).selectOption(&#39;India&#39;);<br></pre><p>16. What is the priority of the locators in playwright?</p><pre>1. getByRole<br>2. getByLabel<br>3. getByPlaceholder<br>4. getByText<br>5.getByTextId<br>6. locator</pre><p>17. What happens if a locator matches two elements, and how do you fix it?</p><pre>If a locator matches two elements then it will give error but we can fix it using following approaches:<br><br>1. Use a more specific locator <br>page.getByRole(&quot;button&quot;, { name: &quot;Submit&quot; }).click()<br><br>2. Use .nth() when elements are repeated<br>page.locator(&quot;.product-card button&quot;).nth(1).click()<br><br>3. Use .first() or .last()<br>page.locator(&quot;button&quot;).last().click()<br><br>4. Filter using text<br>page.locator(&quot;button&quot;, { hasText: &quot;Submit&quot; }).click()<br>page.getByText(&quot;Submit&quot;).click()<br><br></pre><p>18. How do you handle a list of elements (e.g., locator.all())?</p><pre>const products = page.locator(&#39;.product-item&#39;);<br>const count = await products.count();<br><br>for (let i = 0; i &lt; count; i++) {<br>  const text = await products.nth(i).textContent();<br>  console.log(text);<br>}</pre><p>19. How do you find a button inside a specific row using .filter()?</p><pre>await page<br>  .locator(&#39;tr&#39;)<br>  .filter({ hasText: &#39;Sarah&#39; })<br>  .getByRole(&#39;button&#39;, { name: &#39;Edit&#39; })<br>  .click();</pre><p>20. How do you use storageState to log in once and reuse the session for 100 tests?</p><pre>The idea of storageState is to log in once, save the authentication state (cookies + localStorage), and reuse it for all tests so that tests don’t perform login repeatedly.<br><br>storageState stores:<br><br>Cookies<br>Local storage<br>Session storage<br>Once saved, it can be reused in all tests.<br><br>This avoids:<br><br>repeating login<br>slowing down test execution<br>unnecessary UI login flows<br><br>Step 1 — Create a Login Setup Script<br><br>Create a script that logs in once and saves the session.<br><br>Example: auth.setup.ts<br>import { test as setup, expect } from &#39;@playwright/test&#39;;<br><br>setup(&#39;authenticate&#39;, async ({ page }) =&gt; {<br>  await page.goto(&#39;https://example.com/login&#39;);<br><br>  await page.fill(&#39;#username&#39;, &#39;testuser&#39;);<br>  await page.fill(&#39;#password&#39;, &#39;password&#39;);<br><br>  await page.click(&#39;button[type=&quot;submit&quot;]&#39;);<br><br>  await page.waitForURL(&#39;https://example.com/dashboard&#39;);<br><br>  await page.context().storageState({ path: &#39;auth.json&#39; });<br>});<br><br>Step 2 — Configure Playwright to Use Stored Session<br><br>import { defineConfig } from &#39;@playwright/test&#39;;<br><br>export default defineConfig({<br>  use: {<br>    storageState: &#39;auth.json&#39;<br>  }<br>});<br><br>Step 3 — Run Login Setup Before Tests<br><br>You can configure this as a global setup.<br><br>Example:<br><br>export default defineConfig({<br>  globalSetup: &#39;./auth.setup.ts&#39;<br>});<br><br><br><br><br>Using storageState:<br>speeds up test execution 🚀<br>reduces flaky login tests<br>avoids repeating authentication<br>ideal for large test suites (100–2000 tests)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b78924fb343" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns in Selenium Automation Framework]]></title>
            <link>https://medium.com/@pragyas215/design-patterns-in-selenium-automation-framework-01e2191a7f2d?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/01e2191a7f2d</guid>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 09:46:27 GMT</pubDate>
            <atom:updated>2026-02-25T09:46:27.429Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*6VsM9GVpWQfS3xLs" /></figure><p>What are Design Patterns?</p><p>Reusable solutions that bring structure, scalability, and maintainability to Selenium test automation by eliminating redundancy and improving collaboration.</p><h3><strong>Most Important Design Patterns in Selenium Framework</strong></h3><ol><li><strong>Page Object Model (POM)</strong></li></ol><p><strong>Problem It Solves:</strong></p><p>UI locators and test logic get mixed → very hard to maintain when UI changes.</p><p><strong>Solution</strong>:</p><p>Separate:</p><ul><li>Page elements (locators)</li><li>Page actions (methods)</li><li>Test logic</li></ul><p><strong>Structure</strong>:</p><pre>pages/<br>   LoginPage.java<br>tests/<br>   LoginTest.java</pre><p><strong>2. Page Factory Pattern</strong></p><p>Extension of POM using @FindBy.</p><pre>public class LoginPage {<br><br>    WebDriver driver;<br><br>    @FindBy(id=&quot;username&quot;)<br>    WebElement username;<br><br>    @FindBy(id=&quot;password&quot;)<br>    WebElement password;<br><br>    @FindBy(id=&quot;login&quot;)<br>    WebElement loginBtn;<br><br>    public LoginPage(WebDriver driver){<br>        PageFactory.initElements(driver, this);<br>    }<br>}</pre><p><strong>3. Singleton Pattern</strong></p><p><strong>Problem</strong>:</p><p>Multiple WebDriver instances accidentally created.</p><p><strong>Solution</strong>:</p><p>Ensure only <strong>one driver instance</strong> per test execution.</p><pre>public class DriverManager {<br><br>    private static WebDriver driver;<br><br>    private DriverManager() {}<br><br>    public static WebDriver getDriver() {<br>        if(driver == null){<br>            driver = new ChromeDriver();<br>        }<br>        return driver;<br>    }<br>}</pre><p><strong>4. Factory Pattern</strong></p><p><strong>Problem</strong>:</p><p>Need to run tests on multiple browsers (Chrome, Firefox, Edge).</p><p><strong>Solution</strong>:</p><p>Create driver dynamically based on config.</p><pre>public class DriverFactory {<br><br>    public static WebDriver createDriver(String browser){<br>        if(browser.equals(&quot;chrome&quot;)){<br>            return new ChromeDriver();<br>        } else if(browser.equals(&quot;firefox&quot;)){<br>            return new FirefoxDriver();<br>        }<br>        return null;<br>    }<br>}<br><br><br>Used For:<br><br>Cross browser execution<br><br>CI/CD integration<br><br>Parallel execution</pre><p><strong>5. Data Driven Pattern</strong></p><p>commonly used:</p><ul><li>Test data from Excel</li><li>JSON</li><li>CSV</li><li>Database</li></ul><p>Helps separate:</p><ul><li>Test logic</li><li>Test data</li></ul><h3>🏗 How Enterprise Selenium Framework Combines These</h3><p>A mature framework typically uses:</p><ul><li>✅ POM</li><li>✅ Singleton (Driver)</li><li>✅ Factory (Browser)</li><li>✅ Utility classes</li><li>✅ Base test class</li><li>✅ Config reader</li><li>✅ Reporting (Extent)</li><li>✅ Logging (Log4j)</li></ul><p>“In our Selenium framework, we implemented Page Object Model for separation of concerns, Singleton pattern for managing WebDriver lifecycle, Factory pattern for cross-browser support, and Builder pattern for handling complex test data. This improved maintainability, scalability, and reduced code duplication.”</p><p>This article explains the design pattern in detail. Please let me know in the comment section if you want me to cover any specific topic.</p><p>Thanks.</p><p>Happy Reading…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01e2191a7f2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TestNG Cheat Sheet]]></title>
            <link>https://medium.com/@pragyas215/testng-cheat-sheet-24e87dac6d25?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/24e87dac6d25</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Sat, 14 Feb 2026 10:49:20 GMT</pubDate>
            <atom:updated>2026-02-14T10:49:20.348Z</atom:updated>
            <content:encoded><![CDATA[<p>Are you searching for perfect cheat sheet for Testng? So, here it is. I am covering all the important concepts of Testng in this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*p-1xbLlVGVJ9-KX4.jpeg" /></figure><h3><strong>Testng Annotations</strong></h3><p>Order of Annotations:</p><pre>@BeforeSuite<br>@BeforeTest<br>@BeforeClass<br>@BeforeMethod<br>@Test<br>@AfterMethod<br>@AfterClass<br>@AfterTest<br>@AfterSuite<br></pre><p>@Test — This annotation is used to mark a method as a test method. TestNG executes methods annotated with @Test during test execution.</p><p>@BeforeMethod— Runs before each test method.</p><p>@BeforeClass — Runs once before the first test method in the current class.</p><p>@BeforeTest — Runs once before all tests within the current &lt;test&gt; tag.</p><p>@BeforeSuite — Runs once before all tests in the suite.</p><p>@AfterSuite — Runs once after all tests in the suite.</p><p>@AfterTest — Runs once after all tests within the current &lt;test&gt; tag.</p><p>@AfterClass — Runs once after the first test method in the current class.</p><p>@AfterMethod — Runs after each test method.</p><h4><strong>Testng Attributes:</strong></h4><ul><li>Priority — To set the priority of the test cases.</li><li>enabled — To enable /disable test cases by marking them true/false like @test(enable=false) this will not run particular test case.</li><li>groups — To categorize the test cases to execute under a specified group.</li><li>invocationCount — To run the test case method multiple times.</li><li>dependsOnMethod — inject dependency of any particular test method.</li><li>dependsOnGroups — inject dependency of any particular type of group.</li><li>timeout — Total time period for the test case to completely execute its test case.</li><li>invocationtimeout — Maximum time period provided the test case for all invocation count set.</li></ul><h3><strong>Testng Assertions:</strong></h3><pre>import org.testng.Assert;<br><br>Assert.assertEqual(actual, expected);<br>Assert.assertTrue(condition);<br>Assert.assertFalse(condition);<br>Assert.assertNull(object);<br>Assert.assertNotNull(object);</pre><p><strong>Testng Dependencies:</strong></p><pre>@Test(dependsOnMethods = &quot;methodName&quot;)<br>public void testMethod() {<br>    // Test method implementation<br>}</pre><p><strong>Testng Groups:</strong></p><pre>@Test(groups = &quot;groupName&quot;)<br>public void testMethod() {<br>    // Test method implementation<br>}</pre><p><strong>Testng Parameters:</strong></p><pre>import org.testng.annotations.Parameters;<br>import org.testng.annotations.Optional;<br><br>@Parameters({ &quot;parameterName&quot; })<br>@Test<br>public void testMethod(@Optional(&quot;defaultValue&quot;) String parameterValue) {<br>    // Test method implementation<br>}</pre><p><strong>Testng Data Providers:</strong></p><pre>package org.example;<br><br>import org.testng.annotations.DataProvider;<br>import org.testng.annotations.Test;<br><br>public class DataProviderExample {<br>    @Test(dataProvider = &quot;dataPrviderExample&quot;)<br>    public void ExampleTestMethod(String firstName, String lastName, int age)<br>    {<br>        System.out.println(&quot;First Name is &quot; + firstName);<br>        System.out.println(&quot;Last Name is &quot; + lastName);<br>        System.out.println(&quot;Age is &quot; + age);<br>    }<br>    @DataProvider(name = &quot;dataPrviderExample&quot;)<br>    public static Object[][] UserData() {<br>        return new Object[][] {{&quot;James&quot;, &quot;Smith&quot;, 26}, {&quot;John&quot;, &quot;Ioannidis&quot;, 76}, {&quot;Marie&quot;, &quot;Curie&quot;, 66}};<br>    }<br>}</pre><p><strong>Parallel Execution using Testng XML:</strong></p><pre>&lt;!DOCTYPE suite SYSTEM &quot;http://testng.org/testng-1.0.dtd&quot;&gt;<br>&lt;suite name=&quot;DemoTestSuite&quot; parallel=&quot;classes&quot; thread-count=3 &gt;<br>    &lt;test name=&quot;Demo Test&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;org.example.ExampleTest1&quot;/&gt;<br>            &lt;class name=&quot;org.example.ExampleTest2&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br>&lt;/suite&gt;</pre><p><strong>Type of Assertion:</strong></p><ul><li><strong>Hard</strong> <strong>Assertions</strong>: A hard assert is the default assertion mechanism in TestNG. When a hard assert statement fails, it immediately stops the execution of the current test method and moves on to the next test method.</li><li><strong>Soft</strong> <strong>Assertion</strong>: Soft Assert is an assertion mechanism that allows you to continue running a test even after an assertion failure occurs. Unlike regular (hard) assertions, which stop the test execution immediately upon failure, soft assertions collect all assertion failures and report them at the end of the test.</li></ul><p>This cheatsheet covers some of the commonly used features and annotations in TestNG. For more detailed information and examples, refer to the official TestNG documentation and resources.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24e87dac6d25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most Asked Interview Questions for Playwright]]></title>
            <link>https://medium.com/@pragyas215/most-asked-interview-questions-for-playwright-65b6dbbeb809?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/65b6dbbeb809</guid>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 06:44:56 GMT</pubDate>
            <atom:updated>2026-02-02T06:44:56.209Z</atom:updated>
            <content:encoded><![CDATA[<p>According to my recent experience for Playwright Interview, I am sharing bunch of questions that were asked in a company Interview.</p><ol><li>Get all the links present in the footer for <a href="https://www.wikipedia.org/">https://www.wikipedia.org/</a> and click on 3rd link</li></ol><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>test(&#39;Get all footer links and click on 3rd link&#39;, async ({ page }) =&gt; {<br><br> // Step 1: Navigate to Wikipedia<br>  await page.goto(&#39;https://www.wikipedia.org/&#39;);<br><br> // Step 2: Locate footer links<br>  const footerLinks = page.locator(&#39;//a[@class=&quot;other-project-link&quot;]&#39;);<br><br>// Step 3: Get the count of links<br>const linkcount = await footerLinks.count();<br><br>console.log(`Total footer links: ${linkCount}`);<br><br>// checking linkcount is greater than or equal to 3<br>expect(linkcount).toBeGreaterThanOrEqual(3);<br><br>// click on the 3rd link<br>await footerLinks.nth(2).click();</pre><p>2. How do you handle flaky tests in Playwright?</p><pre>- First I Identify Root Cause of tests failing by using Trace viewer, screenshots and video recordings<br>- Check if it is because Network delays, test data issue, wrong element identified, or any CI/CD issue<br><br><br>1. Use Playwright&#39;s auto-waiting feature<br>- To use playwright auto-waiting feature , we can use playwright defined locators and their assertions<br>Like, page.getByRole() , page.getByLabel(), page.getByText() , page.locator(), page.getByAltText(), page.getByTestId(), <br><br>2. Independent Tests - Make sure to make your tests independent of each other so that they don&#39;t get failed while parallel testing<br><br>3. use Retries as a option</pre><p>3. Tell me the automation framework structure for Playwright</p><pre>playwright-automation/<br>│<br>├── playwright.config.ts<br>├── package.json<br>├── tsconfig.json<br>├── .env<br>├── .gitignore<br>│<br>├── tests/<br>│   ├── auth/<br>│   │   └── login.spec.ts<br>│   ├── smoke/<br>│   │   └── smoke.spec.ts<br>│   ├── regression/<br>│   │   └── checkout.spec.ts<br>│   └── api/<br>│       └── user.api.spec.ts<br>│<br>├── pages/<br>│   ├── login.page.ts<br>│   ├── dashboard.page.ts<br>│   └── checkout.page.ts<br>│<br>├── fixtures/<br>│   └── testFixtures.ts<br>│<br>├── utils/<br>│   ├── testData.ts<br>│   ├── helpers.ts<br>│   └── apiUtils.ts<br>│<br>├── test-data/<br>│   ├── users.json<br>│   └── orders.json<br>│<br>├── reports/<br>│   └── html-report/<br>│<br>├── screenshots/<br>├── videos/<br>├── traces/<br>│<br>└── ci/<br>    └── github-actions.yml</pre><p>4. How do you handle Alerts in Playwright?</p><pre><br>// Accept dialog<br>page.on(&#39;dialog&#39;, async dialog =&gt; {<br>  console.log(dialog.message());<br>  await dialog.accept();<br>});<br><br>await page.click(&#39;#show-alert&#39;);<br><br>//Dismiss dialog<br>page.on(&#39;dialog&#39;, async dialog =&gt; {<br>  if (dialog.type() === &#39;confirm&#39;) {<br>    await dialog.dismiss(); // or dialog.accept()<br>  }<br>});<br><br>// prompt dialog<br>page.on(&#39;dialog&#39;, async dialog =&gt; {<br>  if (dialog.type() === &#39;prompt&#39;) {<br>    await dialog.accept(&#39;Playwright Test&#39;);<br>  }<br>});<br><br>// Validate alert text<br>page.on(&#39;dialog&#39;, async dialog =&gt; {<br>  expect(dialog.message()).toContain(&#39;Are you sure&#39;);<br>  await dialog.accept();<br>});</pre><p>5. How do you achieve Parallel Testing in Playwright?</p><pre>There are two ways to achieve Parallel Testing:<br><br>1. you can achieve parallel testing using workers in config.ts file in your Playwright framework<br><br>import { defineConfig } from &#39;@playwright/test&#39;;<br><br>export default defineConfig({<br>  workers: 4 ,<br>retries: 2 ,<br>trace: &#39;retain-on-failure&#39;,<br>});<br><br>2. Run tests in parallel within a file<br>test.describe.parallel(&#39;Checkout tests&#39;, () =&gt; {<br>  test(&#39;Add to cart&#39;, async ({ page }) =&gt; {});<br>  test(&#39;Remove from cart&#39;, async ({ page }) =&gt; {});<br>});<br></pre><p>6. What is fixture? Are you creating fixture for your own needs ? If yes, then can you describe what type it is and how you call them in your framework?</p><pre>A fixture in Playwright is a reusable setup and teardown mechanism that provides test-specific context or data to tests.<br><br>👉 It helps in:<br><br>Reducing duplicate setup code<br><br>Ensuring test isolation<br><br>Managing lifecycle (before → test → after)<br><br>- Yes, I actively create custom fixtures based on project needs.<br><br>// fixtures/auth.fixture.ts<br>import { test as base } from &#39;@playwright/test&#39;;<br><br>export const test = base.extend({<br>  authPage: async ({ browser }, use) =&gt; {<br>    const context = await browser.newContext({<br>      storageState: &#39;auth.json&#39;,<br>    });<br>    const page = await context.newPage();<br>    await use(page);<br>    await context.close();<br>  },<br>});<br><br><br>import { test } from &#39;../fixtures/auth.fixture&#39;;<br><br>test(&#39;Dashboard test&#39;, async ({ authPage }) =&gt; {<br>  await authPage.goto(&#39;/dashboard&#39;);<br>});</pre><p>7. How do you manage test data according to environments?</p><pre>“I manage test data per environment by externalizing data, parameterizing it through configuration, and isolating dynamic data using APIs.”<br><br>1. Environment-based configuration<br>Use .env files per environment:<br><br>.env.qa<br><br>.env.uat<br><br>.env.prod-like<br><br>2. Separate test data from test logic<br>test-data/<br>├── qa/<br>│   └── users.json<br>├── uat/<br>│   └── users.json<br><br>3. Dynamic test data via APIs (Best Practice)<br><br>For parallel-safe tests:<br><br>Create data before test<br><br>Clean up after test<br><br>const user = await apiUtils.createUser();</pre><p>8. Get all the links of the menu items of this <a href="https://www.wikipedia.org/">https://www.wikipedia.org/</a> and print it in the console</p><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>test(&#39;Get all footer links and click on 3rd link&#39;, async ({ page }) =&gt; {<br><br> // Step 1: Navigate to Wikipedia<br>  await page.goto(&#39;https://www.wikipedia.org/&#39;);<br><br>//   // Locate menu (language) links<br>const menuLinks = page.locator(&#39;.central-featured-lang a&#39;);<br><br>const count = await menuLinks.count();<br>console.log(&quot;Total links present:&quot; ${count});<br><br>// Loop and print text + URL<br>for(int i=0; i&lt; count; i++ ) {<br>const text = await menuLinks.nth(i).innerText();<br>const href = await menuLinks.nth(i).getAttribute(&#39;href&#39;);<br><br>console.log(&quot;${text}&quot;+&quot;------&quot;+&quot;${href}&quot;);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65b6dbbeb809" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Most Asked Selenium Interview Questions Bank]]></title>
            <link>https://medium.com/@pragyas215/most-asked-selenium-interview-questions-bank-b9fdb7da947c?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9fdb7da947c</guid>
            <category><![CDATA[sdet]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[selenium]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Sat, 27 Dec 2025 13:14:11 GMT</pubDate>
            <atom:updated>2025-12-27T13:14:11.320Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Explain the architecture of your Automation Framework</li></ol><p>Answer. A typical enterprise automation Framework is modular &amp; Layered:</p><p>Base Layer — This layer contains Base class which have functions for webdriver classification, browsers</p><p>Test Layer — This layer contains all the types of test cases according to POM (page object Model) design pattern</p><p>Business Layer- This layer contains all the pages logic along with locators and their respective functions</p><p>Utility Layer — This layer contains utility files like selenium utility (click, sendkeys, clear, scroll etc), java utility (Excel, Database) etc</p><p>Data Layer — This layer contains files for <a href="http://config.properties/">config.properties</a> according to different type of environments</p><p>Reporting Layer — This layer contains the latest report for test execution</p><pre>Base <br> - Base.java<br> Test<br>  - homepageTest.java<br>  - CheckoutTest.java<br>  - SearchTest.java<br>  - OrderTest.java<br>  Pages<br>  - homePage.java<br>  - checkoutPage.java<br>  - searchPage.java<br>  - orderPage.java<br>  seleniumUtility<br>  - seleniumUtility.java<br>  Utility<br>  - readExcel.java<br>  - writeExcel.java<br>  - database.java<br>  config<br>  - qa.properties<br>  - dev.properties<br>  - prod.properties<br>  test-output<br>  - report.html<br>  resources/data<br>  - excelfile<br>  testng.xml<br>  pom.xml</pre><p>2. Why did you choose a Hybrid Framework?</p><p>Hybrid framework is the combination of POM+data-driven+keyword-driven. It supports maintainability(POM), reusability(business layer) and flexibility(data-driven+keywords)</p><p>3. How do you ensure your framework is scalable and maintainable?</p><ul><li>Separation of layers using POM</li><li>config files according to environment wise</li><li>Utility files to maintain reusability of the functions</li><li>Page object for UI</li><li>Base classes for webdriver and browers</li></ul><p>4. How do you manage environments like QA, Stag or Prod?</p><p>Using config files like qa.properties, dev.properties, prod.properties</p><p>5. How do you manage test data?</p><p>We can manage test data through following ways:</p><ul><li>We can store test data in properties files according to environment wise</li><li>We can store test data in excel files if we have large set of data</li><li>If we want check test data for similiar type of logic then we can go for DataProviders</li><li>Use JSON for structured test cases</li><li>Database for large set of data</li></ul><p>6. What are staleElement issues? How to fix them?</p><p>StaleElementReferenceException occurs when a previously attached element is no longer attached to the DOM. We can <strong>fix by relocating element before use , using explicit waits</strong></p><p>7. How do you handle dynamic elements in your framework?</p><ul><li>we can use dynamic locators like starts-with , contains</li><li>use more stable locators like css, id, data-testid</li><li>use proper waits</li></ul><p>8. How do you reduce flakiness in your tests?</p><p>Use stable locators, proper explicit waits, retries</p><p>9. How do you implement retries for flaky test cases?</p><p>Implement IRetryAnalyzer listener to re-run failed test cases.</p><p>10. What are the common selenium exceptions?</p><ul><li>StaleElementReferenceException</li><li>ElementNotVisible</li><li>NoSuchElementException</li><li>TimeoutException</li><li>WebDriverException</li></ul><p>11. How do you group test cases in TestNg?</p><p>Use @Test(groups = {”smoke”,”regression”}) and run these groups via testng.xml file under &lt;groups&gt; tag</p><p>12. How do you manage parameters using testng.xml?</p><p>@Parameters({”env”}) with @test tag and pass it on testng.xml file &lt;parameter name=”env” value=”qa”&gt;</p><p>13. How do you run test cases in specific order?</p><p>We can use priority or dependsOnMethods</p><p>14. How do you integrate API automation with UI?</p><p>Use RestAssured to setup testdata. Use this data and validate on UI</p><p>15. How do you speed up your Automation suite?</p><ul><li>Use parallel execution</li><li>Reduce unnecessary opening/closing of browsers</li><li>All the details which are required only once then we can pass it in BeforeSuite</li><li>Use Headless execution</li><li>Use api for backend test data creation</li></ul><p>16. Difference between driver.close() and driver.quit() ?</p><p>driver.close() — closes the current active tab</p><p>driver.quit() — close all the tabs which were opened by driver</p><p>17. Difference between Implicit wait and Explicit wait?</p><p>Implicit wait — global wait as it waits for every element</p><pre>driver.manage().timeouts().implicitlywait(driver, Duration.ofSeconds(10));</pre><p>Explicit wait — waits for specific condition and applied to only element</p><pre>Webdriver wait = new WebdriverWait(driver, Duration.ofSeconds(10));<br>wait.until(ExpectedConditions.visibilityOf(Element));</pre><p>18. Explain Fluent wait</p><pre>Wait&lt;WebDriver&gt; wait = new FluentWait&lt;&gt;(driver)<br>        .withTimeout(Duration.ofSeconds(20))<br>        .pollingEvery(Duration.ofSeconds(2))<br>        .ignoring(NoSuchElementException.class);</pre><p>19. What is PageFactory?</p><p>PageFactory is a type of design pattern used for locating elements in the framework</p><pre>@FindBy(id=&quot;username&quot;)<br>WebElement userName;</pre><p>20. How to take screenshots in selenium?</p><pre>File src = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);<br>FileUtils.copyFile(src, new File(&quot;./screenshot.png&quot;));</pre><p>21. How to handle dropdowns ?</p><pre>Select select = new Select(driver.findElement(By.id(&quot;country&quot;)));<br>select.selectByVisibleText(&quot;India&quot;);<br>select.selectByValue(&quot;IN&quot;);<br>select.selectByIndex(2);</pre><p>22. How to handle alerts?</p><pre>Alert alert = driver.switchTo().alert();<br>alert.accept();<br>alert.dismiss();<br>alert.getText();<br>alert.sendKeys(&quot;text&quot;);</pre><p>23. How to handle frames?</p><pre>driver.switchTo().frame(0);<br>driver.switchTo().frame(&quot;frameName&quot;);<br>driver.switchTo().frame(element);<br>driver.switchTo().defaultContent();</pre><p>24. How to perform mouse Hover?</p><pre>Actions action = new Actions(driver);<br>action.moveToElement(element).build().perform();</pre><p>25. How to handle multiple windows?</p><pre>String parent = driver.getWindowHandle();</pre><pre>Set child = driver.getWindowHandles();</pre><pre>Iterator itr = new Iterator();<br>while(itr.hasNext()) {<br>if(!child.equals(parent)) {<br>   driver.switchTo().window(child);<br>   WebElement ele = driver.findElement(By.xpath(&quot;//button&quot;));<br>   ele.click();<br>   }<br>   }</pre><p>26. How to scroll on a page?</p><pre>JavascriptExecutor js= (JavascriptExecutor) driver;<br>js.executeScript(&quot;window.scrollBy(0,500)&quot;);</pre><p>27. Difference between findElement() and findElements() ?</p><pre>findElement() - return single webelement , if no element is found then it will return NoSuchElementException<br>findElements() - return list of webelement, if no element is found then it will return empty list</pre><p>28. How to upload files without using sendKeys?</p><pre>Use Robot class<br>Use AutoIt <br>Use Javascript <br>Use API if endpoints are available</pre><p>29. How to maximize browser window?</p><pre>driver.manage().window().maximize();</pre><p>30. Difference between driver.get() and driver.navigate().to()</p><p>driver.get() — navigate to url , no history maintained , waits until page loads completely</p><p>driver.navigate().to() — navigate to url, history maintained (cookies saved), move forward &amp; backward</p><p>31. How to handle Authentication popups?</p><ul><li>Using URL</li></ul><pre>&lt;https://username:password@site.com&gt;</pre><ul><li>Using Robot class</li><li>Using AutoIt</li><li>Using APIs</li></ul><p>32. Element is not clickable. Why?</p><ul><li>Another element overlaps</li><li>Not visible to screen (Element is out of viewport)</li><li>Timing issues</li></ul><p>we can fix it by:</p><ul><li>Using Explicit wait</li><li>click using javascript executor</li><li>scroll into view</li><li>use Action class</li></ul><p>33. Test running fine locally but failing in Jenkins. why?</p><ul><li>Synchronization Issues</li><li>Environment differences</li><li>Screen size difference</li><li>Headless mode</li></ul><p>34. How do you validate broken links?</p><pre>List&lt;WebElement&gt; links = driver.findElements(By.tagName(&quot;a&quot;));</pre><pre>for (WebElement link : links) {<br>    String url = link.getAttribute(&quot;href&quot;);<br>    HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();<br>    conn.setRequestMethod(&quot;HEAD&quot;);<br>    int status = conn.getResponseCode();<br>    if (status &gt;= 400) {<br>        System.out.println(url + &quot; is broken&quot;);<br>    }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9fdb7da947c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understand Rest-Assured Framework from Scratch]]></title>
            <link>https://medium.com/@pragyas215/understand-rest-assured-framework-from-scratch-e3e6f480f984?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3e6f480f984</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[restassured]]></category>
            <category><![CDATA[qa-automation]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 12:24:53 GMT</pubDate>
            <atom:updated>2025-12-15T12:24:53.073Z</atom:updated>
            <content:encoded><![CDATA[<p>What is Rest Assured ?</p><p>Rest Assured is a java library to test Rest APIs.</p><p><strong>Things you should know before starting Rest Assured:</strong></p><p>GET — retrieve data</p><p>POST — create new data</p><p>PUT — update data</p><p>PATCH — update partial data</p><p>DELETE — delete resource</p><p><strong>Set up required for Rest Assured in Maven:</strong></p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>    &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;<br>    &lt;version&gt;5.4.0&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;</pre><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>    &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>    &lt;version&gt;7.9.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>Now, Lets understand basic requests:</p><ul><li>GET Request</li></ul><pre>import static io.restassured.RestAssured.*;<br>import static org.hamcrest.Matchers.*;<br><br>import org.testng.annotations.Test;<br><br>public class GetUserTest {<br><br>    @Test<br>    public void getUsers() {<br>        given()<br>        .when()<br>                .get(&quot;https://reqres.in/api/users?page=2&quot;)<br>        .then()<br>                .statusCode(200)<br>                .body(&quot;data[0].email&quot;, containsString(&quot;@&quot;));<br>    }<br>}</pre><ul><li>POST Request</li></ul><pre>@Test<br>public void createUser() {<br><br>    String requestBody = &quot;{\n&quot; +<br>            &quot;\&quot;name\&quot;: \&quot;Pragya\&quot;,\n&quot; +<br>            &quot;\&quot;job\&quot;: \&quot;QA Engineer\&quot;\n&quot; +<br>            &quot;}&quot;;<br><br>    given()<br>            .header(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>            .body(requestBody)<br>    .when()<br>            .post(&quot;https://reqres.in/api/users&quot;)<br>    .then()<br>            .statusCode(201)<br>            .body(&quot;name&quot;, equalTo(&quot;Pragya&quot;));<br>}</pre><ul><li>PUT Request</li></ul><pre>@Test<br>public void updateUser() {<br><br>    String requestBody = &quot;{ \&quot;job\&quot;: \&quot;Senior QA\&quot; }&quot;;<br><br>    given()<br>            .header(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>            .body(requestBody)<br>    .when()<br>            .put(&quot;https://reqres.in/api/users/2&quot;)<br>    .then()<br>            .statusCode(200)<br>            .body(&quot;job&quot;, equalTo(&quot;Senior QA&quot;));<br>}</pre><ul><li>DELETE Request</li></ul><pre>@Test<br>public void deleteUser() {<br><br>    given()<br>    .when()<br>            .delete(&quot;https://reqres.in/api/users/2&quot;)<br>    .then()<br>            .statusCode(204); // No content<br>}</pre><h3><strong>Understanding Rest Assured Structure:</strong></h3><p>Rest Assured follows this pattern:</p><pre>given() → preconditions  <br>when() → action  <br>then() → validation</pre><p>This pattern you have seen it in the above examples.</p><h3><strong>Extract Values from Response</strong></h3><pre>Response res = <br>        given()<br>        .when()<br>            .get(&quot;https://reqres.in/api/users/2&quot;);<br><br>String email = res.jsonPath().getString(&quot;data.email&quot;);<br><br>System.out.println(email);</pre><p>Now, question comes in your mind what is JsonPath?</p><p>JSonPath is used to read, extract and query values from JSON response easily.</p><p>JsonPath helps you fetch values from Json reponse in API Testing.</p><p>API Response are mostly in this format:</p><pre>{<br>  &quot;data&quot;: {<br>    &quot;id&quot;: 2,<br>    &quot;email&quot;: &quot;janet.weaver@reqres.in&quot;,<br>    &quot;first_name&quot;: &quot;Janet&quot;<br>  }<br>}</pre><p>So, we can values of the response body using JsonPath:</p><pre>String email = response.jsonPath().getString(&quot;data.email&quot;);</pre><ol><li>Extract Single Values</li></ol><pre>int id = response.jsonPath().getInt(&quot;data.id&quot;);</pre><p>2. Extract lists</p><pre>List&lt;String&gt; emails = response.jsonPath().getList(&quot;data.email&quot;);</pre><h3><strong>Authentication in Rest-Assured</strong></h3><p>Authentication is required for security purpose.The most used authentication methods are following:</p><ol><li>Basic Auth — Used when API needs username+Password</li></ol><pre>given().<br>   auth().basic(&quot;username&quot;,&quot;password&quot;).<br>   when().<br>   get(&quot;https://api.example.com/users&quot;).<br>      then().<br>         statusCode(200);</pre><p>2. Bearer Token — send token in headers</p><pre>given().<br>  header(&quot;Authorization&quot;, &quot;Bearer yourTokenHere&quot;).<br> when().<br>      .get(&quot;https://api.example.com/profile&quot;)<br>.then()<br>    .statusCode(200);</pre><p>3. API Key authentication — Some APIs give you an API key.</p><pre>given()<br>    .queryParam(&quot;apiKey&quot;, &quot;abcd1234&quot;)<br>.when()<br>    .get(&quot;https://api.weather.com/data&quot;)<br>.then()<br>    .statusCode(200);</pre><p>4. OAuth 2.0</p><pre>given()<br>    .auth().oauth2(accessToken)<br>.when()<br>    .get(&quot;/user&quot;)<br>.then()<br>    .statusCode(200);</pre><h3><strong>Logging in Rest Assured</strong></h3><ul><li>log Request</li></ul><pre>given().log().all()</pre><ul><li>log Response</li></ul><pre>then().log().all()</pre><p>Full example:</p><pre>given()<br>    .log().all()<br>.when()<br>    .get(&quot;https://reqres.in/api/users?page=2&quot;)<br>.then()<br>    .log().all()<br>    .statusCode(200);</pre><h3><strong>Serialization &amp; Deserialization (POJO)</strong></h3><p>Serialization — convert java object to JSON</p><p>Deserialization — convert JSON to java object</p><p><strong>Example POJO (User.java)</strong></p><pre>public class User {<br>    private String name;<br>    private String job;<br><br>    // getters and setters<br>}</pre><p><strong>Serialization (Java → JSON)</strong></p><pre>User user = new User();<br>user.setName(&quot;Pragya&quot;);<br>user.setJob(&quot;QA Engineer&quot;);<br><br>given()<br>    .contentType(&quot;application/json&quot;)<br>    .body(user)      // ← REST ASSURED converts POJO → JSON<br>.when()<br>    .post(&quot;https://reqres.in/api/users&quot;)<br>.then()<br>    .statusCode(201);</pre><p><strong>Deserialization (JSON → Java object)</strong></p><pre>User resUser = res.as(User.class);<br><br>System.out.println(resUser.getName());<br>System.out.println(resUser.getJob());</pre><h3><strong>Real Time Project workflow for API Testing</strong></h3><ul><li>Understand API Contract (Swagger/Postman)</li><li>Identify Test cases</li><li>Write positive &amp; Negative test cases</li><li>Create Payload (POJO classes)</li><li>Write Automated API tests</li><li>Run tests in CI</li><li>Integrate with reporting tools</li></ul><h3><strong>RequestSpecification &amp; ResponseSpecification</strong></h3><p>Look at the below code without specs:</p><pre>given()<br>    .baseUri(&quot;https://reqres.in&quot;)<br>    .header(&quot;Content-Type&quot;, &quot;application/json&quot;)<br>    .log().all()<br>    .body(requestBody)<br>.when()<br>    .post(&quot;/api/users&quot;)<br>.then()<br>    .log().all()<br>    .statusCode(201);</pre><p>If you write 50 tests, then you will repeat the code again &amp; again</p><ul><li>same baseUri</li><li>same header</li><li>logs</li><li>content-type</li></ul><p>This makes code difficult to manage, messy and long.</p><p>⭐ <strong>Solution → Create reusable specifications</strong></p><h4>✔ RequestSpecification → for request setup</h4><h4>✔ ResponseSpecification → for validation setup</h4><p>Then you write only:</p><pre>given()<br>    .spec(reqSpec)<br>    .body(user)<br>.when()<br>    .post(&quot;/api/users&quot;)<br>.then()<br>    .spec(resSpec);</pre><h3>🎯 2. REQUEST SPECIFICATION (reqSpec)</h3><h3>📝 Purpose:</h3><ul><li>Store base URI</li><li>Common headers</li><li>Query params</li><li>Authentication</li><li>Logging preferences</li></ul><h3>🧱 Example: Creating RequestSpecification</h3><h3>RequestSpec.java</h3><pre>public class RequestSpec {<br>    public static RequestSpecification reqSpec;static {<br>        reqSpec = new RequestSpecBuilder()<br>                .setBaseUri(&quot;https://reqres.in&quot;)<br>                .setContentType(&quot;application/json&quot;)<br>                .addHeader(&quot;Accept&quot;, &quot;application/json&quot;)<br>                .log(LogDetail.ALL)<br>                .build();<br>    }<br>}</pre><h3>What this means:</h3><ul><li>Every request will use base URI → <a href="https://reqres.in/">https://reqres.in</a></li><li>Every request sends JSON</li><li>All request details will be logged automatically</li><li>Header added automatically</li></ul><h3>🎯 3. Using RequestSpecification in test</h3><pre>given()<br>    .spec(RequestSpec.reqSpec)<br>    .body(user)<br>.when()<br>    .post(&quot;/api/users&quot;)<br>.then()<br>    .statusCode(201);</pre><p>✔ Clean<br> ✔ Reusable<br> ✔ Short test code<br> ✔ Less maintenance</p><h3>⭐ 4. RESPONSE SPECIFICATION (resSpec)</h3><h3>Purpose:</h3><ul><li>Store common validations</li><li>Validate content type</li><li>Validate response time</li><li>Validate status code (optional)</li></ul><h3>Example: ResponseSpec.java</h3><pre>public class ResponseSpec {<br>public static ResponseSpecification resSpec;   static {<br>        resSpec = new ResponseSpecBuilder()<br>                .expectStatusCode(200)<br>                .expectContentType(&quot;application/json&quot;)<br>                .expectResponseTime(lessThan(3000L))<br>                .build();<br>    }<br>}</pre><h3>🎯 5. Use ResponseSpecification in test</h3><pre>given()<br>    .spec(RequestSpec.reqSpec)<br>.when()<br>    .get(&quot;/api/users?page=2&quot;)<br>.then()<br>    .spec(ResponseSpec.resSpec)<br>    .body(&quot;page&quot;, equalTo(2));</pre><h3>What it validates automatically:</h3><p>✔ Status code = 200<br> ✔ Content-Type = JSON<br> ✔ Response time &lt; 3 seconds</p><p>You only add specific validations in the test body.</p><h3>🧠 6. You can override specifications</h3><p>Sometimes you need a different status code or no logging:</p><pre>given()<br>    .spec(RequestSpec.reqSpec)<br>    .log().uri()  // additional logging for this test only</pre><p>You can also change status code:</p><pre>.then()<br>    .spec(ResponseSpec.resSpec)<br>    .statusCode(201);  // override</pre><h3>🌀 7. REAL-TIME FRAMEWORK STRUCTURE WITH SPECS</h3><pre>src/test/java<br>    ├── base<br>    │     BaseTest.java                 → sets baseURI, loads specs<br>    ├── specifications<br>    │     RequestSpec.java              → RequestSpecification<br>    │     ResponseSpec.java             → ResponseSpecification<br>    ├── tests<br>    │     CreateUserTest.java</pre><h3>BaseTest.java</h3><pre>public class BaseTest {   @BeforeClass<br>    public void setup() {<br>        RestAssured.requestSpecification = RequestSpec.reqSpec;<br>        RestAssured.responseSpecification = ResponseSpec.resSpec;<br>    }<br>}</pre><p>Now you don’t even need .spec(reqSpec) in tests!</p><h3>💥 8. CLEAN TEST USING GLOBAL SPECS</h3><pre>public class GetUserTest extends BaseTest {<br>    @Test<br>    public void getUser() {<br>        given()<br>        .when()<br>            .get(&quot;/api/users/2&quot;)<br>        .then()<br>            .body(&quot;data.id&quot;, equalTo(2));<br>    }<br>}</pre><p>✔ No baseURI<br> ✔ No headers<br> ✔ No logging<br> ✔ No content type setup</p><p>Everything handled automatically.</p><h3><strong>Industry Ready Real Automation API Framework</strong></h3><p>Step 1. Create the Project Structure</p><pre>src<br> └── test<br>      ├── java<br>      │     ├── base<br>      │     │     BaseTest.java<br>      │     ├── specs<br>      │     │     RequestSpec.java<br>      │     │     ResponseSpec.java<br>      │     ├── pojo<br>      │     │     User.java<br>      │     ├── utils<br>      │     │     Payloads.java<br>      │     │     Endpoints.java<br>      │     └── tests<br>      │           CreateUserTest.java<br>      └── resources<br>            config.properties</pre><p>Step 2. Add Dependencies in POM.xml</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>    &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;<br>    &lt;version&gt;5.4.0&lt;/version&gt;<br>    &lt;scope&gt;test&lt;/scope&gt;<br>&lt;/dependency&gt;<br><br>&lt;dependency&gt;<br>    &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>    &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>    &lt;version&gt;7.9.0&lt;/version&gt;<br>&lt;/dependency&gt;<br><br>&lt;!-- For Serialization/Deserialization --&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;<br>    &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;<br>    &lt;version&gt;2.17.0&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>Step 3. Create Configuration file</p><p>resources/config.properties</p><pre>baseURI=https://reqres.in</pre><p>Step 4.BaseTest</p><p>base/BaseTest.java</p><pre>public class BaseTest {<br><br>    @BeforeClass<br>    public void setup() {<br>        RestAssured.baseURI = ConfigReader.getProperty(&quot;baseURI&quot;);<br>    }<br>}</pre><p>Step 5. ConfigReader Utility</p><p>utils/ConfigReader.java</p><pre>public class ConfigReader {<br><br>    static Properties prop = new Properties();<br><br>    static {<br>        try {<br>            FileInputStream fis = new FileInputStream(&quot;src/test/resources/config.properties&quot;);<br>            prop.load(fis);<br>        } catch (Exception e) {<br>            e.printStackTrace();<br>        }<br>    }<br><br>    public static String getProperty(String key) {<br>        return prop.getProperty(key);<br>    }<br>}</pre><p>Step 6. Specifications</p><h4>✓ RequestSpec.java</h4><pre>public class RequestSpec {<br><br>    public static RequestSpecification getRequestSpec() {<br>        return new RequestSpecBuilder()<br>                .setContentType(&quot;application/json&quot;)<br>                .log(LogDetail.ALL)<br>                .build();<br>    }<br>}</pre><h4>✓ ResponseSpec.java</h4><pre>public class ResponseSpec {<br><br>    public static ResponseSpecification getResponseSpec200() {<br>        return new ResponseSpecBuilder()<br>                .expectStatusCode(200)<br>                .expectContentType(&quot;application/json&quot;)<br>                .expectResponseTime(lessThan(4000L))<br>                .build();<br>    }<br><br>    public static ResponseSpecification getResponseSpec201() {<br>        return new ResponseSpecBuilder()<br>                .expectStatusCode(201)<br>                .expectContentType(&quot;application/json&quot;)<br>                .build();<br>    }<br>}</pre><p>Step 7. Create POJO Class</p><p>pojo/User.java</p><pre>public class User {<br><br>    private String name;<br>    private String job;<br><br>    public User() {}<br><br>    public User(String name, String job) {<br>        this.name = name;<br>        this.job = job;<br>    }<br><br>    // getters &amp; setters<br>}</pre><p>Step 8. Payload</p><p>utils/Payloads.java</p><pre>public class Payloads {<br><br>    public static User createUserPayload(String name, String job) {<br>        return new User(name, job);<br>    }<br>}</pre><p>Step 9. Endpoints Utility</p><p>utils/Endpoints.java</p><pre>public class Endpoints {<br>    public static final String CREATE_USER = &quot;/api/users&quot;;<br>    public static final String GET_USERS = &quot;/api/users?page=2&quot;;<br>}</pre><p>Step 10. Create Test</p><p>tests/CreateUserTest.java</p><pre>public class CreateUserTest extends BaseTest {<br><br>    @Test<br>    public void createUserTest() {<br><br>        User payload = Payloads.createUserPayload(&quot;Pragya&quot;, &quot;QA&quot;);<br><br>        given()<br>            .spec(RequestSpec.getRequestSpec())<br>            .body(payload)<br>        .when()<br>            .post(Endpoints.CREATE_USER)<br>        .then()<br>            .spec(ResponseSpec.getResponseSpec201())<br>            .body(&quot;name&quot;, equalTo(&quot;Pragya&quot;));<br>    }<br>}</pre><p>Get Api Test</p><pre>@Test<br>public void getUsersTest() {<br><br>    given()<br>        .spec(RequestSpec.getRequestSpec())<br>    .when()<br>        .get(Endpoints.GET_USERS)<br>    .then()<br>        .spec(ResponseSpec.getResponseSpec200())<br>        .body(&quot;page&quot;, equalTo(2));<br>}</pre><p>I hope this article helps you to understand complete Rest-Assured Architecture along with industry ready Framework.</p><p>Happy Reading…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3e6f480f984" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium Cheat Sheet]]></title>
            <link>https://medium.com/@pragyas215/selenium-cheat-sheet-04a4947bfa47?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/04a4947bfa47</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Sun, 07 Dec 2025 18:49:17 GMT</pubDate>
            <atom:updated>2025-12-07T18:49:17.753Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TlhOhkwgEabl5UZF.png" /></figure><h3><strong>Launch Browser</strong></h3><ul><li>Webdriver driver = new ChromeDriver();</li><li>Webdriver driver = new geckoDriver();</li><li>Webdriver driver = new EdgeDriver();</li><li>Webdriver driver = new SafariDriver();</li></ul><h3><strong>Locators</strong></h3><ul><li>ID — driver.findElement(By.id(“element”))</li><li>name — driver.findElement(By.name(“elementName”))</li><li>classname — driver.findElement(By.className(“class”))</li><li>xpath — driver.findElement(By.xpath(“//div//[@text=”element”]))</li><li>css — driver.findElement(By.cssSelector(“[name= “value”]))</li><li>partialLinkText — driver.findElement(By.partialLinkText(“ptext”))</li><li>LinkText — driver.findElement(By.LinkText(“text”))</li><li>TagName- driver.findElement(By.tagName(“tagname”))</li></ul><h3><strong>Identify Elements</strong></h3><ul><li>Identify Single Element — driver.findElement(By.id(“elementid”)); // it will return single element</li><li>Identify list of elements — driver.findElements(By.xpath(“//div//td”)); // it will return list of elements</li></ul><h3><strong>Basic Browser Operations</strong></h3><ul><li>Initialize web browser — WebDriver driver = new ChromeDriver();</li><li>Load web page — driver.get(“https://www.google.com”);</li><li>Maximize page — driver.manage().window().maximize();</li><li>get page title — driver.getTitle();</li><li>get current URL — driver.getCurrentUrl();</li><li>get page source — driver.getPageSource();</li><li>Close window — driver.close();</li><li>Close session — driver.quit();</li></ul><h3><strong>Navigational Commands</strong></h3><ul><li>Refresh Page — driver.navigate().refresh();</li><li>Navigate to Url — driver.navigate().to(“https://www.google.com”);</li><li>Navigate Back — driver.navigate().back();</li><li>Navigate Forward — driver.navigate().forward();</li></ul><h3><strong>WebElement Interaction</strong></h3><ul><li>Locate Element by Id — WebElement element = driver.findElement(By.id(“id”))</li><li>Click Element — element.click();</li><li>Input Text — element.sendKeys(“Text Here”);</li><li>Clear Text — element.clear();</li><li>Retrieve Text —String Text = element.getText();</li><li>get Attribute — element.getAttribute(“class”);</li><li>Is Displayed — element.isDisplayed();</li><li>Is enabled — element.isEnabled();</li><li>Is selected — element.isSelected(); // majorly used for checkboxes, radio buttons</li><li>submit — element.submit(); // majorly used to submit the form</li><li>get Tag name — element.getTagName();</li><li>fetch css value — element.getCssValue();</li></ul><h3><strong>Handling Frames</strong></h3><ul><li>Switch to frame using Index — driver.switchTo().frame(1);</li><li>Switch to frame using webElement — driver.switchTo().frame(locator);</li><li>Switch to frame using Name — driver.switchTo().frame(“framename”);</li><li>Switch to frame using ID — driver.switchTo().frame(“frameID”);</li><li>Switch back to main document — driver.switchTo().defaultContent();</li></ul><h3><strong>Handle Alerts</strong></h3><ul><li>Switch to Alert — Alert alert= driver.switchTo().alert();</li><li>Accept Alert — alert.accept();</li><li>Dismiss Alert — alert.dismiss();</li><li>get Text Alert — alert.getText();</li><li>Send Text to Alert — alert.sendKeys(“abc”);</li></ul><h3><strong>Handle Dropdown</strong></h3><ul><li>Switch to dropdown — Select select = new Select(driver.findElement(By.id(“country”)));</li><li>Select dropdown using Text — select.selectByVisibleText(“India”);</li><li>Select dropdown using value — select.selectByValue(1);</li><li>Select dropsown using Index — select.selectByIndex(1);</li></ul><h3><strong>Waits</strong></h3><ul><li>Implicit wait</li></ul><pre> WebDriver driver = new FirefoxDriver();<br><br> driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);<br><br> driver.get(&quot;https://url_that_delays_loading&quot;);<br><br> WebElement myDynamicElement = driver.findElement(By.id(&quot;myDynamicElement&quot;));</pre><ul><li>Explicit wait</li></ul><pre>WebDriverWait wait = new WebDriverWait(driver, 10);<br>wait.until(ExpectedConditions.visibilityOf(element));</pre><ul><li>Fluent wait</li></ul><pre> Wait wait = new FluentWait(driver)<br><br>    .withTimeout(30, SECONDS)<br><br>    .pollingEvery(5, SECONDS)<br><br>    .ignoring(NoSuchElementException.class);<br><br>  WebElement foo = wait.until(new Function() {<br><br>    public WebElement apply(WebDriver driver) {<br><br>    return driver.findElement(By.id(&quot;foo&quot;));<br><br>    }<br><br>   });</pre><h3><strong>Window Handling</strong></h3><pre> System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;./src/main/resources/chromedriver&quot;);<br>        WebDriver driver = new ChromeDriver();<br>        driver.manage().window().maximize();<br>        driver.get(&quot;https://demoqa.com/browser-windows&quot;);<br>        <br>        driver.findElement(By.id(&quot;windowButton&quot;)).click();<br>        String mainwindow = driver.getWindowHandle();<br>        Set&lt;String&gt; s1 = driver.getWindowHandles();<br>        Iterator&lt;String&gt; i1 = s1.iterator();<br>        <br>        while (i1.hasNext()) {<br>            String ChildWindow = i1.next();<br>                if (!mainwindow.equalsIgnoreCase(ChildWindow)) {<br>                driver.switchTo().window(ChildWindow);<br>                WebElement text = driver.findElement(By.id(&quot;sampleHeading&quot;));<br>                System.out.println(&quot;Heading of child window is &quot; + text.getText());<br>                driver.close();<br>                System.out.println(&quot;Child window closed&quot;);<br>            }<br>        }    <br>  <br>        //  Switch back to the main window which is the parent window.<br>        driver.switchTo().window(mainwindow);<br>        driver.quit();<br>    }</pre><h3><strong>Capture Screenshot</strong></h3><pre>File srcfile = ((TakeScreeshot)driver).getScreenshotAs(OutputType.FILE);<br>FileUtils.copyFile(srcfile, new file(&quot;\\new location&quot;));</pre><h3><strong>Actions class</strong></h3><p>Actions action = new Actions(driver);</p><pre>// Right click<br>action.contextClick(element).build().perform();</pre><pre>// Double click<br>action.doubleClick(element).build().perform();</pre><pre>// Drag and drop<br>action.dragAndDrop(src,des).build().perform();<br><br>action.dragAndDrop(src, x, y).build().perform();</pre><pre>// Mouse over a specific element<br>action.moveToElement(element).build().perform();</pre><p>I have added most of the important libraries of selenium. This will help to prepare for interviews. Please let me know your view in comment section.</p><p>Happy Reading… !!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04a4947bfa47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to do data-driven testing with multiple sets in Playwright]]></title>
            <link>https://medium.com/@pragyas215/how-to-do-data-driven-testing-with-multiple-sets-in-playwright-c9170c804fba?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9170c804fba</guid>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 08:38:20 GMT</pubDate>
            <atom:updated>2025-12-02T08:38:20.789Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*FX5N7VHpPp95B9Do.jpeg" /></figure><p>Below is the clear explaination for how to do parameterization of multiple sets of data in Playwright</p><p>Method 1: test.describe() + forEach()</p><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>const testData = [<br>  { username: &#39;user1&#39;, password: &#39;pass1&#39; },<br>  { username: &#39;user2&#39;, password: &#39;pass2&#39; },<br>  { username: &#39;user3&#39;, password: &#39;pass3&#39; }<br>];<br><br>test.describe(&#39;Login tests&#39;, () =&gt; {<br><br>  testData.forEach(data =&gt; {<br>    test(`Login test for user: ${data.username}`, async ({ page }) =&gt; {<br><br>      await page.goto(&#39;https://example.com/login&#39;);<br><br>      await page.fill(&#39;#username&#39;, data.username);<br>      await page.fill(&#39;#password&#39;, data.password);<br>      await page.click(&#39;#login&#39;);<br><br>      await expect(page.locator(&#39;.welcome&#39;)).toBeVisible();<br>    });<br>  });<br><br>});</pre><p>Method 2: Data from JSON file (Recommended for larger data)</p><p>data.json</p><pre>[<br>  { &quot;username&quot;: &quot;admin&quot;, &quot;password&quot;: &quot;admin123&quot; },<br>  { &quot;username&quot;: &quot;testuser&quot;, &quot;password&quot;: &quot;test123&quot; }<br>]</pre><pre>import testData from &#39;./data.json&#39;;<br><br>test.describe(&#39;Login Tests&#39;, () =&gt; {<br><br>  for (const data of testData) {<br>    test(`Login test for ${data.username}`, async ({ page }) =&gt; {<br><br>      await page.goto(&#39;https://example.com/login&#39;);<br><br>      await page.fill(&#39;#username&#39;, data.username);<br>      await page.fill(&#39;#password&#39;, data.password);<br>      await page.click(&#39;#login&#39;);<br><br>      await expect(page.locator(&#39;text=Dashboard&#39;)).toBeVisible();<br>    });<br>  }<br><br>});</pre><h3><strong>Real life Example with multiple login sets</strong></h3><pre>const users = [<br>  { u: &#39;admin&#39;, p: &#39;admin123&#39; },<br>  { u: &#39;qauser&#39;, p: &#39;qa123&#39; },<br>  { u: &#39;guest&#39;, p: &#39;guest123&#39; }<br>];<br><br>test.describe(&#39;Multiple Login Tests&#39;, () =&gt; {<br><br>  for (const user of users) {<br>    test(`Login as ${user.u}`, async ({ page }) =&gt; {<br><br>      await page.goto(&#39;/login&#39;);<br>      await page.fill(&#39;#username&#39;, user.u);<br>      await page.fill(&#39;#password&#39;, user.p);<br>      await page.click(&#39;#submit&#39;);<br><br>      await expect(page.locator(&#39;#dashboard&#39;)).toBeVisible();<br><br>    });<br>  }<br><br>});</pre><p>Parameterization in Playwright is done using loops (forEach), JSON files, or custom helpers.<br> Playwright does not have built-in “test.each()”, but data-driven tests are easily implemented using JavaScript arrays or external JSON files.</p><p>If you like this session, Please comment and like.</p><p>Happy Reading…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9170c804fba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Testing Using Playwright]]></title>
            <link>https://medium.com/@pragyas215/api-testing-using-playwright-f2fe3a7c7c3f?source=rss-907037c19270------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2fe3a7c7c3f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwrights]]></category>
            <dc:creator><![CDATA[Pragya Singh]]></dc:creator>
            <pubDate>Sun, 30 Nov 2025 15:26:20 GMT</pubDate>
            <atom:updated>2025-11-30T15:26:20.437Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we are going through the API Testing concepts using Playwright.</p><p>Playwright have a built-in api called APIRequestContext that helps you send API calls without opening a real browser.</p><p>Example:</p><pre>const response = await request.get(&#39;https://api.example.com/users&#39;);</pre><p>You can:</p><ul><li>send API requests</li><li>validate data</li><li>perform CRUD operations</li><li>use it inside or outside UI tests</li></ul><p>Playwright is a <strong>full-stack testing tool</strong>.</p><h3><strong>Basic Get API Test</strong></h3><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>test(&#39;GET Users API&#39;, async ({ request }) =&gt; {<br><br>const baseUrl = &#39;https://reqres.in/api&#39;;<br><br> const response = await request.get(`${baseUrl}/users/1`);<br><br> expect(response.status()).toBe(200);<br> const responseBody=response.json();<br><br>expect(responseBody.data.id).toBe(1);<br>expect(responseBody.data.first_name).toBe(&#39;George&#39;)<br>expect(responseBody.data.last_name).toBe(&#39;Bluth&#39;)<br>expect(responseBody.data.length).toBeGreaterThan(0);</pre><ul><li>request.get — -&gt; sends GET request</li><li>response.json() — — -&gt; JSON body parsing</li><li>response.status() — — -&gt; returns status code</li></ul><h3><strong>POST API TEST</strong></h3><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>test(&#39;POST Users API&#39;, async ({ request }) =&gt; {<br><br>const baseUrl = &#39;https://reqres.in/api&#39;;<br><br>const response = await request.post(`${baseUrl}/user`, {<br> data: {<br>    id: 1000,<br>}<br>});<br><br>const responseBody = response.json();<br><br>expect(response.status()).toBe(200);<br>expect(responseBody.data.id).toBe(1000);</pre><h3><strong>PUT API Test</strong></h3><pre>import { test, expect } from &#39;@playwright/test&#39;;<br><br>test(&#39;PUT Users API&#39;, async ({ request }) =&gt; {<br><br>const baseUrl = &#39;https://reqres.in/api&#39;;<br>  const response = await request.put(`${baseUrl}/users/2`, {<br>      //Request Body<br>      data: {<br>        name: &#39;new name&#39;,<br>        job: &#39;new job&#39;,<br>      },<br>    });<br><br>   const responseBody = await response.json();<br><br>    //Print the Response body in console<br>    console.log(responseBody)<br><br>    //Assertions<br>    expect(response.status()).toBe(200)<br>    expect(responseBody.name).toBe(&#39;new name&#39;)<br>    expect(responseBody.job).toBe(&#39;new job&#39;)<br>    expect(responseBody.updatedAt).toBeTruthy()</pre><h3><strong>DELETE API Test</strong></h3><pre>test(&#39;DELETE User Api&#39;, async ({ request }) =&gt; {<br>  const response = await request.delete(&#39;https://reqres.in/api/users/2&#39;);<br>  expect(response.status()).toBe(204);<br>});</pre><p>If you like this tutorial , please like, comment and follow me on medium.Also, if you have any doubt then ask me on the comment section.</p><p>Happy Reading…!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2fe3a7c7c3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>