Skip to content

Latest commit

 

History

History
86 lines (59 loc) · 2.74 KB

README.md

File metadata and controls

86 lines (59 loc) · 2.74 KB

router version @apollo/server version @apollo/client version

Client Router E2E Tests

Client Router E2E Tests

A series of E2E tests that run on push to the main branch of this repository and when PRs are opened against main.

For more information about the test suite, please see demo/README.md.

Running Apollo Router and Cypress tests locally

⚠️ NB: Docker Desktop must be installed and running.

After cloning this repository, first create a .env file inside of the scripts directory and add these two env vars (necessary for running the federated subscriptions tests):

APOLLO_KEY=...
APOLLO_GRAPH_REF=...

Then move into the demo web app's directory, install dependencies and run the router:

$ cd demo && npm i && npm run router:up

To run the tests in headful mode, run the following command:

$ npm run test:local

This will open the Cypress GUI which allows you to run the test suite and inspect the results.

To run the tests in headless mode, run:

$ npm run test

Finally, to stop running apollo-router:

$ npm run router:down

Running the graph locally with a local router

Sometimes testing against a specific branch of the router is necessary. Follow these instructions to run both subgraphs locally and point the router at our local subgraphs.

First, let's run the subgraphs with:

$ cd demo && npm run subgraphs:up:local

Then open scripts/supergraph.yaml and update the routing_url for both subgraphs:

federation_version: =2.6.1
subgraphs:
  products:
-    routing_url: http://products:4000/graphql
+    routing_url: http://localhost:4001/graphql
    schema:
      file: subgraphs/products/products.graphql
  users:
-    routing_url: http://users:4000/graphql
+    routing_url: http://localhost:4002/graphql
    schema:
      file: subgraphs/users/users.graphql

Finally, rebuild the supergraph schema by entering the scripts directory and running:

$ bash compose.sh

Now, inside your local copy of the router repository, checkout the branch you'd like to test and run (this command assumes router and client-router-e2e-tests are siblings):

$ APOLLO_KEY='...' APOLLO_GRAPH_REF='...' cargo run -- --supergraph ../client-router-e2e-tests/scripts/supergraph.graphql --config ../client-router-e2e-tests/scripts/router.yaml --h
ot-reload