atlas-mock-proxy-server

2.11.2 • Public • Published

Atlas Mock Proxy Server

A Node.js based mock server for OTT services.

Starting

Make sure you have run yarn at the root of the repo to install node modules.

To start the server run:

yarn start

To start up the server in development mode run:

yarn dev

Visit http://localhost:5000/

Running Mock Proxy Server on HTTPS locally for on device automation tests

Full documentation can be found here

Adding mocks

You shouldn't need to add a new Koa route handler function for every mock that you add.

To add new mocks, add a route to routes/index.js. If you're adding mocks for ATOM, note that we use wildcard URLs to simplify things:

  1. Work out if you're adding a group, collection, slug, or any other ATOM node
  2. Add the fixture file to fixtures/pcms/<type>
  3. Update the corresponding index file with the partial URL
  '1a042ec6-ad93-11e6-b0fc-0f6df31ff06a': require('./ie/standalone-entertainment-asset-details'),

The route in routes/index.js that matches this is /v3/query/node/:node*.

Delaying the server to simulate a slow environment

MOCK_PROXY_DELAY=2000 yarn dev

Updating graphql mocks and schema

Whenever graphql is update we should be updating the mocks used. To do this we will need to run queries against a graphql server using to this mock proxy server as pcms, search and so on, and then update the mocks with the new responses. There is an automated way to do this:

  • start the mock proxy yarn start
  • run the yarn atlas-mock command on https://github.com/sky-uk/ott-graphql repo (updated master), this spins up a local apollo instance pointing to mock proxy at localhost:5000
  • run the command yarn update-graphql, this will update both the schema and the existing mocks automatically

Labels

Creating labels

yarn build-labels

This will take the label keys + values from each client's mock.jc.en.json, and produce an updated keys.csv. This keys.csv file lists the label key, what interpolations there are (if any), and if the label is plural. If a label is removed from a client's mock.jc.en.json it will be removed from keys.csv. These files get uploaded to ATOM for all PPTs on a master build, where we will then go in and update the values as necessary. concourse/pipeline/jobs/tasks/upload-label-keys.sh is the concourse job that uploads the CSV file to ATOM.

Updating labels - AppleTV (deprecated)

TERRITORY={territory} LANGUAGE={language} PROPOSITION={proposition} CLIENT={client} yarn update-labels

This will run a script over fixtures/pcms/labelling-feed/{client}/{proposition}.{territory}.{language}.json and create update-labels/Default-Messages.xlsx which can be uploaded from the deprecated-upload-labels job on Jenkins, or from upload-labels.sh.

Client specific labels

The values for client are WEB, TV or APPLETV. The labels are built for each of these clients and there are corresponding directories, for example fixtures/pcms/labelling-feed/tv. When editing labels or adding labels they should be done inside the correct client.

Readme

Keywords

none

Package Sidebar

Install

npm i atlas-mock-proxy-server

Weekly Downloads

1

Version

2.11.2

License

none

Unpacked Size

18.5 MB

Total Files

511

Last publish

Collaborators

  • nowtv