From 853c3a7334d98829a680244df744c109c5424dca Mon Sep 17 00:00:00 2001 From: Tanushree Ganju Date: Thu, 11 Jun 2026 22:24:07 +0530 Subject: [PATCH 1/6] Add employer login test cases TC3, TC4, TC5, TC6, TC7 --- pages/AvuaEmployerPage.ts | 1 + tests/employerLogin.spec.ts | 94 +++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 tests/employerLogin.spec.ts diff --git a/pages/AvuaEmployerPage.ts b/pages/AvuaEmployerPage.ts index 48d5b0f..ffb7eac 100644 --- a/pages/AvuaEmployerPage.ts +++ b/pages/AvuaEmployerPage.ts @@ -9,6 +9,7 @@ export class AvuaEmployerPage { readonly publishButton: Locator; currentJobTitle: string = ""; + constructor(page: Page) { this.page = page; this.postJobButton = page.getByRole('button', { name: /Post a Job/i }).first(); diff --git a/tests/employerLogin.spec.ts b/tests/employerLogin.spec.ts new file mode 100644 index 0000000..5ca83b7 --- /dev/null +++ b/tests/employerLogin.spec.ts @@ -0,0 +1,94 @@ +import { test, expect } from '@playwright/test'; +import { AvuaEmployerPage } from '../pages/AvuaEmployerPage'; + +const EMAIL = 'pranjil+test@avua.com'; +const PASS = 'Test@123'; + +test('AEP_01 - Valid login redirects to dashboard', async ({ page }) => { + const employer = new AvuaEmployerPage(page); + await employer.login(EMAIL, PASS); + await expect(page).toHaveURL(/\/employer\/dashboard/i); +}); + +test('TC3 - Sign-in is not clickable when email and password are empty', async ({ page }) => { + await page.goto('/employer-login'); + + // Switch to Password tab + const passwordTab = page.getByRole('button', { name: 'Password' }).first(); + await passwordTab.click(); + + // Try to click Sign in while fields are empty + const signInButton = page.getByRole('button', { name: 'Sign in' }); + await expect(signInButton).toBeDisabled(); +}); + +test('TC4 - Success message is shown and OTP is requested when valid email is submitted', async ({ page }) => { + await page.goto('/employer-login'); + + // Click One-time code tab + const otpTab = page.getByRole('button', { name: 'One-time code' }).first(); + await otpTab.click(); + + // Enter valid work email in "you@company.com" field + const emailInput = page.getByPlaceholder('you@company.com'); + await emailInput.fill('pranjil+test@avua.com'); + + // Click Send sign-in code button + const sendCodeBtn = page.getByRole('button', { name: 'Send sign-in code' }); + await sendCodeBtn.click(); + + // Verify success message is shown + await expect(page.getByText('One-time code sent successfully!')).toBeVisible(); + await expect(page.getByText(/We've sent an one-time code to your email/i)).toBeVisible(); +}); + +test('TC5 - Displays user doesnt exist when unregistered email is entered', async ({ page }) => { + await page.goto('/employer-login'); + + // Click One-time code tab + const otpTab = page.getByRole('button', { name: 'One-time code' }).first(); + await otpTab.click(); + + // Enter invalid/unregistered email (must have valid format to click button) + const emailInput = page.getByPlaceholder('you@company.com'); + await emailInput.fill('user@company.com'); + + // Click Send sign-in code button + const sendCodeBtn = page.getByRole('button', { name: 'Send sign-in code' }); + await sendCodeBtn.click(); + + // Displays user doesn't exist + await expect(page.getByText(/user does not exist/i)).toBeVisible(); +}); + +test('TC6 - Send sign-in code button is disabled when email field is empty', async ({ page }) => { + await page.goto('/employer-login'); + + // Click One-time code tab + const otpTab = page.getByRole('button', { name: 'One-time code' }).first(); + await otpTab.click(); + + // Leave "you@company.com" field empty + const emailInput = page.getByPlaceholder('you@company.com'); + await expect(emailInput).toBeEmpty(); + + // Verify Send sign-in code button is disabled + const sendCodeBtn = page.getByRole('button', { name: 'Send sign-in code' }); + await expect(sendCodeBtn).toBeDisabled(); +}); + +test('TC7 - Employer is redirected to forgot password page when clicking Forgot password link', async ({ page }) => { + await page.goto('/employer-login'); + + // Click Password tab + const passwordTab = page.getByRole('button', { name: 'Password' }).first(); + await passwordTab.click(); + + // Click "Forgot password?" link (it is rendered as text/button, not an link) + const forgotPasswordBtn = page.getByText('Forgot password?'); + await forgotPasswordBtn.click(); + + // Employer is redirected to forgot password page (rendered within same URL path) + await expect(page.getByText('Reset password in two quick steps')).toBeVisible(); + await expect(page.getByRole('button', { name: 'Reset password' })).toBeVisible(); +}); \ No newline at end of file From 4fdf0a80f80f464aa9df8ad5784c46c40a3d1799 Mon Sep 17 00:00:00 2001 From: Aakarshit Sharma Date: Sat, 13 Jun 2026 13:20:27 +0530 Subject: [PATCH 2/6] fix(playwright): update login email, rename test prefixes to TC, remove missing global applicants option --- pages/AvuaEmployerPage.ts | 3 +-- tests/employerJobPost.spec.ts | 2 +- tests/employerLogin.spec.ts | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pages/AvuaEmployerPage.ts b/pages/AvuaEmployerPage.ts index ffb7eac..ae858ce 100644 --- a/pages/AvuaEmployerPage.ts +++ b/pages/AvuaEmployerPage.ts @@ -85,8 +85,7 @@ export class AvuaEmployerPage { await cityInput.fill('New York City'); // Global applications - const globalBtn = this.page.getByRole('button', { name: /Yes, allow global applicants/i }).first(); - await globalBtn.click(); + // (This option seems to have been removed from the UI) } async injectReactStateOverrides(amount = 100, contractLength = "6", jobTitle?: string): Promise { diff --git a/tests/employerJobPost.spec.ts b/tests/employerJobPost.spec.ts index 6947d0d..6a63f75 100644 --- a/tests/employerJobPost.spec.ts +++ b/tests/employerJobPost.spec.ts @@ -13,7 +13,7 @@ test.describe('Employer Job Posting Flow', () => { test('should successfully post a contract job as an employer', async ({ page }) => { const employerPage = new AvuaEmployerPage(page); - const email = 'aakarshit.sharma+0@avua.com'; + const email = 'pranjil+test@avua.com'; const password = 'Test@123'; const jobTitle = `Playwright Test Engineer ${Date.now()}`; console.log('--- STARTING TEST ---'); diff --git a/tests/employerLogin.spec.ts b/tests/employerLogin.spec.ts index 5ca83b7..55045ed 100644 --- a/tests/employerLogin.spec.ts +++ b/tests/employerLogin.spec.ts @@ -4,7 +4,7 @@ import { AvuaEmployerPage } from '../pages/AvuaEmployerPage'; const EMAIL = 'pranjil+test@avua.com'; const PASS = 'Test@123'; -test('AEP_01 - Valid login redirects to dashboard', async ({ page }) => { +test('TC1 - Valid login redirects to dashboard', async ({ page }) => { const employer = new AvuaEmployerPage(page); await employer.login(EMAIL, PASS); await expect(page).toHaveURL(/\/employer\/dashboard/i); From f8abde5e7eed8e14af209555973490fcf34a1c28 Mon Sep 17 00:00:00 2001 From: Aakarshit Sharma Date: Sat, 13 Jun 2026 13:27:28 +0530 Subject: [PATCH 3/6] ci: add GitHub Actions workflow for Playwright tests --- .github/workflows/playwright.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/playwright.yml diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000..467190b --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,27 @@ +name: Playwright Tests +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install dependencies + run: npm ci + - name: Install Playwright Browsers + run: npx playwright install --with-deps + - name: Run Playwright tests + run: npx playwright test + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 From 1f56df88939b038b9551be4e950a947f4606331f Mon Sep 17 00:00:00 2001 From: Aakarshit Sharma Date: Sat, 13 Jun 2026 13:30:12 +0530 Subject: [PATCH 4/6] ci: update triggers for all branches and add repository_dispatch --- .github/workflows/playwright.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 467190b..5d8f381 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -1,9 +1,17 @@ name: Playwright Tests on: push: - branches: [ main, master ] + branches: [ '**' ] pull_request: - branches: [ main, master ] + # Runs on PRs to any branch + repository_dispatch: + types: [frontend-pr-update] + workflow_dispatch: + inputs: + frontend_branch: + description: 'Frontend branch to test against (if applicable)' + required: false + default: 'main' jobs: test: timeout-minutes: 60 From 930c7fdebe858930a4d238d764239c8d267c276b Mon Sep 17 00:00:00 2001 From: Aakarshit Sharma Date: Sat, 13 Jun 2026 13:32:35 +0530 Subject: [PATCH 5/6] ci: pin GitHub Actions to full commit SHAs --- .github/workflows/playwright.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 5d8f381..d43b9df 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -17,8 +17,8 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: lts/* - name: Install dependencies @@ -27,7 +27,7 @@ jobs: run: npx playwright install --with-deps - name: Run Playwright tests run: npx playwright test - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 if: always() with: name: playwright-report From 30d7cce62e17a84f03a947692ae8f2a309a73df1 Mon Sep 17 00:00:00 2001 From: Aakarshit Sharma Date: Sat, 13 Jun 2026 13:33:56 +0530 Subject: [PATCH 6/6] ci: honor frontend_branch input in actions/checkout --- .github/workflows/playwright.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index d43b9df..2287dea 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -18,6 +18,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + ref: ${{ github.event.inputs.frontend_branch || github.ref }} - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: lts/*