This project demonstrates web automation on the Daily Finance website (https://dailyfinance.roadtocareer.net/) using Playwright.
The automated workflow includes:
- Visit the site: https://dailyfinance.roadtocareer.net/.
- Register a new user.
- Assert that a congratulatory email is received.
- Save the user information to a JSON file.
- Login with the newly created user and assert that
/userpersists in the URL. - Add 2 items, store the table values in a TXT file, and logout.
- Reset password:
- Retrieve the new password from the email.
- Login again with the updated password.
- Upload a profile image:
- Ensure the image is ≤ 100 KB.
- Verify the upload by asserting that
img srccontains"profileImage".
- Configure CI/CD pipeline and create a cronjob in
playwright.ymlto run every Friday at 11:59 PM.
npm install playwright@latestnpx playwright test npx playwright show-reportnpm i dotenvnpm i @faker-js/fakerAfter login, assert that the /user page persists in the URL:
await expect(page).toHaveURL(/.*\/user/);To verify the congratulatory email, a Google OAuth token is used from Google OAuth Playground. The token is stored as an environment variable so that Playwright can access it during tests:
Authorization: `Bearer ${process.env.GOOGLE_ACCESS_TOKEN}`and to automate the tests in GitHub Actions, we stored the GOOGLE_ACCESS_TOKEN in the actions variable.
- Go to Settings → Secrets and variables → Actions in your repository.
- Add a new secret:
GOOGLE_ACCESS_TOKENwith your token value. - GitHub Actions will automatically inject it as an environment variable for the workflow.
The workflow is configured in .github/workflows/playwright.yml. The cronjob runs every Friday at 11:59 PM.
schedule:
- cron: "59 23 * * 5" # Friday 11:59 PM