Skip to content

Demo of mobile test automation of react native app using the Detox Framework. It also has unit tests for mobile components, as well as API unit tests and test automation for the API server.

Notifications You must be signed in to change notification settings

WarleyLopes/QAEngineeringChallenge2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mobile Test Automation for React Native Project

This repository showcases mobile test automation for a React Native project using the Detox framework. It also includes unit tests for components in the mobile app, as well as unit tests and test automation for the API.

CI

Detox iOS Demonstration

Detox iOS Demonstration

Detox Android Demonstration

Detox Android Demonstration

Table of Contents

Introduction

In this repository, you will find a comprehensive set of tests for a React Native project. The tests cover both the mobile app and the API, ensuring the quality and reliability of the software.

Mobile Test Automation

The mobile test automation is implemented using the Detox framework. Detox provides a powerful and efficient way to write end-to-end tests in either JavaScript or TypeScript for React Native applications in order to run tests for both iOS and Android with the same code. The tests simulate user interactions and verify the expected behavior of the app.

To run the mobile test automation, follow these steps:

Make sure you have nvm installed.

  1. Clone the repository: git clone https://github.com/WarleyLopes/QAEngineeringChallenge2
  2. In a new terminal window, navigate to ./backend/
  3. Run nvm install
  4. Install the dependencies for the API with yarn install
  5. Start the API server with: yarn start
  6. In a new terminal window, navigate to ./native-app/
  7. Run nvm install
  8. Install dependencies: yarn install
  9. Run the build for iOS with: yarn detox:build:ios
  10. Run the tests for iOS with: yarn detox:test:ios
  11. For Android, make sure you have an android emulator in Android Studio named as Pixel_3a_API_31_x86_64
  12. Make sure the android emulator is created with the API_31 and x86_64 architecture
  13. Run the build for Android with: yarn detox:build:android
  14. Run the tests for Android with: yarn detox:test:android

Artifacts for the run will be generated in case of any failing tests inside the artifacts folder.

Mobile Components Unit Testing

These tests ensure that individual components of the app function correctly and meet the expected behavior. The unit tests are run using the Jest framework, which provides a simple and efficient way to write and run tests in JavaScript or TypeScript and automatically generate code coverage.

To run the unit tests for the mobile components, follow these steps:

Make sure you have nvm installed. And have node version >= 18 installed and being used through nvm.

  1. Clone the repository: git clone https://github.com/WarleyLopes/QAEngineeringChallenge2
  2. Navigate to ./native-app/
  3. Install dependencies: yarn install
  4. Run the tests with: yarn test

Tests for the API

In this section, you will find unit tests for the API and Test Automation using actual requests. These tests ensure that the API functions correctly and returns the expected results. The unit tests and the requests are also run using the Jest framework.

To run the tests for the API, follow these steps:

Make sure you have nvm installed. And have node version >= 18 installed and being used through nvm.

  1. Clone the repository: git clone https://github.com/WarleyLopes/QAEngineeringChallenge2
  2. Navigate to ./backend/
  3. Install dependencies: yarn install
  4. Run the server with: yarn start
  5. In a separated termina, run the tests with: yarn test

Pre-commit hooks

For both ./backend/ and ./native-app/ I also took the extra step of adding a pre-commit hook to run prettier, eslint, and jest automatically on before being able to complete a commit. This allows an automatic forced run of those in order to makee sure the coode is formatted according to the defined rules of the project, eslint will enforce code quality and style guidelines according to configurations too, and jest will run the unit tests. This ensures that the codebase remains consistent, maintainable, and free of common errors as long as the tests are comprehensive and extent enough.

About

Demo of mobile test automation of react native app using the Detox Framework. It also has unit tests for mobile components, as well as API unit tests and test automation for the API server.

Topics

Resources

Stars

Watchers

Forks

Languages

  • TypeScript 65.3%
  • Java 13.1%
  • JavaScript 13.0%
  • Ruby 4.5%
  • Objective-C 3.5%
  • Objective-C 0.4%
  • Other 0.2%