Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finalizing Batch #5b tests #3690

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0b621cb
Adding batches 3 and 4
Oct 29, 2023
5b8a742
Revert "Adding batches 3 and 4"
Oct 29, 2023
436ceac
Revert "Revert "Adding batches 3 and 4""
Oct 29, 2023
e65d312
Revert "Revert "Revert "Adding batches 3 and 4"""
Oct 29, 2023
8ad66df
Merge branch 'next' of https://github.com/Asmaloth/webiny-js into next
Nov 1, 2023
769d08d
Adding 3/4 tests for batch #5b
Nov 5, 2023
b310e89
Adding last batch 4 test
Nov 5, 2023
fd78bbe
Trying to implement cy.origin with custom commands(broken)
Nov 7, 2023
912067b
Final batch 5b commit
Nov 10, 2023
d3abed4
Ran prettier:fix
Nov 10, 2023
3b230da
chore(eslint): fix remaining linting warnings
Nov 10, 2023
e71a3a2
chore(eslint): fix remaining linting warnings
Nov 10, 2023
abd60a0
chore(tests): fixing commands.js imports
Nov 10, 2023
65178b0
Merge branch 'next' into batch-5b
adrians5j Nov 21, 2023
0709ffa
fix(pr): resolving all comments from PR
Nov 23, 2023
9846e25
fix(pr): resolving all comments from PR
Nov 23, 2023
514a470
chore: add `yarn cy:ts` script
adrians5j Nov 28, 2023
82b9de5
fix(pr): fixing most of the latest pr comments
Nov 28, 2023
7f2fbc6
Merge branch 'next' into batch-5b
Asmaloth Nov 30, 2023
57e375a
fix(pr): fixing the latest pr comments
Dec 2, 2023
69762ee
fix(pr): fixed crashing test file
Dec 5, 2023
ec06277
Merge branch 'next' into batch-5b
adrians5j Dec 5, 2023
0bc094e
Merge branch 'next' into batch-5b
adrians5j Dec 6, 2023
af1b65a
Merge branch 'batch-5b' of https://github.com/Asmaloth/webiny-js into…
adrians5j Dec 6, 2023
114cc15
Merge branch 'next' into batch-5b
adrians5j Dec 6, 2023
471e6ab
Merge branch 'batch-5b' of https://github.com/Asmaloth/webiny-js into…
adrians5j Dec 6, 2023
6799d02
Merge branch 'next' into batch-5b
adrians5j Dec 7, 2023
859f932
wip: improve menu-items test
adrians5j Dec 7, 2023
e185aa2
Merge remote-tracking branch 'Asmaloth/batch-5b' into batch-5b
adrians5j Dec 7, 2023
1606ead
wip: improve menu-items test
adrians5j Dec 7, 2023
2efd93d
fix(pr): adding some minor polishes
Dec 7, 2023
7bb83b7
Merge branch 'next' into batch-5b
adrians5j Dec 8, 2023
7263e40
Merge branch 'next' into batch-5b
adrians5j Dec 11, 2023
eab22de
wip: improve menu-items test
adrians5j Dec 12, 2023
3440e4b
Merge branch 'next' into batch-5b
adrians5j Dec 20, 2023
6ea6309
wip: refactor utils
adrians5j Jan 4, 2024
b3db404
wip: refactor utils
adrians5j Jan 4, 2024
288435c
wip: refactor utils
adrians5j Jan 4, 2024
37b5cc5
wip: refactor utils
adrians5j Jan 4, 2024
06a393a
wip: refactor utils
adrians5j Jan 4, 2024
b793d0d
wip: refactor utils
adrians5j Jan 4, 2024
fd1d729
wip: refactor utils
adrians5j Jan 4, 2024
b99ab37
wip: refactor utils
adrians5j Jan 5, 2024
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
59 changes: 59 additions & 0 deletions cypress-tests/cypress/e2e/admin/pageBuilder/menus/menuCrud.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
context("Page Builder - Menu CRUD", () => {
const menuName = "Test menu";
Asmaloth marked this conversation as resolved.
Show resolved Hide resolved
const menuSlug = "test-slug";

const menuNameEdit = "Testing Menu123";
const menuDescEdit = "This is an edited description.";

beforeEach(() => {
cy.login();
cy.pbDeleteAllMenus();
});

it("should be able to create, edit, and immediately delete a menu", () => {
cy.visit("/page-builder/menus");

// Create a menu.
cy.findByTestId("data-list-new-record-button").should("exist");
cy.findByTestId("data-list-new-record-button").click();

cy.findByTestId("pb.menu.create.name").type(menuName);
cy.findByTestId("pb.menu.save.button").click();
cy.findByText("Value is required.").should("exist");
cy.findByTestId("pb.menu.create.slug").type(menuSlug);
cy.findByTestId("pb.menu.create.description").type("This is a cool test.");
cy.findByTestId("pb.menu.save.button").click();

cy.findByText("Menu saved successfully.").should("exist");
cy.wait(500);
Asmaloth marked this conversation as resolved.
Show resolved Hide resolved

// Edit the menu.
cy.findByTestId("pb.menu.create.name").clear().type(menuNameEdit);
cy.findByTestId("pb.menu.create.slug").should("be.disabled");
cy.findByTestId("pb.menu.create.description").clear().type(menuDescEdit);
cy.findByTestId("pb.menu.save.button").click();
cy.findByText("Menu saved successfully.").should("exist");
cy.wait(500);

// Assert the menu is being displayed properly on the right side of the screen.
cy.findByTestId("default-data-list").within(() => {
cy.get("li")
.first()
.within(() => {
cy.findByText(menuNameEdit).should("exist");
cy.findByText(menuDescEdit).should("exist");
cy.get("button").click({ force: true });
Asmaloth marked this conversation as resolved.
Show resolved Hide resolved
});
});

//Finish deleting the menu and assert it is deleted.
Asmaloth marked this conversation as resolved.
Show resolved Hide resolved
cy.contains("Are you sure you want to continue?").should("exist");
cy.findAllByTestId("confirmationdialog-confirm-action").click();

cy.findByText(`Menu "${menuSlug}" deleted.`).should("exist");
cy.wait(500);
cy.findByTestId("default-data-list").within(() => {
cy.findByText(menuNameEdit).should("not.exist");
});
});
});
193 changes: 193 additions & 0 deletions cypress-tests/cypress/e2e/admin/pageBuilder/menus/menuItems.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
context("Page Builder - Menu Items", () => {
const pageListName = "Testing page list";
const pageListNameEdit = "Testing editing page list name";
const linkName = "Link menu item name";
const linkURL = "/test/";
const linkNameEdit = "Link menu item name edit";
const linkURLEdit = "/testedit/";
const folderName = "Folder name";
const folderNameEdit = "Folder name edited";
const pageNameNew = "page-testing";
const pageNameNewEdit = "page-editing";

const menuData = {
data: {
title: "Testing menu items",
slug: "test-menu-items",
description: "Testing menu items.",
items: []
}
};

beforeEach(() => {
cy.login();
cy.pbDeleteAllMenus();
cy.pbCreateMenu(menuData);
cy.wait(500);
cy.pbCreatePage({ category: "static" }).then(page => {
// eslint-disable-next-line jest/valid-expect-in-promise
cy.pbUpdatePage({
id: page.id,
data: {
category: "static",
path: `/${pageNameNew}`,
title: pageNameNew,
settings: {
general: {
layout: "static",
tags: [pageNameNew, pageNameNew]
}
}
}
}).then(page => {
cy.pbPublishPage(page.id);
});
});

cy.pbCreatePage({ category: "static" }).then(page => {
// eslint-disable-next-line jest/valid-expect-in-promise
cy.pbUpdatePage({
id: page.id,
data: {
category: "static",
path: `/${pageNameNewEdit}`,
title: pageNameNewEdit,
settings: {
general: {
layout: "static",
tags: [pageNameNewEdit, pageNameNewEdit]
}
}
}
}).then(page => {
cy.pbPublishPage(page.id);
});
});
});

it("should be able to create, edit, and immediately delete all menu items within a menu", () => {
cy.visit("/page-builder/menus");
cy.findByTestId("default-data-list").within(() => {
cy.get("li").first().click();
});

// Create page list menu items.
cy.findByTestId("pb.menu.create.items.button").children("button").click();
cy.findByTestId("pb.menu.create.items.button").within(() => {
cy.findByText("Page list").click();
});
cy.findByTestId("pb.menu.new.listitem.title").type(pageListName);
cy.findByTestId("pb.menu.new.listitem.button.save").click().wait(200);
cy.findByText("Value is required.").should("exist");
cy.findByTestId("pb.menu.new.listitem.category").type(`Static`);
cy.findByText("Static").click();
cy.findByTestId("pb.menu.new.listitem.sortby").select("Title");
cy.findByTestId("pb.menu.new.listitem.sortdirection").select("Descending");
cy.findByTestId("pb.menu.new.listitem.tags").type("a");
cy.findByText("a").click();
cy.findByTestId("pb.menu.new.listitem.tags").type("b");
cy.findByText("b").click();
cy.findByTestId("pb.menu.new.listitem.button.save").click();

// Edit previously created page list items.
cy.findByTestId("pb-edit-icon-button").click();
cy.findByTestId("pb.menu.new.listitem.title").clear().type(pageListNameEdit);
cy.findByTestId("pb.menu.new.listitem.sortby").select("Published on");
cy.findByTestId("pb.menu.new.listitem.sortdirection").select("Ascending");
cy.findByTestId("pb.menu.new.listitem.tags").type("c");
cy.findByText("c").click();
cy.findByTestId("pb.menu.new.listitem.button.save").click();

// Assert all edits are being properly displayed.
cy.findByTestId(`pb-menu-item-render-${pageListNameEdit}`)
.contains(pageListNameEdit)
.should("exist");
cy.findByTestId("pb-edit-icon-button").click();
cy.findByTestId("pb.menu.new.listitem.title").should("have.value", pageListNameEdit);
cy.findByTestId("pb.menu.new.listitem.sortby").should("have.value", "publishedOn");
cy.findByTestId("pb.menu.new.listitem.sortdirection").should("have.value", "asc");
cy.findByTestId("pb.menu.new.listitem.button.save").click();

// Delete the previously created menu item.
cy.findByTestId("pb-delete-icon-button").click();
cy.wait(500);
cy.findByTestId(`pb-menu-item-render-${pageListNameEdit}`).should("not.exist");

// Create link menu item.
cy.findByTestId("pb.menu.create.items.button").children("button").click();
cy.findByTestId("pb.menu.create.items.button").within(() => {
cy.findByText("Link").click();
});
cy.findByTestId("pb.menu.new.link.title").type(linkName);
cy.findByTestId("pb.menu.new.link.url").type(linkURL);
cy.findByTestId("pb.menu.new.link.button.save").click();

// Edit the link menu item and assert everything is properly displayed.
cy.findByTestId(`pb-menu-item-render-${linkName}`).contains(linkName).should("exist");
cy.findByTestId("pb-edit-icon-button").click();
cy.findByTestId("pb.menu.new.link.title").should("have.value", linkName);
cy.findByTestId("pb.menu.new.link.url").should("have.value", linkURL);
cy.findByTestId("pb.menu.new.link.title").clear().type(linkNameEdit);
cy.findByTestId("pb.menu.new.link.url").clear().type(linkURLEdit);
cy.findByTestId("pb.menu.new.link.button.save").click();
cy.findByTestId(`pb-menu-item-render-${linkNameEdit}`)
.contains(linkNameEdit)
.should("exist");

// Delete the link menu item and assert it's no longer being displayed.
cy.findByTestId("pb-delete-icon-button").click();
cy.wait(500);
cy.findByTestId(`pb-menu-item-render-${linkNameEdit}`).should("not.exist");

// Create folder menu item.
cy.findByTestId("pb.menu.create.items.button").children("button").click();
cy.findByTestId("pb.menu.create.items.button").within(() => {
cy.findByText("Folder").click();
});
cy.findByTestId("pb.menu.new.folder.title").type(folderName);
cy.findByTestId("pb.menu.new.folder.button.save").click();
cy.findByTestId(`pb-menu-item-render-${folderName}`).contains(folderName).should("exist");

// Edit folder menu item and assert the changes have been made.
cy.findByTestId("pb-edit-icon-button").click();
cy.findByTestId("pb.menu.new.folder.title").should("have.value", folderName);
cy.findByTestId("pb.menu.new.folder.title").clear().type(folderNameEdit);
cy.findByTestId("pb.menu.new.folder.button.save").click();

cy.findByTestId(`pb-menu-item-render-${folderNameEdit}`)
.contains(folderNameEdit)
.should("exist");

// Delete folder menu item and assert it's no longer being displayed.
cy.findByTestId("pb-delete-icon-button").click();
cy.wait(500);
cy.findByTestId(`pb-menu-item-render-${folderNameEdit}`).should("not.exist");

// Create page menu item.
cy.findByTestId("pb.menu.create.items.button").children("button").click();
cy.findByTestId("pb.menu.create.items.button").within(() => {
cy.findByText("Page").click();
});
cy.findByTestId("pb.menu.new.pageitem.page").type(pageNameNew);
cy.get('div[role="combobox"] [role="listbox"] [role="option"]').first().click();
cy.findByTestId("pb.menu.new.pageitem.button.save").click();
cy.findByTestId(`pb-menu-item-render-${pageNameNew}`).contains(pageNameNew).should("exist");

// Edit folder menu item and assert the changes have been made.
cy.findByTestId("pb-edit-icon-button").click();
cy.findByTestId("pb.menu.new.pageitem.page").clear();
cy.findByTestId("pb.menu.new.pageitem.page").type(pageNameNewEdit);
cy.get('div[role="combobox"] [role="listbox"] [role="option"]').first().click();
cy.findByTestId("pb.menu.new.pageitem.title").clear();
cy.findByTestId("pb.menu.new.pageitem.title").type(pageNameNewEdit);
cy.findByTestId("pb.menu.new.pageitem.button.save").click();
cy.findByTestId(`pb-menu-item-render-${pageNameNewEdit}`)
.contains(pageNameNewEdit)
.should("exist");

// Delete folder menu item and assert it's no longer being displayed.
cy.findByTestId("pb-delete-icon-button").click();
cy.wait(500);
cy.findByTestId(`pb-menu-item-render-${pageNameNewEdit}`).should("not.exist");
});
});
Asmaloth marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe.skip("Menus Module", () => {

cy.wait(500);
cy.findByTestId("default-data-list").within(() => {
cy.findByText("Main Menu").click();
cy.contains("Main Menu").click();
cy.wait(500);
});

Expand Down Expand Up @@ -112,12 +112,12 @@ describe.skip("Menus Module", () => {
cy.visit("/page-builder/menus");

cy.findByTestId("default-data-list").within(() => {
cy.findByText(`Main Menu`).click({ force: true });
cy.contains(`Main Menu`).click({ force: true });
});

cy.wait(500);

cy.findByTestId(`pb-menu-item-render-added-menu-${id}`).within(() => {
cy.findByTestId(`pb-menu-item-render-${id}`).within(() => {
cy.findByTestId("pb-edit-icon-button").click();
});

Expand Down Expand Up @@ -150,7 +150,7 @@ describe.skip("Menus Module", () => {
cy.visit("/page-builder/menus");

cy.findByTestId("default-data-list").within(() => {
cy.findByText(`Main Menu`).click({ force: true });
cy.contains(`Main Menu`).click({ force: true });
});

cy.findByTestId(`pb-menu-item-render-added-menu-${idEdited}`).within(() => {
Expand Down
Loading
Loading