graphql-engine/console/cypress
Gil Mizrahi f45c379866 add concurrent_bulk api for parallel processing of read-only queries
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7087
Co-authored-by: Tom Harding <6302310+i-am-tom@users.noreply.github.com>
Co-authored-by: Luca Restagno <59067245+lucarestagno@users.noreply.github.com>
GitOrigin-RevId: 0d7a212d004908bc014def9d3828647545c9e062
2022-12-05 13:50:19 +00:00
..
e2e add concurrent_bulk api for parallel processing of read-only queries 2022-12-05 13:50:19 +00:00
fixtures add console to graphql-engine 2018-06-28 10:27:37 +05:30
helpers console: Setup cypress on the Nx monorepo (close #5463) 2022-08-31 09:04:45 +00:00
support test: add snapshot check to action e2e test 2022-12-02 10:03:39 +00:00
.eslintrc console: revert improve data/relationships e2e tests 2021-05-12 07:37:45 +00:00
global.d.ts console: Add Sentry 2022-09-15 17:00:44 +00:00
README.md console: Refactoring the Mutation Actions-related E2E tests 2022-06-17 14:07:16 +00:00
tsconfig.json test(console): Skip a lot of flaky E2E tests 2022-08-31 08:02:51 +00:00

Test

Useful resources

Running all tests to generate coverage

  1. Set the TEST_MODE field in cypress.json to cli
  2. Run the command npm run test from the console directory to run all the tests.

Running tests individually

Tests are modularized into following modules:

  • API-Explorer
  • Data
    • Migration Mode
    • Create Table
    • Insert Browse
    • Modify Table
    • Table Relationships
    • Table and View Permissions
    • Views

To run the tests for the modules individually (say for create table),

  • Go to the cypress.json and set the env > TEST_MODE variable to ui.
{
  "env": {
    "TEST_MODE": "ui"
  }
}
  • Run the command npm run cy:open and click on create-table > test.js

Writing Tests

  • Read ups

    • If this is your first time with cypress, check out this getting started guide

    • Read cypress best practices

  • File Structure

    The top-level directories in console/cypress are auto-generated by cypress except helpers. To understand the use of each directory check out Folder Structure

    helpers directory is used for sharing reusable functions/constants across tests. Before adding a resubale function in this directory, consider if it will be better as a custom cypress command, if so, then add it to Support directory following this guide, preferrably to command.ts file.

  • Adding a Test

    Tests go to integration directory, where there are folders corresponding to Components in Services directory (The top-level routes on the console).

    Each of these folders contains different test folders, named after the particular feature they are testing. For example create-table folder tests the functionality of creating a table from the console UI.