Skip to content

Commit

Permalink
Update cypress fixtures (#1022)
Browse files Browse the repository at this point in the history
* Update fixtures

* Update tests based on updated fixtures
  • Loading branch information
allisonking authored Aug 26, 2022
1 parent 72642cf commit 1d7b896
Show file tree
Hide file tree
Showing 8 changed files with 479 additions and 530 deletions.
82 changes: 32 additions & 50 deletions clients/ctl/admin-ui/cypress/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("Dataset", () => {
);
cy.getByTestId("input-data_qualifier").should("contain", "Identified");
cy.getByTestId("selected-categories").children().should("have.length", 1);
cy.getByTestId("taxonomy-entity-user.derived.identifiable.unique_id");
cy.getByTestId("taxonomy-entity-user.unique_id");
});

it("Can render an edit form for a dataset collection with existing values", () => {
Expand Down Expand Up @@ -434,21 +434,11 @@ describe("Dataset", () => {
"have.attr",
"data-checked"
);
const ancestors = [
"User Data",
"Derived Data",
"Derived User Identifiable Data",
];
ancestors.forEach((a) => {
cy.get(`[data-testid='checkbox-${a}'] > span`).should(
"have.attr",
"data-indeterminate"
);
});
cy.getByTestId("selected-categories").should(
"contain",
"user.derived.identifiable.unique_id"
cy.get(`[data-testid='checkbox-User Data'] > span`).should(
"have.attr",
"data-indeterminate"
);
cy.getByTestId("selected-categories").should("contain", "user.unique_id");
});

it("Can deselect data categories", () => {
Expand Down Expand Up @@ -479,24 +469,18 @@ describe("Dataset", () => {
cy.getByTestId("field-row-uuid").click();
cy.getByTestId("data-category-dropdown").click();
cy.getByTestId("checkbox-Telemetry Data").click();
cy.getByTestId("checkbox-Account Data").click();
cy.getByTestId("checkbox-System Data").click();
cy.getByTestId("data-category-done-btn").click();
cy.getByTestId("selected-categories").should(
"contain",
"user.derived.identifiable.unique_id"
);
cy.getByTestId("selected-categories").should(
"contain",
"user.derived.identifiable.telemetry"
);
cy.getByTestId("selected-categories").should("contain", "account");
cy.getByTestId("selected-categories").should("contain", "user.unique_id");
cy.getByTestId("selected-categories").should("contain", "user.telemetry");
cy.getByTestId("selected-categories").should("contain", "system");
cy.getByTestId("save-btn").click({ force: true });
cy.wait("@putDataset").then((interception) => {
const { body } = interception.request;
expect(body.collections[0].fields[5].data_categories).to.eql([
"user.derived.identifiable.unique_id",
"user.derived.identifiable.telemetry",
"account",
"user.unique_id",
"user.telemetry",
"system",
]);
});
});
Expand All @@ -505,40 +489,41 @@ describe("Dataset", () => {
cy.visit("/dataset/demo_users");
cy.getByTestId("field-row-uuid").click();
cy.getByTestId("data-category-dropdown").click();
// expand account data
cy.getByTestId("expand-Account Data").click();
// expand system data
cy.getByTestId("expand-System Data").click();
// select 1/2 children
cy.getByTestId("checkbox-Account Contact Data").click();
cy.get("[data-testid='checkbox-Account Contact Data'] > span").should(
cy.getByTestId("checkbox-Authentication Data").click();
cy.get("[data-testid='checkbox-Authentication Data'] > span").should(
"have.attr",
"data-checked"
);
// parent should be indeterminate since not all children are checked
cy.get("[data-testid='checkbox-Account Data'] > span").should(
cy.get("[data-testid='checkbox-System Data'] > span").should(
"have.attr",
"data-indeterminate"
);
// now select all children
cy.getByTestId("checkbox-Payment Data").click();
cy.getByTestId("checkbox-Operations Data").click();
// parent should be checked since all children are checked
cy.get("[data-testid='checkbox-Account Data'] > span").should(
cy.get("[data-testid='checkbox-System Data'] > span").should(
"have.attr",
"data-checked"
);
// the children's children should be disabled and checked since the parent is selected
cy.get("[data-testid='checkbox-Account City'] > span").should(
// the children of selected parents should be disabled
cy.getByTestId("checkbox-Credentials").click();
cy.get("[data-testid='checkbox-Password'] > span").should(
"have.attr",
"data-checked"
);
cy.get("[data-testid='checkbox-Account City'] > span").should(
cy.get("[data-testid='checkbox-Biometric Credentials'] > span").should(
"have.attr",
"data-disabled"
);
cy.getByTestId("data-category-done-btn").click();
const expectedSelected = [
"account.contact",
"account.payment",
"user.derived.identifiable.unique_id",
"system.authentication",
"system.operations",
"user.credentials",
];
expectedSelected.forEach((e) => {
cy.getByTestId("selected-categories").should("contain", e);
Expand All @@ -549,27 +534,24 @@ describe("Dataset", () => {
cy.visit("/dataset/demo_users");
cy.getByTestId("field-row-uuid").click();
cy.getByTestId("data-category-dropdown").click();
cy.getByTestId("checkbox-Account Data").click();
cy.get("[data-testid='checkbox-Account Data'] > span").should(
cy.getByTestId("checkbox-System Data").click();
cy.get("[data-testid='checkbox-System Data'] > span").should(
"have.attr",
"data-checked"
);
cy.getByTestId("data-category-done-btn").click();
cy.getByTestId("selected-categories").should(
"contain",
"user.derived.identifiable.unique_id"
);
cy.getByTestId("selected-categories").should("contain", "account");
cy.getByTestId("selected-categories").should("contain", "user.unique_id");
cy.getByTestId("selected-categories").should("contain", "system");
cy.getByTestId("data-category-dropdown").click();
cy.getByTestId("data-category-clear-btn").click();
cy.get("[data-testid='checkbox-Account Data'] > span").should(
cy.get("[data-testid='checkbox-System Data'] > span").should(
"not.have.attr",
"data-checked"
);
cy.getByTestId("data-category-done-btn").click();
cy.getByTestId("selected-categories").should(
"not.contain",
"user.derived.identifiable.unique_id"
"user.unique_id"
);
});
});
Expand Down
35 changes: 15 additions & 20 deletions clients/ctl/admin-ui/cypress/e2e/taxonomy.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,15 @@ describe("Taxonomy management page", () => {

it("Can open up accordion to see taxonomy entities", () => {
// should only see the 3 root level taxonomy
cy.getByTestId("accordion-item-Account Data").should("be.visible");
cy.getByTestId("accordion-item-System Data").should("be.visible");
cy.getByTestId("accordion-item-User Data").should("be.visible");
cy.getByTestId("accordion-item-Payment Data").should("not.be.visible");

// clicking should open up accordions to render more items visible
cy.getByTestId("accordion-item-Account Data").click();
cy.getByTestId("accordion-item-Payment Data").should("be.visible");
cy.getByTestId("accordion-item-Payment Data").click();
cy.getByTestId("item-Account Payment Financial Account Number").should(
"be.visible"
);
cy.getByTestId("accordion-item-User Data").click();
cy.getByTestId("accordion-item-Credentials").should("be.visible");
cy.getByTestId("accordion-item-Credentials").click();
cy.getByTestId("item-Password").should("be.visible");
});

it("Can render accordion elements on flat structures", () => {
Expand All @@ -63,7 +60,7 @@ describe("Taxonomy management page", () => {

it("Can render action buttons on hover", () => {
cy.getByTestId("action-btns").should("not.exist");
cy.getByTestId("accordion-item-Account Data").trigger("mouseover");
cy.getByTestId("accordion-item-System Data").trigger("mouseover");
cy.getByTestId("action-btns").should("exist");
});
});
Expand Down Expand Up @@ -99,9 +96,9 @@ describe("Taxonomy management page", () => {
const expectedTabValues = [
{
tab: "Data Categories",
name: "Account Data",
key: "account",
description: "Data related to a system account.",
name: "System Data",
key: "system",
description: "Data unique to, and under control of the system.",
parentKey: "",
isParent: true,
request: "@putDataCategory",
Expand Down Expand Up @@ -173,15 +170,13 @@ describe("Taxonomy management page", () => {

it("Can render the parent field", () => {
cy.getByTestId("tab-Data Categories").click();
cy.getByTestId(`accordion-item-Account Data`).click();
cy.getByTestId("accordion-item-Payment Data").click();
cy.getByTestId("item-Account Payment Financial Account Number").trigger(
"mouseover"
);
cy.getByTestId(`accordion-item-User Data`).click();
cy.getByTestId("accordion-item-Credentials").click();
cy.getByTestId("item-Password").trigger("mouseover");
cy.getByTestId("edit-btn").click();
cy.getByTestId("input-parent_key").should(
"have.value",
"account.payment"
"user.credentials"
);
});

Expand Down Expand Up @@ -220,7 +215,7 @@ describe("Taxonomy management page", () => {
name: "Provide the capability",
description:
"Provide, give, or make available the product, service, application or system.",
is_default: false,
is_default: true,
parent_key: null,
legal_basis: "Legitimate Interests",
special_category: "Vital Interests",
Expand Down Expand Up @@ -273,7 +268,7 @@ describe("Taxonomy management page", () => {
description:
"An individual registered to voter with a state or authority.",
fides_key: "citizen_voter",
is_default: false,
is_default: true,
name: "foo",
rights: {
values: rightValues,
Expand All @@ -298,7 +293,7 @@ describe("Taxonomy management page", () => {
}).as("putDataCategoryError");

cy.getByTestId(`tab-Data Categories`).click();
cy.getByTestId("accordion-item-Account Data").trigger("mouseover");
cy.getByTestId("accordion-item-System Data").trigger("mouseover");
cy.getByTestId("edit-btn").click();

const addedText = "foo";
Expand Down
Loading

0 comments on commit 1d7b896

Please sign in to comment.