Skip to content

Commit e03b344

Browse files
add more playwright tests
1 parent 7576352 commit e03b344

14 files changed

Lines changed: 112 additions & 72 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
name: Playwright Tests
22
on:
33
push:
4-
branches: [ main, master ]
4+
branches: [main, master]
55
pull_request:
6-
branches: [ main, master ]
6+
branches: [main, master]
77
jobs:
88
test:
99
timeout-minutes: 60
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-node@v4
14-
with:
15-
node-version: lts/*
16-
- name: Install dependencies
17-
run: npm ci
18-
- name: Install Playwright Browsers
19-
run: npx playwright install --with-deps
20-
- name: Run Playwright tests
21-
run: npx playwright test
22-
- uses: actions/upload-artifact@v4
23-
if: ${{ !cancelled() }}
24-
with:
25-
name: playwright-report
26-
path: playwright-report/
27-
retention-days: 30
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
env:
23+
BASE_URL: https://michaelsavage.ie
24+
- uses: actions/upload-artifact@v4
25+
if: ${{ !cancelled() }}
26+
with:
27+
name: playwright-report
28+
path: playwright-report/
29+
retention-days: 30

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"lint": "biome lint --error-on-warnings ./src",
1111
"prepare": "husky",
1212
"type-check": "tsc --noEmit",
13-
"test": "playwright test"
13+
"test": "playwright test",
14+
"test:ui": "playwright test --ui"
1415
},
1516
"dependencies": {
1617
"@emotion/react": "^11.13.3",

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default defineConfig({
2626
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2727
use: {
2828
/* Base URL to use in actions like `await page.goto('/')`. */
29-
baseURL: 'http://localhost:8888',
29+
baseURL: process.env.BASE_URL || 'http://localhost:8888',
3030

3131
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
3232
trace: 'on-first-retry',

src/components/atoms/Project.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Project = ({ data, selectedTech }: Props) => {
1616

1717
const shouldDim = selectedTech && !data.technology.includes(selectedTech);
1818
return (
19-
<CardWrapper $shouldDim={shouldDim}>
19+
<CardWrapper $shouldDim={shouldDim} data-testid="project-card">
2020
<Card key={id} to={slug}>
2121
<CardTitle main={colors.main}>{title}</CardTitle>
2222
<CardBody bg={colors.bg}>{description}</CardBody>

src/components/molecules/Button/Button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ export const Button = ({
3030
return (
3131
<ButtonStyled
3232
role="button"
33-
data-active={active}
3433
disabled={disabled}
3534
type={type}
3635
onClick={onClick}
3736
variant={variant}
3837
active={active}
38+
data-active={active}
3939
selected={selected}
40+
data-selected={selected}
4041
styles={styles}
4142
>
4243
{text} {icon}

src/components/molecules/Navbar/Navbar.styled.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@ export const StyledLink = styled(Link)`
6666
}
6767
`;
6868

69-
export const Panel = styled.section`
70-
display: flex;
71-
justify-content: center;
72-
flex-direction: row;
73-
`;
74-
7569
export const Icons = styled.div`
7670
display: flex;
7771
flex-direction: row;

src/components/molecules/Navbar/Navbar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@/components/icons";
99
import posthog from "posthog-js";
1010
import { memo } from "react";
11-
import { Header, Icons, Panel, StyledLink } from "./Navbar.styled";
11+
import { Header, Icons, StyledLink } from "./Navbar.styled";
1212

1313
interface Props {
1414
to: string;
@@ -37,7 +37,6 @@ const Navbar = () => {
3737
<NavLink to="/projects" text="Projects" />
3838
<NavLink to="/about" text="About" />
3939
</nav>
40-
<Panel>
4140
<Icons>
4241
<Icon
4342
label="GitHub Profile"
@@ -70,7 +69,6 @@ const Navbar = () => {
7069
isExternal
7170
/>
7271
</Icons>
73-
</Panel>
7472
</Header>
7573
);
7674
};

src/routes/projects/index.lazy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Projects() {
5454
<MetaData title="My Projects" description={description} />
5555
<Container>
5656
<Header>
57-
<p>{description}</p>
57+
<p data-testid="projects-description">{description}</p>
5858
<Group wrap="wrap">
5959
{TECHNOLOGIES.map((tech) => (
6060
<Button

src/styles/routes/blog.styled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Heading = styled.h1`
2323
`)}
2424
`;
2525

26-
export const Page = styled.section`
26+
export const Page = styled.article`
2727
position: relative;
2828
min-height: 80vh;
2929
`;

src/styles/routes/home.styled.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Arrow = styled(ArrowDown)`
2222
cursor: pointer;
2323
`;
2424

25-
export const Section = styled(motion.div)<{
25+
export const Section = styled(motion.section)<{
2626
main?: string;
2727
bg?: string;
2828
}>`

0 commit comments

Comments
 (0)