{"id":267,"date":"2018-08-30T10:49:42","date_gmt":"2018-08-30T10:49:42","guid":{"rendered":"http:\/\/loadfocus.com\/blog\/tech\/?p=267"},"modified":"2024-07-04T06:41:24","modified_gmt":"2024-07-04T06:41:24","slug":"end-to-end-testing-of-asos-com-using-testcafe-in-under-30-minutes","status":"publish","type":"post","link":"https:\/\/loadfocus.com\/blog\/tech\/2018\/08\/end-to-end-testing-of-asos-com-using-testcafe-in-under-30-minutes","title":{"rendered":"End to End Testing for Asos.com using TestCafe in Under 30 minutes"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span><!-- pn-tldr --><h2>Key takeaways<\/h2><ul><li>TestCafe needs no WebDriver, which is why a working suite is possible in half an hour.<\/li><li>Automatic waiting removes most of the sleep-based flakiness beginners hit first.<\/li><li>Use a public site to learn the framework, then point it at your own app.<\/li><\/ul><!-- \/pn-tldr -->\n<p class=\"lead\">In this article, we&#8217;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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why Use TestCafe for Running Tests?<\/h3>\n\n\n\n<p>For this tutorial, we&#8217;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:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Simplified Setup<\/strong>: TestCafe eliminates the need for WebDriver, avoiding compatibility issues between WebDriver and browser versions.<\/li><li><strong>Faster Execution<\/strong>: Tests run significantly faster compared to WebDriver-based tests.<\/li><li><strong>Clear Error Reporting<\/strong>: TestCafe provides precise error messages when a test fails, unlike WebDriver-based frameworks that often offer ambiguous error messages.<\/li><li><strong>Ease of Implementation<\/strong>: Once the initial setup is complete, implementing tests is straightforward, providing a high return on investment (ROI).<\/li><li><strong>JavaScript-Based<\/strong>: TestCafe uses JavaScript, making it accessible and easy to use for front-end developers.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">How to Create the Framework and Run Tests Against the E-Commerce Platform<\/h3>\n\n\n\n<p>The project for this demonstration is available at:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/loadfocusapp\/asos-testcafe-e2e\">ASOS TestCafe E2E Demo<\/a><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note<\/strong>: This is a demo project for learning purposes. We are not affiliated with, funded by, or associated with the ASOS brand.<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">Steps to Get Started<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Clone the Repository<\/strong>Open your terminal and run the following command to clone the repository: <code>git clone https:\/\/github.com\/loadfocusapp\/asos-testcafe-e2e<\/code><\/li><li><strong>Install Dependencies<\/strong>Navigate 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 <a href=\"https:\/\/www.npmjs.com\/get-npm\" class=\"broken_link\">here<\/a>. This demo uses Node v8.9.4 and npm v5.6.0.bashCopy code<code>npm install<\/code><\/li><li><strong>Run the Tests<\/strong>You can run the tests against different ASOS markets using the following commands: <code>ENV=AsosCom npm run e2e:firefox ENV=AsosDe npm run e2e:chrome ENV=AsosIt npm run e2e:safari <\/code>These commands will run the tests on the UK, DE, and IT versions of the ASOS website using Firefox, Chrome, and Safari respectively.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Need Help?<\/h3>\n\n\n\n<p>If you need assistance setting this up for your own web application, feel free to reach out.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">About LoadFocus<\/h3>\n\n\n\n<p>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&#8217;s and web services&#8217; performance, identifying potential bottlenecks before your customers do. Run a free website speed test today.<\/p>\n\n\n\n<p>LoadFocus also offers test automation services tailored to small and medium-sized businesses.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>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!<\/p>\n<!-- pn-faq --><h2>Frequently Asked Questions<\/h2><h3>Does TestCafe need WebDriver?<\/h3><p>No, and that is the main reason a working suite is possible in half an hour. There is no driver binary to match against your browser version, so the usual first day of setup problems disappears.<\/p><h3>How does TestCafe handle waiting?<\/h3><p>It waits automatically for elements and for page loads, which removes most of the sleep based flakiness beginners hit first. You still need explicit waits for genuinely asynchronous states, but not for ordinary navigation.<\/p><h3>Why test against a public site in a tutorial?<\/h3><p>Because it lets you learn the framework without also fighting your own environment, test data and logins. Once the mechanics are familiar, point the same project at your own application.<\/p><!-- \/pn-faq --><!-- pn-related-reading --><h2>Related reading<\/h2><ul><li><a href=\"https:\/\/loadfocus.com\/blog\/2019\/11\/using-testcafe-for-end-to-end-testing\">Using TestCafe for End to End Testing<\/a><\/li><li><a href=\"https:\/\/loadfocus.com\/blog\/2020\/04\/cypress-the-web-testing-framework-of-the-moment\">Cypress: The Web Testing Framework of the Moment<\/a><\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutes read<\/span><\/span>Key takeaways TestCafe needs no WebDriver, which is why a working suite is possible in half an hour. Automatic waiting removes most of the sleep-based flakiness beginners hit first. Use a public site to learn the framework, then point it at your own app. In this article, we&#8217;ll demonstrate how to create End-to-End (E2E) UI&#8230;  <a href=\"https:\/\/loadfocus.com\/blog\/tech\/2018\/08\/end-to-end-testing-of-asos-com-using-testcafe-in-under-30-minutes\" class=\"more-link\" title=\"Read End to End Testing for Asos.com using TestCafe in Under 30 minutes\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":494,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[52,51,53],"class_list":["post-267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ui-testing","tag-e2e-testing","tag-end-to-end-testing","tag-website-ui-testing"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/posts\/267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/comments?post=267"}],"version-history":[{"count":14,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/posts\/267\/revisions"}],"predecessor-version":[{"id":434,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/posts\/267\/revisions\/434"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/media\/494"}],"wp:attachment":[{"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/media?parent=267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/categories?post=267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/loadfocus.com\/blog\/tech\/wp-json\/wp\/v2\/tags?post=267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}