Skip to content

Commit

Permalink
Merge pull request #1814 from OpenC3/bug/open-file-dialog
Browse files Browse the repository at this point in the history
Fix ScriptRunner open_file_dialog
  • Loading branch information
ryan-pratt authored Jan 8, 2025
2 parents 88de888 + 75eacc8 commit e5a8384
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<v-file-input
label="Choose File"
v-model="inputValue"
:rules="fileInputRules"
autofocus
data-test="file-input"
:accept="filter"
Expand Down Expand Up @@ -102,6 +103,8 @@ export default {
data() {
return {
inputValue: null,
valid: null,
fileInputRules: [(value) => !!value?.length || 'Required'],
}
},
computed: {
Expand Down
11 changes: 5 additions & 6 deletions playwright/tests/script-runner/prompts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@ test('opens a dialog for prompt', async ({ page, utils }) => {
await expect(page.locator('[data-test=state] input')).toHaveValue('stopped')
})

// Opening a file dialog might not be possible in a Github action?
test.skip('opens a file dialog', async ({ page, utils }) => {
test('opens a file dialog', async ({ page, utils }) => {
await page.locator('textarea').fill(`
file = open_file_dialog("Open a single file", "Choose something interesting")
puts file.read
Expand Down Expand Up @@ -320,15 +319,15 @@ test.skip('opens a file dialog', async ({ page, utils }) => {
// It is important to call waitForEvent before click to set up waiting.
page.waitForEvent('filechooser'),
// Open the file chooser
page.locator('text=Choose File').click(),
page.getByLabel('Choose File').first().click(),
])
await fileChooser.setFiles('.env')
await fileChooser.setFiles('package.json')
await page.locator('.v-dialog >> button:has-text("Ok")').click()
await expect(page.locator('[data-test=state] input')).toHaveValue('stopped')
await expect(page.locator('[data-test=output-messages]')).toContainText(
'File(s): [".env"]',
'File(s): ["package.json"]',
)
await expect(page.locator('[data-test=output-messages]')).toContainText(
'RUBYGEMS_URL',
'devDependencies',
)
})

0 comments on commit e5a8384

Please sign in to comment.