Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Oct 31, 2024
1 parent 3ab81ed commit 534d845
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions web/tests/dataViewer.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {promise} from "selenium-webdriver";
import {
ByUIClass,
goToPage,
Expand All @@ -13,8 +14,12 @@ describe("dataViewer:", () => {
await goToPage("_test/data/default::Account");

// wait until schema and data loaded
await driver.wait(
until.elementLocated(ByUIClass("dataInspector_cellWrapper"))
await waitUntilElementsContentHasChanged(
await driver.wait(
until.elementLocated(ByUIClass("dataview_rowCount"))
),
"loading...",
2000
);
});

Expand All @@ -24,7 +29,18 @@ describe("dataViewer:", () => {
);
const initialItemsCount = parseInt(await itemsCountEl.getText(), 10);
// click insert button
await driver.findElement(ByUIClass("dataview_headerButton")).click();
await driver
.findElement(() =>
promise.filter(
driver.findElements(
ByUIClass("dataview_headerButtons", "button_button")
),
async (button) =>
(await button.getText()).toLowerCase().includes("insert")
)
)
.click();

// enter new username
const usernameField = await driver.findElement(
By.css(
Expand All @@ -40,7 +56,9 @@ describe("dataViewer:", () => {
.sendKeys("Test Account", Key.chord(cmdCtrl, Key.ENTER));
// apply changes
await driver.findElement(ByUIClass("dataview_reviewChanges")).click();
await driver.findElement(ByUIClass("editsModal_greenButton")).click();
await driver
.findElement(ByUIClass("modal_modal", "button_primary"))
.click();
// wait for data refresh
await waitUntilElementNotLocated(ByUIClass("modal_modalOverlay"));
const newItemsCount = parseInt(await itemsCountEl.getText(), 10);
Expand Down Expand Up @@ -71,7 +89,9 @@ describe("dataViewer:", () => {

// apply changes
await driver.findElement(ByUIClass("dataview_reviewChanges")).click();
await driver.findElement(ByUIClass("editsModal_greenButton")).click();
await driver
.findElement(ByUIClass("modal_modal", "button_primary"))
.click();
// wait for data refresh
await waitUntilElementNotLocated(ByUIClass("modal_modalOverlay"));

Expand All @@ -96,8 +116,12 @@ describe("dataViewer:", () => {
await goToPage("_test/data/default::Movie");

// wait until schema and data loaded
await driver.wait(
until.elementLocated(ByUIClass("dataInspector_cellWrapper"))
await waitUntilElementsContentHasChanged(
await driver.wait(
until.elementLocated(ByUIClass("dataview_rowCount"))
),
"loading...",
2000
);
});

Expand Down

0 comments on commit 534d845

Please sign in to comment.