Skip to content

Commit

Permalink
[Chore] Create e2e test for meta description validation for dataset i…
Browse files Browse the repository at this point in the history
…tems (#2991)

Adds tests for #2984
  • Loading branch information
finnar-bin authored Oct 8, 2024
1 parent 9f31ad5 commit 4526643
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions cypress/e2e/content/meta.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const today = Date.now();

describe("Content Meta", () => {
before(() => {
cy.waitOn("/v1/content/models*", () => {
cy.visit("/content/6-556370-8sh47g/7-b939a4-457q19/meta");
});
});
// before(() => {
// cy.waitOn("/v1/content/models*", () => {
// cy.visit("/content/6-556370-8sh47g/7-b939a4-457q19/meta");
// });
// });

// skipping failing test in preparation for CI.
it.skip("Modifies and saves Meta fields", () => {
Expand Down Expand Up @@ -63,4 +65,39 @@ describe("Content Meta", () => {
cy.get("#SaveItemButton").click();
cy.contains("Saved a new ").should("exist");
});

it("Does not validate meta description for dataset items", () => {
cy.waitOn("/v1/content/models*", () => {
cy.waitOn("/v1/env/nav", () => {
cy.waitOn("/v1/search/items*", () => {
cy.visit("/content/6-675028-84dq4s/new");
});
});
});

cy.get("#12-7893a0-w4j9gk", { timeout: 5000 }).find("input").type(today);
cy.getBySelector("CreateItemSaveButton").click();
cy.get("[data-cy=toast]").contains("Created Item");
});

it("Does validate meta description for non-dataset items", () => {
cy.waitOn("/v1/content/models*", () => {
cy.waitOn("/v1/env/nav", () => {
cy.waitOn("/v1/search/items*", () => {
cy.visit("/content/6-556370-8sh47g/7-b939a4-457q19/meta");
});
});
});

cy.getBySelector("metaDescription", { timeout: 10000 })
.find("textarea")
.first()
.type("test");
cy.getBySelector("metaDescription")
.find("textarea")
.first()
.type("{selectall}{del}");
cy.get("#SaveItemButton").click();
cy.getBySelector("FieldErrorsList").should("exist");
});
});

0 comments on commit 4526643

Please sign in to comment.