Code Monkey home page Code Monkey logo

e2e-tests's Introduction

License

Repository with E2E tests for Summer.fi DeFi web application

  1. Introduction
  2. Installation
  3. Environment variables
  4. Browsers
  5. Running the tests
  6. Test reports
  7. Tags
  8. Projects
  9. License

1. Introduction

This repository contains a repository of tests for the e2e testing of the Summer.fi DeFi web application.

There are two main categories of e2e tests:

  • No wallet: Tests without a wallet connected.
  • With wallet: Tests with a wallet connected (Metamask) and, in most of the cases, with a Tenderly fork.

The tests and framework have been written using Playwright and Typescript.

  • The 'No wallet' tests use Playwright only.
  • The 'With wallet' tests use Playwright, Synpress (for Metamask wallet) and Tenderly APIs (for forks).

2. Installation

First, install the programs required to run the application:

Next, clone this repository:

git clone https://github.com/OasisDEX/e2e-tests.git

Go to the repo directory and install the dependencies:

yarn install

3. Environment variables

To run the tests locally you will need to create a .env file. You can create a copy from .env.example file by running:

cp .env.example .env

There aren't any mandatory environment variables for no wallet tests.

The following environment variables are mandatory for with wallet tests:

Variable Description
TENDERLY_PROJECT Your project in Tenderly. Or create a new one.
TENDERLY_USER Your user in Tenderly. Or create a new one.
TENDERLY_ACCESS_KEY Your access key in Tenderly. Create one if you don't have any.

You can also use these other environment variables:

Variable Default Description
BASE_URL This is the base url used to run the tests. As per .env.example file. If you don't set this variable the tests will run with https://staging.summer.fi as base url
FULLY_PARALLEL false Playwright Test runs tests in parallel. In order to achieve that, it runs several worker processes that run at the same time. By default, test files are run in parallel. However, tests in a single file are run in order, in the same worker process. You can configure entire test run to concurrently execute all tests in all files using this option. Note that with wallet tests can run only serial mode, so this variable will be applied only to no wallet tests.
WORKERS 1 Number of workers used to run the tests. To run the tests in pralallel you need to use more than 1 workers. Note that with wallet tests can run only with 1 worker, so this variable will be applied only to no wallet tests.
TIMEOUT 30000 Timeout for each test in milliseconds. Note that some timeouts have been defined in ./utils/config.ts file, so this TIMEOUT variable might not have any effect in some cases.
RETRIES 2 The maximum number of retry attempts given to failed tests. By default failing tests are not retried.
HEADLESS true Whether to run browser in headless mode. Note that with wallet tests can run only in headed mode, so this variable will be applied only to no wallet tests.
FLAGS '' You can pass one or more flags to enable hidden features in staging and dev environments. To pass more than one flag separate them with an empty space: 'flag1:true flag2:false'

4. Browsers

For now the tests have been setup so that they run only on desktop Chrome.

5. Running the tests

Note that in oder to considerably reduce the test execution time, several scripts have been created so that with wallet tests can be run in parallel jobs (docker containers) in GitHub actions.

  1. Create .env file.

  2. For running with wallet tests, set TENDERLY_PROJECT, TENDERLY_USER and TENDERLY_ACCESS_KEY variables in .env file.

  3. Run tests by running, for example:

  • Run all tests: yarn test:e2e
  • Run all regression tests: yarn test:e2e:regression
  • Run no wallet tests: yarn no-wallet
  • Run no wallet regression tests: yarn no-wallet:regression
  • Run with wallet tests: yarn with-wallet:all
  • Run with wallet regression tests: yarn with-wallet:all:regression

Check all the scripts in package.json file

6. Test reports

The test reports for the test runs executed in gitHub can be found in https://github.com/OasisDEX/e2e-tests/actions.

  1. Click on the test run you wish to see the report for.
  2. Scroll down to the Artifacts section and click on the report name you wish to download.
  3. Unzip the report file you just downloaded and double click on the index.html file to open the report in the browser.

After running one or more tests locally you can run the following commands to open test reports in the browser:

  • yarn test:report:no-wallet
  • yarn test:report:with-wallet:aave:ethereum
  • yarn test:report:with-wallet:aave:other
  • yarn test:report:with-wallet:maker-and-spark

7. Tags

Tests can be tagged so that we can run only the tests that have the certain tag. At the moment we are using the following tags:

  • @regression: Add this tag to all the tests that should be part of the regression test suite.

8. Projects

A project is a logical group of tests running with the same configuration. For now we are using projects so that we can achieve the two following goals:

  • Applying different configuration to no wallet and with wallet tests.
  • Splitting with wallet tests so that they can run in parallel containers, and so reducing significantly the test execution time.

At the moment we are using the following projects:

  • no-wallet
  • with-wallet-aave-other'
  • with-wallet-aave-ethereum
  • with-wallet-maker-and-spark

9. License

Copyright (C) 2021 Oazo Apps Limited, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

e2e-tests's People

Contributors

juan-langa avatar marcinciarka avatar dependabot[bot] avatar

Watchers

 avatar Andrei David avatar Roberto Cano avatar  avatar James Tuckett avatar Halaprix avatar Huiyu Yang avatar Damian Paszkowski avatar  avatar

Forkers

juan-langa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.