Skip to content

Commit c7fc0e5

Browse files
committed
updated
1 parent 0e0440a commit c7fc0e5

7 files changed

Lines changed: 133 additions & 53 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,42 @@ name: Playwright Tests
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: [ main, master ]
66
pull_request:
7-
branches: ["main"]
7+
branches: [ main, master ]
88
schedule:
9-
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
9+
- cron: '*/5 * * * *' # Run every 5 minutes
1010

1111
jobs:
1212
test:
13+
timeout-minutes: 60
1314
runs-on: ubuntu-latest
1415

15-
strategy:
16-
matrix:
17-
node-version: [18.x]
18-
1916
steps:
2017
# 1️⃣ Checkout code
2118
- uses: actions/checkout@v4
2219

23-
# 2️⃣ Setup Node.js (no caching since no package-lock.json)
24-
- name: Setup Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v4
20+
# 2️⃣ Setup Node.js
21+
- uses: actions/setup-node@v4
2622
with:
27-
node-version: ${{ matrix.node-version }}
23+
node-version: lts/*
2824

29-
# 3️⃣ Install dependencies & Playwright browsers
25+
# 3️⃣ Install dependencies
3026
- name: Install dependencies
31-
run: |
32-
npm install
33-
npx playwright install --with-deps
27+
run: npm install
28+
29+
# 4️⃣ Install Playwright browsers
30+
- name: Install Playwright Browsers
31+
run: npx playwright install --with-deps
3432

35-
# 4️⃣ Run Playwright tests (headless, retries, screenshots/videos on failure)
36-
- name: Run Tests
33+
# 5️⃣ Run Playwright tests
34+
- name: Run Playwright tests
3735
run: npx playwright test --reporter=html
3836

39-
# ✅ Optional: you can remove this step if you don't want reports uploaded
40-
# - name: Upload HTML Report
41-
# if: always()
42-
# uses: actions/upload-artifact@v3
43-
# with:
44-
# name: playwright-report
45-
# path: playwright-report/
37+
# 6️⃣ Upload Playwright HTML report (optional)
38+
- uses: actions/upload-artifact@v4
39+
if: ${{ !cancelled() }}
40+
with:
41+
name: playwright-report
42+
path: playwright-report/
43+
retention-days: 30

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "dailyfinance_playwright",
33
"version": "1.0.0",
44
"description": "",
5-
"type": "module",
65
"main": "index.js",
76
"scripts": {},
87
"keywords": [],

pages/ResetPassword.page.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {Page} from '@playwright/test';
2-
import { readLatestEmail } from '../services/Gmail_Read.service';
3-
42

53
export class ResetPassword{
64
constructor(private page:Page){ }

pages/UploadImage.page.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import {Page} from "@playwright/test";
1+
import { Page } from "@playwright/test";
22

3-
export class UploadImage{
4-
constructor(private page:Page){ }
3+
export class UploadImage {
4+
constructor(private page: Page) { }
55

6-
async doUploadImage(imageUrl:string) {
7-
await this.page.getByRole('button', { name: 'account of current user' }).click();
8-
await this.page.getByRole('menuitem', { name: 'Profile' }).click();
9-
await this.page.getByRole('button', { name: 'Edit' }).click();
10-
await this.page.getByRole('button', { name: 'Choose File' }).setInputFiles(imageUrl);
11-
this.page.once('dialog', dialog => {
12-
console.log(`Dialog message: ${dialog.message()}`);
13-
dialog.dismiss().catch(() => {});
14-
});
15-
await this.page.getByRole('button', { name: 'Upload Image' }).click();
16-
await this.page.getByRole('button', { name: 'Update' }).click();
17-
}
6+
async doUploadImage(imageUrl: string) {
7+
await this.page.getByRole('button', { name: 'account of current user' }).click();
8+
await this.page.getByRole('menuitem', { name: 'Profile' }).click();
9+
await this.page.getByRole('button', { name: 'Edit' }).click();
10+
await this.page.getByRole('button', { name: 'Choose File' }).setInputFiles(imageUrl);
11+
this.page.once('dialog', dialog => {
12+
console.log(`Dialog message: ${dialog.message()}`);
13+
dialog.dismiss().catch(() => { });
14+
});
15+
await this.page.getByRole('button', { name: 'Upload Image' }).click();
16+
await this.page.getByRole('button', { name: 'Update' }).click();
17+
}
1818
}

resources/items.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Item Name | Quantity | Amount | Purchase Date | Month | Remarks
2-
Hat | 2 | 5966 | 11/11/2025 | November | This is test remarks for Hat
3-
Shirt | 2 | 5998 | 11/11/2025 | November | This is test remarks for Shirt
2+
Chicken | 2 | 8435 | 11/11/2025 | November | This is test remarks for Chicken
3+
Chair | 2 | 5904 | 11/11/2025 | November | This is test remarks for Chair

resources/userData.json

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,93 @@
142142
"password": "1234",
143143
"phoneNumber": "01905720545",
144144
"address": "34443 Hardy Point"
145+
},
146+
{
147+
"firstName": "Juvenal",
148+
"lastName": "Kuhlman",
149+
"email": "teachercopilot123+706@gmail.com",
150+
"password": "1234",
151+
"phoneNumber": "01905678097",
152+
"address": "18665 Rosalind Turnpike"
153+
},
154+
{
155+
"firstName": "Ryder",
156+
"lastName": "Powlowski",
157+
"email": "teachercopilot123+511@gmail.com",
158+
"password": "1234",
159+
"phoneNumber": "01905223725",
160+
"address": "8368 Reynolds Mill"
161+
},
162+
{
163+
"firstName": "Camden",
164+
"lastName": "Crona",
165+
"email": "teachercopilot123+675@gmail.com",
166+
"password": "1234",
167+
"phoneNumber": "01905800523",
168+
"address": "9071 Ondricka Green"
169+
},
170+
{
171+
"firstName": "Paxton",
172+
"lastName": "Bins",
173+
"email": "teachercopilot123+619@gmail.com",
174+
"password": "1234",
175+
"phoneNumber": "01905515945",
176+
"address": "9573 Murazik Springs"
177+
},
178+
{
179+
"firstName": "Giles",
180+
"lastName": "Daniel",
181+
"email": "teachercopilot123+426@gmail.com",
182+
"password": "1234",
183+
"phoneNumber": "01905657215",
184+
"address": "33668 Abbott Port"
185+
},
186+
{
187+
"firstName": "Kelly",
188+
"lastName": "Smith",
189+
"email": "teachercopilot123+555@gmail.com",
190+
"password": "1234",
191+
"phoneNumber": "01905631394",
192+
"address": "79915 Keebler Rapid"
193+
},
194+
{
195+
"firstName": "Edwardo",
196+
"lastName": "Predovic",
197+
"email": "teachercopilot123+132@gmail.com",
198+
"password": "1234",
199+
"phoneNumber": "01905207699",
200+
"address": "500 Will Ramp"
201+
},
202+
{
203+
"firstName": "Zackery",
204+
"lastName": "Mann-Rippin",
205+
"email": "teachercopilot123+537@gmail.com",
206+
"password": "1234",
207+
"phoneNumber": "01905384716",
208+
"address": "404 S Elm Street"
209+
},
210+
{
211+
"firstName": "Ruben",
212+
"lastName": "Bergstrom",
213+
"email": "teachercopilot123+284@gmail.com",
214+
"password": "1234",
215+
"phoneNumber": "01905230588",
216+
"address": "14948 5th Avenue"
217+
},
218+
{
219+
"firstName": "Graham",
220+
"lastName": "McCullough",
221+
"email": "teachercopilot123+655@gmail.com",
222+
"password": "1234",
223+
"phoneNumber": "01905322445",
224+
"address": "59182 W 5th Street"
225+
},
226+
{
227+
"firstName": "Annabell",
228+
"lastName": "Kertzmann",
229+
"email": "teachercopilot123+672@gmail.com",
230+
"password": "1234",
231+
"phoneNumber": "01905201557",
232+
"address": "6799 Bergnaum Mission"
145233
}
146234
]

tests/1_testPipeline.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import { AddItem } from "../pages/AddItem.page";
99
import { ItemModel } from "../models/ItemModel";
1010
import { ResetPassword } from "../pages/ResetPassword.page";
1111
import * as dotenv from "dotenv";
12-
import fs from 'fs';
13-
import path from 'path';
14-
1512
import { UploadImage } from "../pages/UploadImage.page";
1613
dotenv.config({ override: true });
1714

@@ -27,9 +24,6 @@ test.describe.serial("User Registration", async () => {
2724
await page.close();
2825
})
2926

30-
const userDataPath = path.resolve('./resources/userData.json');
31-
const userData = JSON.parse(fs.readFileSync(userDataPath, 'utf-8'));
32-
3327
test("Create New User", async () => {
3428
await page.goto("https://dailyfinance.roadtocareer.net/");
3529

@@ -46,7 +40,9 @@ test.describe.serial("User Registration", async () => {
4640
await registerUser.userRegistration(person);
4741

4842
saveJsonData(person, "./resources/userData.json");
49-
await page.waitForTimeout(5000);
43+
// saveEnv("userEmail", person.email);
44+
// saveEnv("userPassword", person.password);
45+
await page.waitForTimeout(10000);
5046
let latestEmail = await readLatestEmail();
5147
console.log(latestEmail);
5248
expect(latestEmail).toContain("Welcome to our platform");
@@ -108,20 +104,21 @@ test.describe.serial("User Registration", async () => {
108104
await page.waitForTimeout(5000);
109105
let lastEmail = await readLatestEmail();
110106
console.log(lastEmail);
111-
await page.waitForTimeout(5000);
107+
112108
const urlRegex = /(https?:\/\/[^\s]+)/;
113109
const match = lastEmail.match(urlRegex);
114110

115111
if (match) {
116112
const resetUrl = new URL(match[0]);
117113
console.log("Navigating to:", resetUrl);
118114
await page.goto(resetUrl.href, { waitUntil: "domcontentloaded" });
119-
const newPassword = "newPassword";
115+
const newPassword = "4321";
120116
saveEnv("userPassword", newPassword);
121117
await reset.doInputNewPassword(newPassword);
122118
} else {
123119
throw new Error("No reset link found in email");
124120
}
121+
await page.waitForTimeout(10000);
125122
})
126123

127124
test("User can upload image", async () => {

0 commit comments

Comments
 (0)