-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues with vendor selector behavior (#4521)
- Loading branch information
Showing
7 changed files
with
232 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,42 +24,44 @@ describe("System management with Plus features", () => { | |
cy.intercept("GET", "/api/v1/system", { | ||
fixture: "systems/systems.json", | ||
}).as("getSystems"); | ||
cy.intercept({ method: "POST", url: "/api/v1/system*" }).as( | ||
"postDictSystem" | ||
); | ||
}); | ||
|
||
describe("vendor list", () => { | ||
beforeEach(() => { | ||
stubVendorList(); | ||
cy.visit(`${SYSTEM_ROUTE}/configure/demo_analytics_system`); | ||
cy.wait(["@getDictionaryEntries", "@getSystems", "@getSystem"]); | ||
cy.visit(`${ADD_SYSTEMS_MANUAL_ROUTE}`); | ||
cy.wait(["@getDictionaryEntries", "@getSystems"]); | ||
}); | ||
|
||
it("can display the vendor list dropdown", () => { | ||
cy.getSelectValueContainer("input-vendor_id"); | ||
cy.getSelectValueContainer("input-name"); | ||
}); | ||
|
||
it("contains type ahead dictionary entries", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("A"); | ||
cy.get("#react-select-select-vendor_id-option-0").contains("Aniview LTD"); | ||
cy.get("#react-select-select-vendor_id-option-1").contains( | ||
cy.getSelectValueContainer("input-name").type("A"); | ||
cy.get("#react-select-select-name-option-0").contains("Aniview LTD"); | ||
cy.get("#react-select-select-name-option-1").contains( | ||
"Anzu Virtual Reality LTD" | ||
); | ||
}); | ||
|
||
it("can reset suggestions by clearing vendor input", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("L{enter}"); | ||
cy.getSelectValueContainer("input-name").type("L{enter}"); | ||
cy.getByTestId("input-legal_name").should("have.value", "LINE"); | ||
cy.getSelectValueContainer("input-vendor_id") | ||
.siblings(".custom-select__indicators") | ||
.find(".custom-select__clear-indicator"); | ||
cy.getByTestId("clear-btn").click(); | ||
cy.getByTestId("input-legal_name").should("be.empty"); | ||
}); | ||
|
||
it("can't refresh suggestions immediately after populating", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("A{enter}"); | ||
cy.getSelectValueContainer("input-name").type("A{enter}"); | ||
cy.getByTestId("refresh-suggestions-btn").should("be.disabled"); | ||
}); | ||
|
||
it("can refresh suggestions when editing a saved system", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("A{enter}"); | ||
cy.getSelectValueContainer("input-name").type("A{enter}"); | ||
cy.fixture("systems/dictionary-system.json").then((dictSystem) => { | ||
cy.fixture("systems/system.json").then((origSystem) => { | ||
cy.intercept( | ||
|
@@ -75,11 +77,8 @@ describe("System management with Plus features", () => { | |
).as("getDictSystem"); | ||
}); | ||
}); | ||
cy.intercept({ method: "PUT", url: "/api/v1/system*" }).as( | ||
"putDictSystem" | ||
); | ||
cy.getByTestId("save-btn").click(); | ||
cy.wait("@putDictSystem"); | ||
cy.wait("@postDictSystem"); | ||
cy.wait("@getDictSystem"); | ||
cy.getByTestId("refresh-suggestions-btn").should("not.be.disabled"); | ||
}); | ||
|
@@ -88,7 +87,7 @@ describe("System management with Plus features", () => { | |
// the form to be mistakenly marked as dirty and the "unsaved changes" | ||
// modal to pop up incorrectly when switching tabs | ||
it("can switch between tabs after populating from dictionary", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("Anzu{enter}"); | ||
cy.getSelectValueContainer("input-name").type("Anzu{enter}"); | ||
// the form fetches the system again after saving, so update the intercept with dictionary values | ||
cy.fixture("systems/dictionary-system.json").then((dictSystem) => { | ||
cy.fixture("systems/system.json").then((origSystem) => { | ||
|
@@ -105,11 +104,8 @@ describe("System management with Plus features", () => { | |
).as("getDictSystem"); | ||
}); | ||
}); | ||
cy.intercept({ method: "PUT", url: "/api/v1/system*" }).as( | ||
"putDictSystem" | ||
); | ||
cy.getByTestId("save-btn").click(); | ||
cy.wait("@putDictSystem"); | ||
cy.wait("@postDictSystem"); | ||
cy.wait("@getDictSystem"); | ||
cy.getByTestId("input-dpo").should("have.value", "[email protected]"); | ||
cy.getByTestId("tab-Data uses").click(); | ||
|
@@ -119,15 +115,15 @@ describe("System management with Plus features", () => { | |
}); | ||
|
||
it("locks editing for a GVL vendor when TCF is enabled", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("Aniview{enter}"); | ||
cy.getSelectValueContainer("input-name").type("Aniview{enter}"); | ||
cy.getByTestId("locked-for-GVL-notice"); | ||
cy.getByTestId("input-description").should("be.disabled"); | ||
}); | ||
|
||
it("does not allow changes to data uses when locked", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("Aniview{enter}"); | ||
cy.getSelectValueContainer("input-name").type("Aniview{enter}"); | ||
cy.getByTestId("save-btn").click(); | ||
cy.wait(["@putSystem", "@getSystem", "@getSystems"]); | ||
cy.wait(["@postSystem", "@getSystem", "@getSystems"]); | ||
cy.getByTestId("tab-Data uses").click(); | ||
cy.getByTestId("add-btn").should("not.exist"); | ||
cy.getByTestId("delete-btn").should("not.exist"); | ||
|
@@ -136,7 +132,7 @@ describe("System management with Plus features", () => { | |
}); | ||
|
||
it("does not lock editing for a non-GVL vendor", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("L{enter}"); | ||
cy.getSelectValueContainer("input-name").type("L{enter}"); | ||
cy.getByTestId("locked-for-GVL-notice").should("not.exist"); | ||
cy.getByTestId("input-description").should("not.be.disabled"); | ||
}); | ||
|
@@ -156,9 +152,9 @@ describe("System management with Plus features", () => { | |
}); | ||
|
||
it("allows changes to data uses for non-GVL vendors", () => { | ||
cy.getSelectValueContainer("input-vendor_id").type("L{enter}"); | ||
cy.getSelectValueContainer("input-name").type("L{enter}"); | ||
cy.getByTestId("save-btn").click(); | ||
cy.wait(["@putSystem", "@getSystem", "@getSystems"]); | ||
cy.wait(["@postSystem", "@getSystem", "@getSystems"]); | ||
cy.getByTestId("tab-Data uses").click(); | ||
cy.getByTestId("add-btn"); | ||
cy.getByTestId("delete-btn"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.