-
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
dc0de18
commit cee1395
Showing
11 changed files
with
224 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { faker } from "@faker-js/faker"; | ||
import { CourseData } from "./utils/types/test-types"; | ||
|
||
export const e2eCourses: CourseData[] = [ | ||
{ | ||
title: "For E2E Testing", | ||
description: "DO NOT DELETE THIS COURSE", | ||
state: "published", | ||
priceInCents: 9900, | ||
category: "E2E Testing", | ||
imageUrl: faker.image.urlPicsumPhotos(), | ||
lessons: [ | ||
{ | ||
title: "E2E Testing Lesson", | ||
description: "E2E Testing Lesson Description", | ||
state: "published", | ||
items: [ | ||
{ | ||
type: "text_block", | ||
title: "E2E Testing Text Block", | ||
body: "E2E Testing Text Block Body", | ||
state: "published", | ||
}, | ||
{ | ||
type: "question", | ||
questionType: "open_answer", | ||
questionBody: "E2E Testing Question Body", | ||
state: "published", | ||
}, | ||
], | ||
}, | ||
{ | ||
title: "E2E Testing Lesson 2", | ||
description: "E2E Testing Lesson 2 Description", | ||
state: "published", | ||
items: [ | ||
{ | ||
type: "text_block", | ||
title: "E2E Testing Text Block 2", | ||
body: "E2E Testing Text Block 2 Body", | ||
state: "published", | ||
}, | ||
{ | ||
type: "file", | ||
title: "E2E Testing File", | ||
fileType: "external_video", | ||
url: "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", | ||
state: "published", | ||
}, | ||
{ | ||
type: "question", | ||
questionType: "single_choice", | ||
questionBody: "E2E Testing Single Choice Question Body", | ||
state: "published", | ||
}, | ||
], | ||
}, | ||
{ | ||
title: "E2E Testing Lesson 3", | ||
description: "E2E Testing Lesson 3 Description", | ||
state: "published", | ||
items: [ | ||
{ | ||
type: "text_block", | ||
title: "E2E Testing Text Block 3", | ||
body: "E2E Testing Text Block 3 Body", | ||
state: "published", | ||
}, | ||
{ | ||
type: "file", | ||
title: "E2E Testing File 2", | ||
fileType: "external_presentation", | ||
url: "https://res.cloudinary.com/dinpapxzv/raw/upload/v1727104719/presentation_gp0o3d.pptx", | ||
state: "published", | ||
}, | ||
{ | ||
type: "question", | ||
questionType: "multiple_choice", | ||
questionBody: "E2E Testing Multiple Choice Question Body", | ||
state: "published", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]; |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Status } from "src/storage/schema/utils"; | ||
|
||
export const LessonFileType = { | ||
presentation: "Presentation", | ||
external_presentation: "External Presentation", | ||
video: "Video", | ||
external_video: "External Video", | ||
} as const; | ||
|
||
export const QuestionType = { | ||
open_answer: "Open Answer", | ||
single_choice: "Single Choice", | ||
multiple_choice: "Multiple Choice", | ||
} as const; | ||
|
||
export interface CourseData { | ||
title: string; | ||
description: string; | ||
imageUrl?: string; | ||
state: keyof typeof Status; | ||
priceInCents: number; | ||
category: string; | ||
lessons: { | ||
title: string; | ||
description: string; | ||
state: keyof typeof Status; | ||
items: Array< | ||
| { | ||
type: "text_block"; | ||
title: string; | ||
body: string; | ||
state: keyof typeof Status; | ||
} | ||
| { | ||
type: "file"; | ||
title: string; | ||
fileType: keyof typeof LessonFileType; | ||
url: string; | ||
state: keyof typeof Status; | ||
} | ||
| { | ||
type: "question"; | ||
questionType: keyof typeof QuestionType; | ||
questionBody: string; | ||
state: keyof typeof Status; | ||
} | ||
>; | ||
}[]; | ||
} |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
/build | ||
.env | ||
/test-results | ||
**/e2e/.auth |
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,56 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test.describe("course", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/auth/login"); | ||
}); | ||
|
||
test("should find, open and enroll the paid course", async ({ page }) => { | ||
await page.getByLabel("email").fill("[email protected]"); | ||
await page.getByLabel("password").fill("studentpassword"); | ||
await page.getByRole("button", { name: /login/i }).click(); | ||
|
||
await expect(page).toHaveURL("/"); | ||
await expect(page).toHaveTitle(/dashboard/i); | ||
|
||
await page | ||
.getByPlaceholder("Search by name or keyword...") | ||
.fill("For E2E Testing"); | ||
await expect(page.getByRole("button", { name: "Clear All" })).toBeVisible(); | ||
|
||
await page.getByRole("link", { name: "For E2E Testing" }).click(); | ||
await expect(page).toHaveURL( | ||
/course\/[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/ | ||
); | ||
await expect(page.getByText("For E2E Testing")).toBeVisible(); | ||
await expect( | ||
page.getByText("E2E Testing Lesson Description") | ||
).toBeVisible(); | ||
await expect( | ||
page.getByText("E2E Testing Lesson 2 Description") | ||
).toBeVisible(); | ||
await expect( | ||
page.getByText("E2E Testing Lesson 3 Description") | ||
).toBeVisible(); | ||
|
||
await page.getByRole("button", { name: "Enroll" }).click(); | ||
|
||
const stripeFrame = page.frameLocator( | ||
'iframe[title="Secure payment input frame"]' | ||
); | ||
await stripeFrame.locator("#Field-numberInput").fill("4242424242424242"); | ||
await stripeFrame | ||
.locator("#Field-expiryInput") | ||
.fill(`10${new Date().getFullYear() + 1}`); | ||
await stripeFrame.locator("#Field-cvcInput").fill("123"); | ||
await expect(page.getByText(/Buy for/)).toBeVisible(); | ||
|
||
await page.getByRole("button", { name: /Buy for/ }).click(); | ||
|
||
const unenrollButton = page.getByRole("button", { name: "Unenroll" }); | ||
await unenrollButton.waitFor({ state: "visible", timeout: 10000 }); | ||
await expect(unenrollButton).toBeVisible(); | ||
await unenrollButton.click(); | ||
await expect(page.getByRole("button", { name: /Enroll - / })).toBeVisible(); | ||
}); | ||
}); |
File renamed without changes.
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ test.describe("register page", () => { | |
}); | ||
|
||
test("register user", async ({ page }) => { | ||
await page.getByLabel("first name").fill("testname"); | ||
await page.getByLabel("last name").fill("testlastname"); | ||
await page.getByLabel("email").fill("[email protected]"); | ||
await page.getByLabel("password").fill("password"); | ||
|
||
|
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