Skip to content

Commit

Permalink
Merge pull request #1245 from OpenC3/playwright
Browse files Browse the repository at this point in the history
Playwright enhancements
  • Loading branch information
jmthomas authored May 8, 2024
2 parents bfa19bc + f8f982f commit 08a6a56
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions playwright/tests/admin/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test('resets clock sync warning suppression', async ({ page, utils }) => {
test('clears default configs', async ({ page, utils }) => {
// Visit PacketViewer and change a setting
await page.goto('/tools/packetviewer')
await expect(page.locator('.v-app-bar')).toContainText('Packet Viewer')
await page.locator('[data-test=packet-viewer-view]').click()
await page.locator('text=Show Ignored').click()
await utils.sleep(100)
Expand Down
4 changes: 3 additions & 1 deletion playwright/tests/bucket-explorer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ test('navigate gems volume', async ({ page, utils }) => {
test('direct URLs', async ({ page, utils }) => {
// Verify using slashes rather than %2F works
await page.goto('/tools/bucketexplorer/config/DEFAULT/targets/')
await utils.sleep(300) // Ensure the page is rendered before getting the count
await expect(page.locator('.v-app-bar')).toContainText('Bucket Explorer')
// Can't match exact because Enterprise has the PW_TEST target
await expect.poll(() => page.locator('tr').count()).toBeGreaterThan(4)

// Basic makes it a bucket
await page.goto('/tools/bucketexplorer/blah')
await expect(page.locator('.v-app-bar')).toContainText('Bucket Explorer')
await expect(
page.getByText('Unknown bucket / volume OPENC3_BLAH_BUCKET'),
).toBeVisible()
// Prepending %2F makes it a volume
await page.goto('/tools/bucketexplorer/%2FBAD')
await expect(page.locator('.v-app-bar')).toContainText('Bucket Explorer')
await expect(
page.getByText('Unknown bucket / volume OPENC3_BAD_VOLUME'),
).toBeVisible()
Expand Down
2 changes: 2 additions & 0 deletions playwright/tests/cmd-tlm-server/cmd-pkts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ test('displays the command count', async ({ page, utils }) => {
await page.goto('/tools/cmdsender/INST/ABORT', {
waitUntil: 'domcontentloaded',
})
await expect(page.locator('.v-app-bar')).toContainText('Command Sender')
await page.locator('[data-test=select-send]').click()
await expect(page.locator('main')).toContainText('cmd("INST ABORT") sent')
await page
Expand All @@ -68,6 +69,7 @@ test('displays the command count', async ({ page, utils }) => {
await page.goto('/tools/cmdtlmserver/cmd-packets', {
waitUntil: 'domcontentloaded',
})
await expect(page.locator('.v-app-bar')).toContainText('CmdTlmServer')
await expect
.poll(() =>
page.locator('[data-test=cmd-packets-table] >> tbody > tr').count(),
Expand Down
7 changes: 4 additions & 3 deletions playwright/tests/command-sender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ test('selects a target and packet', async ({ page, utils }) => {

test('displays INST COLLECT using the route', async ({ page, utils }) => {
await page.goto('/tools/cmdsender/INST/COLLECT')
await expect(page.locator('.v-app-bar')).toContainText('Command Sender')
await utils.inputValue(page, '[data-test=select-target] input', 'INST')
await utils.inputValue(page, '[data-test=select-packet] input', 'COLLECT')
await expect(page.locator('main')).toContainText('Starts a collect')
Expand Down Expand Up @@ -404,9 +405,9 @@ test('executes commands from history', async ({ page, utils }) => {
expect(text).toContain('INST CLEAR')
expect(text).toContain('INST SETPARAMS')
await page.locator('[data-test="clear-history"]').click()
text = await page.locator('[data-test=sender-history]').innerText()
expect(text).not.toContain('INST CLEAR')
expect(text).not.toContain('INST SETPARAMS')
await expect
.poll(() => page.locator('[data-test=sender-history]').innerText())
.not.toContain('INST CLEAR')
})

test('send vs history', async ({ page, utils }) => {
Expand Down
2 changes: 2 additions & 0 deletions playwright/tests/data-extractor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ test('edit all items', async ({ page, utils }) => {
test('processes commands', async ({ page, utils }) => {
// Preload an ABORT command
await page.goto('/tools/cmdsender/INST/ABORT')
await expect(page.locator('.v-app-bar')).toContainText('Command Sender')
await page.locator('[data-test=select-send]').click()
await page.locator('text=cmd("INST ABORT") sent')
await utils.sleep(1000)
Expand All @@ -205,6 +206,7 @@ test('processes commands', async ({ page, utils }) => {

const start = sub(new Date(), { minutes: 1 })
await page.goto('/tools/dataextractor')
await expect(page.locator('.v-app-bar')).toContainText('Data Extractor')
await page.locator('rux-icon-apps path').click()
await page.locator('[data-test=start-time]').fill(format(start, 'HH:mm:ss'))
await page.locator('label:has-text("Command")').click()
Expand Down
1 change: 1 addition & 0 deletions playwright/tests/packet-viewer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test('displays INST HEALTH_STATUS and polls the api', async ({
}) => {
// Verify we can hit it using the route
await page.goto('/tools/packetviewer/INST/HEALTH_STATUS')
await expect(page.locator('.v-app-bar')).toContainText('Packet Viewer')
await utils.inputValue(page, '[data-test=select-target] input', 'INST')
await utils.inputValue(
page,
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/script-runner/file-menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test('open a file using url param', async ({ page, utils }) => {
await page.goto('/tools/scriptrunner?file=INST2/procedures/collect.py', {
waitUntil: 'domcontentloaded',
})
await utils.sleep(1000)
await expect(page.locator('.v-app-bar')).toContainText('Script Runner')
expect(await page.locator('#sr-controls')).toContainText(
`INST2/procedures/collect.py`,
)
Expand Down
1 change: 1 addition & 0 deletions playwright/tests/wait-for-build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test('waits for the services to deploy and connect', async ({
utils,
}) => {
await page.goto('/tools/cmdtlmserver')
await expect(page.locator('.v-app-bar')).toContainText('CmdTlmServer')
// Check the 3rd column (nth starts at 0) on the row containing INST_INT says CONNECTED
await expect(
page.locator('tr:has-text("INST_INT") td >> nth=2'),
Expand Down

0 comments on commit 08a6a56

Please sign in to comment.