Skip to content

Commit

Permalink
Move api intercepts before page visits (#33951)
Browse files Browse the repository at this point in the history
* Move api intercepts before page visits

* Update another intercept
  • Loading branch information
acrollet authored Jan 7, 2025
1 parent 38e781c commit 4fb75bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class MedicationsSite {
this.mockVamcEhr();

if (isMedicationsUser) {
cy.login(mockUser);
// src/platform/testing/e2e/cypress/support/commands/login.js handles the next two lines
// window.localStorage.setItem('isLoggedIn', true);
// cy.intercept('GET', '/v0/user', mockUser).as('mockUser');

cy.intercept(
'GET',
'/my_health/v1/prescriptions?page=1&per_page=999',
prescriptions,
).as('prescriptions');
cy.intercept('GET', '/health-care/refill-track-prescriptions');

// src/platform/testing/e2e/cypress/support/commands/login.js handles the next two lines
// window.localStorage.setItem('isLoggedIn', true);
// cy.intercept('GET', '/v0/user', mockUser).as('mockUser');
cy.login(mockUser);
} else {
// cy.login();
window.localStorage.setItem('isLoggedIn', false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class MedicationsLandingPage {
};

visitLandingPageURL = () => {
cy.visit(medicationsUrls.MEDICATIONS_ABOUT);
cy.intercept('GET', Paths.LANDING_LIST, rxList);
cy.visit(medicationsUrls.MEDICATIONS_ABOUT);
};

verifyPrescriptionRefillRequestInformationAccordionDropDown = () => {
Expand Down Expand Up @@ -128,8 +128,8 @@ class MedicationsLandingPage {
};

visitLandingPageURLforEmptyMedicationsList = () => {
cy.visit(medicationsUrls.MEDICATIONS_ABOUT);
cy.intercept('GET', Paths.LANDING_LIST, emptyPrescriptionsList);
cy.visit(medicationsUrls.MEDICATIONS_ABOUT);
};

visitMedicationsListPage = prescriptionsList => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Paths } from '../utils/constants';

class MedicationsRefillPage {
loadRefillPage = prescriptions => {
cy.visit(medicationsUrls.MEDICATIONS_REFILL);
cy.intercept(
'GET',
'my_health/v1/prescriptions/list_refillable_prescriptions',
prescriptions,
).as('refillList');
cy.intercept('GET', '/my_health/v1/medical_records/allergies', allergies);
cy.visit(medicationsUrls.MEDICATIONS_REFILL);
};

loadRefillPageForApiCallFailure = () => {
Expand Down

0 comments on commit 4fb75bf

Please sign in to comment.