Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

fylein/fyle-qbo-app-2

Repository files navigation

Fyle QBO App

Frontend Repository for Fyle <> Quickbooks Online Integration

Documentation

Please refer this link to find the documentation of the project.

Local development setup

Setup - 1 (Recommended)

Follow instructions mentioned in Integrations Central

Setup - 2

  • Install dependencies

    npm install
  • Copy environment.json from integrations-central/ and add it to src/environments

    cp ../fyle-integrations-central/app-secrets/qbo-app-2/environment.json src/environments/environment.json
  • Run app

    npm start

Running End to End Tests on local

Setup Org to test

Note: All the steps mentioned in this section are one time activity

  • It would be very easy if we use this org for running tests since we have pre populated data in Fyle to run tests

    Email: ashwin.t@fyle.in | Org Name: Fyle For QBO Angular Tests - Github Action
    
    Email: admin1@fyleformicro.testing | Org Name: Fyle For netsuiteMicroActiontesting
    
  • Login to this org on local once and complete QBO OAuth connection (Connect to Sandbox Company_US_2 company in QBO)

  • Update values for these variables in e2e_tests key in environment.json (present in src/environments) - (Copy all these values from local storage) Note: Copy refresh_token from user key in local storage

        "workspace_id": "",
        "refresh_token": "",
        "org_id": ""
    
  • Create an sql function to partially setup an org to run tests -

    # bash into database
    \i ../fyle-qbo-api/sql/functions/e2e-test-setup-workspace-local.sql;
  • Partially reset the org using the sql script we created -

    select reset_workspace_e2e(<workspace_id_goes_here>);

Helper commands

  • Make sure the app and api is up and running

  • To open Cypress UI and run end to end test spec wise, use this command -

    npm run cypress_open 

    Note: Running this command will decrease the code coverage since we run 1 test at a time

  • To run all end to end tests and update code coverage, use this command -

    npm run cypress_run

    Note: Running this command will update the code coverage This step is highly recommended when you write a new end to end test

  • To reset the org to initial data, use the reset_workspace_e2e() sql function and re run tests

Bonus points

  • Add new test for new feature in micro action
  • Before running Journey test, do reset the db for the org, using reset_workspace_e2e()

End to End Tests on Github

  • End to End tests runs on all PRs, after the PR is approved. Only if all tests pass, contributor will be able to merge it to master. This happens against the staging environment. We'll receive a comment in the PR about the run status and code coverage summary.
  • End to End tests against production environment will run every Tuesday and Thursday at 2pm.
  • Manually if we wanted to trigger end to end tests, we can make use of manual github action and run it against Staging/Production environment with the specified branch and click on Run Workflow button.
  • Once the tests are completed, we'll receive a message on slack with the summary and screen recordings incase the test fails.
  • Consider the following scenario for example -
    • Developer raised a PR -> reviewer approved it -> e2e failed -> dev fixed the broken test
    • Now, to trigger the action, the developer should manually trigger the github action by creating a label named run e2e tests in the PR.
    • Dev will be able to un label and label them multiple times to trigger e2e tests. Note: Labels can be found in the right side section where Reviewer, Assignee are maintained

For more detailed notes, please to check the Notion doc about End to End Tests on QBO App