<?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 Aartithareja on Medium]]></title>
        <description><![CDATA[Stories by Aartithareja on Medium]]></description>
        <link>https://medium.com/@aartithareja9?source=rss-6bd8b6c2f270------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*IOEVw-LW4t7Wqogg</url>
            <title>Stories by Aartithareja on Medium</title>
            <link>https://medium.com/@aartithareja9?source=rss-6bd8b6c2f270------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:45:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aartithareja9/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[Playwright Timeouts: Understanding Test, Action & Expect Timeouts]]></title>
            <link>https://medium.com/@aartithareja9/playwright-timeouts-understanding-test-action-expect-timeouts-da13876ca585?source=rss-6bd8b6c2f270------2</link>
            <guid isPermaLink="false">https://medium.com/p/da13876ca585</guid>
            <category><![CDATA[time-out]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <dc:creator><![CDATA[Aartithareja]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 08:39:42 GMT</pubDate>
            <atom:updated>2026-09-04T08:39:42.960Z</atom:updated>
            <content:encoded><![CDATA[<p>When writing automated tests with Playwright, you will eventually encounter a timeout error.</p><p>But what exactly does a timeout mean?</p><p>A common misconception is:</p><blockquote>“If I configure a 30-second timeout, Playwright will wait for 30 seconds.”</blockquote><p><strong>Not exactly.</strong></p><p>A timeout is a <strong>maximum amount of time Playwright is allowed to wait</strong> for something. If the required condition is satisfied earlier, Playwright continues immediately.</p><p>Playwright provides several timeout mechanisms, but three important ones we commonly configure in playwright.config.ts are:</p><ul><li><strong>Test timeout</strong></li><li><strong>Action timeout</strong></li><li><strong>Expect timeout</strong></li></ul><p>Let’s understand the difference.</p><h3>1. Test Timeout — How Long Can the Test Run?</h3><p>The <strong>test timeout</strong> controls the maximum amount of time a complete test is allowed to run.</p><p>For example:</p><pre>test(&#39;successful login&#39;, async ({ page }) =&gt; {    <br>await page.getByPlaceholder(&#39;Username&#39;)<br>        .fill(&#39;standard_user&#39;);<br>await page.getByPlaceholder(&#39;Password&#39;)<br>        .fill(&#39;secret_sauce&#39;);<br>    await page.getByRole(&#39;button&#39;, { name: &#39;Login&#39; })<br>        .click();<br>    await expect(page.getByText(&#39;Products&#39;))<br>        .toBeVisible();<br>});</pre><p>If we configure:</p><pre>timeout: 30*1000</pre><p>the <strong>entire test</strong> has a maximum of 30 seconds to complete.</p><p>Think of it as the test’s overall time budget:</p><pre>Test<br> │<br> ├── Navigate<br> ├── Fill username<br> ├── Fill password<br> ├── Click Login<br> └── Verify Products<br>          │<br>          ▼<br>     Maximum: 30 sec</pre><p>Importantly, this does <strong>not</strong> mean every action gets 30 seconds.</p><p>It is the maximum duration of the test itself.</p><h3>2. Action Timeout — How Long Should an Action Wait?</h3><p>The <strong>action timeout</strong> controls how long Playwright waits for an action such as:</p><pre>click()<br>fill()<br>check()<br>selectOption()</pre><p>to become possible.</p><p>For example:</p><pre>await page.getByRole(&#39;button&#39;, { name: &#39;Login&#39; }).click();</pre><p>Before performing the click, Playwright performs <strong>actionability checks</strong>.</p><p>Depending on the action, Playwright may wait for the element to be:</p><ul><li>present</li><li>visible</li><li>stable</li><li>enabled</li><li>able to receive pointer events</li></ul><p>If those conditions are not satisfied within the configured timeout, the action fails.</p><p>For example:</p><pre>use: {<br>    actionTimeout: 10*1000<br>}</pre><p>means an action can wait for up to 10 seconds.</p><p>Again, this is a <strong>maximum</strong>, not a fixed 10-second delay.</p><p>If the button becomes actionable after 500 ms, Playwright clicks it after approximately 500 ms.</p><p>It does not deliberately wait another 9.5 seconds.</p><h3>3. Expect Timeout — How Long Should an Assertion Retry?</h3><p>The <strong>expect timeout</strong> controls how long Playwright waits for an assertion to become true.</p><p>For example:</p><pre>await expect(page.getByText(&#39;Products&#39;))<br>    .toBeVisible();</pre><p>Suppose we configure:</p><pre>expect: {<br>    timeout: 5*1000<br>}</pre><p>Playwright will keep retrying the assertion for up to 5 seconds.</p><p>If Products becomes visible after 1 second:</p><pre>0s ───── 1s ─────────────── 5s<br>          ↑<br>       Products<br>        visible<br>          │<br>          └── PASS</pre><p>The test continues after 1 second.</p><p>It does <strong>not</strong> wait the full 5 seconds.</p><p>If Products never becomes visible, the expectation eventually fails when the timeout is reached.</p><h3>Putting the Three Together</h3><p>A typical playwright.config.ts could look like this:</p><pre>import { defineConfig, devices } from &#39;@playwright/test&#39;;<br>export default defineConfig({<br>testDir: &#39;./tests&#39;,<br>    // Maximum time for the complete test<br>    timeout: 30_000,<br>    // Maximum time for expect assertions<br>    expect: {<br>        timeout: 5_000<br>    },<br>    use: {<br>        baseURL: &#39;https://www.saucedemo.com&#39;,<br>        // Maximum time for actions<br>        actionTimeout: 10_000,<br>        trace: &#39;on-first-retry&#39;,<br>        screenshot: &#39;only-on-failure&#39;<br>    },<br>    projects: [<br>        {<br>            name: &#39;chromium&#39;,<br>            use: {<br>                ...devices[&#39;Desktop Chrome&#39;]<br>            }<br>        }<br>    ]<br>});</pre><p>The easiest way to remember them is:</p><pre>PLAYWRIGHT TEST<br>                       │<br>          ┌────────────┼────────────┐<br>          │            │            │<br>       TEST          ACTION        EXPECT<br>      TIMEOUT        TIMEOUT       TIMEOUT<br>          │            │            │<br>       Whole test    click/fill    assertions<br>          │            │            │<br>        30 sec       10 sec         5 sec</pre><h3>What If a Test Really Needs More Time?</h3><p>Now suppose your normal test timeout is:</p><pre>timeout: 30_000</pre><p>but one particular test performs a genuinely long-running operation and needs 60 seconds.</p><p>You don’t necessarily want to increase the global timeout for every test.</p><p>Instead, you can increase the timeout specifically for that test:</p><pre>test(&#39;long running operation&#39;, async ({ page }) =&gt; {<br>test.setTimeout(60_000);<br>    // test steps...<br>});</pre><p>Now this test has a 60-second limit while the rest of the test suite keeps the 30-second default.</p><p>This is generally better than doing:</p><pre>timeout: 120_000</pre><p>for the entire suite just because one test is slow.</p><h3>Timeout ≠ Fixed Waiting</h3><p>This distinction is extremely important.</p><p>Consider:</p><pre>await page.waitForTimeout(5000);</pre><p>This is a <strong>fixed delay</strong>.</p><p>Playwright will wait 5 seconds regardless of whether the application is ready after 500 ms.</p><p>But:</p><pre>await expect(locator).toBeVisible();</pre><p>with a 5-second timeout is a <strong>conditional wait</strong>.</p><p>Playwright waits <strong>up to</strong> 5 seconds, but stops as soon as the condition is satisfied.</p><p>So:</p><pre>waitForTimeout(5000)</pre><pre>&quot;Wait exactly 5 seconds.&quot;</pre><p>whereas:</p><pre>expect(..., { timeout: 5000 })</pre><pre>&quot;Wait until the condition is satisfied,<br>but don&#39;t wait longer than 5 seconds.&quot;</pre><p>This is one of the reasons Playwright’s auto-waiting and web-first assertions are so powerful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da13876ca585" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Selenium to Playwright: How I Changed the Way I Think About Test Automation]]></title>
            <link>https://medium.com/@aartithareja9/from-selenium-to-playwright-how-i-changed-the-way-i-think-about-test-automation-db192241b5d8?source=rss-6bd8b6c2f270------2</link>
            <guid isPermaLink="false">https://medium.com/p/db192241b5d8</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[web-automation-testing]]></category>
            <category><![CDATA[locator]]></category>
            <category><![CDATA[playwright-automation]]></category>
            <category><![CDATA[selenium-to-playwright]]></category>
            <dc:creator><![CDATA[Aartithareja]]></dc:creator>
            <pubDate>Wed, 02 Sep 2026 12:26:29 GMT</pubDate>
            <atom:updated>2026-09-02T12:28:08.826Z</atom:updated>
            <content:encoded><![CDATA[<p><em>My journey from Selenium + JavaScript to Playwright + TypeScript.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLX3Vb9Jnlf08XoIElXuNw.jpeg" /></figure><p>When I started working with test automation, my world was largely built around Selenium and JavaScript.I knew how to find elements, click buttons, enter data, write Page Objects, add assertions, and run tests through CI/CD. Selenium gave me a strong foundation in browser automation. So when I started learning Playwright with TypeScript, I initially thought:<br><em>“It’s another browser automation tool. I just need to learn a different syntax.”</em><br>I was wrong. The biggest change wasn’t learning a new framework.It was changing the way I think about test automation, From Browser Automation to Framework Thinking.</p><p>With Selenium, my mental model was roughly:<br><strong><em>Test<br>↓<br>Page Object<br>↓<br>WebDriver<br>↓<br>Browser<br>↓<br>Application</em></strong></p><p>A lot of my attention went into making browser interactions reliable — finding elements, handling waits, managing browser state, and dealing with synchronization.<br>Playwright made me look at the bigger picture.Its test ecosystem provides capabilities such as:</p><p><strong><em>* Auto-waiting<br>* Web-first assertions<br>* Fixtures<br>* Browser-context isolation<br>* Parallel execution<br>* Tracing<br>* Network interception<br>* API testing</em></strong></p><p>Suddenly, I wasn’t just asking:<br><strong><em>“How do I automate this step?”</em></strong><br>I started asking:<br><strong><em>“How should this test framework be designed?”</em></strong><br>That was the real shift.</p><p>Lesson 1: Rethinking Locators<br>Coming from Selenium, I was very comfortable with XPath and CSS.</p><p>For example:<br>//button[<a href="http://twitter.com/id">@id</a>=’login-button’]<br>or:<br>#login-button</p><p>Playwright introduced me to locators such as:<br>page.getByRole(‘button’, { name: ‘Login’ })</p><p>Initially, I wondered why I needed another way to locate elements. Then I understood the philosophy.<br>Instead of thinking:<br><strong><em>“Find this element in the DOM.”</em></strong><br>I started thinking:<br><strong><em>“Find the button representing the Login action.”</em></strong></p><p>CSS and XPath are still useful when appropriate, but Playwright encouraged me to think more about user-facing behavior and stable application semantics.</p><p>Lesson 2: Understanding Auto-Waiting<br>Another major change was how I thought about synchronization. With Selenium, I became very familiar with questions like:<em><br></em><strong><em>Is the element present?<br>Is it visible?<br>Is it enabled?<br>Do I need an explicit wait?<br>How long should I wait?</em></strong></p><p>In Playwright, an action such as:<br>await page.getByRole(‘button’, { name: ‘Login’ }).click();<br>automatically performs relevant actionability checks before interacting with the element.<br>My mental model became:<br><strong><em>Locator<br> ↓<br>Find element<br> ↓<br>Wait for required state<br> ↓<br>Check actionability<br> ↓<br>Perform action</em></strong></p><p>This doesn’t mean Playwright never needs explicit waiting. It changed the question I ask. Instead of:<br><em>“How many seconds should I wait?”</em><br>I now ask:<br><em>“What application state am I actually waiting for?”</em><br>That’s a much better way to think about synchronization.</p><p>Lesson 3: Web-First Assertions<br>This naturally led me to Playwright’s web-first assertions.<br>For example:<br>await expect(page.getByText(‘Products’)).toBeVisible();</p><p>The important part isn’t just the assertion.Playwright waits for the expected web state rather than treating the check as an instantaneous operation.<br>So instead of:<br><strong><em>Check → Pass/Fail</em></strong></p><p>I started thinking:<br><strong><em>Check expected state<br> ↓<br>Not ready?<br> ↓<br>Wait and retry<br> ↓<br>Pass when state is reached</em></strong></p><p>This reinforced something I had already learned through Selenium:<br>Reliable UI automation is fundamentally about synchronizing with application state, not adding arbitrary delays.</p><p><em>Selenium taught me how to automate a browser.<br>Playwright is teaching me how to engineer an automation framework.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db192241b5d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>