Skip to content

Commit 93cb0ce

Browse files
Merge pull request #161 from laravel/pest-ci
Integrate PestPHP 4 Browser Tests
2 parents d81539e + 7c3ed0d commit 93cb0ce

File tree

14 files changed

+87
-15
lines changed

14 files changed

+87
-15
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88

99
CHANGELOG.md export-ignore
1010
README.md export-ignore
11+
.github/workflows/browser-test.yml export-ignore
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: browser-tests
2+
3+
on:
4+
push:
5+
branches:
6+
- pest-ci
7+
- develop
8+
- main
9+
pull_request:
10+
branches:
11+
- pest-ci
12+
- develop
13+
- main
14+
15+
jobs:
16+
ci:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: 8.4
27+
tools: composer:v2
28+
coverage: xdebug
29+
30+
- name: Setup Node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: '22'
34+
cache: 'npm'
35+
36+
- name: Install Node Dependencies
37+
run: npm ci
38+
39+
- name: Install Playwright Dependencies
40+
run: npm install playwright@latest
41+
42+
- name: Install Playwright Browsers
43+
run: npx playwright install --with-deps
44+
45+
- name: Add `laravel-labs/starter-kit-browser-tests` Repository
46+
run: |
47+
composer config repositories.browser-tests '{"type": "vcs", "url": "https://github.com/laravel-labs/starter-kit-browser-tests"}' --file composer.json
48+
composer remove "phpunit/phpunit" --dev --no-update
49+
composer require "laravel-labs/starter-kit-browser-tests:dev-main@dev" --dev --no-update
50+
51+
- name: Install Dependencies
52+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
53+
54+
- name: Copy Environment File
55+
run: cp .env.example .env
56+
57+
- name: Generate Application Key
58+
run: php artisan key:generate
59+
60+
- name: Setup Test Environment
61+
run: |
62+
cp vendor/laravel-labs/starter-kit-browser-tests/phpunit.xml.dist .
63+
rm phpunit.xml
64+
rm -Rf tests/
65+
cp -rf vendor/laravel-labs/starter-kit-browser-tests/tests/ tests/
66+
67+
- name: Build Assets
68+
run: npm run build
69+
70+
- name: Tests
71+
run: php vendor/bin/pest

resources/js/components/delete-user.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function DeleteUser() {
2222

2323
<Dialog>
2424
<DialogTrigger asChild>
25-
<Button variant="destructive">Delete account</Button>
25+
<Button variant="destructive" data-test="delete-user-button">Delete account</Button>
2626
</DialogTrigger>
2727
<DialogContent>
2828
<DialogTitle>Are you sure you want to delete your account?</DialogTitle>
@@ -67,7 +67,7 @@ export default function DeleteUser() {
6767
</DialogClose>
6868

6969
<Button variant="destructive" disabled={processing} asChild>
70-
<button type="submit">Delete account</button>
70+
<button type="submit" data-test="confirm-delete-user-button">Delete account</button>
7171
</Button>
7272
</DialogFooter>
7373
</>

resources/js/components/user-menu-content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function UserMenuContent({ user }: UserMenuContentProps) {
3737
</DropdownMenuGroup>
3838
<DropdownMenuSeparator />
3939
<DropdownMenuItem asChild>
40-
<Link className="block w-full" href={logout()} as="button" onClick={handleLogout}>
40+
<Link className="block w-full" href={logout()} as="button" onClick={handleLogout} data-test="logout-button">
4141
<LogOut className="mr-2" />
4242
Log out
4343
</Link>

resources/js/layouts/settings/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Heading from '@/components/heading';
22
import { Button } from '@/components/ui/button';
33
import { Separator } from '@/components/ui/separator';
44
import { cn } from '@/lib/utils';
5-
import { appearance } from '@/routes';
5+
import { edit as editAppearance } from '@/routes/appearance';
66
import { edit as editPassword } from '@/routes/password';
77
import { edit } from '@/routes/profile';
88
import { type NavItem } from '@/types';
@@ -22,7 +22,7 @@ const sidebarNavItems: NavItem[] = [
2222
},
2323
{
2424
title: 'Appearance',
25-
href: appearance(),
25+
href: editAppearance(),
2626
icon: null,
2727
},
2828
];

resources/js/pages/auth/confirm-password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function ConfirmPassword() {
2626
</div>
2727

2828
<div className="flex items-center">
29-
<Button className="w-full" disabled={processing}>
29+
<Button className="w-full" disabled={processing} data-test="confirm-password-button">
3030
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
3131
Confirm password
3232
</Button>

resources/js/pages/auth/forgot-password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function ForgotPassword({ status }: { status?: string }) {
3030
</div>
3131

3232
<div className="my-6 flex items-center justify-start">
33-
<Button className="w-full" disabled={processing}>
33+
<Button className="w-full" disabled={processing} data-test="email-password-reset-link-button">
3434
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
3535
Email password reset link
3636
</Button>

resources/js/pages/auth/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function Login({ status, canResetPassword }: LoginProps) {
6666
<Label htmlFor="remember">Remember me</Label>
6767
</div>
6868

69-
<Button type="submit" className="mt-4 w-full" tabIndex={4} disabled={processing}>
69+
<Button type="submit" className="mt-4 w-full" tabIndex={4} disabled={processing} data-test="login-button">
7070
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
7171
Log in
7272
</Button>

resources/js/pages/auth/register.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export default function Register() {
8080
<InputError message={errors.password_confirmation} />
8181
</div>
8282

83-
<Button type="submit" className="mt-2 w-full" tabIndex={5}>
83+
<Button type="submit" className="mt-2 w-full" tabIndex={5} data-test="register-user-button">
8484
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
8585
Create account
8686
</Button>

resources/js/pages/auth/reset-password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) {
5858
<InputError message={errors.password_confirmation} className="mt-2" />
5959
</div>
6060

61-
<Button type="submit" className="mt-4 w-full" disabled={processing}>
61+
<Button type="submit" className="mt-4 w-full" disabled={processing} data-test="reset-password-button">
6262
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
6363
Reset password
6464
</Button>

0 commit comments

Comments
 (0)