Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions cypress/e2e/content/headTags.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
// assumes no Head Tags as starting state
describe("Head Tags", () => {
before(() => {
cy.task("seed:content", "fixtures/item.json").then(
({ model, fields, items }) => {
Cypress.env("modelZUID", model?.ZUID);
Cypress.env("itemZUID", items[0]?.meta?.ZUID);
}
);
});
it("creates and deletes new head tag", () => {
cy.waitOn("/v1/content/models*", () => {
cy.visit("/content/6-556370-8sh47g/7-b939a4-457q19/head");
cy.visit(
`/content/${Cypress.env("modelZUID")}/${Cypress.env("itemZUID")}/head`
);
});

cy.contains("Create Head Tag", { timeout: 10000 }).click();
cy.contains("Create Head Tag").click();

cy.get("[data-cy=newTagCard]")
cy.getBySelector("newTagCard")
.last()
.find(".MuiSelect-select")
.click({ force: true });
Expand All @@ -17,16 +27,15 @@ describe("Head Tags", () => {
.find('[data-value="script"]')
.click({ force: true });

//cy.get("[data-cy=tagCard]:last-child")
cy.get("[data-cy=newTagCard]")
cy.getBySelector("newTagCard")
.last()
.contains("Value")
.parent()
.find("input")
.clear()
.type("Changing the value of content");

cy.get("[data-cy=newTagCard]")
cy.getBySelector("newTagCard")
.last()
.contains("Attribute")
.parent()
Expand All @@ -35,11 +44,11 @@ describe("Head Tags", () => {
.type("newAttr");

// Saves Head Tag
cy.get("[data-cy=newTagCard]").last().find("#SaveItemButton").click();
cy.getBySelector("newTagCard").last().find("#SaveItemButton").click();
cy.contains("New head tag created");

// Deletes Head Tag
cy.get("[data-cy=tagCard]")
cy.getBySelector("tagCard")
.last()
.contains("Delete Head Tag")
.invoke("show")
Expand Down
87 changes: 87 additions & 0 deletions cypress/fixtures/item.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"model": {
"label": "Content - Item",
"type": "pageset",
"listed": true
},
"fields": [
{
"label": "Text",
"name": "text",
"datatype": "text",
"sort": 0,
"settings": {
"list": true
}
},
{
"datatype": "textarea",
"name": "textarea",
"label": "textarea",
"sort": 1,
"settings": {
"list": true
}
},
{
"datatype": "markdown",
"name": "markdown",
"label": "markdown",
"sort": 2,
"settings": {
"list": true
}
},
{
"datatype": "wysiwyg_basic",
"name": "wysiwyg_basic",
"label": "wysiwyg basic",
"sort": 3,
"settings": {
"list": true
}
},
{
"label": "Dropdown",
"name": "dropdown",
"datatype": "dropdown",
"sort": 4,
"settings": {
"list": true,
"options": {
"Option 1": "Option 1",
"Option 2": "Option 2"
}
}
},
{
"label": "Yes/No",
"name": "yes_no",
"datatype": "yes_no",
"sort": 5,
"settings": {
"list": true,
"options": {
"0": "No",
"1": "Yes"
}
}
}
],
"items": [
{
"web": {
"metaTitle": "Content Item",
"metaLinkText": "Content Item"
},
"data": {
"text": "text",
"textarea": "textarea",
"markdown": "markdown",
"wysiwyg_basic": "<p>wysiwyg_basic</p>",
"yes_no": "0",
"dropdown": "Option 1"
}
}
]
}