diff --git a/packages/serverless-workflow-diagram-editor/tests-e2e/conditional-task.spec.ts b/packages/serverless-workflow-diagram-editor/tests-e2e/conditional-task.spec.ts new file mode 100644 index 00000000..df3a313b --- /dev/null +++ b/packages/serverless-workflow-diagram-editor/tests-e2e/conditional-task.spec.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2021-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { test, expect } from "@playwright/test"; + +test("diagram editor renders conditional task", async ({ page }) => { + await page.goto("/iframe.html?id=examples-workflows--conditional-task"); + + await expect(page.getByTestId("react-flow-canvas")).toBeVisible(); + + await expect(page.getByTestId("start-node-root-entry-node")).toBeVisible(); + + await expect(page.getByTestId("end-node-root-exit-node")).toBeVisible(); + + await expect(page.getByText("raiseErrorIfUnderage")).toBeVisible(); + + await expect(page.locator(".edge-label")).toContainText(".customer.age < 18"); + + await expect(page.getByText("RAISE", { exact: true })).toBeVisible(); +}); diff --git a/packages/serverless-workflow-diagram-editor/tests-e2e/for-loop.spec.ts b/packages/serverless-workflow-diagram-editor/tests-e2e/for-loop.spec.ts new file mode 100644 index 00000000..12165c07 --- /dev/null +++ b/packages/serverless-workflow-diagram-editor/tests-e2e/for-loop.spec.ts @@ -0,0 +1,43 @@ +/* + * Copyright 2021-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { test, expect } from "@playwright/test"; + +test("diagram editor renders for loop workflow", async ({ page }) => { + await page.goto("/iframe.html?id=examples-workflows--for"); + + const forNode = page.getByTestId("for-node-/do/0/checkup"); + + await expect(forNode).toBeVisible(); + + await expect(forNode).toContainText("checkup"); + + await expect(forNode).toContainText("FOR"); + + await expect(page.getByTestId("for-node-/do/0/checkup-badge")).toHaveText("while"); + + const listenNode = page.getByTestId("listen-node-/do/0/checkup/for/do/0/waitForCheckup"); + + await expect(listenNode).toBeVisible(); + + await expect(listenNode).toContainText("waitForCheckup"); + + await expect(listenNode).toContainText("LISTEN"); + + await expect( + page.getByTestId("listen-node-/do/0/checkup/for/do/0/waitForCheckup-badge"), + ).toHaveText("one"); +}); diff --git a/packages/serverless-workflow-diagram-editor/tests-e2e/forever-foreach.spec.ts b/packages/serverless-workflow-diagram-editor/tests-e2e/forever-foreach.spec.ts new file mode 100644 index 00000000..401c134e --- /dev/null +++ b/packages/serverless-workflow-diagram-editor/tests-e2e/forever-foreach.spec.ts @@ -0,0 +1,32 @@ +/* + * Copyright 2021-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { test, expect } from "@playwright/test"; + +test("renders listen node with validation error", async ({ page }) => { + await page.goto("/iframe.html?id=examples-workflows--listen-to-any-forever-foreach"); + + const node = page.getByTestId("listen-node-/do/0/listenToGossips"); + + await expect(node).toContainText("listenToGossips"); + await expect(node).toContainText("LISTEN"); + + await expect(page.getByTestId("listen-node-/do/0/listenToGossips-badge")).toHaveText("any"); + + await expect(page.getByTestId("listen-node-/do/0/listenToGossips-error")).toBeVisible(); + + await expect(node).toHaveClass(/has-error/); +}); diff --git a/packages/serverless-workflow-diagram-editor/tests-e2e/validation-error.spec.ts b/packages/serverless-workflow-diagram-editor/tests-e2e/validation-error.spec.ts new file mode 100644 index 00000000..df614233 --- /dev/null +++ b/packages/serverless-workflow-diagram-editor/tests-e2e/validation-error.spec.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2021-Present The Serverless Workflow Specification Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { test, expect } from "@playwright/test"; + +test("renders document validation error in sidebar", async ({ page }) => { + await page.goto("/iframe.html?id=features-validation-errors--document-error"); + + const errors = page.getByTestId("sidebar-errors"); + await expect(errors).toBeVisible(); + await expect( + errors.getByText( + /The DSL version of the workflow '\d\.\d\.\d' does not satisfy.*supported by this SDK/, + ), + ).toBeVisible(); +});