Fix Playwright BASE_URL handling and failed UAT report tests
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
const { test, expect } = require('@playwright/test');
|
||||
require('dotenv').config();
|
||||
const { BASE_URL, absoluteUrl } = require('../fixtures/url');
|
||||
const { login } = require('../fixtures/auth');
|
||||
const { expectNoBackendError, readBody, blockedOrNotFound } = require('../fixtures/v204-helpers');
|
||||
const { expectBlockedOrSafe } = require('../fixtures/assertions');
|
||||
@@ -98,7 +99,7 @@ test.describe('CASE: Notice case sub-pages', () => {
|
||||
test('[V25-CASE-008] CASE-008 Notice case document delete CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('CASE_DOCUMENT_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/notice-cases/documents/${idOr('CASE_DOCUMENT_A_ID')}/delete`,
|
||||
`${BASE_URL}/notice-cases/documents/${idOr('CASE_DOCUMENT_A_ID')}/delete`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -108,7 +109,7 @@ test.describe('CASE: Notice case sub-pages', () => {
|
||||
test('[V25-CASE-009] CASE-009 Notice case upload CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('NOTICE_CASE_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/notice-cases/${idOr('NOTICE_CASE_A_ID')}/documents/upload`,
|
||||
`${BASE_URL}/notice-cases/${idOr('NOTICE_CASE_A_ID')}/documents/upload`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -179,7 +180,7 @@ test.describe('SVC: Services depth', () => {
|
||||
|
||||
test('[V25-SVC-005] SVC-005 Bulk import preview CSRF-less POST is rejected', async ({ request }) => {
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/services/bulk-imports/service-master`,
|
||||
`${BASE_URL}/services/bulk-imports/service-master`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -203,7 +204,7 @@ test.describe('SVC: Services depth', () => {
|
||||
test('[V25-SVC-008] SVC-008 Subscription lock CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('SUBSCRIPTION_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/services/${idOr('SUBSCRIPTION_A_ID')}/lock`,
|
||||
`${BASE_URL}/services/${idOr('SUBSCRIPTION_A_ID')}/lock`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -212,7 +213,7 @@ test.describe('SVC: Services depth', () => {
|
||||
|
||||
test('[V25-SVC-009] SVC-009 Bulk lock CSRF-less POST is rejected', async ({ request }) => {
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/services/bulk-lock`,
|
||||
`${BASE_URL}/services/bulk-lock`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -222,7 +223,7 @@ test.describe('SVC: Services depth', () => {
|
||||
test('[V25-SVC-010] SVC-010 Subscription generate CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('SUBSCRIPTION_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/services/subscriptions/${idOr('SUBSCRIPTION_A_ID')}/generate`,
|
||||
`${BASE_URL}/services/subscriptions/${idOr('SUBSCRIPTION_A_ID')}/generate`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -245,7 +246,7 @@ test.describe('SVC: Services depth', () => {
|
||||
|
||||
test('[V25-SVC-013] SVC-013 Task bulk-update CSRF-less POST is rejected', async ({ request }) => {
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/services/tasks/bulk-update`,
|
||||
`${BASE_URL}/services/tasks/bulk-update`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -270,7 +271,7 @@ test.describe('WORK: Work detail and task operations', () => {
|
||||
test('[V25-WORK-002] WORK-002 Task status update CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('TASK_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/status`,
|
||||
`${BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/status`,
|
||||
{ form: { status: 'completed', csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -280,7 +281,7 @@ test.describe('WORK: Work detail and task operations', () => {
|
||||
test('[V25-WORK-003] WORK-003 Task comment POST CSRF-less is rejected', async ({ request }) => {
|
||||
skipIfMissing('TASK_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/comment`,
|
||||
`${BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/comment`,
|
||||
{ form: { message: 'test comment', csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -304,7 +305,7 @@ test.describe('WORK: Work detail and task operations', () => {
|
||||
test('[V25-WORK-006] WORK-006 Task upload CSRF-less POST is rejected', async ({ request }) => {
|
||||
skipIfMissing('TASK_A_ID');
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/documents/tasks/${idOr('TASK_A_ID')}/upload`,
|
||||
`${BASE_URL}/documents/tasks/${idOr('TASK_A_ID')}/upload`,
|
||||
{ form: { csrf_token: '' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
@@ -322,7 +323,7 @@ test.describe('WORK: Work detail and task operations', () => {
|
||||
skipIfMissing('TASK_A_ID');
|
||||
// Raw API attempt without valid session for a different user
|
||||
const resp = await request.post(
|
||||
`${process.env.BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/status`,
|
||||
`${BASE_URL}/work/tasks/${idOr('TASK_A_ID')}/status`,
|
||||
{ form: { status: 'completed', csrf_token: 'invalid' } }
|
||||
).catch(() => null);
|
||||
if (!resp || [404, 405].includes(resp.status())) test.skip(true, 'Route not available');
|
||||
|
||||
Reference in New Issue
Block a user