Adaptation of the E2E Tests for a Big Project

Rate this content
Bookmark

DeliveryHero is a huge international company. And like in every big company, the introduction of a new technical improvement is a hot topic. Get to know the challenges our team faced while making our platform E2E tested, how our reporting mechanisms improved over time and solutions we developed to test different variations of a feature.

This talk has been presented at JSNation Live 2020, check out the latest edition of this JavaScript Conference.

FAQ

The purpose of implementing end-to-end tests at Delivery Hero is to improve the efficiency of testing large front-end projects, reduce the need for manual testing and debugging, and enhance the confidence and resilience during deployment of significant changes.

The end-to-end testing setup at Delivery Hero is structured in a separate repository, which simplifies running tests and onboarding developers. This setup was chosen during the migration from an old project to a monorepo with micro front-ends.

Delivery Hero uses a custom command that allows developers to test individual pages or features directly by marking and setting up necessary data in the browser's local storage, bypassing the need to navigate through the entire site flow.

Delivery Hero leverages browser cookies to manage different variations of a feature. They have a utility service that modifies feature flags based on cookies values, allowing them to test various feature configurations efficiently.

Future plans include moving end-to-end tests from being scheduled as cron jobs to integrating them into the CI/CD pipelines, and eventually incorporating these tests into the monorepo for the micro front-ends once migration is complete.

Delivery Hero follows several best practices in their end-to-end testing, including the use of Cypress for testing automation, incorporating accessibility principles into tests, and creating reusable Cypress commands for common actions.

The custom Slack integration developed by Delivery Hero allows team members to receive immediate test reports via Slack. These reports include stack traces, error details, and screenshots, making it easier to diagnose issues quickly.

Vadym Kukhtin
Vadym Kukhtin
Devesh Jadon
Devesh Jadon
8 min
18 Jun, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Delivery Hero has adapted its end-to-end testing to enhance resilience and calmness during big deployments. The end-to-end setup is housed in a separate repository and runs as a cron job. They use Cypress for testing automation and incorporate accessibility principles. Custom commands allow testing individual pages by setting up data in local storage, while cookies manage feature variations. Future plans include moving tests to a CI/CD pipeline and consolidating them in a monorepo. The project involves over 20 front-end developers and more than 50k lines of code. Immediate test reports are sent via custom Slack integration. The approach improves efficiency and reduces manual testing.

1. Introduction to End-to-End Testing and Setup

Short description:

Hi, I'm Vadim, a front-end engineer from Delivery Hero, and today with my colleague Devesh, I want to present you the adaptation of the end-to-end test we have done for our project. We thought it's a big improvement to introduce the end-to-end test to improve our resilience and calmness while deploying a big change. We have more than 20 front-end developers, do 10 pull requests daily, and our micro-front-end repo has more than 50k total lines of code without node modules. The end-to-end setup is a separate repo, and we run them as a cron job. We also use best practices from Cypress team and accessibility principles in the test. Now, I want to give over to Dinesh.

Hi, I'm Vadim, I'm a front-end engineer from Delivery Hero, and today with my colleague Devesh, I want to present you the adaptation of the end-to-end test which we have done for our project in Delivery Hero. The agenda for today would be the case study for the end-to-end tests, or why we are start doing that, the end-to-end test setup, and the best practices we use, then how to avoid repeating this cycle while developing tests, and how we are testing different variations of the feature.

So the case study for the end-to-end were pretty simple and common like for everyone, because Delivery Hero is a huge company with a huge front-end project, it takes a lot of time and effort to maintain and develop it, so we thought that it's a big improvement to the situation to introduce the end-to-end test so we don't need to do manually testing features every time or debug fixes, so we can improve our resilience and the calmness while deploying a big change. So just to have an overview of the scale, we have more than 20 front-end developers, we do the 10 pull requests daily, our micro-front-end repo has more than 50k total lines of code without node modules, and the monolith have the old monolith have the 200k total lines of code, so it's quite big.

The end-to-end setup we have is basically a separate repo, because we added the tests while we are migrating from the old project to the mono-repo with the micro-front-ends, and we have like simplicity of running the test in the separate repo so we can easily onboard developers. For now, we run them as a cron job, yeah, we know that it's not a standard, let's say, but we are working on the integration to the CICD pipelines, and we created our own custom Slack integration with Cypress. We know that there is an official plugin developed last week, but yeah, we still have our own for now. Yeah, you can see the example of what the Slack bot is a message with the report, and you can click on the report button and check this kind of report, which is very helpful because it shows like the stack trace, the error, exactly error, and the screenshot. We also, of course, are using some best practices from the Cypress team and some of our own, which is trying to use accessibility principles in the test created by Ken Dodds, which is the testing library creator. So instead of using data CI, which is a best practice from Cypress team, we can use the area labels and other accessibility attributes, which is very helpful and handy. We also, of course, use the Cypress commands for general helpers, like if something is used in separate specs, or more than two times, we just wrap it into the command and use it as a one-liner, which is simpler. As well, we are using like a given annotation, but not only as a structure for the test, but also, as a command, because as you see here in an example, it's very helpful, because even if you remove the whole code, you still have an idea of what the test is going to test, because sometimes the commands can be complicated.

And now, I want to give over for Dinesh, please. Thank you, Vadim. Hi, everyone. So, Vadim like told quite good scenarios like what are the best practices we are following. So, I'll be going like guiding you through about two particular things that we are doing at our end, like which really helps us achieve a test very quickly. So, this one particular thing is about like how to avoid repeating the cycle. So, I mean, most of the E2Es that you see nowadays it's like a single flow. First, the user I mean, first the E2E goes through the one page, then the second place, and the third place. So, it's a sequential manner. But considering we are the 20 plus dev team, as Vadym mentioned, and like different teams are working on different pages or different modules, we don't want to actually repeat the whole cycle during the development. Like, we want to test our features, we want to test only our only our page. So, this will be something like this, okay? Going from one page to the directly to our page. So, how are we actually achieving it? So, we actually created a utility service in our utilities. I mean, not the utility, but you can say a command that Vadym mentioned. We have custom command, which is about go to the page. So, what happens in this particular command? So, this this could be any page. Like, this could be a go to my page and then I can actually mark the previous data about all the pages which came before it, like all the data that they added to the browser, to the storage, everything will be marked here. And what I'll be doing after this, so I'll be using the, like, SIPLESS window.

2. Testing Different Versions of a Feature

Short description:

I'll be setting the local storage, all the data, then I'll perform the test related to my particular page. And if something is wrong, like during the marking of the data, I can just avoid doing the test and redirect to the default page. To test different versions of a feature on a page, we leverage cookies from the browser. We created a utility service that changes the values from the feature flag service and merges them with new values. After setting the key inside a cookie, we write the test. While we have good practices in place, there's always room for improvement. We plan to move away from the cron job and add E2E tests to a CICD pipeline. We will also consolidate the E2E tests in our monorepo for the micro front end. Join us at Delivery Hero.

I'll be setting the local storage, all the data, then I'll perform the test related to my particular page. And if something is wrong, like something is wrong during the marking of the data, I can just avoid doing the test and I can just redirect to the default page.

Now, what comes next is like, how are we actually testing the different versions of a feature. Suppose you are on a page, so you have your page, but now you want to test different versions of your feature on that particular page. So, what would you do? So, for this particular thing, we went to a simple solution, like, leverage the cookies from the browser. So, for that, we actually created a utility service in our app, which uses the cookies from the browser, and it actually changes the values, which are coming from the feature flag service, and it actually maps to, it merges with the new values. So, in this case, this utility service can be used to change the variation of the feature flag, and it looks something like this. So, in this case, you can see, like, we have the feature flags coming from the service, we have the flags from the cookies, we merge it, and we store it in memory cache.

And what happens after that? Okay. Our app is ready to handle it, handle the cookies. Now, we just need to actually set this particular key inside a cookie with the variations mentioned over here. So, as you can see in the test, so, test for feature flag variation, and I'll just set the cookie for those variations, and then, after that, I can just keep on writing my test. And so, as you see, like, we have a lot of good practices, and we have good things in place right now, but nobody's perfect, and there's always a room for improvement. So, a few things that we notice, and we have a plan for it. So, one thing is, like, moving away from the cron job and adding the E2E tests to a CICD pipeline. And the next thing is, like, as Vade mentioned, we have the E2E test in a separate repo. And we had the use case, because we have two different projects we are supporting. We are migrating from the monolith to a micro front end. So, once everything will be migrated to micro front end, we will be adding the E2E to our monorepo for the micro front end, and definitely, always keep improving. So, that's what we are doing. We'll keep improving the quality of our test. And last but not my least, please, please join us. We are looking for some developers like you, please join us at delivery hero. Thank you.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Today's Talk discusses the importance of managing technical debt through refactoring practices, prioritization, and planning. Successful refactoring requires establishing guidelines, maintaining an inventory, and implementing a process. Celebrating success and ensuring resilience are key to building a strong refactoring culture. Visibility, support, and transparent communication are crucial for addressing technical debt effectively. The team's responsibilities, operating style, and availability should be transparent to product managers.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.
Testing Web Applications with Playwright
TestJS Summit 2022TestJS Summit 2022
20 min
Testing Web Applications with Playwright
Top Content
Watch video: Testing Web Applications with Playwright
Testing web applications with Playwright, a reliable end-to-end testing tool. Playwright offers fast execution, powerful tooling, and support for multiple languages. It provides precise selectors, web-first assertions, and code generation for easy testing. Playwright also offers features like live debugging, tracing, and running tests on CI. The future of Playwright aims to make testing easy and fun, with a focus on creating frustration-free web experiences.
A Practical Guide for Migrating to Server Components
React Advanced 2023React Advanced 2023
28 min
A Practical Guide for Migrating to Server Components
Top Content
Watch video: A Practical Guide for Migrating to Server Components
React query version five is live and we'll be discussing the migration process to server components using Next.js and React Query. The process involves planning, preparing, and setting up server components, migrating pages, adding layouts, and moving components to the server. We'll also explore the benefits of server components such as reducing JavaScript shipping, enabling powerful caching, and leveraging the features of the app router. Additionally, we'll cover topics like handling authentication, rendering in server components, and the impact on server load and costs.
Power Fixing React Performance Woes
React Advanced 2023React Advanced 2023
22 min
Power Fixing React Performance Woes
Top Content
Watch video: Power Fixing React Performance Woes
This Talk discusses various strategies to improve React performance, including lazy loading iframes, analyzing and optimizing bundles, fixing barrel exports and tree shaking, removing dead code, and caching expensive computations. The speaker shares their experience in identifying and addressing performance issues in a real-world application. They also highlight the importance of regularly auditing webpack and bundle analyzers, using tools like Knip to find unused code, and contributing improvements to open source libraries.

Workshops on related topic

Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
WorkshopFree
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop
Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
Testing Web Applications Using Cypress
TestJS Summit - January, 2021TestJS Summit - January, 2021
173 min
Testing Web Applications Using Cypress
Top Content
WorkshopFree
Gleb Bahmutov
Gleb Bahmutov
This workshop will teach you the basics of writing useful end-to-end tests using Cypress Test Runner.
We will cover writing tests, covering every application feature, structuring tests, intercepting network requests, and setting up the backend data.
Anyone who knows JavaScript programming language and has NPM installed would be able to follow along.
Build a chat room with Appwrite and React
JSNation 2022JSNation 2022
41 min
Build a chat room with Appwrite and React
WorkshopFree
Wess Cope
Wess Cope
API's/Backends are difficult and we need websockets. You will be using VS Code as your editor, Parcel.js, Chakra-ui, React, React Icons, and Appwrite. By the end of this workshop, you will have the knowledge to build a real-time app using Appwrite and zero API development. Follow along and you'll have an awesome chat app to show off!
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
WorkshopFree
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.