Merge pull request #3441 from Budibase/fix/pc-generic-fixes

Save automation test data
This commit is contained in:
Peter Clement 2021-11-23 20:07:19 +00:00 committed by GitHub
commit 70c522a06a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 43 deletions

View File

@ -22,9 +22,9 @@ context("Create a automation", () => {
cy.get(".spectrum-Picker-label").click() cy.get(".spectrum-Picker-label").click()
cy.wait(500) cy.wait(500)
cy.contains("dog").click() cy.contains("dog").click()
cy.wait(2000)
// Create action // Create action
cy.contains("Add Action").click() cy.get(".block > .spectrum-Icon").click()
cy.get(".modal-inner-wrapper").within(() => { cy.get(".modal-inner-wrapper").within(() => {
cy.wait(1000) cy.wait(1000)
cy.contains("Create Row").trigger('mouseover').click().click() cy.contains("Create Row").trigger('mouseover').click().click()

View File

@ -93,7 +93,9 @@ const automationActions = store => ({
}, },
select: automation => { select: automation => {
store.update(state => { store.update(state => {
let testResults = state.selectedAutomation?.testResults
state.selectedAutomation = new Automation(cloneDeep(automation)) state.selectedAutomation = new Automation(cloneDeep(automation))
state.selectedAutomation.testResults = testResults
state.selectedBlock = null state.selectedBlock = null
return state return state
}) })

View File

@ -84,7 +84,6 @@
class="block" class="block"
animate:flip={{ duration: 500 }} animate:flip={{ duration: 500 }}
in:fly|local={{ x: 500, duration: 1500 }} in:fly|local={{ x: 500, duration: 1500 }}
out:fly|local={{ x: 500, duration: 800 }}
> >
<FlowItem {testDataModal} {testAutomation} {onSelect} {block} /> <FlowItem {testDataModal} {testAutomation} {onSelect} {block} />
</div> </div>

View File

@ -25,10 +25,10 @@
let resultsModal let resultsModal
let setupToggled let setupToggled
let blockComplete let blockComplete
$: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter(
step => step.stepId === block.stepId step => step.stepId === block.stepId
) )
$: isTrigger = block.type === "TRIGGER" $: isTrigger = block.type === "TRIGGER"
$: selected = $automationStore.selectedBlock?.id === block.id $: selected = $automationStore.selectedBlock?.id === block.id
@ -150,15 +150,6 @@
>Finish and test automation</Button >Finish and test automation</Button
> >
{/if} {/if}
<Button
disabled={!hasCompletedInputs}
on:click={() => {
setupToggled = false
actionModal.show()
}}
primary={!isTrigger}
cta={isTrigger}>Add Action</Button
>
{/if} {/if}
</Layout> </Layout>
</div> </div>

View File

@ -9,6 +9,7 @@
onMount(() => { onMount(() => {
automationStore.actions.fetch() automationStore.actions.fetch()
}) })
function selectAutomation(automation) { function selectAutomation(automation) {
automationStore.actions.select(automation) automationStore.actions.select(automation)
$goto(`./${automation._id}`) $goto(`./${automation._id}`)

View File

@ -51,8 +51,7 @@
: { schema: {} } : { schema: {} }
$: schemaFields = table ? Object.values(table.schema) : [] $: schemaFields = table ? Object.values(table.schema) : []
const onChange = debounce( const onChange = debounce(async function (e, key) {
async function (e, key) {
if (isTestModal) { if (isTestModal) {
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents // Special case for webhook, as it requires a body, but the schema already brings back the body's contents
if (stepId === "WEBHOOK") { if (stepId === "WEBHOOK") {
@ -67,15 +66,16 @@
[key]: e.detail, [key]: e.detail,
}) })
testData[key] = e.detail testData[key] = e.detail
await automationStore.actions.save(
$automationStore.selectedAutomation?.automation
)
} else { } else {
block.inputs[key] = e.detail block.inputs[key] = e.detail
await automationStore.actions.save( await automationStore.actions.save(
$automationStore.selectedAutomation?.automation $automationStore.selectedAutomation?.automation
) )
} }
}, }, 800)
isTestModal ? 0 : 800
)
function getAvailableBindings(block, automation) { function getAvailableBindings(block, automation) {
if (!block || !automation) { if (!block || !automation) {

View File

@ -72,15 +72,17 @@
} }
</script> </script>
<ActionMenu> {#if allowDeletion}
<ActionMenu>
<div slot="control" class="icon"> <div slot="control" class="icon">
<Icon s hoverable name="MoreSmallList" /> <Icon s hoverable name="MoreSmallList" />
</div> </div>
{#if !external}
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem> <MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
{#if allowDeletion}
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
{/if} {/if}
</ActionMenu> <MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
</ActionMenu>
{/if}
<Modal bind:this={editorModal}> <Modal bind:this={editorModal}>
<ModalContent <ModalContent