-
Notifications
You must be signed in to change notification settings - Fork 0
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
57990a6
commit cec78d6
Showing
5 changed files
with
437 additions
and
20 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,52 @@ | ||
import { clerkSetup, setupClerkTestingToken } from "@clerk/testing/playwright"; | ||
Check failure on line 1 in apps/nextjs/tests-e2e/tests/aila-chat/downloads.test.ts GitHub Actions / test-e2e[public] › tests/aila-chat/downloads.test.ts:9:5 › Downloading a completed lesson plan
|
||
import { test, expect } from "@playwright/test"; | ||
|
||
import { TEST_BASE_URL } from "../../config/config"; | ||
import { prepareUser } from "../../helpers/auth"; | ||
import { bypassVercelProtection } from "../../helpers/vercel"; | ||
import { isFinished } from "./helpers"; | ||
|
||
test("Downloading a completed lesson plan", async ({ page }) => { | ||
await test.step("Setup", async () => { | ||
await clerkSetup(); | ||
await bypassVercelProtection(page); | ||
await setupClerkTestingToken({ page }); | ||
|
||
await prepareUser(page, "typical"); | ||
|
||
await page.goto(`${TEST_BASE_URL}/aila/e2e-seed-typical-chat`); | ||
await isFinished(page); | ||
}); | ||
|
||
await test.step("Go to downloads page", async () => { | ||
// Open 'download resources' menu | ||
const downloadResources = page.getByTestId("chat-download-resources"); | ||
await downloadResources.click(); | ||
page.waitForURL(/\aila\/.*\/download/); | ||
page.getByRole("heading", { name: "Download resources" }); | ||
|
||
// Click to download lesson plan | ||
const downloadLessonPlan = page.getByTestId("chat-download-lesson-plan"); | ||
await downloadLessonPlan.click(); | ||
|
||
// Skip feedback form | ||
if (await page.getByLabel("Skip").isVisible()) { | ||
await page.getByLabel("Skip").click(); | ||
} else { | ||
console.log("Feedback form not found"); | ||
} | ||
|
||
// Generating | ||
await expect(downloadLessonPlan).toContainText( | ||
"Generating Lesson plan for export", | ||
); | ||
|
||
// Generated | ||
await expect(downloadLessonPlan).toContainText( | ||
"Download lesson plan (.docx)", | ||
); | ||
await expect(downloadLessonPlan).toContainText( | ||
"Download Lesson plan (.pdf)", | ||
); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { prisma } from "@oakai/db"; | ||
|
||
import { typicalChat } from "./typical"; | ||
|
||
export const seedChat = async (userId: string) => { | ||
const id = `e2e-typical-user${userId}`; | ||
await prisma.appSession.upsert({ | ||
where: { | ||
id, | ||
}, | ||
create: { | ||
id, | ||
appId: "lesson-planner", | ||
userId: userId, | ||
output: typicalChat, | ||
}, | ||
update: { | ||
output: typicalChat, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.