Giter VIP home page Giter VIP logo

qa_starter's Introduction

DCARB Testing

This repository contains all of the code you need for testing the DCARB Project or DCARB at Cowlar. It consists of automated test cases code that executes End-to-End Testing using the Cypress Javascript Library.

DCARB Testing Cypress Screen

Setup

Make sure you've setup the project first. i.e the backend, frontend and devOps repos.
See Setting Up Project Locally

  1. Clone the repository

    Make sure to clone the repository in windows if you are using WSL (not inside WSL)

    git clone [email protected]:cowlar/dcarb/dcarb-testing.git
    
  2. Clone the submodule repository (You may need to request for access of [email protected]/cowlar/dcarb/dcarb-commons)

    cd dcarb-testing
    git submodule update --init
    
  3. Installing NPM libraries

    npm ci
    
  4. Obtain these env files from your team​ and place them in the root of the project:

    • cypress.env.json file

      {
        "ORGANIZATION_ID": "<ID of organisation>",
        "devUrl": "<Dev URL>",
        "API_URL": "<Backend API URL>",
      
        "DASHBOARD_LOGIN_CEO_USERNAME_1": "CEO Username",
        "DASHBOARD_LOGIN_CEO_PASSWORD": "CEO Password",
      
        "superAdminEmail": "Super Admin Email",
        "superAdminPassword": "Super Admin Password",
      
        "adminEmail": "Admin Email",
        "adminPassword": "Admin Password",
      
        "ceoEmail": "CEO Email",
        "ceoPassword": "CEO Password",
      
        "operatorEmail": "Operator Email",
        "operatorPassword": "Operator Password",
      
        "customerEmail": "Customer Email",
        "customerPassword": "Customer Password"
      }
    • and .env file

      TEST_ENVIRONMENT="<Environment>"
      STAGING_TICKET="<JIRA Ticket for Staging Test Results>"
      
      XRAY_CLOUD_JIRA_URL="https://<JIRA Poject URL>"
      XRAY_CLOUD_AUTH_URL="https://xray.cloud.getxray.app/api/v2/authenticate"
      XRAY_CLIENT_ID="<XRAY Client ID>"
      XRAY_CLIENT_SECRET="<XRAY Client Secret>"
      
      SLACK_WEBHOOK_INTERNAL="<Slack Incoming Webhook>"
      SLACK_ACCESS_TOKEN="xoxb-<Slack API Access Token>"
      SLACK_POST_MESSAGE_URL="https://slack.com/api/chat.postMessage"
      SLACK_CHANNEL_ID="<Slack Channel's ID, to post results to>"
  5. Open the Cypress tool

    npm run cy:dev
    

Creating Test Case Template

gen is a node script that creates template files, in their respective folders, with boilerplate code and file extension.
Flags starting with dashes i.e --fixture and --help , work when script is run as node scripts/template-gen.js, but not with npm run gen

Syntax

npm run gen <testCaseName> [fixture]

For example if you want to create files for DC-123_SomeTestCase test case
Run

npm run gen DC-123_SomeTestCase

Note that we've given no file extension above.

Running above command will ask you to:

  • Select the folder to put test case in.
  • Enter description of the test case.

After hitting enter it creates two files:

  • cypress/e2e/TestCases/<folder>/DC-123_SomeTestCase.cy.js
  • cypress/support/TestCases/<folder>/DC-123_SomeTestCase.js

ℹ️ If files exist already, it will skip those and won't overwrite them.

If fixture file is also needed, pass fixture flag at the end. i.e.

Run

npm run gen DC-123_SomeTestCase fixture

Now above command creates three files:

  • cypress/e2e/TestCases/<folder>/DC-123_SomeTestCase.cy.js
  • cypress/support/TestCases/<folder>/DC-123_SomeTestCase.js
  • cypress/fixtures/<folder>/DC-123_SomeTestCase.json

To show help

npm run gen help

Restoring Influx data and running the project locally

If you don't have Docker installed on your machine, See Installing Docker

  1. Obtain these env files from your team and place them in ./docker-compose/:

    • .env
    • backend.env
    • frontend.env
  2. Login to registery.github.com

    docker login registry.github.com

    It will ask for your github username and password/access token

  3. Change directory to ./docker-compose

    cd docker-compose
    
  4. Start the docker containers for the project in the background​ (on linux run it with sudo)

    docker compose up -d -V
  5. Open (InfluxDB) localhost:8086 and login using credentials in the provided .env file

  6. Obtain the InfluxDB API token from the InfluxDB dashboard and save it in the .env and backend.env files in ./docker-compose/ folder

  7. Run a command in InfluxDB container to load data

    docker exec  -it dcarb-influxdb2.local bash
    
  8. (In Linux) Get read/write access to ./docker-compose/backups folder. Run below command in ./docker-compose folder

    sudo chmod 777 ./backups
  9. Get the zip file for the backup from your team. Extract it in ./docker-compose/backups folder, then run following command in linux shell inside docker. Anything inside ./docker-compose/backups folder will become accessable inside the influx container

    influx restore /usr/backups/<backup folder> -t <influxdb_token>
    
  10. Open (Adminer) localhost:8085, login and directly import the backup files

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.