722b1e78ed
- Introduced Playwright configuration for e2e testing. - Implemented authentication tests to validate login functionality. - Created tests for GRN (Goods Receipt Note) to ensure proper stock handling. - Developed production run tests to verify lifecycle and stock posting. - Added stock transfer tests to check movement between warehouses. - Implemented stock adjustment tests for positive and negative adjustments. - Established API seeder for test data setup and verification. - Enhanced utility functions for UI interactions and response handling.
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { test, expect } from "@playwright/test"
|
|
import { LoginPage } from "../pages/LoginPage"
|
|
import { env } from "../support/env"
|
|
|
|
// Runs unauthenticated - unlike every other spec, it must not use the "chromium" project's
|
|
// saved storageState, since it is exercising the login form itself.
|
|
test.use({ storageState: { cookies: [], origins: [] } })
|
|
|
|
test.describe("Login", () => {
|
|
test("valid credentials redirect to the dashboard", async ({ page }) => {
|
|
const login = new LoginPage(page)
|
|
await login.goto()
|
|
await login.login(env.adminEmail, env.adminPassword)
|
|
await login.expectLoggedIn()
|
|
})
|
|
|
|
test("invalid password shows an inline error and stays on /login", async ({ page }) => {
|
|
const login = new LoginPage(page)
|
|
await login.goto()
|
|
await login.login(env.adminEmail, "definitely-not-the-password")
|
|
await login.expectError()
|
|
await expect(page).toHaveURL(/\/login/)
|
|
})
|
|
|
|
test("session-expired redirect shows the amber notice", async ({ page }) => {
|
|
await page.goto("/login?next=/dashboard/receiving/grn")
|
|
await expect(page.getByText(/session is missing or expired/i)).toBeVisible()
|
|
})
|
|
})
|