-
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.
feat: mpa session timeout after 15 minutes
- Loading branch information
1 parent
4349a76
commit 15667c8
Showing
11 changed files
with
135 additions
and
36 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,18 @@ | ||
<!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="./multi-page.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,38 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("Resumes flow when page is reopened", async ({ page }) => { | ||
await page.goto("/multi-page/multi-page.html"); | ||
await expect(page.locator(".flows-tooltip")).not.toBeVisible(); | ||
await page.click(".start-flow"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await expect(page.locator(".flows-tooltip")).toContainText("First"); | ||
await page.click(".flows-continue"); | ||
await expect(page.locator(".flows-tooltip")).toContainText("Second"); | ||
await page.goto("/"); | ||
await expect(page.locator(".flows-tooltip")).not.toBeVisible(); | ||
await page.goto("/multi-page/multi-page.html"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await expect(page.locator(".flows-tooltip")).toContainText("Second"); | ||
}); | ||
|
||
test("Doesn't resume flow when page is reopened after timeout", async ({ page }) => { | ||
await page.goto("/multi-page/multi-page.html"); | ||
await expect(page.locator(".flows-tooltip")).not.toBeVisible(); | ||
await page.click(".start-flow"); | ||
await expect(page.locator(".flows-tooltip")).toBeVisible(); | ||
await expect(page.locator(".flows-tooltip")).toContainText("First"); | ||
await page.click(".flows-continue"); | ||
await expect(page.locator(".flows-tooltip")).toContainText("Second"); | ||
await page.evaluate(() => | ||
localStorage.setItem( | ||
"flows.state", | ||
JSON.stringify({ | ||
...JSON.parse(localStorage.getItem("flows.state")!), | ||
expiresAt: new Date(), | ||
}), | ||
), | ||
); | ||
await page.goto("/"); | ||
await page.goto("/multi-page/multi-page.html"); | ||
await expect(page.locator(".flows-tooltip")).not.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,23 @@ | ||
import { init, startFlow } from "@flows/js"; | ||
|
||
init({ | ||
flows: [ | ||
{ | ||
id: "flow", | ||
steps: [ | ||
{ | ||
title: "First", | ||
element: ".target", | ||
}, | ||
{ | ||
title: "Second", | ||
element: ".target", | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
|
||
document.querySelector(".start-flow")?.addEventListener("click", () => { | ||
startFlow("flow"); | ||
}); |
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
Binary file removed
BIN
-190 KB
...s/tracking/tracking.spec.ts-snapshots/Emits-correct-events-1-chromium-linux.png
Binary file not shown.
Binary file removed
BIN
-210 KB
...ts/tracking/tracking.spec.ts-snapshots/Emits-correct-events-1-firefox-linux.png
Binary file not shown.
Binary file removed
BIN
-120 KB
...sts/tracking/tracking.spec.ts-snapshots/Emits-correct-events-1-webkit-linux.png
Binary file not shown.
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 |
---|---|---|
|
@@ -20,5 +20,6 @@ module.exports = { | |
}, | ||
rules: { | ||
"@typescript-eslint/naming-convention": 0, | ||
"no-empty": "off", | ||
}, | ||
}; |
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