In this article, we’ll demonstrate how to create End-to-End (E2E) UI tests for the e-commerce platform ASOS across three of their markets (UK, IT, DE) in less than 30 minutes.
Why Use TestCafe for Running Tests?
For this tutorial, we’ll be using the TestCafe framework. TestCafe is an open-source framework that evolved from a commercial product, offering several advantages over WebDriver-based frameworks:
Are Your APIs as Reliable as You Think?
Don’t let hidden issues disrupt your service. With LoadFocus’s advanced API Monitoring, catch problems before they impact your users. Ensure flawless performance and avoid costly outages—monitor, test, and optimize your APIs effortlessly.
- Simplified Setup: TestCafe eliminates the need for WebDriver, avoiding compatibility issues between WebDriver and browser versions.
- Faster Execution: Tests run significantly faster compared to WebDriver-based tests.
- Clear Error Reporting: TestCafe provides precise error messages when a test fails, unlike WebDriver-based frameworks that often offer ambiguous error messages.
- Ease of Implementation: Once the initial setup is complete, implementing tests is straightforward, providing a high return on investment (ROI).
- JavaScript-Based: TestCafe uses JavaScript, making it accessible and easy to use for front-end developers.
How to Create the Framework and Run Tests Against the E-Commerce Platform
The project for this demonstration is available at:
Note: This is a demo project for learning purposes. We are not affiliated with, funded by, or associated with the ASOS brand.
Steps to Get Started
- Clone the RepositoryOpen your terminal and run the following command to clone the repository:
git clone https://github.com/loadfocusapp/asos-testcafe-e2e
- Install DependenciesNavigate to the directory where you cloned the repository and install the necessary dependencies. Ensure you have Node.js and npm installed on your machine. You can find instructions to install npm here. This demo uses Node v8.9.4 and npm v5.6.0.bashCopy code
npm install
- Run the TestsYou can run the tests against different ASOS markets using the following commands:
ENV=AsosCom npm run e2e:firefox ENV=AsosDe npm run e2e:chrome ENV=AsosIt npm run e2e:safari
These commands will run the tests on the UK, DE, and IT versions of the ASOS website using Firefox, Chrome, and Safari respectively.
Need Help?
If you need assistance setting this up for your own web application, feel free to reach out.
Think your website can handle a traffic spike?
Fair enough, but why leave it to chance? Uncover your website’s true limits with LoadFocus’s cloud-based Load Testing for Web Apps, Websites, and APIs. Avoid the risk of costly downtimes and missed opportunities—find out before your users do!
About LoadFocus
LoadFocus is an easy-to-use cloud testing tool that requires no setup and runs directly from your browser. It helps you understand your website’s and web services’ performance, identifying potential bottlenecks before your customers do. Run a free website speed test today.
LoadFocus also offers test automation services tailored to small and medium-sized businesses.
By following this guide, you should be able to set up and run E2E tests for the ASOS e-commerce platform in multiple markets quickly and efficiently using TestCafe. Happy testing!