Skip to content

Commit 6bac055

Browse files
Merge pull request #11 from py-dev-nandini-12/feature/e2e-after-vercel-deployment
new workflow to run e2e after deployment
2 parents 221be87 + fe43783 commit 6bac055

File tree

5 files changed

+48
-74
lines changed

5 files changed

+48
-74
lines changed

.github/workflows/e2e-corn.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,8 @@ jobs:
2222
- name: Checkout repository
2323
uses: actions/checkout@v4
2424

25-
- name: Install Node.js
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: 22
29-
30-
- name: Install Playwright
31-
run: npx exec playwright install --with-deps
25+
- name: Install dependencies
26+
run: npm ci && npx playwright install --with-deps
3227

3328
- name: Run E2E tests
3429
env:

.github/workflows/e2e.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Playwright Tests
2+
3+
on:
4+
deployment_status:
5+
6+
jobs:
7+
run-e2es:
8+
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Install dependencies
15+
run: npm ci && npx playwright install --with-deps
16+
17+
- name: Run Playwright tests
18+
env:
19+
BASE_URL: ${{ github.event.deployment_status.environment_url }}
20+
run: npx playwright test
21+
22+
- name: Upload Playwright Report
23+
uses: actions/upload-artifact@v4
24+
if: always()
25+
with:
26+
name: playwright-report
27+
path: playwright-report/
28+
retention-days: 7
29+
30+
- name: GitHub Notification
31+
if: failure()
32+
uses: actions/github-script@v6
33+
with:
34+
script: |
35+
github.issues.createComment({
36+
issue_number: 1,
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
body: "🚨 Playwright tests failed after deployment!"
40+
});

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ yarn-error.log*
3939
# typescript
4040
*.tsbuildinfo
4141
next-env.d.ts
42+
43+
playwright-report

playwright.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ export default defineConfig({
66
port: 3000,
77
reuseExistingServer: true,
88
},
9+
reporter: [
10+
['list'],
11+
['html', { outputFolder: 'playwright-report' }]
12+
],
913
});

src/app/form/page.tsx

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,3 @@
1-
// 'use client';
2-
3-
// import { useState } from 'react';
4-
5-
// export default function Form() {
6-
// const [name, setName] = useState('');
7-
// const [email, setEmail] = useState('');
8-
// const [message, setMessage] = useState('');
9-
// const [loading, setLoading] = useState(false);
10-
// const [error, setError] = useState('');
11-
12-
// const handleSubmit = async (e: React.FormEvent) => {
13-
// e.preventDefault();
14-
// setLoading(true);
15-
// setMessage('');
16-
// setError('');
17-
18-
// try {
19-
// const res = await fetch('/api/submit', {
20-
// method: 'POST',
21-
// headers: { 'Content-Type': 'application/json' },
22-
// body: JSON.stringify({ name, email }),
23-
// });
24-
25-
// if (!res.ok) throw new Error('Failed to submit');
26-
// const data = await res.json();
27-
// setMessage(data.message);
28-
// } catch {
29-
// setError('Submission failed. Please try again.');
30-
// } finally {
31-
// setLoading(false);
32-
// }
33-
// };
34-
35-
// const handleReset = () => {
36-
// setName('');
37-
// setEmail('');
38-
// setMessage('');
39-
// setError('');
40-
// };
41-
42-
// return (
43-
// <div>
44-
// <h1>Form Page</h1>
45-
// <form onSubmit={handleSubmit}>
46-
// <input
47-
// type="text"
48-
// placeholder="Enter your name"
49-
// value={name}
50-
// onChange={(e) => setName(e.target.value)}
51-
// />
52-
// <input
53-
// type="email"
54-
// placeholder="Enter your email"
55-
// value={email}
56-
// onChange={(e) => setEmail(e.target.value)}
57-
// />
58-
// <button type="submit" disabled={loading}>
59-
// {loading ? 'Submitting...' : 'Submit'}
60-
// </button>
61-
// <button type="button" onClick={handleReset}>Reset</button>
62-
// </form>
63-
// {message && <p style={{ color: 'green' }}>{message}</p>}
64-
// {error && <p style={{ color: 'red' }}>{error}</p>}
65-
// </div>
66-
// );
67-
// }
681

692

703
'use client';

0 commit comments

Comments
 (0)