diff --git a/.eslintrc b/.eslintrc index 0c57feb..d47034a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,10 @@ "ecmaVersion": "latest", "sourceType": "module" }, + "rules": { + "no-use-before-define": "off", + "no-unused-vars": "off" + }, "overrides": [ { "files": "**/*.ts", diff --git a/cypress/e2e/augury.cy.ts b/cypress/e2e/augury.cy.ts index b68cd68..cd7cef8 100644 --- a/cypress/e2e/augury.cy.ts +++ b/cypress/e2e/augury.cy.ts @@ -1,3 +1,5 @@ +/* global JQuery */ + describe("Augury", () => { beforeEach(() => { cy.login(Cypress.env("TEST_PRX_USER"), Cypress.env("TEST_PRX_PASS")); @@ -81,4 +83,71 @@ describe("Augury", () => { // cy.contains("button.btn-danger", "Delete Creative").click(); // cy.contains("Creative deleted"); }); + + it("checks inventory availability", () => { + cy.visit("/availability"); + + // Functions to be implemented + cy.getStartDateInput().type("2024-07-01"); + cy.getEndDateInput().type("2024-07-31"); + cy.selectSlimSelect("#inventory_id", "Acceptance Test Series"); + cy.contains("House Preroll"); + cy.selectSlimSelect("#zone", "House Preroll"); + + cy.getAvailabilityResults().should("be.visible"); + cy.getAvailabilityResults().contains("Calculate"); + cy.getAvailabilityResults().click(); + + // page should container "Forecasted Inventory" + cy.contains("Forecasted Inventory"); + }); + + it("generates a campaign report", () => { + cy.visit("/reports"); + cy.contains("Navigate to different types of reports across Dovetail"); + + cy.get("#campaign_id + .ss-main").click(); // Open the dropdown + cy.contains("Search"); + + // The dropdown is disconnected/supra of the #campaign_id element + cy.get(".ss-open-below .ss-search input[type=search]").click({ multiple: true }); + cy.get(".ss-open-below .ss-search input[type=search]").type("C"); + + cy.contains("Campaign Acceptance Test"); + cy.get(".ss-open-below .ss-search input[type=search]").type("{downArrow}{enter}"); + cy.get("#campaign_id").closest(".card").find(".btn").click(); + + cy.contains("Report Builder"); + }); +}); + +declare namespace Cypress { + interface Chainable { + getStartDateInput(): Chainable>; + getEndDateInput(): Chainable>; + getInventoryTypeSelect(): Chainable>; + getAvailabilityResults(): Chainable>; + selectSlimSelect(selector: string, value: string): Chainable>; + } +} + +// Custom commands that can be chained +Cypress.Commands.add("getStartDateInput", () => { + return cy.get("input#start_date"); +}); + +Cypress.Commands.add("getEndDateInput", () => { + return cy.get("input#end_date"); +}); + +Cypress.Commands.add("getInventoryTypeSelect", () => {}); + +Cypress.Commands.add("selectSlimSelect", (selector, value) => { + cy.get(`${selector} + .ss-main`).click(); // Open the dropdown + cy.contains(value); // Confirm the option is present + cy.get(".ss-option").contains(value).click({ force: true }); // Select the option +}); + +Cypress.Commands.add("getAvailabilityResults", () => { + cy.get('form.button_to button[type="submit"]'); });