Skip to content

Commit

Permalink
Merge pull request #73 from kids-first/add-homepage-tests
Browse files Browse the repository at this point in the history
✅ Add Homepage tests
  • Loading branch information
abgeorge7 authored May 21, 2020
2 parents 9189ead + 9b6f42d commit b100edb
Show file tree
Hide file tree
Showing 16 changed files with 1,643 additions and 7 deletions.
24 changes: 21 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version: 2
version: 2.1
orbs:
cypress: cypress-io/cypress@1

jobs:
build:
docker:
Expand Down Expand Up @@ -27,8 +30,8 @@ jobs:
-t "kidsfirstdrc/kf-ui-fhir-data-dashboard:kidsfirst" .
fi
- run:
name: 'Push docker images'
command: |
name: 'Push docker images'
command: |
if [ $CIRCLE_BRANCH == 'master' ]; then
GIT_COMMIT=$(git rev-parse HEAD)
docker login -u $KF_DOCKER_HUB_USER -p $KF_DOCKER_HUB_PW
Expand All @@ -39,3 +42,18 @@ jobs:
docker push kidsfirstdrc/kf-ui-fhir-data-dashboard:kidsfirst
docker push kidsfirstdrc/kf-ui-fhir-data-dashboard:$GIT_COMMIT
fi
workflows:
build_and_test:
jobs:
- cypress/install:
build: 'npm run build'
- cypress/run:
requires:
- cypress/install
executor: cypress/browsers-chrome69
browser: chrome
start: 'npm start'
- build:
requires:
- cypress/run
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ npm start

This will open up the application at `localhost:3000`.
More on `create-react-app` [here](https://reactjs.org/docs/create-a-new-react-app.html).

### Tests

The dashboard uses [Cypress](https://www.cypress.io/) and the local development server to run frontend tests. To open Cypress, use the command:

`npm run cypress:open`

This will pull up an interactive window for running tests. You must also be running the dashboard locally at `http://localhost:3000` to run the tests. Click on any of the tests listed to execute them.
8 changes: 8 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"baseUrl": "http://localhost:3000",
"env": {
"REACT_APP_FHIR_API": "http://hapi.fhir.org/baseR4/"
},
"video": false,
"chromeWebSecurity": false
}
236 changes: 236 additions & 0 deletions cypress/fixtures/homepage/resources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"resourceType": "Bundle",
"id": "12345",
"meta": {
"lastUpdated": "2020-05-13T18:53:40.532+00:00"
},
"type": "searchset",
"total": 8,
"link": [
{
"relation": "self",
"url": "http://hapi.fhir.org/baseR4/StructureDefinition"
}
],
"entry": [
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestPatient",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestPatient",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestPatient",
"name": "TestPatient",
"status": "draft",
"description": "TestPatient",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Patient"
}
],
"type": "Patient",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Patient",
"snapshot": {
"element": []
}
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestSpecimen",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestSpecimen",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestSpecimen",
"name": "TestSpecimen",
"status": "draft",
"description": "TestSpecimen",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Specimen"
}
],
"type": "Specimen",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Specimen"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestGroup",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestGroup",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestGroup",
"name": "TestGroup",
"status": "draft",
"description": "TestGroup",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Group"
}
],
"type": "Group",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Group"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestCondition",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestCondition",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestCondition",
"name": "TestCondition",
"status": "draft",
"description": "TestCondition",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Condition"
}
],
"type": "Condition",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Condition"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestObservation",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestObservation",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestObservation",
"name": "TestObservation",
"status": "draft",
"description": "TestObservation",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Observation"
}
],
"type": "Observation",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestPractitioner",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestPractitioner",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestPractitioner",
"name": "TestPractitioner",
"status": "draft",
"description": "TestPractitioner",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Practitioner"
}
],
"type": "Practitioner",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Practitioner"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestEncounter",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestEncounter",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestEncounter",
"name": "TestEncounter",
"status": "draft",
"description": "TestEncounter",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Encounter"
}
],
"type": "Encounter",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Encounter"
}
},
{
"fullUrl": "http://hapi.fhir.org/baseR4/StructureDefinition/TestTask",
"resource": {
"resourceType": "StructureDefinition",
"id": "TestTask",
"meta": {
"versionId": "1",
"lastUpdated": "2019-09-19T09:05:12.803+00:00",
"source": "#5ac66523eb8d3133"
},
"url": "http://hapi.fhir.org/baseR4/StructureDefinition/TestTask",
"name": "TestTask",
"status": "draft",
"description": "TestTask",
"fhirVersion": "4.0.0",
"kind": "complex-type",
"abstract": false,
"context": [
{
"type": "element",
"expression": "Task"
}
],
"type": "Task",
"baseDefinition": "http://hl7.org/fhir/StructureDefinition/Task"
}
}
]
}
Loading

0 comments on commit b100edb

Please sign in to comment.