You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2026/09/20 09:10:56 UTC
(myfaces-tobago) branch main updated: test(migration): Jasmine to Playwright
This is an automated email from the ASF dual-hosted git repository.
henningn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/main by this push:
new 3758cf33d0 test(migration): Jasmine to Playwright
3758cf33d0 is described below
commit 3758cf33d0eb9a8d8f8beaa228df3ba201a24984
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Sep 17 16:53:56 2026 +0200
test(migration): Jasmine to Playwright
---
.../900-test/sheet/80-lazy-sort/Lazy_Sort.test.js | 141 ---------------------
.../83-lazy-columnPanel/Lazy_ColumnPanel.test.js | 86 -------------
.../lazy-selectable-use-case.test.js | 92 --------------
.../lazy-row-attribute.test.js | 71 -----------
.../900-test/sheet/80-lazy-sort/Lazy_Sort.test.ts | 132 +++++++++++++++++++
.../83-lazy-columnPanel/Lazy_ColumnPanel.test.ts | 76 +++++++++++
.../lazy-selectable-use-case.test.ts | 70 ++++++++++
.../lazy-row-attribute.test.ts | 70 ++++++++++
8 files changed, 348 insertions(+), 390 deletions(-)
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.js
deleted file mode 100644
index e1067815c5..0000000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {elementByIdFn, querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
-import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
-
-it("focus row index 25 and scroll up", function (done) {
- const submit = elementByIdFn("page:mainForm:submit");
-
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(100));
- test.wait(() => isLoaded(100));
- test.setup(() => isLoaded(100) && !isLoaded(0) && !isLoaded(15), () => focusRowIndex(100), "click", submit);
- test.do(() => focusRowIndex(15)); //visible rows: 15 to 28 (new area)
- test.wait(() => isLoaded(15));
- test.do(() => expect(isLoaded(4)).toBeFalse());
- test.do(() => expect(isLoaded(5, 38)).toBeTrue());
- test.do(() => expect(isLoaded(39)).toBeFalse());
-
- test.do(() => focusRowIndex(8)); //visible rows: 8 to 17 (known area)
- test.wait(() => isLoaded(4));
- test.do(() => expect(isLoaded(0, 38)).toBeTrue());
- test.do(() => expect(isLoaded(39)).toBeFalse());
- test.start();
-});
-
-it("focus row index 9970 (max row index is 9999) and scroll down", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(9970)); //visible rows: 9970 to 9983 (new area)
- test.wait(() => isLoaded(9970));
- test.do(() => expect(isLoaded(9959)).toBeFalse());
- test.do(() => expect(isLoaded(9960, 9993)).toBeTrue());
- test.do(() => expect(isLoaded(9994)).toBeFalse());
-
- test.do(() => focusRowIndex(9980)); //visible rows: 9980 to 9989 (known area)
- test.wait(() => isLoaded(9999));
- test.do(() => expect(isLoaded(9959)).toBeFalse());
- test.do(() => expect(isLoaded(9960, 9999)).toBeTrue());
- test.start();
-});
-
-it("focus row index 500 and go up", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(500)); //visible rows: 500 to 513 (new area)
- test.wait(() => isLoaded(500));
- test.do(() => expect(isLoaded(489)).toBeFalse());
- test.do(() => expect(isLoaded(490, 523)).toBeTrue());
- test.do(() => expect(isLoaded(524)).toBeFalse());
-
- test.do(() => focusRowIndex(494)); //visible rows: 494 to 503 (known area)
- test.wait(() => isLoaded(489));
- test.do(() => expect(isLoaded(469)).toBeFalse());
- test.do(() => expect(isLoaded(470, 523)).toBeTrue());
- test.do(() => expect(isLoaded(524)).toBeFalse());
- test.start();
-});
-
-it("focus row index 1000 and go down", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(1000)); //visible rows: 1000 to 1013 (new area)
- test.wait(() => isLoaded(1000));
- test.do(() => expect(isLoaded(989)).toBeFalse());
- test.do(() => expect(isLoaded(990, 1023)).toBeTrue());
- test.do(() => expect(isLoaded(1024)).toBeFalse());
-
- test.do(() => focusRowIndex(1010)); //visible rows: 1010 to 1019 (known area)
- test.wait(() => isLoaded(1024));
- test.do(() => expect(isLoaded(989)).toBeFalse());
- test.do(() => expect(isLoaded(990, 1043)).toBeTrue());
- test.do(() => expect(isLoaded(1044)).toBeFalse());
- test.start();
-});
-
-it("focus row index 1500 and sort name asc, focus row index 2000 and sort desc", function (done) {
- const nameColumn = elementByIdFn("page:mainForm:sheet:nameColumn_sorter");
- const nameOutputs = querySelectorAllFn("tr tobago-out[id$=':name']");
-
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(1500));
- test.wait(() => isLoaded(1500));
- test.do(() => expect(isLoaded(1489)).toBeFalse());
- test.do(() => expect(isLoaded(1490, 1523)).toBeTrue());
- test.do(() => expect(isLoaded(1524)).toBeFalse());
-
- test.event("click", nameColumn, () => nameColumn().classList.contains("tobago-ascending"));
- test.wait(() => isLoaded(1500));
- test.do(() => expect(isLoaded(1489)).toBeFalse());
- test.do(() => expect(isLoaded(1490, 1519)).toBeTrue()); //preloaded from server
- test.do(() => expect(isLoaded(1520)).toBeFalse());
- test.do(() => expect(nameOutputs().length).toEqual(30));
- test.do(() => expect(nameOutputs()[0].id).not.toEqual("page:mainForm:sheet:0:name"));
-
- test.do(() => focusRowIndex(2000)); //visible rows: 2000 to 2013 (new area)
- test.wait(() => isLoaded(2000));
- test.do(() => expect(isLoaded(1989)).toBeFalse());
- test.do(() => expect(isLoaded(1990, 2023)).toBeTrue());
- test.do(() => expect(isLoaded(2024)).toBeFalse());
-
- test.event("click", nameColumn, () => nameColumn().classList.contains("tobago-descending"));
- test.wait(() => isLoaded(2000));
- test.do(() => expect(isLoaded(1989)).toBeFalse());
- test.do(() => expect(isLoaded(1990, 2019)).toBeTrue()); //preloaded from server
- test.do(() => expect(isLoaded(2020)).toBeFalse());
- test.do(() => expect(nameOutputs().length).toEqual(30));
- test.do(() => expect(nameOutputs()[0].id).not.toEqual("page:mainForm:sheet:0:name"));
- test.start();
-});
-
-function isLoaded(startRow, endRow) {
- if (endRow === undefined) {
- endRow = startRow;
- }
- for (let i = startRow; i <= endRow; i++) {
- if (row(i).getAttribute("dummy") != null) {
- return false;
- }
- }
- return true;
-}
-
-function row(rowIndex) {
- return querySelectorFn("tr[row-index='" + rowIndex + "']")();
-}
-
-function focusRowIndex(rowIndex) {
- querySelectorFn("#page\\:mainForm\\:sheet .tobago-body")().scrollTop = row(rowIndex).offsetTop;
-}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.js
deleted file mode 100644
index 0938724995..0000000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {elementByIdFn, querySelectorFn} from "/script/tobago-test.js";
-import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
-
-it("initial load", function (done) {
- const submit = elementByIdFn("page:mainForm:submit");
-
- const test = new JasmineTestTool(done);
- test.setup(() => isLoaded(0) && isLoaded(9), () => focusRowIndex(0), "click", submit);
- test.do(() => expect(isLoaded(0)).toBeTrue());
- test.do(() => expect(isLoaded(9)).toBeTrue());
- test.do(() => expect(isLoaded(10)).toBeFalse());
- test.start();
-});
-
-it("focus row index 200 and scroll up", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(200)); //new area; 200 to 213 visible; range 195 to 218
- test.wait(() => isLoaded(200));
- test.do(() => expect(isLoaded(194)).toBeFalse());
- test.do(() => expect(isLoaded(195, 218)).toBeTrue());
- test.do(() => expect(isLoaded(219)).toBeFalse());
-
- test.do(() => focusRowIndex(197)); //discovered area; 197 to 200 visible; range 194 to 203
- test.wait(() => isLoaded(194));
- test.do(() => expect(isLoaded(184)).toBeFalse());
- test.do(() => expect(isLoaded(185, 218)).toBeTrue());
- test.do(() => expect(isLoaded(219)).toBeFalse());
- test.start();
-});
-
-it("focus row index 300 and scroll down", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(300)); //new area; 300 to 313 visible; range 295 to 318
- test.wait(() => isLoaded(300));
- test.do(() => expect(isLoaded(294)).toBeFalse());
- test.do(() => expect(isLoaded(295, 318)).toBeTrue());
- test.do(() => expect(isLoaded(319)).toBeFalse());
-
- test.do(() => focusRowIndex(313)); //discovered area; 313 to 316 visible; range 310 to 319
- test.wait(() => isLoaded(319));
- test.do(() => expect(isLoaded(294)).toBeFalse());
- test.do(() => expect(isLoaded(295, 328)).toBeTrue());
- test.do(() => expect(isLoaded(329)).toBeFalse());
- test.start();
-});
-
-function isLoaded(startRow, endRow) {
- if (endRow === undefined) {
- endRow = startRow;
- }
- for (let i = startRow; i <= endRow; i++) {
- if (row(i).getAttribute("dummy") != null || rowColumnPanel(i) === null) {
- return false;
- }
- }
- return true;
-}
-
-function row(rowIndex) {
- return querySelectorFn("tr[row-index='" + rowIndex + "']")();
-}
-
-function rowColumnPanel(rowIndex) {
- return querySelectorFn("tr[data-tobago-for='" + rowIndex + "'].tobago-column-panel")();
-}
-
-function focusRowIndex(rowIndex) {
- querySelectorFn("#page\\:mainForm\\:sheet .tobago-body")().scrollTop = row(rowIndex).offsetTop;
-}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.js
deleted file mode 100644
index 840e58ee5d..0000000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import {elementByIdFn, querySelectorAllFn, querySelectorFn} from "/script/tobago-test.js";
-import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
-
-it("TOBAGO-2349: Lazy sheet: tobago-behavior not initialized", function (done) {
- const selectAjax = elementByIdFn("page:mainForm:changeAjaxOrFsr::0");
- const selectMulti = elementByIdFn("page:mainForm:changeSelectable::2");
- const reset = elementByIdFn("page:mainForm:reset");
- const timestampElement = querySelectorFn("#page\\:mainForm\\:timestamp .form-control-plaintext");
- const checkAjax = elementByIdFn("page:mainForm:checkAjax::field");
- const checkSelectable = elementByIdFn("page:mainForm:checkSelectable::field");
- const ajaxButton = elementByIdFn("page:mainForm:ajaxButton");
- const europaRow = elementByIdFn("page:mainForm:solar:18:rowAjax");
- const europaUpdateTimestamp = elementByIdFn("page:mainForm:solar:18:updateTimestamp");
- const name = elementByIdFn("page:mainForm:name::field");
-
- let timestamp;
-
- const test = new JasmineTestTool(done);
- test.setup(() => getFirstVisibleRow() === 0, null, "click", reset);
- test.setup(() => checkAjax().checked, () => selectAjax().checked = true, "change", selectAjax);
- test.setup(() => checkSelectable().value === "multi", () => selectMulti().checked = true, "change", selectMulti);
- test.setup(() => name().value === "Sun", null, "click", reset);
-
- test.do(() => focusRowIndex(30)); //discovered area; visible rows 30 to 34; range 5 to 59
- test.wait(() => isLoaded(50));
- test.do(() => expect(isLoaded(0, 87)).toBeTrue()); //loaded to row 99, but max row is 87
- test.do(() => timestamp = Number(timestampElement().textContent));
- test.event("click", ajaxButton, () => Number(timestampElement().textContent) > timestamp);
- test.wait(() => isLoaded(5, 69));
- test.event("click", europaRow, () => name().value === "Europa");
- test.do(() => expect(name().value).toBe("Europa"));
- test.do(() => timestamp = Number(timestampElement().textContent));
- test.event("click", europaUpdateTimestamp, () => Number(timestampElement().textContent) > timestamp);
- test.do(() => expect(Number(timestampElement().textContent) > timestamp).toBeTrue());
-
- test.start();
-});
-
-function isLoaded(startRow, endRow) {
- if (endRow === undefined) {
- endRow = startRow;
- }
- for (let i = startRow; i <= endRow; i++) {
- if (row(i).getAttribute("dummy") != null) {
- return false;
- }
- }
- return true;
-}
-
-function row(rowIndex) {
- return querySelectorFn("tr[row-index='" + rowIndex + "']")();
-}
-
-function focusRowIndex(rowIndex) {
- querySelectorFn("#page\\:mainForm\\:solar .tobago-body")().scrollTop = row(rowIndex).offsetTop;
-}
-
-function getFirstVisibleRow() {
- const tobagoBodyScrollTop = querySelectorFn("tobago-sheet .tobago-body")().scrollTop;
- const rows = querySelectorAllFn("tobago-sheet tr[row-index]")();
-
- let firstVisibleRow = 0;
- for (const row of rows) {
- if (row.offsetTop <= tobagoBodyScrollTop) {
- firstVisibleRow = Number(row.getAttribute("row-index"));
- } else {
- return firstVisibleRow;
- }
- }
-
- return -1;
-}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.js b/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.js
deleted file mode 100644
index c7382232c8..0000000000
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import {querySelectorFn} from "/script/tobago-test.js";
-import {JasmineTestTool} from "/tobago/test/tobago-test-tool.js";
-
-it("focus row index 200 and scroll up", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(200)); //new area; visible: 200 to 213; range: 175 to 238
- test.wait(() => isLoaded(200));
- test.do(() => expect(isLoaded(174)).toBeFalse());
- test.do(() => expect(isLoaded(175, 238)).toBeTrue());
- test.do(() => expect(isLoaded(239)).toBeFalse());
-
- test.do(() => focusRowIndex(189)); //discovered area; visible 189 to 202; range: 174 to 217
- test.wait(() => isLoaded(174));
- test.do(() => expect(isLoaded(124)).toBeFalse());
- test.do(() => expect(isLoaded(125, 238)).toBeTrue());
- test.do(() => expect(isLoaded(239)).toBeFalse());
- test.start();
-});
-
-it("focus row index 400 and scroll down", function (done) {
- const test = new JasmineTestTool(done);
- test.do(() => focusRowIndex(400)); //new area; visible: 400 to 413; range: 375 to 438
- test.wait(() => isLoaded(400));
- test.do(() => expect(isLoaded(374)).toBeFalse());
- test.do(() => expect(isLoaded(375, 438)).toBeTrue());
- test.do(() => expect(isLoaded(439)).toBeFalse());
-
- test.do(() => focusRowIndex(411)); //discovered area; visible 411 to 424; range: 396 to 439
- test.wait(() => isLoaded(439));
- test.do(() => expect(isLoaded(374)).toBeFalse());
- test.do(() => expect(isLoaded(375, 488)).toBeTrue());
- test.do(() => expect(isLoaded(489)).toBeFalse());
- test.start();
-});
-
-function isLoaded(startRow, endRow) {
- if (endRow === undefined) {
- endRow = startRow;
- }
- for (let i = startRow; i <= endRow; i++) {
- if (row(i).getAttribute("dummy") != null) {
- return false;
- }
- }
- return true;
-}
-
-function row(rowIndex) {
- return querySelectorFn("tr[row-index='" + rowIndex + "']")();
-}
-
-function focusRowIndex(rowIndex) {
- querySelectorFn("#page\\:mainForm\\:sheet .tobago-body")().scrollTop = row(rowIndex).offsetTop;
-}
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.ts
new file mode 100644
index 0000000000..c08fd1d293
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/80-lazy-sort/Lazy_Sort.test.ts
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {expect, Page, test} from "@playwright/test";
+
+test.describe("900-test/sheet/80-lazy-sort/Lazy_Sort.xhtml", () => {
+
+ test.beforeEach(async ({page}) => {
+ await page.goto("/content/900-test/sheet/80-lazy-sort/Lazy_Sort.xhtml");
+ });
+
+ test("focus row index 25 and scroll up", async ({page}) => {
+ const submit = page.locator("[id='page:mainForm:submit']");
+
+ await testLoadedState(page, false, 100);
+ await focusRowIndex(page, 100);
+ await testLoadedState(page, true, 100);
+ await submit.click();
+ await testLoadedState(page, true, 100);
+ await testLoadedState(page, false, 15);
+
+ await focusRowIndex(page, 15);
+ await testLoadedState(page, false, 4);
+ await testLoadedState(page, true, 5, 38);
+ await testLoadedState(page, false, 39);
+
+ await focusRowIndex(page, 8); //visible rows: 8 to 17 (known area)
+ await testLoadedState(page, true, 0, 38);
+ await testLoadedState(page, false, 39);
+ });
+
+ test("focus row index 9970 (max row index is 9999) and scroll down", async ({page}) => {
+ await focusRowIndex(page, 9970); //visible rows: 9970 to 9983 (new area)
+ await testLoadedState(page, false, 9959);
+ await testLoadedState(page, true, 9960, 9993);
+ await testLoadedState(page, false, 9994);
+
+ await focusRowIndex(page, 9980); //visible rows: 9980 to 9989 (known area)
+ await testLoadedState(page, false, 9959);
+ await testLoadedState(page, true, 9960, 9999);
+ });
+
+ test("focus row index 500 and go up", async ({page}) => {
+ await focusRowIndex(page, 500); //visible rows: 500 to 513 (new area)
+ await testLoadedState(page, false, 489);
+ await testLoadedState(page, true, 490, 523);
+ await testLoadedState(page, false, 524);
+
+ await focusRowIndex(page, 494); //visible rows: 494 to 503 (known area)
+ await testLoadedState(page, false, 469);
+ await testLoadedState(page, true, 470, 523);
+ await testLoadedState(page, false, 524);
+ });
+
+ test("focus row index 1000 and go down", async ({page}) => {
+ await focusRowIndex(page, 1000); //visible rows: 1000 to 1013 (new area)
+ await testLoadedState(page, false, 989);
+ await testLoadedState(page, true, 990, 1023);
+ await testLoadedState(page, false, 1024);
+
+ await focusRowIndex(page, 1010); //visible rows: 1010 to 1019 (known area)
+ await testLoadedState(page, false, 989);
+ await testLoadedState(page, true, 990, 1043);
+ await testLoadedState(page, false, 1044);
+ });
+
+ test("focus row index 1500 and sort name asc, focus row index 2000 and sort desc", async ({page}) => {
+ const nameColumn = page.locator("[id='page:mainForm:sheet:nameColumn_sorter']");
+ const nameOutputs = page.locator("tr tobago-out[id$=':name']");
+
+ await focusRowIndex(page, 1500);
+ await testLoadedState(page, false, 1489);
+ await testLoadedState(page, true, 1490, 1523);
+ await testLoadedState(page, false, 1524);
+
+ await nameColumn.click();
+ await expect(nameColumn).toContainClass("tobago-ascending");
+ await testLoadedState(page, false, 1489);
+ await testLoadedState(page, true, 1490, 1519); //preloaded from server
+ await testLoadedState(page, false, 1520);
+ await expect(nameOutputs).toHaveCount(30);
+ await expect(nameOutputs.nth(0)).not.toHaveAttribute("id", "page:mainForm:sheet:0:name");
+
+ await focusRowIndex(page, 2000); //visible rows: 2000 to 2013 (new area)
+ await testLoadedState(page, false, 1989);
+ await testLoadedState(page, true, 1990, 2023);
+ await testLoadedState(page, false, 2024);
+
+ await nameColumn.click();
+ await expect(nameColumn).toContainClass("tobago-descending");
+ await testLoadedState(page, false, 1989);
+ await testLoadedState(page, true, 1990, 2019); //preloaded from server
+ await testLoadedState(page, false, 2020);
+ await expect(nameOutputs).toHaveCount(30);
+ await expect(nameOutputs.nth(0)).not.toHaveAttribute("id", "page:mainForm:sheet:0:name");
+ });
+
+ async function testLoadedState(page: Page, loaded: boolean, startRow: number, endRow?: number): Promise<void> {
+ if (endRow === undefined) {
+ endRow = startRow;
+ }
+ for (let i = startRow; i <= endRow; i++) {
+ const row = page.locator("tr[row-index='" + i + "']");
+ if (loaded) {
+ await expect(row).not.toHaveAttribute("dummy");
+ } else {
+ await expect(row).toHaveAttribute("dummy");
+ }
+ }
+ }
+
+ async function focusRowIndex(page: Page, rowIndex: number) {
+ await page.locator("[id='page:mainForm:sheet'] .tobago-body").evaluate((sheetBody, rowIndex) => {
+ const row = sheetBody.querySelector("tr[row-index='" + rowIndex + "']") as HTMLTableRowElement;
+ sheetBody.scrollTop = row.offsetTop;
+ }, rowIndex);
+ }
+});
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.ts
new file mode 100644
index 0000000000..fdf9af806c
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.test.ts
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {expect, Page, test} from "@playwright/test";
+
+test.describe("900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.xhtml", () => {
+
+ test.beforeEach(async ({page}) => {
+ await page.goto("/content/900-test/sheet/83-lazy-columnPanel/Lazy_ColumnPanel.xhtml");
+ });
+
+ test("initial load", async ({page}) => {
+ await testLoadedState(page, true, 0, 9);
+ await testLoadedState(page, false, 10);
+ });
+
+ test("focus row index 200 and scroll up", async ({page}) => {
+ await focusRowIndex(page, 200); //new area; 200 to 213 visible; range 195 to 218
+ await testLoadedState(page, false, 194);
+ await testLoadedState(page, true, 195, 218);
+ await testLoadedState(page, false, 219);
+
+ await focusRowIndex(page, 197); //discovered area; 197 to 200 visible; range 194 to 203
+ await testLoadedState(page, false, 184);
+ await testLoadedState(page, true, 185, 218);
+ await testLoadedState(page, false, 219);
+ });
+
+ test("focus row index 300 and scroll down", async ({page}) => {
+ await focusRowIndex(page, 300); //new area; 300 to 313 visible; range 295 to 318
+ await testLoadedState(page, false, 294);
+ await testLoadedState(page, true, 295, 318);
+ await testLoadedState(page, false, 319);
+
+ await focusRowIndex(page, 313); //discovered area; 313 to 316 visible; range 310 to 319
+ await testLoadedState(page, false, 294);
+ await testLoadedState(page, true, 295, 328);
+ await testLoadedState(page, false, 329);
+ });
+
+ async function testLoadedState(page: Page, loaded: boolean, startRow: number, endRow?: number): Promise<void> {
+ if (endRow === undefined) {
+ endRow = startRow;
+ }
+ for (let i = startRow; i <= endRow; i++) {
+ const row = page.locator("tr[row-index='" + i + "']");
+ if (loaded) {
+ await expect(row).not.toHaveAttribute("dummy");
+ await expect(page.locator("tr[name='" + i + "'].tobago-column-panel")).toHaveCount(1);
+ } else {
+ await expect(row).toHaveAttribute("dummy");
+ }
+ }
+ }
+
+ async function focusRowIndex(page: Page, rowIndex: number) {
+ await page.locator("[id='page:mainForm:sheet'] .tobago-body").evaluate((sheetBody, rowIndex) => {
+ const row = sheetBody.querySelector("tr[row-index='" + rowIndex + "']") as HTMLTableRowElement;
+ sheetBody.scrollTop = row.offsetTop;
+ }, rowIndex);
+ }
+});
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.ts
new file mode 100644
index 0000000000..170d12a846
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.test.ts
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {expect, Page, test} from "@playwright/test";
+
+test.describe("900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.xhtml", () => {
+
+ test.beforeEach(async ({page}) => {
+ await page.goto("/content/900-test/sheet/84-lazy-selectable-use-case/lazy-selectable-use-case.xhtml");
+ });
+
+ test("TOBAGO-2349: Lazy sheet: tobago-behavior not initialized", async ({page}) => {
+ const timestampElement = page.locator("[id='page:mainForm:timestamp'] .form-control-plaintext");
+ const ajaxButton = page.locator("[id='page:mainForm:ajaxButton']");
+ const europaOut = page.locator("[id='page:mainForm:solar:18:rowAjax'] td tobago-out");
+ const europaUpdateTimestamp = page.locator("[id='page:mainForm:solar:18:updateTimestamp']");
+ const name = page.locator("[id='page:mainForm:name::field']");
+
+ let timestampValue: number;
+
+ await focusRowIndex(page, 30); //discovered area; visible rows 30 to 34; range 5 to 59
+ await testLoadedState(page, true, 0, 87); //loaded to row 99, but max row is 87
+ timestampValue = Number(await timestampElement.textContent());
+ await ajaxButton.click();
+ await expect.poll(async () => Number(await timestampElement.textContent())).toBeGreaterThan(timestampValue);
+ await testLoadedState(page, true, 5, 69);
+ await europaOut.click();
+ await expect(name).toHaveValue("Europa");
+ timestampValue = Number(await timestampElement.textContent());
+ await europaUpdateTimestamp.click();
+ await expect.poll(async () => Number(await timestampElement.textContent())).toBeGreaterThan(timestampValue);
+ });
+
+ async function testLoadedState(page: Page, loaded: boolean, startRow: number, endRow?: number): Promise<void> {
+ if (endRow === undefined) {
+ endRow = startRow;
+ }
+ for (let i = startRow; i <= endRow; i++) {
+ const row = page.locator("tr[row-index='" + i + "']");
+ if (loaded) {
+ await expect(row).not.toHaveAttribute("dummy");
+ } else {
+ await expect(row).toHaveAttribute("dummy");
+ }
+ }
+ }
+
+ async function focusRowIndex(page: Page, rowIndex: number) {
+ await page.locator("[id='page:mainForm:solar'] .tobago-body").evaluate((sheetBody, rowIndex) => {
+ const row = sheetBody.querySelector("tr[row-index='" + rowIndex + "']") as HTMLTableRowElement;
+ sheetBody.scrollTop = row.offsetTop;
+ }, rowIndex);
+ }
+});
diff --git a/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.ts b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.ts
new file mode 100644
index 0000000000..7d55bd754b
--- /dev/null
+++ b/tobago-example/tobago-example-demo/src/test/typescript/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.test.ts
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import {expect, Page, test} from "@playwright/test";
+
+test.describe("900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.xhtml", () => {
+
+ test.beforeEach(async ({page}) => {
+ await page.goto("/content/900-test/sheet/85-lazy-row-attribute/lazy-row-attribute.xhtml");
+ });
+
+ test("focus row index 200 and scroll up", async ({page}) => {
+ await focusRowIndex(page, 200); //new area; visible: 200 to 213; range: 175 to 238
+ await testLoadedState(page, false, 174);
+ await testLoadedState(page, true, 175, 238);
+ await testLoadedState(page, false, 239);
+
+ await focusRowIndex(page, 189); //discovered area; visible 189 to 202; range: 174 to 217
+ await testLoadedState(page, false, 124);
+ await testLoadedState(page, true, 125, 238);
+ await testLoadedState(page, false, 239);
+ });
+
+ test("focus row index 400 and scroll down", async ({page}) => {
+ await focusRowIndex(page, 400); //new area; visible: 400 to 413; range: 375 to 438
+ await testLoadedState(page, false, 374);
+ await testLoadedState(page, true, 375, 438);
+ await testLoadedState(page, false, 439);
+
+ await focusRowIndex(page, 411); //discovered area; visible 411 to 424; range: 396 to 439
+ await testLoadedState(page, false, 374);
+ await testLoadedState(page, true, 375, 488);
+ await testLoadedState(page, false, 489);
+ });
+
+ async function testLoadedState(page: Page, loaded: boolean, startRow: number, endRow?: number): Promise<void> {
+ if (endRow === undefined) {
+ endRow = startRow;
+ }
+ for (let i = startRow; i <= endRow; i++) {
+ const row = page.locator("tr[row-index='" + i + "']");
+ if (loaded) {
+ await expect(row).not.toHaveAttribute("dummy");
+ } else {
+ await expect(row).toHaveAttribute("dummy");
+ }
+ }
+ }
+
+ async function focusRowIndex(page: Page, rowIndex: number) {
+ await page.locator("[id='page:mainForm:sheet'] .tobago-body").evaluate((sheetBody, rowIndex) => {
+ const row = sheetBody.querySelector("tr[row-index='" + rowIndex + "']") as HTMLTableRowElement;
+ sheetBody.scrollTop = row.offsetTop;
+ }, rowIndex);
+ }
+});