Skip to content

Commit

Permalink
Merge pull request #113 from digi-serve/jh/moreFixes
Browse files Browse the repository at this point in the history
Additional tweaks to make sure all test pass consistently on my local machine (and hopefully in GitHub)
  • Loading branch information
Hiro-Nakamura authored May 22, 2024
2 parents a27f18d + 98e79ec commit d80c4eb
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 135 deletions.
266 changes: 196 additions & 70 deletions appbuilder_app.json

Large diffs are not rendered by default.

28 changes: 7 additions & 21 deletions test_cases/dataCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default () => {
.as("list")
.should("be.visible")
.find(".webix_dataview_item")
.should("have.length", 18);
.should("have.length", 3);
// add a new record, should see it
cy.request("POST", `/app_builder/model/${testkcsObjectID}`, {
singlelinetext: "new",
});
cy.get("@list").find(".webix_dataview_item").should("have.length", 18);
cy.get("@list").find(".webix_dataview_item").should("have.length", 3);
});

it("Linked DC loads data according to parent cursor", () => {
Expand Down Expand Up @@ -132,26 +132,12 @@ export default () => {
).should("be.visible");

// Click to show the scroll bar
cy.get(
'[data-cy="ABViewGrid_d08be402-470e-4b9d-b5f4-72e27426522c_datatable"]',
)
.find(".webix_ss_body .webix_ss_right")
.click();

// Close the popup
cy.get(
'[data-cy="Popup Close Button Edit TestKCS 5403c1cf-57f9-463d-b306-799d3641be11"]',
).click();

// Drag the scroll bar to bottom
cy.get(
'[data-cy="ABViewGrid_d08be402-470e-4b9d-b5f4-72e27426522c_datatable"]',
)
.find(".webix_c_scroll_y")
.should("be.visible")
.trigger("mousedown")
.trigger("mousemove", { which: 1, pageY: 2000 })
.trigger("mouseup");
cy.GridScroll(
"ABViewGrid_d08be402-470e-4b9d-b5f4-72e27426522c_datatable",
0,
2000,
);

// Select the edit item
cy.get(
Expand Down
12 changes: 11 additions & 1 deletion test_cases/process_test-kcs-onCreate-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export default (folderName, Common) => {
it('Process inserts a record after inserting a label value on the tab "process > onCreate"', () => {
cy.get(
'[data-cy="string label 06a93149-590d-4e4f-9463-5ff43a689fd1 2172ba78-b327-42a1-8918-d97852234aee"]',
).type("test label");
)
.as("inputField")
.type("test label")
.clear();
cy.get("@inputField").type("test label", { delay: 0 });

cy.get(
'[data-cy="button save 2172ba78-b327-42a1-8918-d97852234aee"]',
Expand All @@ -33,6 +37,12 @@ export default (folderName, Common) => {
// "There are two labels: the one we are looking for contains the word 'None'",
// );

cy.get(
'[data-cy="ABViewGrid_4c2af349-da19-407e-9db0-ab34d1a35837_datatable"]',
)
.find('[column="1"] > .webix_cell')
.should("not.be.empty");

cy.get(
'[data-cy="ABViewGrid_4c2af349-da19-407e-9db0-ab34d1a35837_datatable"]',
)
Expand Down
3 changes: 3 additions & 0 deletions test_cases/widget_filter_by_connected_record.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export default (folderName) => {
cy.get('[data-cy^="connectObject options uuid22"]')
.should("be.visible")
.click({ force: true });

cy.get(".webix_progress_icon").should("not.exist");

cy.get('[data-cy^="connectObject connectto3"]').should("be.visible");
cy.get('[data-cy^="connectObject connectto3"]')
.find("input")
Expand Down
10 changes: 4 additions & 6 deletions test_cases/widget_form_save.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ export default () => {
'[data-cy="string Title 2e7a1c02-141a-4cdd-b93e-62c6c4e4765b 7e074587-ddc5-4d34-9f37-a0ab88a4258b"]',
)
.should("be.visible")
.type("Please work")
.clear()
.type("Test Record Rules");
.type("Test Record Rules", { delay: 0 });

cy.get(
'[data-cy="button save 7e074587-ddc5-4d34-9f37-a0ab88a4258b"]',
).click({ force: true });
cy.get('[data-cy="button save 7e074587-ddc5-4d34-9f37-a0ab88a4258b"]')
.should("be.enabled")
.click({ force: true });
cy.get(
'[data-cy^="ABViewGrid_42938e52-9da9-4ece-b492-deb253244d3e_datatable"]',
).scrollIntoView();
Expand Down
73 changes: 40 additions & 33 deletions test_cases/widget_grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ export default () => {
describe("Grid", () => {
beforeEach(() => {
cy.get(
'[data-cy="tab-Grid-e7c04584-4fbd-4ca9-b64b-0f5bcb477c1e-b52e6e96-5033-4c7f-a104-29bd5ddcac4a"]'
'[data-cy="tab-Grid-e7c04584-4fbd-4ca9-b64b-0f5bcb477c1e-b52e6e96-5033-4c7f-a104-29bd5ddcac4a"]',
)
.should("exist")
.click();
});
it("Exists", () => {
cy.get(
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_toolbar"]'
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_toolbar"]',
).should("exist");
cy.get(
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]'
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]',
).should("exist");
});
it("Can edit connected records", () => {
Expand All @@ -28,9 +28,9 @@ export default () => {
pos: 5300,
};
// Many Side
gridScroll(GRID, connect_mm.pos);
cy.GridScroll(GRID, connect_mm.pos);
cy.log(
"Find the cell in the 'connect-to-another-record-mm' column, row 1"
"Find the cell in the 'connect-to-another-record-mm' column, row 1",
);

cy.get(".webix_hcell")
Expand All @@ -39,7 +39,7 @@ export default () => {
.then(($column) => {
const mmIndex = $column.attr("column");
cy.get(
`.webix_column[column="${mmIndex}"] > [role="gridcell"][aria-rowindex="1"]`
`.webix_column[column="${mmIndex}"] > [role="gridcell"][aria-rowindex="1"]`,
)
.should("exist")
.click({ force: true });
Expand All @@ -54,15 +54,15 @@ export default () => {
.click();
cy.get(".webix_button").contains("Select").click();
cy.get(
`.webix_column[column="${mmIndex}"] > [role="gridcell"][aria-rowindex="1"]`
`.webix_column[column="${mmIndex}"] > [role="gridcell"][aria-rowindex="1"]`,
)
.should("contain", "test-KCS-ID:0000000001")
.and("contain", "test-KCS-ID:0000000002");
});
// One Side
gridScroll(GRID, connect_om.pos);
cy.GridScroll(GRID, connect_om.pos);
cy.log(
"Find the cell in the 'connect-to-another-record-om' column, row 1"
"Find the cell in the 'connect-to-another-record-om' column, row 1",
);

cy.get(".webix_hcell")
Expand All @@ -72,7 +72,7 @@ export default () => {
const omIndex = $column.attr("column");

cy.get(
`.webix_column[column="${omIndex}"] > [role="gridcell"][aria-rowindex="1"]`
`.webix_column[column="${omIndex}"] > [role="gridcell"][aria-rowindex="1"]`,
)
.should("exist")
.click({ force: true });
Expand All @@ -82,51 +82,54 @@ export default () => {
.contains("test-KCS-ID:0000000001")
.click();
cy.get(
`.webix_column[column="${omIndex}"] > [role="gridcell"][aria-rowindex="1"]`
`.webix_column[column="${omIndex}"] > [role="gridcell"][aria-rowindex="1"]`,
).should("contain", "test-KCS-ID:0000000001");
});
});
it("Sort a select list field", async () => {
// click to open the sort popup
cy.get(
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_buttonSort"]'
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_buttonSort"]',
)
.should("exist")
.click();

// click to show the Field option list
cy.get(
'[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort"]'
'[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort"]',
)
.find('[view_id="sort_1"]')
.find('.webix_el_combo')
.find(".webix_el_combo")
.should("exist")
.click();


// select the Field option item
cy.get(
'[webix_l_id="85ac56c3-17d5-48c0-abbb-850838b9a71d"]'
)
cy.get('[webix_l_id="85ac56c3-17d5-48c0-abbb-850838b9a71d"]')
.should("exist")
.click();

// Reorder 'item2' to the top
const win = await getWindow();
const $sortForm = win.$$("ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form");
const $sortForm = win.$$(
"ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form",
);
const $orderList = $sortForm.queryView({ view: "list" });
$orderList.moveTop("item2");
$orderList.refresh();

// Assert the order of options
cy.get('[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form"]')
.find('.webix_list')
.find('.webix_list_item')
cy.get(
'[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form"]',
)
.find(".webix_list")
.find(".webix_list_item")
.first()
.should("contain", "item2");

// Assert data
cy.get('[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]')
cy.get(
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]',
)
.find('[column="2"]')
.find('[aria-rowindex="1"]')
.should("contain", "text")
Expand All @@ -137,14 +140,18 @@ export default () => {
});

// Assert the order of options
cy.get('[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form"]')
.find('.webix_list')
.find('.webix_list_item')
cy.get(
'[view_id="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_table_popupSort_form"]',
)
.find(".webix_list")
.find(".webix_list_item")
.first()
.should("contain", "item1");

// Assert
cy.get('[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]')
cy.get(
'[data-cy="ABViewGrid_7aa0b5b1-8667-4293-ae9a-93e6639c4681_datatable"]',
)
.find('[column="2"]')
.find('[aria-rowindex="1"]')
.should("contain", "text 2");
Expand All @@ -158,16 +165,16 @@ export default () => {
* @param {int} h horizontal scroll in pixels
* @param {int=0} v veritcal scroll in pixels
*/
function gridScroll(id, h, v = 0) {
cy.window().then((win) => {
return win.$$(id).scrollTo(h, v);
});
}
// function gridScroll(id, h, v = 0) {
// cy.window().then((win) => {
// return win.$$(id).scrollTo(h, v);
// });
// }

function getWindow() {
return new Promise((resolve) => {
cy.window().then((win) => {
resolve(win);
});
});
}
}
9 changes: 5 additions & 4 deletions test_cases/widget_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ export default () => {
describe("Text", () => {
it("Exists", () => {
// Select the Text tab
cy.get(
'[data-cy^="tab-Text-"]'
)
cy.get('[data-cy^="tab-Text-"]')
.scrollIntoView()
.should("be.visible")
.click();
cy.get('[view_id^="ABViewText_"]')
.find('[view_id$="_text"]')
.should("be.visible")
.should("have.text", "longtext", { timeout: 50000, retryInterval: 500 });
.should("have.text", "longtext", {
timeout: 50000,
retryInterval: 500,
});
});
});
};
6 changes: 6 additions & 0 deletions test_setup/sql/add_testkcs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,9 @@ INSERT INTO `AB_kitchensink_testkcsForm2Link` (`uuid`, `created_at`, `updated_at
VALUES
('b0ff1e8c-8257-4076-a5e9-dff84d6cfe6e','2024-04-22 22:16:43','2024-04-22 22:16:43',NULL,'Link1');
UNLOCK TABLES;

LOCK TABLES `AB_kitchensink_testkcsText` WRITE;
INSERT INTO `AB_kitchensink_testkcsText` (`uuid`, `created_at`, `updated_at`, `properties`, `longtext`, `sort`)
VALUES
(UUID(),NOW(),NOW(),NULL,'longtext',1);
UNLOCK TABLES;
4 changes: 4 additions & 0 deletions test_setup/sql/reset_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ LOCK TABLES `AB_kitchensink_testkcsForm2Link` WRITE;
TRUNCATE TABLE `AB_kitchensink_testkcsForm2Link`;
UNLOCK TABLES;

LOCK TABLES `AB_kitchensink_testkcsText` WRITE;
TRUNCATE TABLE `AB_kitchensink_testkcsText`;
UNLOCK TABLES;

SET FOREIGN_KEY_CHECKS = 1;

0 comments on commit d80c4eb

Please sign in to comment.