-
-
Couldn't load subscription status.
- Fork 173
Adding E2E tests for my-posts page Part 1 #1187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
NiallJoeMaher
merged 8 commits into
codu-code:develop
from
JohnAllenTech:chore/adding-my-posts-e2e-tests
Nov 1, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0807ad5
chore: added tests for my posts page
JohnAllenTech fd35856
chore: pre pr cleanup
JohnAllenTech 250dff5
chore: moving some constants from around the test suite into a consta…
JohnAllenTech 5a8f459
chore: implementing the bots suggestions
JohnAllenTech aea9ff4
Merge branch 'develop' into chore/adding-my-posts-e2e-tests
JohnAllenTech 7e9eec4
chore: merged develop
JohnAllenTech 760b448
chore: merged develop
JohnAllenTech 8222755
chore: resolving merge issues
JohnAllenTech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,15 +1,56 @@ | ||
| import test from "@playwright/test"; | ||
| import { loggedInAsUserOne } from "./utils"; | ||
| import test, { expect } from "@playwright/test"; | ||
| import { articleExcerpt, loggedInAsUserOne } from "./utils"; | ||
|
|
||
| test.describe("Unauthenticated my-posts Page", () => { | ||
| // | ||
| // Replace with tests for unauthenticated users | ||
| test("Unauthenticated users should be redirected to get-started page if they access my-posts directly", async ({ | ||
| page, | ||
| }) => { | ||
| await page.goto("http://localhost:3000/my-posts"); | ||
| await page.waitForURL("http://localhost:3000/get-started"); | ||
| expect(page.url()).toEqual("http://localhost:3000/get-started"); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe("Authenticated my-posts Page", () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await loggedInAsUserOne(page); | ||
| }); | ||
| // | ||
| // Replace with tests for authenticated users | ||
|
|
||
| test("Tabs for different type of posts should be visible", async ({ | ||
| page, | ||
| }) => { | ||
| await page.goto("http://localhost:3000/my-posts"); | ||
|
|
||
| await expect(page.getByRole("link", { name: "Drafts" })).toBeVisible(); | ||
| await expect(page.getByRole("link", { name: "Scheduled" })).toBeVisible(); | ||
| await expect(page.getByRole("link", { name: "Published" })).toBeVisible(); | ||
| }); | ||
|
|
||
| test("Different article tabs should correctly display articles matching that type", async ({ | ||
| page, | ||
| }) => { | ||
| await page.goto("http://localhost:3000/my-posts"); | ||
|
|
||
| await expect(page.getByRole("link", { name: "Drafts" })).toBeVisible(); | ||
| await expect(page.getByRole("link", { name: "Scheduled" })).toBeVisible(); | ||
| await expect(page.getByRole("link", { name: "Published" })).toBeVisible(); | ||
|
|
||
| await page.getByRole("link", { name: "Drafts" }).click(); | ||
| await expect( | ||
| page.getByRole("heading", { name: "Draft Article" }), | ||
| ).toBeVisible(); | ||
| await expect(page.getByText(articleExcerpt)).toBeVisible(); | ||
|
|
||
| await page.getByRole("link", { name: "Scheduled" }).click(); | ||
| await expect( | ||
| page.getByRole("heading", { name: "Scheduled Article" }), | ||
| ).toBeVisible(); | ||
| await expect(page.getByText(articleExcerpt)).toBeVisible(); | ||
|
|
||
| await page.getByRole("link", { name: "Published" }).click(); | ||
| await expect( | ||
| page.getByRole("heading", { name: "Published Article" }), | ||
| ).toBeVisible(); | ||
| await expect(page.getByText(articleExcerpt, { exact: true })).toBeVisible(); | ||
| }); | ||
| }); | ||
This file contains hidden or 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 hidden or 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,4 @@ | ||
| export const articleContent = | ||
| "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae ipsum id metus vestibulum rutrum eget a diam. Integer eget vulputate risus, ac convallis nulla. Mauris sed augue nunc. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam congue posuere tempor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut ac augue non libero ullamcorper ornare. Ut commodo ligula vitae malesuada maximus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam sagittis justo non justo placerat, a dapibus sapien volutpat. Nullam ullamcorper sodales justo sed."; | ||
|
|
||
| export const articleExcerpt = "Lorem ipsum dolor sit amet"; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export * from "./utils"; | ||
| export * from "./constants"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.