Git Product home page Git Product logo

client-router-e2e-tests's Introduction

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

client-router-e2e-tests's People

Contributors

renovate[bot] avatar alessbell avatar dependabot[bot] avatar svc-secops avatar

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.