Skip to content

Commit cfb8a05

Browse files
committed
PV allow search on null packet
1 parent 7d417f1 commit cfb8a05

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-packetviewer/src/tools/PacketViewer/PacketViewer.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,11 @@ export default {
493493
if (this.isPinned(value)) {
494494
return true
495495
} else {
496-
return value.toString().indexOf(search.toUpperCase()) >= 0
496+
if (value) {
497+
return value.toString().indexOf(search.toUpperCase()) >= 0
498+
} else {
499+
return false
500+
}
497501
}
498502
},
499503
packetChanged(event) {

playwright/tests/bucket-explorer.spec.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
// @ts-check
1717
import { test, expect } from './fixture'
18-
import { format } from 'date-fns'
1918

2019
test.use({
2120
toolPath: '/tools/bucketexplorer',
@@ -185,7 +184,7 @@ test('upload and delete', async ({ page, utils }) => {
185184
await expect(page.locator('[data-test="file-path"]')).toHaveText(
186185
'/ DEFAULT / tmp /',
187186
)
188-
await utils.sleep(5000) // Ensure the table is rendered before getting the count
187+
await page.locator('tbody> tr').first().waitFor()
189188
let count = await page.locator('tbody > tr').count()
190189

191190
// Note that Promise.all prevents a race condition
@@ -264,7 +263,7 @@ test('navigate logs and tools bucket', async ({ page, utils }) => {
264263
)
265264
await expect(page).toHaveURL(/.*\/tools\/bucketexplorer\/logs%2FDEFAULT%2F/)
266265
// Ensure the log files have the correct dates
267-
let date = format(new Date(), 'yyyyMMdd')
266+
let date = new Date().toISOString().split('T')[0].replace(/-/g, '')
268267
await page.getByRole('cell', { name: 'raw_logs' }).click()
269268
await page.getByRole('cell', { name: 'tlm' }).click()
270269
await page.getByRole('cell', { name: 'INST', exact: true }).click()
@@ -335,7 +334,7 @@ test('auto refreshes to update files', async ({
335334
await page.locator('[data-test="upload-file-submit-btn"]').click()
336335

337336
// The second tab shouldn't have refreshed yet, so the file shouldn't be there
338-
await utils.sleep(5000) // Ensure the table is rendered before checking
337+
await page.locator('tbody> tr').first().waitFor()
339338
await expect(
340339
pageTwo.getByRole('cell', { name: 'package2.json' }),
341340
).not.toBeVisible()
@@ -352,7 +351,7 @@ test('auto refreshes to update files', async ({
352351
await pageTwo.locator('.v-dialog').press('Escape')
353352

354353
// Second tab should auto refresh in 1s and then the file should be there
355-
await utils.sleep(5000) // Ensure the table is rendered before checking
354+
await page.locator('tbody> tr').first().waitFor()
356355
await expect(
357356
pageTwo.getByRole('cell', { name: 'package2.json' }),
358357
).toBeVisible()

playwright/tests/packet-viewer.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,13 @@ test('changes the polling rate', async ({ page, utils }) => {
164164
.locator('.v-dialog [data-test=refresh-interval] input')
165165
.press('Enter')
166166
await page.locator('.v-dialog').press('Escape')
167-
const received = parseInt(await page.inputValue('tr:has-text("RECEIVED_COUNT") input'))
167+
const received = parseInt(
168+
await page.inputValue('tr:has-text("RECEIVED_COUNT") input'),
169+
)
168170
await utils.sleep(7000)
169-
const received2 = parseInt(await page.inputValue('tr:has-text("RECEIVED_COUNT") input'))
171+
const received2 = parseInt(
172+
await page.inputValue('tr:has-text("RECEIVED_COUNT") input'),
173+
)
170174
expect(received2 - received).toBeLessThanOrEqual(6) // Allow slop
171175
expect(received2 - received).toBeGreaterThanOrEqual(4) // Allow slop
172176
// Set it back
@@ -193,6 +197,12 @@ test('displays formatted items with units by default', async ({
193197
await matchItem(page, 'TEMP1', /^-?\d+\.\d{3}\s\S$/)
194198
})
195199

200+
test('searches on packets without data', async ({ page, utils }) => {
201+
await utils.selectTargetPacketItem('EXAMPLE', 'STATUS')
202+
await page.locator('[data-test="search"] input').fill('STRING')
203+
await expect.poll(() => page.locator('tbody > tr').count()).toEqual(1)
204+
})
205+
196206
test('displays formatted items with units', async ({ page, utils }) => {
197207
await utils.selectTargetPacketItem('INST', 'HEALTH_STATUS')
198208
await page.locator('[data-test="search"] input').fill('TEMP1')

0 commit comments

Comments
 (0)