This project uses Playwright and TypeScript to automate end-to-end tests for the login functionality at the-internet.herokuapp.com/login. Tests are generated and managed using the playwright-test-generator and follow best practices with page objects and a base page for common elements.
- Positive and negative login scenarios
- Page Object Model:
BasePage,LoginPage,SecureAreaPage - Automatic screenshots and video recording for all tests
- Tests for login, logout, and error handling
- Seed file for consistent test setup
- Playwright Overview
- Playwright Test Runner
- Playwright Configuration
- Page Object Model
- Screenshots
- Video Recording
- HTML Reporter
- Trace Viewer
- Playwright with TypeScript
- Playwright Test Generator (Codegen)
- base.page.ts: Common elements and helpers
- login.page.ts: Login form actions and assertions
- secure-area.page.ts: Secure area actions and assertions
- login-positive.spec.ts: Positive login/logout flow
- login-negative.spec.ts: Negative login scenarios
- seed.spec.ts: Seed test for logged-in user
- playwright.config.ts: Playwright configuration (screenshots, video, etc.)
- login.plan.md: Test plan
-
Install dependencies:
npm install
-
Run all tests:
npx playwright test -
View HTML report:
npx playwright show-report
- Screenshots are captured for every test (
screenshot: 'on') - Video is recorded for every test (
video: 'on') - All configuration is in playwright.config.ts
- Update page objects in pages for new elements or flows
- Add new test scenarios in login.plan.md and generate tests
"Using Playwright and playwright-test-planner, outline positive and negative test cases for https://the-internet.herokuapp.com/login
- "Go to https://the-internet.herokuapp.com/login and check that the title is "Login Page".
- "Login as tomsmith / SuperSecretPassword!
- "Once on Secure Area, select the Logout button and make sure that when back on the Login Page, that "You logged out of the secure area!" appears".
"Using Playwright + TypeScript and playwright-test-generator, generate the tests for specs/login.plan.md. Refactor locators into page objects, and common elements into a base page".
- Run tests
- Can you do screenshots at the end whether it passed or failed?
- Can we turn on video when debugging?
- Turn video on all the time
- Change this.heading = page.getByRole('heading', { name: 'Secure Area' }); to "h2".
- Generate a README based on the prompts mentioned
- Add in the prompts used to the README