Giter Site home page Giter Site logo

todo-detox-e2e's Introduction

Todo - Detox E2E

  • Example test end to end of React native project with Detox

Quick start

  • Clone: https://github.com/nhanhuynh-agilityio/todo-detox-e2e.git

  • Installing dependencies:

    cd todo-detox-e2e && yarn

  • Configuration ios device and android adv to run E2E(.detoxrc.json)

    • iOS: Updating the name of device at: device.type
    • Android: Updating the name of adv at: device.avdName
  • Building and running E2E

    • Android: yarn build:e2e-android & yarn test:e2e-android
    • iOS: yarn build:e2e-ios & yarn test:e2e-ios

Notes configuration Detox on new project(Only Android)

  • Installing detox cli and package

    • npm install -g detox-cli
    • yarn add detox -D
  • Editing android/build.gradle

    • Editing minSdkVersion & Add the following line kotlinVersion

      ext {
          ...
          minSdkVersion = 18
          kotlinVersion = "1.3.41"
      }
      
    • Add the following line in dependencies

          ...
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
      
    • Add the following lines in allprojects.repositories

          ...
          maven {
              url "$rootDir/../node_modules/detox/Detox-android"
          }
      
  • Editing: android/app/build.gradle

    • Add the following line android.defaultConfig

          ...
          testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
      
    • Add the following line in android.buildTypes.release

          ...
          // Detox-specific additions to pro-guard
          proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
      
    • Add the following line in dependencies

          ...
          androidTestImplementation('com.wix:detox:+')
      
  • Creating DetoxTest.java

    • Add the file android/app/src/androidTest/java/com/[package]/DetoxTest.java

    • Content of DetoxTest.java

      package com.[package];
      import androidx.test.ext.junit.runners.AndroidJUnit4;
      import androidx.test.filters.LargeTest;
      import androidx.test.rule.ActivityTestRule;
      import com.wix.detox.Detox;
      import com.wix.detox.config.DetoxConfig;
      import org.junit.Rule;
      import org.junit.Test;
      import org.junit.runner.RunWith;
      
      @RunWith(AndroidJUnit4.class)
      @LargeTest
      public class DetoxTest {
          @Rule
          public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(
              MainActivity.class,
              false,
              false
          );
      
          @Test
          public void runDetoxTests() {
              DetoxConfig detoxConfig = new DetoxConfig();
              detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
              detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
              detoxConfig.rnContextLoadTimeoutSec =
              (com.[package].BuildConfig.DEBUG ? 180 : 60);
      
              Detox.runTests(mActivityRule, detoxConfig);
          }
      }
      

Docs Reference

todo-detox-e2e's People

Watchers

 avatar

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.