## podcast

To run cypress against QA you can run
```bash
CYPRESS_PASSWORD=pass CYPRESS_BASE_URL=https://podcast.qaorch.com/ yarn test:integration:open
```

### Setup

Make sure your yarn and node versions are up to date:

```bash
brew upgrade node
brew upgrade yarn
```

A grass token is needed to run the application. See how to obtain one for development [here](https://github.com/theorchard/ows-grass#session-token).

You will need to be able to access the QA microservices (i.e., be in the office, or on the VPN) for the grass token to be authenticated, and for the app to display anything.

To get the app running in development mode:

```bash
cp .env.shadow .env # initialize environment configuration
edit .env and add grass token, add poeditor project id, poeditor api token

yarn --frozen-lockfile # install all dependencies
yarn terms # download translation
yarn start:main # start dev server
```
Check with DevOps team that you have access to Orchard's aws secret manager service to have access to getSecretValue function and run the following command on root folder of the forked project.

yarn check:env

this will fetch the cypress.env.json file from secrets manager service (prod environment, region us_east-1)

These files will not be fetched from aws once downloaded unless forced. You can refresh them by running:

make refresh_secrets

if you are facing issues with aws credentials you should follow these instructions https://github.com/theorchard/collab/tree/master/jcarrion/aws-creds-generator to get the proper temporary creds

If you still cannot have access to secrets manager service you can always fill in the cypress.env.json.shadow file and remove the .shadow from the filename.

To see all available tasks, run `yarn run`.


### running cypress locally

In order to run cypress tests against local environment (frontend, graphql and ows-podcast) you need:

Get the ows-podcast microservice running locally [howto](https://github.com/theorchard/ows-podcast#locally)

Get graphql-product service running locally [howto](https://github.com/theorchard/graphql-product#running-locally):
You would need to point graphql-product to local ows-podcast in .env:
```bash
OWS_PODCAST_URL=http://localhost:YOUR_LOCAL_OWS_PODCAST_PORT/
ORCHARD_IDENTITY_ID=5dcc0fc1ec2f8b0e3cf67f48
```

Get frontend-podcast running locally (see description above), before setup variables in .env:
```bash
LOCAL_GRAPHQL_PORT=YOUR_LOCAL_GRAPHQL_PRODUCT_PORT
LOCAL_OWS_PODCAST_PORT=YOUR_LOCAL_OWS_PODCAST_PORT
USE_LOCAL_GRAPHQL=1
GRAPHQL_URL=/grass/graphql-router/graphql
LOCAL_ORCHARD_USER_ID='alw:1'
```

Run cypress tests
```bash
CYPRESS_PASSWORD=pass CYPRESS_BASE_URL=http://localhost:YOUR_FRONTEND_PODCAST_PORT/ yarn test:integration:open
```
