# E2E Test Automation Docs

Euro-wallet have two major environment, the Staging and Prod. The automated test was derived from staging environment.

* **Setup Wallet test automation environment**

  Prerequeset:

  * VSCode
  * Node v14.15.4
  * git

  For wallet local environment

  * amazon cli
  * Docker
  * kind

  Installation:

  #### Windows OS

  Install VScode by downloading the .exe file from this link:

  ```jsx
   [<https://code.visualstudio.com/download>](<https://code.visualstudio.com/download>)
  ```

  This installation is pretty straight forward and interactive since it was in .exe file. Then add extensions to VScode that are helpfull during the scripting. Those are as follows:

  ```jsx
  - Bracket Pair Colorizer
  - Color Highlight
  - Cucumber (Gherking) Full support
  - Gherkin indent
  - Prettier - Code formatter
  ```

  It should look like this:

  ![](https://2808248181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8eU2eqBm5NpK3wHDjfNO%2Fuploads%2FyKkvtQbkZp4yLxUTo0bw%2Fimage.png?alt=media\&token=beb36ad4-c483-48c8-bd7a-8373728ddbea)

  Next was to install the node v14.15.4 by the exe file downloaded in this link:

  ```jsx
  <https://nodejs.org/es/blog/release/v14.15.4/>
  ```

  Choose the 64 bit installer:

![](https://2808248181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8eU2eqBm5NpK3wHDjfNO%2Fuploads%2FOXYfbdRx7eU6EmT18MO1%2Fimage.png?alt=media\&token=630e3f69-fdf3-4699-bb89-ddb6af286bfc)

Once downloaded, run the exe file and set everything as default.

To determine if node is installed execute the following command at the terminal

```jsx
node -v
npm -v
```

node -v will return the version of node. Please see screenshot below.

![](https://2808248181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8eU2eqBm5NpK3wHDjfNO%2Fuploads%2F7oYCHBCKb25aYc8FQ7hy%2Fimage.png?alt=media\&token=6c774d4b-8cdd-4515-970b-76c460b1f383)

Next was to install the git. Download its installer right here:<https://git-scm.com/download/win>

Download the 64 bit version exe file and once completes, install the application setting everything as default. To verfiy that git is installed, run the command `git - -version` . The command are expecting to return git version.

![](https://2808248181-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8eU2eqBm5NpK3wHDjfNO%2Fuploads%2FXN7Z3NDVdW3PgQB3zVEs%2Fimage.png?alt=media\&token=55b45dbb-c1d9-4893-a6d7-9fb7e05b0139)

Docker, aws cli and kind are to be installed later.

### Get started

We can’t pull the repository for wallet automation if we’re not given an access. Please request an access to the repo from Dev Ops team. Repository name: [**onewallet.test.automation**](https://github.com/new-future-holdings/onewallet.test.automation)

When access to the Repo is given, we can now clone it. But first we must create a directory to put cypress test files. At the VScode, open the directory that was created earlier. Then open the terminal and we now can start cloning. Clone the repo ‣ executing this command

```jsx
git clone <https://github.com/new-future-holdings/onewallet.test.automation.git>
```

Enter your user name and password once it ask for you github credentials.

\**Note: We can’t access the repo if not authorized from devOps*

Repo clone succeeds when the terminal does’nt gave an error message

Cloning repo requires github credentials. Enter your allowed credential the when the terminal ask for it. Usualy it started by asking username then after is the password.

* **Wallet site test**

  Wallet site are intended for customers to access and play product games. This is where customers mostly interact to the application.

  The site test can be found at `cypress/integration/site`

  What test are covered from the existing end to end test

  1. Signup feature

  ```gherkin
  Scenario: Guest user can signup to wallet Site
  Scenario: Validation error prompts in the first page sign-up when invalid data is entered during signup
  Scenario Outline: Validation error prompts in the second page of sign-up when invalid data is entered during signup
  Scenario Outline: Validation error prompts in the third page when invalid data in the username is entered during signup
  Scenario Outline: Validation error prompts in the third page when invalid data in the password is entered during signup
  Scenario Outline: Validation error prompts in the third page when invalid data in the Confirm password is entered during signup
  Scenario: Validation error prompts from Username, Password , Confirm password , Terms and Conditions fields
  ```

  1. Guest landing page

  ```gherkin
  Scenario: Complete Header navbar are available for Guest users
  Examples:
  	       |no. |headersList          | 
           |2   |Slot                 |
           |3   |Sports Casino        |
  ```

  1. Member Login

  ```gherkin
  Scenario: Member can login to wallet site page
  ```

  1. Member Account balance

  ```gherkin
  Scenario: Member balance are shown in the transaction balance
  Scenario Outline: Member can open deposit form from clicking <label> <type>
  Scenario Outline: Member can view betting history of Sports betting history
  Scenario Outline: Member can view betting history from Games history tab
  Scenario Outline: Member can view Transaction history
  Scenario: Member can view Bunos
  Scenario: Member can view Account Verification
  Scenario: Member can view Personnal info
  Scenario: Member can view Messages
  Scenario: Member can view responsible contents
  Scenario Outline: Member can view responsible contents
  ```

  1. Member Deposit

  ```gherkin
  Scenario: Member can open deposit form from Account Deposit list
  Scenario: Member can open deposit form from navbar Deposit button
  Scenario: Member can proceed to deposit credit card form
  Scenario: Member can deposit to his account
  ```

  1. Feature: Member password validation

  ```gherkin
  Scenario: Eerror message show up when incorrect Old Password is entered
  Scenario: Error message show up in all of the fields when no data is entered
  Scenario: Fields should only accepts password with atleast three of special characters, lowercase and uppercase letters, numerical digits and with the length atleast 8 - 20
  ```

  1. Reality Checked

  ```gherkin
  Scenario Outline: Member can set to <elapsedTime> elapsed time
  Examples:
              |elapsedTime  |
              |15 mins      |
              |30 mins      |
              |45 mins      |
              |60 mins      |
  Scenario: Member cannot set to 45 mins elapsed time
  ```

  1. Responsible Gaming

  ```gherkin
  Scenario: Member can set timeout to his account
  Scenario: Member can set Self Exclusion to his account
  Scenario: member can set Account Closure to his account
  Scenario Outline: Member can set limitation
  ```

  1. Feature: Member Account verification validation

  ```gherkin
  Scenario Outline: Member can upload file <file>
  Scenario: Uploaded file is shown in the Account verification
  ```

  1. Feature: Member Account verification

  ```gherkin
  Scenario: Member can select type of document to be uploaded
  ```

  1. Feature: Registered user Withdraw form

  ```gherkin
  Scenario: Member can open Withdraw form
  Scenario: Member can withdraw balance
  ```

  1. Feature: Change password

  ```gherkin
  Scenario: Member can change his Account
  ```

  1. Feature: Landing page for Member

  ```gherkin
  Scenario Outline: Header navbar <list> are available for Member
  Scenario Outline: Member is redrected to <pageUrl> when clicking nav button <page>
  Scenario: Member can see List of Promo
  Scenario Outline: Member can see Promo details of <promo> by clicking Read More
  ```

  #### Run Site wallet test

  Base URL was setted to wallet site so we can run all of the above test but entering the command:

  ```gherkin
  npx cypress run
  ```

  or for with browser

  ```gherkin
  npx cypress open
  ```

  These are the global environment used for site test: `/cypress.json`

  ```gherkin
  "env" : {
  "siteStagingAuthURL": "[<https://api-authentication-staging.aonewallet.com/authenticate?ttl=1d>](<https://api-authentication-staging.aonewallet.com/authenticate?ttl=1d>)",
  "siteProdAuthURL": "[<https://api-authentication.nexiux.io/authenticate?ttl=90d>](<https://api-authentication.nexiux.io/authenticate?ttl=90d>)",
  "site": "[<https://api-site-staging.aonewallet.com/graphql>](<https://api-site-staging.aonewallet.com/graphql>)",
  }
  ```

  Also to prevent flake test, retries was setted upto 3 time when it fails.

  Default timeout as setted to 30 sec.
* **Wallet BO test**
* **Updating data from cypress environment variables**

  Update member for used to Site.

  * wallet site test use 3 member accounts. The keys are as follows.

  ```jsx
  "authtrans" : "Basic dHJhbnNhY3Q6cGFzc3dvcmQ=",
  "authtest" : "Basic cmVzdHRlc3Q6cGFzc3dvcmQ=",
  "authreset" : "Basic YXV0b3Jlc2V0OnBhc3N3b3Jk",
  ```

  **Note**: *authtrans is for deposit and withdrawal transactions*, *authreset is account for password reseting, authtest is for the rest of site test.*

  Value was encoded in a base 64. *Ex: for member resttest with accoiunt password of “password”. base 64 equivalient could be `cmVzdHRlc3Q6cGFzc3dvcmQ=`*

  <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/5303f992-cc0e-4e65-a22b-e610a3f80bb5/Untitled.png" alt="Untitled" data-size="original">

  Use the tool<https://www.base64encode.org/> to do base 64 encode and Decode

  Once new member is encoded, replaced either of the three key values appending “Basis”.

  Replacing *`authtrans`* values required a member to have a balance atleast $5000. This only application for stagin and not on Prod.
* **Definition of Terms**

  #### Custom commands `cypress/support/commands.ts`

  | methods                  | Functionalities                                                | Parameters                                           |
  | ------------------------ | -------------------------------------------------------------- | ---------------------------------------------------- |
  | setAdminCode             | Setup sre admin code from UI                                   | code                                                 |
  | siteLogin                | to send api login request                                      | auth, code, authURL, env                             |
  | checkDetails             | Site check member details                                      | dataTable                                            |
  | navTo                    | Site navigate from sign up pages                               | num                                                  |
  | passwordReset            | api request Resets password to its default \<password>         | access, code, site                                   |
  | deleteMemberDocs         | api request to delete existing verification docs               | deleteQuery, access, code, site                      |
  | checkMemberDocs          | api request to check if the verification docs exist            | access, code, site                                   |
  | fileList                 | checked file list if exist in the members verification page    | dataTable                                            |
  | signupFirstPage          | site signup first page filling out of the fields               | dataTable                                            |
  | signupSecondPage         | site signup second page filling out of the fields              | dataTable                                            |
  | signupLastPage           | site signup third page filling out of the fields               | dataTable                                            |
  | createMember             | site api request to create a member                            | code                                                 |
  | createOperator           | bo create an operator                                          | dataTable                                            |
  | editOperator             | bo edit operator                                               | dataTable                                            |
  | deleteOperator           | bo deletion of operator                                        |                                                      |
  | createPermission         | bo create permission                                           | name                                                 |
  | editPermission           | bo edit permission                                             |                                                      |
  | deletePermission         | bo delete permission                                           |                                                      |
  | editMember               | bo edit member                                                 |                                                      |
  | deleteDeposits           | bo api request deletion of deposit thru createManualAdjustment | access, site, amount, accountID                      |
  | memberDeposit            | bo api request deposit thru DEPOSIT type                       | access, site, amount                                 |
  | createMemberMarker       | bo api request creating of member marker                       | access, site, markerName, status                     |
  | deleteMemberMarker       | bo api request of deleting member level                        | access, site, markerID                               |
  | searchMember             | bo member marker search Member                                 | member                                               |
  | updateConfigToDefault    | bo api request update member management config to default      | access, site                                         |
  | updateConfig             | bo api request to update config from member Profile settings   | access, site, RealNameVerfication, GenderVerfication |
  | boLogin                  | bo api request to login and generate Access token              | auth, authURL                                        |
  | createAffiliateProgramme | bo api request to create Affiliate program                     | access, site                                         |
  | submitAffiliateProgramme | bo api request to submit Affiliate program                     | access, site, queryString                            |
  | updateAffiliate          | bo api request to update Affiliate program                     | access, site, queryString                            |
  | checkMemberBalance       | bo api request to checked member balance                       | access, site, memberAccount                          |
  | checkMemberLabel         | bo api request to checked member label                         | access, site, labelName                              |
  | deleteMemberLabel        | bo api request to delete member label                          | access, site, labelID                                |
  | createMemberLabel        | bo api request to create member label                          | access, site, labelName                              |
  | resetMemberLevelDefault  | bo api request to reset member label to its default            | access, site                                         |
  | filterMemberMarker       | bo api request to filter member marker                         | access, site, markerName                             |
  | deactivateMemberMarker   | bo api request to deactivate member marker                     | access, site, markerID                               |
  | queryPaymentMethod       | bo api request to query member existing paymentMethod          | access, site, paymentMethodName                      |
  | deletePaymentMethod      | bo api request to delete member paymentMethod                  | access, site, paymentMethodID                        |
  | paymentMethodStatus      | bo api request to check member paymentMethod status            | access, site, paymentMethodID, status                |
  | createPaymentMethod      | bo api request to check create paymentMethod                   | access, site, status                                 |
  | queryWithdrawalMethod    | bo api request to query withdrawal Method                      | access, site, withdrawalMethodName                   |
  | deleteWithdrawalMethod   | bo api request to delete withdrawal Method                     | access, site, withdrawalMethodID                     |
  | withdrawalMethodStatus   | bo api request to update withdrawal Method status              | access, site, withdrawalMethodID, status             |
  | createWithdrawalMethod   | bo api request to create withdrawal Method                     | dataTable                                            |
  | createPromoCategory      | bo api request to create promo Category                        | access, site, categoryName                           |
  | queryPromoCategories     | bo api request to search existing promo Category               | access, site                                         |
  | deletePromoCategory      | bo api request to delete promo Category                        | access, site, categoryID                             |
  | queryPromo               | bo api request to search existing promo                        | access, site                                         |
  | updatePromo              | bo api request to update existing promo                        | access, site, promoID, status                        |
  | deletePromo              | bo api request to delete existing promo                        | access, site, promoID                                |
  | createDraftPromo         | bo api request to create a draft promo                         | access, site, promoName, categoryID                  |
  | submitPromo              | bo api request to submit a draft promo                         | access, site, promoID                                |
  | createPromoLabel         | bo api request to create a promo label                         | access, site, promoLabelName, labelColor             |
  | updatePromoLabel         | bo api request to update a promo label                         | access, site, promoLabelName, labelColor, id         |
  | deletePromoLabel         | bo api request to delete a promo label                         | access, site, id                                     |
  | queryPromoLabel          | bo api request to search existing promo label                  | access, site                                         |
  | createVIP                | bo api request to create a VIP                                 | access, site, vipName                                |
  | publishedVIP             | bo api request to published a draft VIP                        | access, site, vipID                                  |
  | activateVIP              | bo api request to activate created VIP                         | access, site, vipID                                  |
  | deactivateVIP            | bo api request to deactive a VIP                               | access, site, vipID                                  |
  | queryVIP                 | bo api request to search existing VIP                          | access, site, vipName                                |
  | deleteVIP                | bo api request to delete a VIP                                 | access, site, vipName                                |
  | queryGameCategories      | bo api request to search game categories                       | access, site, vendorCatName                          |
  | createGameCategory       | bo api request to create game categories                       | access, site, vendorCatName                          |
  | deleteGameCategory       | bo api request to delete existing game categories              | access, site, id                                     |
  | updateGameCategory       | bo api request to update existing game categories              | access, site, gameCategoryID                         |
  | updateVendor             | bo api request to update existing Vendors                      | access, site, gameCategoryID                         |
  | updateGeoFenceConfig     | bo api request to update GeoFence configuration                | access, site                                         |
  | setFraudCheck            | bo api request to check Fraud status                           | access, site, status                                 |
  | sessionManagement        | bo api request to update session Management                    | access, site, status                                 |
  | updateAutomatedMessage   | bo api request to update automated message                     | access, site, id, status                             |
  | editAutomatedMessage     | bo api request to edit automated message                       | access, site, id, title, content                     |
  | resetPassword            | bo api request to reset BO account password                    | access, site                                         |
* **Circle CI config**

  The configuration below shows that the CI test will only run for Staging BO and site.

  ```jsx
  version: 2.1
  orbs:
    continuation: circleci/continuation@0.2.0
    cypress: cypress-io/cypress@1.28.0

  executors:
    default_container:
      docker:
        - image: 'cypress/browsers:node14.17.0-chrome88-ff89'
      resource_class: medium+
      environment:
        CYPRESS_RECORD_KEY: 485e8b4b-562d-4b7f-8edf-ddaaa9b1f759
        GITHUB_TOKEN: 8gnw5u

  commands:
    report-coverage:
      description: Store coverage report.
      steps:
        - store_artifacts:
            path: mochawesome-report
        - store_artifacts:
            path: cypress/videos
        - store_artifacts:
            path: cypress/screenshots

  cypress-workflow: &cypress-workflow
    jobs:
      - cypress/install:
          name: 'Setup'
          executor: default_container
          post-steps:
            - run:
                name: Print machine info ℹ️
                command: npx cypress info
            - run:
                name: Lint Files
                command: npm run lint

      # test
      - cypress/run:
          name: 'E2E Tests - Chrome'
          browser: chrome
          spec: cypress/integration/site/**
          executor: default_container
          record: true
          parallel: false
          timeout: 30m
          ci-build-id: ${CIRCLE_SHA1:0:8}
          group: 'UI - Chrome Test'
          requires:
            - Setup
          post-steps:
            - report-coverage

      # prod test
      # - cypress/run:
      #     name: 'E2E Prod Tests - Chrome'
      #     browser: chrome
      #     spec: cypress/integration/prod/**
      #     executor: default_container
      #     wait-on: '<https://betvision.nexiux.io>'
      #     record: true
      #     config: 'baseUrl=https://betvision.nexiux.io'
      #     parallel: false
      #     timeout: 30m
      #     ci-build-id: ${CIRCLE_SHA1:0:8}
      #     group: 'UI - Chrome Prod Test'
      #     requires:
      #       - Setup
      #     post-steps:
      #       - report-coverage

      # bo test
      - cypress/run:
          name: 'E2E Back Office Tests - Chrome'
          browser: chrome
          spec: cypress/integration/back-office-C8/**
          executor: default_container
          wait-on: '<http://admin-staging.aonewallet.com>'
          record: true
          config: 'baseUrl=http://admin-staging.aonewallet.com'
          parallel: false
          timeout: 30m
          ci-build-id: ${CIRCLE_SHA1:0:8}
          group: 'UI - Chrome BO Test'
          requires:
            - Setup
          post-steps:
            - report-coverage

      # bo test
      # - cypress/run:
      #     name: 'Prod E2E Back Office Tests - Chrome'
      #     browser: chrome
      #     spec: cypress/integration/back-office-Prod/**
      #     executor: default_container
      #     wait-on: '<https://admin.nexiux.io/signin>'
      #     record: true
      #     config: 'baseUrl=https://admin.nexiux.io/signin'
      #     parallel: false
      #     timeout: 30m
      #     ci-build-id: ${CIRCLE_SHA1:0:8}
      #     group: 'UI - Chrome Prod BO Test'
      #     requires:
      #       - Setup
      #     post-steps:
      #       - report-coverage

  workflows:
    E2E:
      <<: *cypress-workflow

    'E2E Testing Scheduled':
      triggers:
        - schedule:
            cron: '0 22 * * 1-5'
            filters:
              branches:
                only:
                  - master

      <<: *cypress-workflow
  ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hov-qa.gitbook.io/hov-qa-engineers/projects/wallet/e2e-test-automation-docs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
