-
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
4287ae0
commit e59de17
Showing
25 changed files
with
346 additions
and
142 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
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ init({ | |
id: "flow", | ||
steps: [ | ||
{ | ||
element: ".target", | ||
targetElement: ".target", | ||
title: "Hello", | ||
}, | ||
], | ||
|
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,19 @@ | ||
<!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> | ||
<button class="start-flow">Start flow</button> | ||
|
||
<div | ||
style="background-color: grey; width: 20px; height: 20px; margin: 40px" | ||
class="target" | ||
></div> | ||
|
||
<script type="module" src="./frequency.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,58 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("should show up only once by default", async ({ page }) => { | ||
await page.goto("/frequency/frequency.html"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.locator(".flows-finish").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
}); | ||
test("should show up only once with frequency once", async ({ page }) => { | ||
await page.goto("/frequency/frequency.html?frequency=once"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.locator(".flows-finish").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
}); | ||
test("should show up multiple times when frequency is every time", async ({ page }) => { | ||
await page.goto("/frequency/frequency.html?frequency=every-time"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.locator(".flows-finish").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
}); | ||
test("should show up again when page is reloaded", async ({ page }) => { | ||
await page.goto("/frequency/frequency.html"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.locator(".flows-finish").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.reload(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
}); | ||
test("should not show up again when seenFlows are saved to localStorage", async ({ page }) => { | ||
await page.goto("/frequency/frequency.html?saveSeenFlows=true"); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await page.locator(".flows-finish").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
await page.reload(); | ||
await page.locator(".start-flow").click(); | ||
await expect(page.locator(".flows-tooltip")).toBeHidden(); | ||
}); |
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,29 @@ | ||
import { Flow, FlowsOptions, init } from "@flows/js"; | ||
|
||
const frequency = new URLSearchParams(window.location.search).get("frequency") as Flow["frequency"]; | ||
const saveSeenFlows = new URLSearchParams(window.location.search).get("saveSeenFlows") === "true"; | ||
|
||
const flow: Flow = { | ||
element: ".start-flow", | ||
id: "flow", | ||
|
||
steps: [ | ||
{ | ||
targetElement: ".target", | ||
title: "Hello", | ||
}, | ||
], | ||
}; | ||
if (frequency) flow.frequency = frequency as Flow["frequency"]; | ||
|
||
const options: FlowsOptions = { | ||
flows: [flow], | ||
}; | ||
|
||
if (saveSeenFlows) { | ||
options.seenFlows = JSON.parse(localStorage.getItem("flows-seen-flows") ?? "[]"); | ||
options.onSeenFlowsChange = (seenFlows) => | ||
localStorage.setItem("flows-seen-flows", JSON.stringify(seenFlows)); | ||
} | ||
|
||
init(options); |
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
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
Oops, something went wrong.