Skip to content

Commit 92b4ebc

Browse files
committed
[grid] Add "URI" to the list of sort-by choices on Overview UI
1 parent 7ace725 commit 92b4ebc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

javascript/grid-ui/src/screens/Overview/Overview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ function Overview (): JSX.Element {
6767
const sortProperties = {
6868
'platformName': (a, b) => compareSlotStereotypes(a, b, 'platformName'),
6969
'status': (a, b) => a.status.localeCompare(b.status),
70+
'uri': (a, b) => a.uri.localeCompare(b.uri),
7071
'browserName': (a, b) => compareSlotStereotypes(a, b, 'browserName'),
7172
'browserVersion': (a, b) => compareSlotStereotypes(a, b, 'browserVersion'),
7273
'slotCount': (a, b) => {
@@ -80,6 +81,7 @@ function Overview (): JSX.Element {
8081
const sortPropertiesLabel = {
8182
'platformName': 'Platform Name',
8283
'status': 'Status',
84+
'uri': 'URI',
8385
'browserName': 'Browser Name',
8486
'browserVersion': 'Browser Version',
8587
'slotCount': 'Slot Count',

javascript/grid-ui/src/tests/components/Overview.test.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,26 @@ describe('Overview component', () => {
255255
}
256256
})
257257

258+
it('sorts nodes by URI when selected', async () => {
259+
render(
260+
<MockedProvider mocks={mocks} addTypename={false}>
261+
<Overview />
262+
</MockedProvider>
263+
)
264+
265+
await screen.findByText('http://192.168.1.10:4444')
266+
267+
const user = userEvent.setup()
268+
const selectElement = screen.getByRole('combobox')
269+
await user.click(selectElement)
270+
await user.click(screen.getByText('URI'))
271+
272+
// After sorting by URI, node1 should appear before node2
273+
const nodeUris = screen.getAllByText(/http:\/\/192\.168\.1\.\d+:4444/)
274+
expect(nodeUris[0]).toHaveTextContent('http://192.168.1.10:4444')
275+
expect(nodeUris[1]).toHaveTextContent('http://192.168.1.11:4444')
276+
})
277+
258278
it('renders live view icon for node with VNC session', async () => {
259279
render(
260280
<MockedProvider mocks={mocks} addTypename={false}>

0 commit comments

Comments
 (0)