-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02bdbda
commit ffa15a2
Showing
8 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" href="/tests/reset.css" /> | ||
<link rel="stylesheet" href="/node_modules/@flows/js/css.min/flows.css" /> | ||
</head> | ||
<body> | ||
<div | ||
style="background-color: grey; width: 20px; height: 20px; margin: 40px" | ||
class="target" | ||
></div> | ||
|
||
<script type="module" src="./cloud.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { invalidFlow, validFlow } from "./flow-mocks"; | ||
|
||
test("Should validate local flow", async ({ page }) => { | ||
await page.route("**/sdk/flows?projectId=my-proj", (route) => route.fulfill({ json: [] })); | ||
await page.goto("/cloud/cloud.html?validLocalFlow=true"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.goto("/cloud/cloud.html?invalidLocalFlow=true"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
}); | ||
|
||
test("Should run valid cloud flow", async ({ page }) => { | ||
await page.route("**/sdk/flows?projectId=my-proj", (route) => | ||
route.fulfill({ json: [validFlow] }), | ||
); | ||
await page.goto("/cloud/cloud.html"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
}); | ||
|
||
test("Should run invalid cloud flow", async ({ page }) => { | ||
await page.route("**/sdk/flows?projectId=my-proj", (route) => | ||
route.fulfill({ json: [invalidFlow] }), | ||
); | ||
await page.goto("/cloud/cloud.html"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { init } from "@flows/js"; | ||
import { invalidFlow, validFlow } from "./flow-mocks"; | ||
|
||
const validLocalFlow = new URLSearchParams(window.location.search).get("validLocalFlow") === "true"; | ||
const invalidLocalFlow = | ||
new URLSearchParams(window.location.search).get("invalidLocalFlow") === "true"; | ||
|
||
const flows = []; | ||
if (validLocalFlow) flows.push(validFlow); | ||
if (invalidLocalFlow) flows.push(invalidFlow); | ||
|
||
init({ | ||
projectId: "my-proj", | ||
flows, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Flow } from "@flows/js"; | ||
|
||
export const validFlow: Flow = { | ||
id: "valid-local-flow", | ||
location: "/", | ||
steps: [ | ||
{ | ||
title: "Hello", | ||
targetElement: ".target", | ||
}, | ||
], | ||
}; | ||
|
||
export const invalidFlow: Flow = { | ||
id: "invalid-local-flow", | ||
location: "/", | ||
steps: [ | ||
{ | ||
title: "Hello", | ||
targetElement: ".target", | ||
// @ts-ignore | ||
invalidOption: "invalid", | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters