Files
2026-03-09 22:30:41 +00:00

513 lines
11 KiB
JSON

{
"$schema": "https://metabuilder.dev/schemas/package-playwright.schema.json",
"package": "auth",
"version": "1.0.0",
"description": "Authentication and login tests - validates login and register pages",
"tests": [
{
"name": "should display login form after navigating to login",
"tags": [
"@auth",
"@login"
],
"timeout": 10000,
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "salesforce-login-page",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "salesforce-email-input",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "salesforce-password-input",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "salesforce-login-button",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should show error on invalid credentials",
"tags": [
"@auth",
"@login",
"@validation"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "click",
"testId": "switch-to-material"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "fill",
"testId": "email-input",
"value": "invaliduser@test.com"
},
{
"action": "fill",
"testId": "password-input",
"value": "wrongpassword"
},
{
"action": "click",
"testId": "login-button"
},
{
"action": "wait",
"timeout": 1000
},
{
"action": "expect",
"testId": "auth-layout",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should have register option via link",
"tags": [
"@auth",
"@registration"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "salesforce-register-link",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should navigate to register from login",
"tags": [
"@auth",
"@navigation"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "click",
"testId": "salesforce-register-link"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "auth-layout",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should display login form elements",
"tags": [
"@auth",
"@tdd",
"@pom"
],
"timeout": 10000,
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "click",
"testId": "switch-to-material"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "email-input",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "password-input",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "login-button",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should show login form on direct access",
"tags": [
"@auth",
"@login"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "salesforce-login-page",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "salesforce-password-input",
"assertion": {
"matcher": "toBeVisible"
}
},
{
"action": "expect",
"testId": "salesforce-login-button",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should validate form on login attempt",
"tags": [
"@auth",
"@validation"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "click",
"testId": "salesforce-login-button"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "salesforce-password-input",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should allow public page access without authentication",
"tags": [
"@auth",
"@permissions"
],
"steps": [
{
"action": "navigate",
"url": ""
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "expect",
"selector": "body",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should show registration form",
"tags": [
"@auth",
"@registration"
],
"steps": [
{
"action": "navigate",
"url": "register"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "auth-layout",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should display password strength indicator on register",
"tags": [
"@auth",
"@registration"
],
"steps": [
{
"action": "navigate",
"url": "register"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "fill",
"testId": "password-input",
"value": "Test123!"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "password-strength-indicator",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should navigate login footer link to register",
"tags": [
"@auth",
"@registration"
],
"steps": [
{
"action": "navigate",
"url": "login"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "click",
"testId": "salesforce-register-link"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "wait",
"timeout": 500
},
{
"action": "expect",
"testId": "auth-layout",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should redirect non-existent routes to not-found",
"tags": [
"@auth",
"@permissions"
],
"steps": [
{
"action": "navigate",
"url": "nonexistent-protected-route"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "expect",
"selector": "body",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should allow public page access",
"tags": [
"@auth",
"@permissions"
],
"steps": [
{
"action": "navigate",
"url": ""
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "expect",
"selector": "body",
"assertion": {
"matcher": "toBeVisible"
}
}
]
},
{
"name": "should show 404 for undefined routes",
"tags": [
"@auth",
"@permissions",
"@ui"
],
"steps": [
{
"action": "navigate",
"url": "supergod-xyz-invalid"
},
{
"action": "waitForLoadState",
"state": "domcontentloaded"
},
{
"action": "expect",
"selector": "body",
"assertion": {
"matcher": "toBeVisible"
}
}
]
}
]
}