Skip to content

Commit

Permalink
PROD-2481 Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucano Vera committed Aug 14, 2024
1 parent 752ed61 commit 0ad2e9b
Showing 1 changed file with 0 additions and 149 deletions.
149 changes: 0 additions & 149 deletions clients/admin-ui/cypress/e2e/datasets.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,155 +162,6 @@ describe("Dataset", () => {
cy.getByTestId("row-0-col-name").contains("uuid");
cy.getByTestId("row-1-col-name").should("not.exist");
});

describe("Data category checkbox tree", () => {
it("Can render chosen data categories", () => {
cy.visit("/dataset/demo_users_dataset/users");
cy.getByTestId("row-5-col-actions").find("button").click();

cy.getByTestId("data-category-dropdown").click();
cy.get("[data-testid='checkbox-Unique ID'] > span").should(
"have.attr",
"data-checked",
);
cy.get(`[data-testid='checkbox-User Data'] > span`).should(
"have.attr",
"data-indeterminate",
);
cy.getByTestId("selected-categories").should(
"contain",
"user.unique_id",
);
});

it.only("Can deselect data categories", () => {
cy.visit("/dataset/demo_users_dataset/users");
cy.getByTestId("row-5-col-actions").find("button").click();

cy.getByTestId("data-category-dropdown").click();
cy.getByTestId("checkbox-Unique ID").click();
// should collapse away
cy.getByTestId("checkbox-Unique ID").should("not.exist");
cy.get("[data-testid='checkbox-User Data'] > span").should(
"not.have.attr",
"data-indeterminate",
);
cy.getByTestId("data-category-done-btn").click();
cy.getByTestId("selected-categories").should(
"not.contain",
"user.derived.identifiable.unique_id",
);
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([]);
});
});

it("Can select more data categories", () => {
cy.visit("/dataset/demo_users_dataset");
cy.getByTestId("row-5-col-actions").find("button").click();
cy.getByTestId("data-category-dropdown").click();
cy.getByTestId("checkbox-Telemetry Data").click();
cy.getByTestId("checkbox-System Data").click();
cy.getByTestId("data-category-done-btn").click();
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.unique_id",
"user.telemetry",
"system",
]);
});
});

it("Can interact with the checkbox tree properly", () => {
cy.visit("/dataset/demo_users_dataset");
cy.getByTestId("row-5-col-actions").find("button").click();
cy.getByTestId("data-category-dropdown").click();
// expand system data
cy.getByTestId("expand-System Data").click();
// select 1/2 children
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-System Data'] > span").should(
"have.attr",
"data-indeterminate",
);
// now select all children
cy.getByTestId("checkbox-Operations Data").click();
// parent should be checked since all children are checked
cy.get("[data-testid='checkbox-System Data'] > span").should(
"have.attr",
"data-checked",
);
// the children of selected parents should be disabled
cy.getByTestId("checkbox-Authorization Information").click();
cy.get("[data-testid='checkbox-Account password'] > span").should(
"have.attr",
"data-checked",
);
cy.get("[data-testid='checkbox-Biometric Credentials'] > span").should(
"have.attr",
"data-disabled",
);
cy.get("[data-testid='checkbox-Password'] > span").should(
"have.attr",
"data-disabled",
);
cy.getByTestId("data-category-done-btn").click();
const expectedSelected = [
"system.authentication",
"system.operations",
"user.authorization",
];
expectedSelected.forEach((e) => {
cy.getByTestId("selected-categories").should("contain", e);
});
});

it("Should be able to clear selected", () => {
cy.visit("/dataset/demo_users_dataset");
cy.getByTestId("row-5-col-actions").find("button").click();
cy.getByTestId("data-category-dropdown").click();
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.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-System Data'] > span").should(
"not.have.attr",
"data-checked",
);
cy.getByTestId("data-category-done-btn").click();
cy.getByTestId("selected-categories").should(
"not.contain",
"user.unique_id",
);
});
});
});

describe("Creating datasets", () => {
Expand Down

0 comments on commit 0ad2e9b

Please sign in to comment.