Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Optimizing long-running playwright test

    Optimizing long-running playwright test

    May 6, 2024

    I have just completed my first two playwright tests, but I am not sure how to optimize them.

    The scenario is the following:

    I log in to the system with an administrative user.
    I create a new user and save the generated username and password using the following code:

    // copy username and password
    const username = await page.locator(‘#username0’).innerText();
    const password = await page.locator(‘#passwd0’).innerText();
    expect(username).not.toBeNull();
    expect(username).not.toBeUndefined();
    expect(password).not.toBeNull();
    expect(password).not.toBeUndefined();

    I log out the admin user.
    I log in the created user (using the const created above), accept the terms and conditions and answer 220 questions, saving a screenshot of every 20th question.

    for (let x = 1; x <= 220; x++) {
    if (x % 20 === 0) {
    await storeScreenshot(popupPage, testInfo, ‘test Q’ + x);
    }
    await popupPage.waitForLoadState();
    await popupPage.locator(user.selector).click();
    if (x % 20 === 0) {
    await storeScreenshot(popupPage, testInfo, ‘test Q’ + x + ‘ – selected’);
    }
    await popupPage.locator(‘#submitknap’).click();
    }

    I am very happy that this works, and it is even parameterized with a csv for testing different answer patterns.

    If any step in this fails, the whole case fails.

    Ideally the admin part is not necessary as a part of the test and is reusable, but creating a user IS something I want to have. I could create some static users and wipe them before running each test, but I like the dynamic approach of creating a user prior to logging it in. I also have some environments that are not easily reset.

    I am in doubt as to how I can split this test scenario up. Should I have the admin part as a helper function called by the testcase, or as a smaller testcase prior to calling the main testcase?

    Edit

    For a little perspective this test takes 3 minutes to complete. a complete run of 6 parameters in three browsers takes 16 minutes.

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleWhy is Hyperautomation for the P&C Insurance Industry Important?
    Next Article Is it possible to validate response with json schema file in karate?

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-2305 – Apache Linux Path Traversal Vulnerability

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Video security analysis for privileged access management using generative AI and Amazon Bedrock

    Machine Learning

    Revolutionizing Web Design: The Role of AI in Modern Development

    Development

    Unleashing the multimodal power of Amazon Bedrock Data Automation to transform unstructured data into actionable insights

    Machine Learning

    Tailwind CSS v4 is Here

    Development

    Highlights

    Faster Algorithms for User-Level Private Stochastic Convex Optimization

    November 21, 2024

    We study private stochastic convex optimization (SCO) under user-level differential privacy (DP) constraints. In this…

    5 Unique HTML Elements You Might Not Know

    July 11, 2024

    maim takes screenshots of your desktop

    April 2, 2025

    XMPP: Il Protocollo di Messaggistica Istantanea Open-Source e Sicuro

    February 21, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.