Skip to content

Commit 5bb8206

Browse files
committed
Add/fix playwright tests
1 parent b4d3e61 commit 5bb8206

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

playwright/tests/command-sender.p.spec.ts

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ test('warns for required parameters', async ({ page, utils }) => {
169169
await expect(page.locator('.v-dialog')).toContainText('Error sending')
170170
await expect(page.locator('.v-dialog')).toContainText('INST COLLECT TYPE')
171171
await expect(page.locator('.v-dialog')).toContainText(
172-
"Required command parameter 'INST COLLECT TYPE' not given",
172+
"not one of NORMAL, SPECIAL",
173173
)
174174
await page.locator('button:has-text("Ok")').click()
175175
})
@@ -750,3 +750,48 @@ for (const target of ['INST', 'INST2']) {
750750
.toMatch(/\[\s*4,\s*5\s*\]/)
751751
})
752752
}
753+
754+
test('sends manually entered state values', async ({ page, utils }) => {
755+
await page.locator('[data-test="clear-history"]').click()
756+
await utils.selectTargetPacketItem('INST', 'COLLECT')
757+
await expect(page.locator('main')).toContainText(
758+
'Starts a collect on the INST target',
759+
)
760+
761+
// Enable Ignore Range Checks to unlock manual entry
762+
await page.locator('[data-test=command-sender-mode]').click()
763+
await page.getByText('Ignore Range Checks').click()
764+
await page.locator('[data-test=command-sender-mode]').click()
765+
766+
// Select MANUALLY_ENTERED from the TYPE state dropdown
767+
let row = page.locator('tr:has(td:text-is("TYPE"))')
768+
await row.locator('[data-test=cmd-param-select]').click({ force: true })
769+
await page.getByRole('option', { name: 'MANUALLY_ENTERED' }).click()
770+
771+
// Enter a raw numeric value in the manual entry text field
772+
await row.locator('[data-test=cmd-param-value] input').first().fill('0')
773+
await row.locator('[data-test=cmd-param-value] input').first().press('Enter')
774+
775+
// Send the command
776+
await page.locator('[data-test="select-send"]').click()
777+
await expect(page.locator('main')).toContainText(
778+
'cmd_no_range_check("INST COLLECT with TYPE 0, DURATION 1, OPCODE 171, TEMP 0") sent',
779+
)
780+
await checkHistory(
781+
page,
782+
'cmd_no_range_check("INST COLLECT with TYPE 0, DURATION 1, OPCODE 171, TEMP 0")',
783+
)
784+
785+
// Disable Ignore Range Checks and verify MANUALLY_ENTERED option is gone
786+
await page.locator('[data-test=command-sender-mode]').click()
787+
await page.getByText('Ignore Range Checks').click()
788+
await page.locator('[data-test=command-sender-mode]').click()
789+
790+
// The TYPE dropdown should no longer have MANUALLY_ENTERED
791+
await row.locator('[data-test=cmd-param-select]').click({ force: true })
792+
await expect(
793+
page.getByRole('option', { name: 'MANUALLY_ENTERED' }),
794+
).not.toBeVisible()
795+
// Close the dropdown by pressing Escape
796+
await page.keyboard.press('Escape')
797+
})

0 commit comments

Comments
 (0)