zapier / zapier-platform-cli

:computer: Build Zapier integrations and test locally using the JavaScript tools you already know.

Home Page:https://zapier.github.io/zapier-platform-cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Way to test dynamic inputs function

drobnikj opened this issue · comments

I want to test my getActorAdditionalFields function, which loads dynamic fields into my action. It would be great if I can test it the same as operation.perform function with z object included.

// my action
module = {
    key: 'createActorRun',
    noun: 'Actor Run',
    display: {
        label: 'Run Actor',
        description: 'Run a specified actor.',
    },

    operation: {
        inputFields: [
            {
                label: 'Actor',
                helpText: 'Please select actor from the following list:',
                key: 'actorId',
                required: true,
                dynamic: 'actors.id.name',
                altersDynamicFields: true,
            },
            {
                label: 'Run synchronously',
                helpText: 'If it checks the Zap waits until task finises. The hard timeout for task run is 60s.',
                key: 'runSync',
                required: true,
                type: 'boolean',
                default: 'no',
            },
            getActorAdditionalFields,
        ],

        perform: runTask,

        sample: TASK_SAMPLE,
        outputFields: TASK_OUTPUT_FIELDS,
    },
};

I didn't find any example in doc. It would be great if you can add info about that into https://github.com/zapier/zapier-platform-example-app-dynamic-dropdown.

If there is a proper way how to do it, let me know. I will use some workaround now and I will post it there.

hey @drobnikj! Great question. I haven't tested it, but I believe you can declare getActorAdditionalFields as a hidden trigger and then test it normally using appTester(app.triggers.getActorAdditonalFields). I realize it's weird since it's not really a trigger, but that's the easiest thing to do right now.

@xavdid Thanks, I will do it like that.