/
patient-conditions.js
40 lines (32 loc) · 1.13 KB
/
patient-conditions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Given } from "cypress-cucumber-preprocessor/steps";
let identifier = null;
let patient = null;
before({ tags: "@patient-conditions" }, () => {
cy.generateIdentifier().then((generatedIdentifier) => {
identifier = generatedIdentifier;
cy.createPatient(identifier).then((generatedPatient) => {
patient = generatedPatient;
});
});
});
Given("the user is logged in", () => {
cy.login();
});
Given("the user arrives on a patient’s summary page", () => {
cy.visit(`patient/${patient.uuid}/chart`);
});
When("the user clicks on Conditions tab", () => {
cy.contains("Conditions").click({ force: true });
});
Then("the empty Conditions page should display", () => {
cy.contains("There are no conditions to display for this patient");
});
When("the user record a condition", () => {
cy.contains("Record conditions").click({force:true});
cy.getByPlaceholder('Search conditions').type("HIV resulting");
cy.contains("HIV resulting in other conditions").click({force:true});
cy.get('button[type=submit]').click();
});
Then("the condition should record successfully", () => {
cy.contains("Condition saved");
});