Skip to content

Commit

Permalink
fix getDisplayValue() crash on FieldMap (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoelzer authored Oct 4, 2024
1 parent 6bf2d75 commit 3570472
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// (C) Copyright 2024 Dassault Systemes SE. All Rights Reserved.
package com.nuodb.selenium.advanced;

import static org.junit.jupiter.api.Assertions.assertNotEquals;

import java.util.List;

import org.junit.jupiter.api.Test;

import com.nuodb.selenium.Constants;
import com.nuodb.selenium.TestRoutines;
import com.nuodb.selenium.basic.BannerTest;

public class RandomClicks extends TestRoutines {

@Test
public void testRandomClicks() {
login(Constants.ADMIN_ORGANIZATION, Constants.ADMIN_USER, Constants.ADMIN_PASSWORD);
for(int i=0; i<3; i++) {
String projectName = createProject();
String databaseName = createDatabase(projectName);
createBackup(projectName, databaseName);
}

// Verify client doesn't produce a call stack by quickly clicking around (async reload issues)
long start = System.currentTimeMillis();
while(System.currentTimeMillis() - start < 30*1000) {
// get all the menu items
List<String> menuItems = getTextList("menu-button-", BannerTest.expectedMenuItems.size());

assertNotEquals(0, menuItems.size());

int index = (int)(Math.random()*menuItems.size());
waitElement("menu-button-" + index).click();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import com.google.common.collect.ImmutableList;
import com.nuodb.selenium.Constants;
import com.nuodb.selenium.TestRoutines;

import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.List;

public class BannerTest extends TestRoutines {
private List<String> expectedMenuItems = Arrays.asList("backuppolicies", "backups", "databases", "projects", "users");
public static final List<String> expectedMenuItems = ImmutableList.of("backuppolicies", "backups", "databases", "projects", "users");

@Test
public void testHorizontalBanner() throws MalformedURLException {
Expand Down
15 changes: 10 additions & 5 deletions ui/src/components/pages/ListResource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function ListResource({ schema }: SchemaType) {
const path = "/" + useParams()["*"];
const pageSize = 20;

const [items, setItems] = useState([]);
const [itemsAndPath, setItemsAndPath] = useState({ items: [], path });
const [page, setPage] = useState(1);
const [allItems, setAllItems] = useState([]);
const [createPath, setCreatePath] = useState<string | null>(null);
Expand Down Expand Up @@ -65,14 +65,14 @@ export default function ListResource({ schema }: SchemaType) {
setAbortController(
getResourceEvents(path + "?listAccessible=true&expand=true&offset=" + String(start + (page - 1) * pageSize) + "&limit=" + Math.min(pageSize, end - start) + labelFilter, (data: TempAny) => {
if (data.items) {
setItems(data.items);
setItemsAndPath({ items: data.items, path });
}
else {
setItems([]);
setItemsAndPath({ items: [], path });
}
}, (error: TempAny) => {
Auth.handle401Error(error);
setItems([]);
setItemsAndPath({ items: [], path });
})
);
}).catch((reason) => {
Expand Down Expand Up @@ -125,7 +125,12 @@ export default function ListResource({ schema }: SchemaType) {
<Path schema={schema} path={path} filterValues={getFilterValues()} search={search} setSearch={setSearch} setPage={setPage} />
{createPath && <Button data-testid="list_resource__create_button" variant="outlined" onClick={handleCreate}>Create</Button>}
{renderPaging()}
<Table data-testid="list_resource__table" schema={schema} data={items.filter((d: TempAny) => d.__deleted__ !== true)} path={path} />
<Table
data-testid="list_resource__table"
schema={schema}
data={itemsAndPath.items.filter((d: TempAny) => d.__deleted__ !== true)}
path={itemsAndPath.path}
/>
{renderPaging()}
</React.Fragment>
);
Expand Down

0 comments on commit 3570472

Please sign in to comment.