Skip to content

Commit

Permalink
fix(frontend): ✅ update fullBlogCard to test img src… (#352)
Browse files Browse the repository at this point in the history
* fix(frontend): ✅ update fullBlogCard to test img src instead of visibility

* fix(frontend): 🐛 fix import bug, retries for component testing and run prettier

---------

Co-authored-by: Lucas Tran <lucastran1107@gmail.com>
  • Loading branch information
2 people authored and GitHub committed Apr 22, 2024
1 parent 5dd949d commit 1082d33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/playwright-ct.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: 2,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/convertSatrec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as satellite from "satellite.js";
import { SatRec } from "satellite.js";
import globeData from "@components/homeComponents/files/globe-data.json";
import globeData from "@/components/homeComponents/files/globe-data.json";

// turf needs ts ignore to work with typescript
// @ts-ignore
Expand Down
7 changes: 5 additions & 2 deletions frontend/tests/componentTests/fullblogcard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ test("FullBlogCard renders correctly", async ({ mount }) => {
component.getByText("Mock article content preview text..."),
).toBeVisible();

//Check if the image is visible
await expect(component.getByRole("img")).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();
Expand Down

0 comments on commit 1082d33

Please sign in to comment.