-
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.
Merge branch 'main' of https://github.com/NTNU-SmallSat-Lab/outreach-…
- Loading branch information
Showing
23 changed files
with
357 additions
and
51 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,64 @@ | ||
| import { test, expect } from "@playwright/experimental-ct-react"; | ||
| import FullBlogCard from "@/components/fullBlogCard"; | ||
| import { BlogPost } from "@/app/blog/page"; | ||
| import { Enum_Article_Tag } from "@/__generated__/graphql"; | ||
|
|
||
| test("FullBlogCard renders correctly", async ({ mount }) => { | ||
| const mockArticle: BlogPost = { | ||
| key: "mock-key", | ||
| title: "Mock Article Title", | ||
| content: [ | ||
| { | ||
| type: "paragraph", | ||
| children: [ | ||
| { | ||
| type: "text", | ||
| text: "Mock article content preview text...", | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| coverImage: "mock-cover-image.jpg", | ||
| datePublished: "2024-04-13", | ||
| tag: Enum_Article_Tag.Projects, | ||
| slug: "mock-article-slug", | ||
| }; | ||
| // Mount the FullBlogCard component with mock data | ||
| const component = await mount(<FullBlogCard article={mockArticle} />); | ||
|
|
||
| //Check if the component is visible | ||
| await expect(component).toBeVisible(); | ||
|
|
||
| //Check if title is correct | ||
| await expect(component.getByTestId("blogCardLink")).toContainText( | ||
| "Mock Article Title", | ||
| ); | ||
|
|
||
| //Check if preview text for blog is visible | ||
| await expect( | ||
| component.getByText("Mock article content preview text..."), | ||
| ).toBeVisible(); | ||
|
|
||
| //Wait for the image to actually have its src attribute set with the real image URL | ||
| await expect(component.getByRole("img")).toHaveAttribute( | ||
| "src", | ||
| /mock-cover-image\.jpg/, | ||
| ); | ||
|
|
||
| //Check if datePublished is visible | ||
| await expect(component.getByText("April 13, 2024")).toBeVisible(); | ||
|
|
||
| //Check if the tag is correct | ||
| await expect(component.getByTestId("articleTag")).toHaveText("Projects"); | ||
|
|
||
| //Check if the urls on the links are correct | ||
| await expect(component.getByTestId("blogCardLink")).toHaveAttribute( | ||
| "href", | ||
| "/blog/mock-article-slug", | ||
| ); | ||
|
|
||
| await expect(component.getByText("Read more")).toHaveAttribute( | ||
| "href", | ||
| "/blog/mock-article-slug", | ||
| ); | ||
| }); |
Oops, something went wrong.