Monday, February 17, 2025

Playwright Test Automation Framework generated with AI

 

Playwright Test Automation Framework Developed With The Help Of AI Search Agent.



In this article, we will discuss to generate a frontend test automation framework with Playwright and JavaScript on saucedemo website using AI-powered web agent Bolt. 
Here is the website link: https://bolt.new/

What is Bolt?

Bolt.new developed by the StackBlitz team, is an amazing and powerful AI tool designed to streamline web development by automating code generation.

This AI-powered web development agent helps you to generate, test, and deploy web apps that use modern frameworks. You have to Prompt first and then run, edit and can deploy full-stack web and mobile apps directly from your browser and do not need an additional local set up.


Basically, first signup to Bolt. I have signed in using my GitHub credentials. After signing into bolt,  First thing, Type in the prompt provided with the keywords you want.



I typed "Create a test automation framework for https://www.saucedemo.com/ website in Playwright and Javascript". Hit Enter that's all Bingo..!

You will see all the work done by the AI tool to generate your test automation framework within seconds. It's too fast!












If, it throws error like 'Tests are configured but cannot run in WebContainer. Please run locally.' 
when running your tests here on the browser, just download the project to your local desktop on your computer to run the tests locally.

Click on the Download button as shown below.







Downloaded successfully!

Open this project on your VS Code locally on your computer.


Run the command "npm install" to install the necessary npm packages to run your tests.

Change your package.json as shown below.

Change From :


Change TO: 


Add these 4 lines to your tsconfig.json file generated by this AI Tool as shown below.


Open "login.spec.js" test from your folder as shown below and add this line as highlighted.

This AI Agent also creates an awesome README.md file.


Open the playwright.config.js file and modify it as headless as false to run the test in Headed mode as shown below.

Run the test with the command "npm run test:one" on your terminal



Voila.......! The test ran successfully! 
 
I also pushed the code generated by this amazing AI Agent on to my GitHub. Please check the GitHub repo here: Playwright-with-AI

You can also deploy your code using this wonderful AI-powered tool.

I'm really blown away with this AI-powered agent. 
It is so amazing writing and generating code within seconds. It is too fast. 
It also generates code for developers on creating mobile and web apps. AI is definitely rocking and soon or later it dominates and competes the market over Google users for sure.

Happy AI Automation Testing Guys :) !

No comments:

Post a Comment

Robot Framework - Frontend Test Automation Framework generated by AI

  Robot Framework with Browser Library Web Test Automation Framework Developed With The Help Of AI Search Agent. In this article, we will di...