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"
:type="getInputComponent(arg) !== 'select' ? getInputType(arg) : 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)" />
<span class="argument-description" v-html="arg.description"></span>
@@ -202,6 +202,16 @@ async function validateArgument(arg, value) {
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 {
const validateArgumentTypeArgs = {
value: value,
@@ -286,10 +296,12 @@ async function startAction(actionArgs) {
}
try {
await window.client.startAction(startActionArgs)
console.log('Action started successfully with tracking ID:', startActionArgs.uniqueTrackingId)
const response = await window.client.startAction(startActionArgs)
console.log('Action started successfully with tracking ID:', response.executionTrackingId)
return response
} catch (err) {
console.error('Failed to start action:', err)
throw err
}
}
@@ -319,9 +331,12 @@ async function handleSubmit(event) {
const argvs = getArgumentValues()
console.log('argument form has elements that passed validation')
await startAction(argvs)
router.back()
try {
const response = await startAction(argvs)
router.push(`/logs/${response.executionTrackingId}`)
} catch (err) {
console.error('Failed to start action:', err)
}
}
function handleCancel() {

View File

@@ -12,6 +12,5 @@ actions:
- name: datetime
title: Select a date and time
type: datetime
required: true
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')
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
const label = await webdriver.findElement(By.css('label[for="datetime"]'))
expect(await label.getText()).to.contain('Select a date and time')