Skip to content
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

ci: configure gitHub actions to run tests after pr merge #24

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: E2E tests
name: Unit Tests & E2E

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

jobs:
test:
timeout-minutes: 60
Expand All @@ -17,9 +17,18 @@ jobs:
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
- name: Run Unit & Integration Tests with Coverage
run: npm run test:cov
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 30
- name: Run Playwright E2E Tests
run: npx playwright test
- uses: actions/upload-artifact@v4
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
exports[`RecommendedVideoCard should matches snapshot 1`] = `
<DocumentFragment>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root custom-class css-1d48sfh-MuiPaper-root-MuiCard-root-RecommendedVideoCardContainer-root"
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root custom-class css-18r2xxk-MuiPaper-root-MuiCard-root-RecommendedVideoCardContainer-root"
data-testid="recommended-video-card"
style="--Paper-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2),0px 1px 1px 0px rgba(0,0,0,0.14),0px 1px 3px 0px rgba(0,0,0,0.12);"
style="--Paper-shadow: var(--mui-shadows-1); --Paper-overlay: var(--mui-overlays-1);"
>
<div
class="MuiCardContent-root css-1lt5qva-MuiCardContent-root"
Expand All @@ -25,13 +25,13 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
class="video-detail MuiBox-root css-0"
>
<div
class="MuiTypography-root MuiTypography-h5 css-16xl4zq-MuiTypography-root"
class="MuiTypography-root MuiTypography-h5 css-1ayj0vs-MuiTypography-root"
title="Sample Video Title"
>
Sample Video Title
</div>
<p
class="MuiTypography-root MuiTypography-body2 date-time css-7ctihp-MuiTypography-root"
class="MuiTypography-root MuiTypography-body2 date-time css-ljgvyt-MuiTypography-root"
data-testid="date-time"
>
Jan 01, 2024
Expand All @@ -41,7 +41,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
</p>
<span
aria-label="4 Stars"
class="MuiRating-root MuiRating-sizeSmall Mui-readOnly MuiRating-readOnly css-mrxd2j-MuiRating-root"
class="MuiRating-root MuiRating-sizeSmall Mui-readOnly MuiRating-readOnly css-1ynetyc-MuiRating-root"
role="img"
>
<span>
Expand All @@ -50,7 +50,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1ckov0h-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"
data-testid="StarIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -67,7 +67,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1ckov0h-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"
data-testid="StarIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -84,7 +84,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1ckov0h-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"
data-testid="StarIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -101,7 +101,7 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1ckov0h-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"
data-testid="StarIcon"
focusable="false"
viewBox="0 0 24 24"
Expand All @@ -114,11 +114,11 @@ exports[`RecommendedVideoCard should matches snapshot 1`] = `
</span>
<span>
<span
class="MuiRating-icon MuiRating-iconEmpty css-9xw0na-MuiRating-icon"
class="MuiRating-icon MuiRating-iconEmpty css-h06ynj-MuiRating-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1ckov0h-MuiSvgIcon-root"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-8hoymy-MuiSvgIcon-root"
data-testid="StarIcon"
focusable="false"
viewBox="0 0 24 24"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { customRender as render, screen } from "@/jest/utils/testUtils";

import RecommendedVideoCard from "./recommendedVideoCard";
import { RecommendedVideoCardProps } from "./types";
Expand Down
16 changes: 16 additions & 0 deletions src/jest/utils/testUtils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React, { ReactElement } from "react";

import "@testing-library/jest-dom";
import { render, RenderOptions } from "@testing-library/react";

import ThemeProvider from "@/components/theme/theme-provider";

const customRender = (ui: ReactElement, options?: Omit<RenderOptions, "wrapper">) =>
render(ui, {
wrapper: ({ children }) => <ThemeProvider>{children}</ThemeProvider>,
...options,
});

export * from "@testing-library/react";

export { customRender };