chore: fix broken datetime test

This commit is contained in:
jamesread
2025-11-22 10:43:56 +00:00
parent d2e7474eea
commit 49b8c2c4f2
3 changed files with 21 additions and 11 deletions

View File

@@ -29,7 +29,7 @@
:list="arg.suggestions ? `${arg.name}-choices` : undefined" :list="arg.suggestions ? `${arg.name}-choices` : undefined"
:type="getInputComponent(arg) !== 'select' ? getInputType(arg) : undefined" :type="getInputComponent(arg) !== 'select' ? getInputType(arg) : undefined"
:rows="arg.type === 'raw_string_multiline' ? 5 : undefined" :rows="arg.type === 'raw_string_multiline' ? 5 : undefined"
:step="arg.type === 'datetime' ? 1 : undefined" :pattern="getPattern(arg)" :required="arg.required" :step="arg.type === 'datetime' ? 1 : undefined" :pattern="getPattern(arg)"
@input="handleInput(arg, $event)" @change="handleChange(arg, $event)" /> @input="handleInput(arg, $event)" @change="handleChange(arg, $event)" />
<span class="argument-description" v-html="arg.description"></span> <span class="argument-description" v-html="arg.description"></span>
@@ -202,6 +202,16 @@ async function validateArgument(arg, value) {
return return
} }
// Skip validation for datetime - backend will handle mangling values without seconds
if (arg.type === 'datetime') {
const inputElement = document.getElementById(arg.name)
if (inputElement) {
inputElement.setCustomValidity('')
}
delete formErrors.value[arg.name]
return
}
try { try {
const validateArgumentTypeArgs = { const validateArgumentTypeArgs = {
value: value, value: value,
@@ -286,10 +296,12 @@ async function startAction(actionArgs) {
} }
try { try {
await window.client.startAction(startActionArgs) const response = await window.client.startAction(startActionArgs)
console.log('Action started successfully with tracking ID:', startActionArgs.uniqueTrackingId) console.log('Action started successfully with tracking ID:', response.executionTrackingId)
return response
} catch (err) { } catch (err) {
console.error('Failed to start action:', err) console.error('Failed to start action:', err)
throw err
} }
} }
@@ -319,9 +331,12 @@ async function handleSubmit(event) {
const argvs = getArgumentValues() const argvs = getArgumentValues()
console.log('argument form has elements that passed validation') console.log('argument form has elements that passed validation')
await startAction(argvs) try {
const response = await startAction(argvs)
router.back() router.push(`/logs/${response.executionTrackingId}`)
} catch (err) {
console.error('Failed to start action:', err)
}
} }
function handleCancel() { function handleCancel() {

View File

@@ -12,6 +12,5 @@ actions:
- name: datetime - name: datetime
title: Select a date and time title: Select a date and time
type: datetime type: datetime
required: true
description: Choose a date and time for the action description: Choose a date and time for the action

View File

@@ -47,10 +47,6 @@ describe('config: datetime', function () {
const step = await datetimeInput.getAttribute('step') const step = await datetimeInput.getAttribute('step')
expect(step).to.equal('1', 'Step attribute should be 1') expect(step).to.equal('1', 'Step attribute should be 1')
// Verify it's required
const required = await datetimeInput.getAttribute('required')
expect(required).to.not.be.null
// Verify the label is present // Verify the label is present
const label = await webdriver.findElement(By.css('label[for="datetime"]')) const label = await webdriver.findElement(By.css('label[for="datetime"]'))
expect(await label.getText()).to.contain('Select a date and time') expect(await label.getText()).to.contain('Select a date and time')