Claypot Store is a ecommerce website that provides clay based pots to the customers. It is basically a demo wordpress site that is integrated the woocommerce plugin, created to perform necessary automation testing using Playwright.
Visit Claypot Store:
Development and testing of Claypot Store (uses woocommerce plugin) are given below:
-
Install wordpress local from the website and create a local site named "ClaypotStore" in local app
- Start the site button, login to admin section of the site and Kiosko theme is selected for the ecommerce site
- Install woocommerce plugin
- Add features such as login,register,product search,product display,cart,checkout,header and footer,home pages are integrated into claypot store from the woocommerce plugin
- All the pages are customized and integrated all the necessary functionalities from woocommerce plugin before the testing phase
The claypot store is a wordpress site that uses woocommerce plugin. The online store consists of the following pages:
- Login Page
- Register Page
- Home Page
- Header & Footer
- Shop Page
- Product Display Page
- Cart Page
- Checkout Page
- Local WP application
- Website URL(Localhost): http://localhost:10016/
- Browser: Microsoft Edge
- Code Editor: VS Code
- Operating System: Windows 10
- Device: Desktop, Mobile(iPhone 15 Pro Max) and Tablet(iPad gen 7)
- Open Local WP application and start the site
- Go to Microsoft Edge and type the URL in the address bar:
http://localhost:10016/ - The site is hosted in localhost and then open playwright and start writing functional, API, end to end test scripts to test the application
- After completeing test scripts,tests are excuted in the terminal
- Functional Testing: Clay pot store homepage, login,register,cart,shop,search and product display and checkout page functionality have been tested individually.The below command is given to test a specific module
npx playwright test ***fileName*** --project=***Device option from config file*** --headed - API Testing: Restful APIs are included here and tested throughly. Mainly three kinds of API such as
- Customer API: Throgh this API, Customers data were viewed,created,updated and deleted through GET,POST,PUT/PATCH,DELETE http methods.
- Order API: Similar to Cutomer API but this API deals with the customer orders and these order data were viewed,created,updated and deleted through GET,POST,PUT/PATCH,DELETE http methods.
- Product API: Similar to order API but this API focuses on the Shop products data and product data were viewed,created,updated and deleted through GET,POST,PUT/PATCH,DELETE http methods.
- Smoke Testing:In all the necessary functionalities are included in smoke test file and to run the specific smoke test file below command is generated in the terminal
npx playwright test ***file_name*** --project=***Device option from config file*** --headed - Full Regression Testing:All the test script has been included in regression test suite where the test script are tagged in with regression test so by simply running the below command can enable the entire regression test
npx playwright test --grep @regression --project=***Device option from config file*** --headed - Compatibility Testing: Desktop, Mobile(iPhone 15 Pro Max) and Tablet(iPad gen 7) are used to test the compatibility of all the devices to view the Clay pot store website.
Device name and browser option must be included in the playwright config file before running the test
Below command is used to run the test file.npx playwright test ***fileName*** --project=***Device option from config file*** --headed - E2E (End to End) Testing: From Login to product checkout end to end testing scenario has been covered in this testing where user login to order placement and user log out all had been done sequentially to test the website for end to end scenario.
Woocommerce Rest API is included in the Claypot Store website.To test API,first
- Rest API needs to enabled in the Woocommerce settings option
- Create API key and pass the consumer key as username and consumer secret as password for Basic Authorization in the wordpress admin section.
- Username and Password were added in the playwright config file so user does not have to pass Basic auth in every test.
- Design and execute multple tests for customer,product and order APIs of Claypot Store web application
Rest API documentation was followed to view,add,update and delete ClaypotStore products,orders and customers information.The documentation follows:
Documentation: Woocommerce Rest API
The following table has the sample APIs that are used to perform multiple API operations.
| Descriptions | Http Methods | APIs |
|---|---|---|
| View All Customers | GET | http://localhost:10016/wp-json/wc/v3/customers |
| Update Customer | PUT | http://localhost:10016/wp-json/wc/v3/customers/:id |
| Create an Order | POST | http://localhost:10016/wp-json/wc/v3/orders |
| Delete a Order | DELETE | http://localhost:10016/wp-json/wc/v3/orders/:orderid?force=true |
| View Every Product | GET | http://localhost:10016/wp-json/wc/v3/products |
| View a Order | GET | http://localhost:10016/wp-json/wc/v3/orders/:orderid?force=true |
After all the testing, the ClayPot Store website is launched in live version.
After completeing all the tests on playwright,third party reporter such as Allure is used to generated the test reports.
- Step 1: Installed "allure-playwright" module and allure command line
- Step 2: Add allure-playwright reporter with the destination folder to store allure reports in the playwright config file
- Step 3:Run the test using the below command:
npx playwright test filename.spec.js - Step 4: Generated Allure Reports:
1) Run the below command in the command line:npx allure-commandline generate allure-results -o allure-report --clean
2) Open Allure Report:
Use the below command
npx allure-commandline open allure-report
Generated Allure Reports For:
- Each module functional test
- Smoke test
- Full regression test
- Compatibility test
- Complete end to end test
Allure Report: Open [ClaypotStore Allure Report.mhtml]("https://github.com/nolakkapali/Woocommerce-plugin-Test-Playwright-Javascript/blob/main/ClaypotStore%20Allure%20Report.mhtml")