feat(Cypress): Implemented test step GET Patient
This commit is contained in:
parent
7e88cf0482
commit
68acc2a949
@ -164,8 +164,11 @@ describe("it test the api", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("I fetch the CommunicationRequest after waiting 10sec for the IA to process it", () => {
|
it("I fetch the CommunicationRequest's PatientId after waiting 10 sec for the IA to process it", () => {
|
||||||
cy.wait(10000);
|
cy.wait(10000);
|
||||||
|
// avec cypress-recurse, on surveille jusqu'a ce que l'IA ai finit son traitement ; plutot que d'attendre un temps arbitraire.
|
||||||
|
// import { recurse } from 'cypress-recurse' // a placer en début de fichier.
|
||||||
|
// recurse(() => cy.request(...), (response) => { expect(response.body).to.have.property('status', 'suspended') } ).then((response) => {...})
|
||||||
cy.request({
|
cy.request({
|
||||||
url: `${apiUrl}/fhir/CommunicationRequest/${communicationRequestId}`,
|
url: `${apiUrl}/fhir/CommunicationRequest/${communicationRequestId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -181,7 +184,23 @@ describe("it test the api", () => {
|
|||||||
expect(response.body).to.have.property('subject');
|
expect(response.body).to.have.property('subject');
|
||||||
expect(response.body).to.have.property('recipient');
|
expect(response.body).to.have.property('recipient');
|
||||||
expect(response.body.subject).to.have.property('reference');
|
expect(response.body.subject).to.have.property('reference');
|
||||||
patientId = response.body.subject.reference;
|
let patient = response.body.subject.reference;
|
||||||
|
patientId = patient.split("/")[1];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("I get the Patient", () => {
|
||||||
|
cy.request({
|
||||||
|
url: `${apiUrl}/fhir/Patient/${patientId}`,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
authorization: `Bearer ${jsonWebToken}`
|
||||||
|
}
|
||||||
|
}).then((response) => {
|
||||||
|
expect(response.status).to.eq(200);
|
||||||
|
expect(response.headers["content-type"]).to.eq("application/fhir+json;charset=UTF-8");
|
||||||
|
expect(response.body).to.have.property("resourceType", "Patient");
|
||||||
|
expect(response.body).to.have.property('id', patientId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user