Skip to content

Commit

Permalink
chore: Prepare workflows test
Browse files Browse the repository at this point in the history
  • Loading branch information
ramedina86 committed Nov 15, 2024
1 parent 0e05573 commit 62c2f0e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{"id": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "type": "page", "content": {"pageMode": "compact"}, "handlers": {}, "isCodeManaged": false, "parentId": "root", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}}
{"id": "bebc5fe9-63a7-46a7-b0fa-62303555cfaf", "type": "header", "content": {"text": "Workflows Test App"}, "handlers": {}, "isCodeManaged": false, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}}
{"id": "ixxb26ukbvr0sknw", "type": "repeater", "content": {"keyVariable": "itemId", "repeaterObject": "{ \"pl\": { \"object\": \"plant\" }, \"cu\": { \"object\": \"cup\" }}", "valueVariable": "item"}, "handlers": {}, "isCodeManaged": false, "parentId": "c0f99a9e-5004-4e75-a6c6-36f17490b134", "position": 1}
{"id": "iftqnmjw8ipaknex", "type": "section", "content": {"title": "@{itemId}: @{item.object}"}, "handlers": {}, "isCodeManaged": false, "parentId": "ixxb26ukbvr0sknw", "position": 0}
{"id": "7no34ag7gmwgm1rd", "type": "textinput", "content": {"label": ""}, "handlers": {"wf-change": "$runWorkflow_handle_object"}, "isCodeManaged": false, "parentId": "iftqnmjw8ipaknex", "position": 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"id": "i9io5f734z9esrxs", "type": "page", "content": {}, "handlers": {}, "isCodeManaged": false, "parentId": "root", "position": 1}
{"id": "16eeo21o6k8tcxf7", "type": "chatbot", "content": {"conversation": "@{convo}"}, "handlers": {"wf-chatbot-message": "$runWorkflow_handle_object"}, "isCodeManaged": false, "parentId": "i9io5f734z9esrxs", "position": 0}
1 change: 1 addition & 0 deletions tests/e2e/presets/workflows/.wf/components-root.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id": "root", "type": "root", "content": {"appName": "My App"}, "handlers": {}, "isCodeManaged": false, "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id": "workflows_root", "type": "workflows_root", "content": {}, "handlers": {}, "isCodeManaged": false, "position": 0, "visible": {"binding": "", "expression": true, "reversed": false}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{"id": "auxjfi7lssb268ly", "type": "workflows_workflow", "content": {"key": "handle_object"}, "handlers": {}, "isCodeManaged": false, "parentId": "workflows_root", "position": 0}
{"id": "bgfri5xbo3l5916z", "type": "workflows_writeraddchatmessage", "content": {"conversationStateElement": "convo", "message": "@{payload}"}, "handlers": {}, "isCodeManaged": false, "outs": [{"toNodeId": "36w4ghu0oioub912", "outId": "success"}], "parentId": "auxjfi7lssb268ly", "position": 0, "x": 473, "y": 204}
{"id": "36w4ghu0oioub912", "type": "workflows_writerchat", "content": {"conversationStateElement": "convo", "tools": "{\"get_employee_info\":{\"description\":\"Gets info for an employee, given an employee id\",\"parameters\":{\"id\":{\"type\":\"string\",\"description\":\"Id of the employee\"}},\"type\":\"function\"}}", "useStreaming": "no"}, "handlers": {}, "isCodeManaged": false, "outs": [{"toNodeId": "6ktplk37vue14rog", "outId": "tools_get_employee_info"}], "parentId": "auxjfi7lssb268ly", "position": 1, "x": 889, "y": 173}
{"id": "6ktplk37vue14rog", "type": "workflows_httprequest", "content": {"url": "https://reqres.in/api/users/@{id}"}, "handlers": {}, "isCodeManaged": false, "outs": [{"toNodeId": "8ly2cojv5m77lfpd", "outId": "success"}], "parentId": "auxjfi7lssb268ly", "position": 2, "x": 1382, "y": 152}
{"id": "i183fmlmluglk2tg", "type": "workflows_writerinitchat", "content": {"alias": "", "conversationStateElement": "convo"}, "handlers": {}, "isCodeManaged": false, "outs": [{"toNodeId": "bgfri5xbo3l5916z", "outId": "success"}], "parentId": "auxjfi7lssb268ly", "position": 3, "x": 52, "y": 203}
{"id": "8ly2cojv5m77lfpd", "type": "workflows_returnvalue", "content": {"value": "@{result.body}"}, "handlers": {}, "isCodeManaged": false, "parentId": "auxjfi7lssb268ly", "position": 4, "x": 1744, "y": 170}
3 changes: 3 additions & 0 deletions tests/e2e/presets/workflows/.wf/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"writer_version": "0.8.0rc6"
}
3 changes: 3 additions & 0 deletions tests/e2e/presets/workflows/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import writer as wf

wf.Config.feature_flags = ["workflows"]
43 changes: 43 additions & 0 deletions tests/e2e/tests/workflows.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
import { test, expect } from "@playwright/test";
const setTextField = async (page, text) => {
await page.locator('div.CoreText.component').click();
await page
.locator('.BuilderFieldsText[data-automation-key="text"] .templateInput')
.fill(text);
}
test.describe("state autocompletion", () => {
let url: string;
test.beforeAll(async ({request}) => {
const response = await request.post(`/preset/workflows`);
expect(response.ok()).toBeTruthy();
({url} = await response.json());
});
test.afterAll(async ({request}) => {
await request.delete(url);
});
test.beforeEach(async ({ page }) => {
await page.goto(url);
});
test.describe("text", () => {
test("completion", async ({ page }) => {
const instancePaths = ["root:0,c0f99a9e-5004-4e75-a6c6-36f17490b134:0,ixxb26ukbvr0sknw:0,iftqnmjw8ipaknex:0,7no34ag7gmwgm1rd:0", "root:0,c0f99a9e-5004-4e75-a6c6-36f17490b134:0,ixxb26ukbvr0sknw:0,iftqnmjw8ipaknex:0,7no34ag7gmwgm1rd:0"];
await setTextField(page, "@{types.");
page.locator('.BuilderFieldsText[data-automation-key="text"] .fieldStateAutocomplete span.prop:text-matches("string")').click();
await expect(page
.locator('.BuilderFieldsText[data-automation-key="text"] .templateInput'))
.toHaveValue("@{types.string");
});
});
});
*/

0 comments on commit 62c2f0e

Please sign in to comment.