Giter Club home page Giter Club logo

with-detox-tests's Introduction

๐Ÿšจ Attention! ๐Ÿšจ

This repository is no longer maintained. We recommend that you refer to the following repository instead: https://github.com/yaron1m/expo-detox-typescript-example


Archived documentation

with-detox-tests

Demonstrates integration of the Detox gray box end-to-end testing library with Expo. Uses detox 9.0.6+, detox-expo-helpers and expo-detox-hooks.

Try it out

  1. Install dependencies (only follow Step 1 from this guide for now, the rest is already done in this project)
  2. Run ./setup.sh. This should grab the latest Expo app and place it inside bin/
  3. Start the packager: expo start (if you don't have expo installed, yarn global add expo).
  4. npm run e2e

with-detox-tests's People

Contributors

brentvatne avatar dependabot[bot] avatar ide avatar quinlanj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

with-detox-tests's Issues

Using Detox work with Expo Ejected App

I am trying to implement Detox for an Ejected Expo RN app.

Currently, I am failing at the last step, i.e while running the detox test.

Verisions Used:
React Native 0.59.8
Detox : 1.15.1
Expo Kit: 35

Error:

 ReferenceError: device is not defined
 ` describe("Example", () => {
      beforeEach(async () => {
      await device.reloadReactNative();
               ^
         });
      
       it("should have welcome screen", async () => {

      at Object._callee$ (firstTest.spec.js:5:11)
      at tryCatch (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:288:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:114:21)`

ReferenceError: element is not defined

`  6 |   });
       7 |
    >  8 |   it("should have welcome screen", async () => {
         |                                    ^
       9 |     await expect(element(by.id("welcome"))).toBeVisible();
      10 |   });
      11 |

      at Object._callee2$ (firstTest.spec.js:8:36)
      at tryCatch (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62:40)
      at Generator.invoke [as _invoke] (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:288:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:114:21)
      at tryCatch (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62:40)
      at invoke (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:152:20)
      at ../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:187:11
      at callInvokeWithMethodAndArg (../node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:186:16)`

Can you please let me know if we need to use detox expo helpers as we use with detox tests for Expo RN app.

unclear how to use this

Maybe it's because I have not running an Expo app in production yet, and only tried running from the expo app, but how do I do this?

This repo contains a bin//Exponent-1.19.0.app directory, where does that come from? Can I use e2e testing with the Expo app in the iOS emulator?

I hope someone can enlighten me.

Cannot find UI Element

I tried this example and got this error

Error: Error: Cannot find UI Element.
Exception with Assertion: {
  "Assertion Criteria" : "assertWithMatcher:matcherForSufficientlyVisible(>=0.750000)",
  "Element Matcher" : "(((respondsToSelector(accessibilityIdentifier) && accessibilityID('welcome')) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((respondsToSelector(accessibilityIdentifier) && accessibilityID('welcome')) && kindOfClass('RCTScrollView'))))))",
  "Recovery Suggestion" : "Check if the element exists in the UI hierarchy printed below. If it exists, adjust the matcher so that it accurately matches element."
}

Error Trace: [
  {
    "Description" : "Interaction cannot continue because the desired element was not found.",
    "Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Error Code" : "0",
    "File Name" : "GREYElementInteraction.m",
    "Function Name" : "-[GREYElementInteraction matchedElementsWithTimeout:error:]",
    "Line" : "124"
  }
]

This troubleshoot doesn't help

I also tried to upgrade all package, but got same error

  "dependencies": {
    "expo": "^24.0.2",
    "react": "16.2.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz"
  },
  "devDependencies": {
    "detox": "^6.0.4",
    "detox-expo-helpers": "^0.2.0",
    "mocha": "^4.1.0"
  },

Launching App

I have my e2e test structured just like your example here (only difference is I'm using my Exponent.app) but the issue I'm running into is when I run detox test it installs my app into the simulator & then gets into what looks like an infinite loop of attempting to relaunch the app.

System logs show: (UIKitApplication:com.vivintsolar.hea[0xb217][36260][36509]): Program specified by service does not contain any valid architectures for this system.

Any ideas or insight into why this might be or if I'm doing anything wrong?

package.json

"detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "bin/Exponent.app",
        "build": "",
        "type": "ios.simulator",
        "name": "iPhone 7"
      }
    }
  },

e2e/firstTest.spec.js

const { reloadApp } = require('detox-expo-helpers');

describe('Example', () => {
  beforeEach(async () => {
    await reloadApp();
  });

  it('should have welcome screen', async () => {
    await expect(element(by.label('Login'))).toBeVisible();
  });
});

e2e/init.js

require('babel-polyfill');
const detox = require('detox');
const config = require('../package.json').detox;

before(async () => {
  await detox.init(config);
});

after(async () => {
  await detox.cleanup();
});

versions

detox: 6.0.2
detox-expo-helpers: 0.2.0
expo: 23.0.0
node: 8.6.0

(This is a standalone app that's built with CRNA)

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.