mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 15:32:10 +01:00
refactor: fix biome linting issues and update project documentation
- Fix 36+ biome linting issues reducing errors/warnings from 227 to 191 - Replace explicit 'any' types with proper TypeScript interfaces - Fix React hooks dependencies and useCallback patterns - Resolve unused variables and parameter assignment issues - Improve accessibility with proper label associations - Add comprehensive API documentation for admin and security features - Update README.md with accurate PostgreSQL setup and current tech stack - Create complete documentation for audit logging, CSP monitoring, and batch processing - Fix outdated project information and missing developer workflows
This commit is contained in:
@ -34,17 +34,17 @@ async function loginAsAdmin(page: Page) {
|
||||
async function waitForDataProcessing(page: Page, timeout = 30000) {
|
||||
// Wait for processing indicators to disappear
|
||||
await page.waitForSelector('[data-testid="processing-indicator"]', {
|
||||
state: 'hidden',
|
||||
timeout
|
||||
state: "hidden",
|
||||
timeout,
|
||||
});
|
||||
}
|
||||
|
||||
async function setupMockCsvEndpoint(page: Page) {
|
||||
// Mock the CSV endpoint to return test data
|
||||
await page.route('**/test-csv-data', (route) => {
|
||||
await page.route("**/test-csv-data", (route) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/csv',
|
||||
contentType: "text/csv",
|
||||
body: mockCsvData,
|
||||
});
|
||||
});
|
||||
@ -66,29 +66,32 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await expect(page).toHaveURL(/\/dashboard\/company/);
|
||||
|
||||
// Update CSV configuration
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill('[data-testid="csv-username"]', 'testuser');
|
||||
await page.fill('[data-testid="csv-password"]', 'testpass');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.fill('[data-testid="csv-username"]', "testuser");
|
||||
await page.fill('[data-testid="csv-password"]', "testpass");
|
||||
|
||||
// Save settings
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
// Should show success message
|
||||
await expect(page.locator('[data-testid="success-message"]')).toContainText(
|
||||
'Settings saved successfully'
|
||||
);
|
||||
await expect(
|
||||
page.locator('[data-testid="success-message"]')
|
||||
).toContainText("Settings saved successfully");
|
||||
});
|
||||
|
||||
test("should validate CSV URL format", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
|
||||
// Enter invalid URL
|
||||
await page.fill('[data-testid="csv-url"]', 'invalid-url');
|
||||
await page.fill('[data-testid="csv-url"]', "invalid-url");
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
// Should show validation error
|
||||
await expect(page.locator('[data-testid="csv-url-error"]')).toContainText(
|
||||
'Invalid URL format'
|
||||
"Invalid URL format"
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -97,9 +100,14 @@ test.describe("CSV Processing Workflow", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Configure CSV settings first
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
await expect(page.locator('[data-testid="success-message"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="success-message"]')
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should trigger manual CSV import", async ({ page }) => {
|
||||
@ -110,15 +118,17 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.click('[data-testid="refresh-data-button"]');
|
||||
|
||||
// Should show processing indicator
|
||||
await expect(page.locator('[data-testid="processing-indicator"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="processing-indicator"]')
|
||||
).toBeVisible();
|
||||
|
||||
// Wait for processing to complete
|
||||
await waitForDataProcessing(page);
|
||||
|
||||
// Should show success message
|
||||
await expect(page.locator('[data-testid="import-success"]')).toContainText(
|
||||
'Data imported successfully'
|
||||
);
|
||||
await expect(
|
||||
page.locator('[data-testid="import-success"]')
|
||||
).toContainText("Data imported successfully");
|
||||
});
|
||||
|
||||
test("should display import progress", async ({ page }) => {
|
||||
@ -128,18 +138,29 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.click('[data-testid="refresh-data-button"]');
|
||||
|
||||
// Check progress indicators
|
||||
await expect(page.locator('[data-testid="import-progress"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="import-progress"]')
|
||||
).toBeVisible();
|
||||
|
||||
// Progress should show stages
|
||||
await expect(page.locator('[data-testid="stage-csv-import"]')).toContainText('CSV Import');
|
||||
await expect(page.locator('[data-testid="stage-processing"]')).toContainText('Processing');
|
||||
await expect(page.locator('[data-testid="stage-ai-analysis"]')).toContainText('AI Analysis');
|
||||
await expect(
|
||||
page.locator('[data-testid="stage-csv-import"]')
|
||||
).toContainText("CSV Import");
|
||||
await expect(
|
||||
page.locator('[data-testid="stage-processing"]')
|
||||
).toContainText("Processing");
|
||||
await expect(
|
||||
page.locator('[data-testid="stage-ai-analysis"]')
|
||||
).toContainText("AI Analysis");
|
||||
});
|
||||
|
||||
test("should handle import errors gracefully", async ({ page }) => {
|
||||
// Configure invalid CSV URL
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/nonexistent-csv');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/nonexistent-csv"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
// Try to import
|
||||
@ -148,7 +169,7 @@ test.describe("CSV Processing Workflow", () => {
|
||||
|
||||
// Should show error message
|
||||
await expect(page.locator('[data-testid="import-error"]')).toContainText(
|
||||
'Failed to fetch CSV data'
|
||||
"Failed to fetch CSV data"
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -157,7 +178,10 @@ test.describe("CSV Processing Workflow", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Import test data first
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -169,16 +193,24 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
|
||||
// Check metric cards show correct data
|
||||
await expect(page.locator('[data-testid="total-sessions"]')).toContainText('3');
|
||||
await expect(
|
||||
page.locator('[data-testid="total-sessions"]')
|
||||
).toContainText("3");
|
||||
|
||||
// Check sentiment distribution
|
||||
const sentimentChart = page.locator('[data-testid="sentiment-chart"]');
|
||||
await expect(sentimentChart).toBeVisible();
|
||||
|
||||
// Verify sentiment data
|
||||
await expect(page.locator('[data-testid="positive-sentiment"]')).toContainText('1');
|
||||
await expect(page.locator('[data-testid="neutral-sentiment"]')).toContainText('1');
|
||||
await expect(page.locator('[data-testid="negative-sentiment"]')).toContainText('1');
|
||||
await expect(
|
||||
page.locator('[data-testid="positive-sentiment"]')
|
||||
).toContainText("1");
|
||||
await expect(
|
||||
page.locator('[data-testid="neutral-sentiment"]')
|
||||
).toContainText("1");
|
||||
await expect(
|
||||
page.locator('[data-testid="negative-sentiment"]')
|
||||
).toContainText("1");
|
||||
});
|
||||
|
||||
test("should display geographic distribution", async ({ page }) => {
|
||||
@ -189,19 +221,29 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await expect(geoMap).toBeVisible();
|
||||
|
||||
// Check country data
|
||||
await expect(page.locator('[data-testid="country-us"]')).toContainText('US: 1');
|
||||
await expect(page.locator('[data-testid="country-nl"]')).toContainText('NL: 1');
|
||||
await expect(page.locator('[data-testid="country-de"]')).toContainText('DE: 1');
|
||||
await expect(page.locator('[data-testid="country-us"]')).toContainText(
|
||||
"US: 1"
|
||||
);
|
||||
await expect(page.locator('[data-testid="country-nl"]')).toContainText(
|
||||
"NL: 1"
|
||||
);
|
||||
await expect(page.locator('[data-testid="country-de"]')).toContainText(
|
||||
"DE: 1"
|
||||
);
|
||||
});
|
||||
|
||||
test("should display escalation metrics", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
|
||||
// Check escalation rate
|
||||
await expect(page.locator('[data-testid="escalation-rate"]')).toContainText('33%');
|
||||
await expect(
|
||||
page.locator('[data-testid="escalation-rate"]')
|
||||
).toContainText("33%");
|
||||
|
||||
// Check HR forwarding rate
|
||||
await expect(page.locator('[data-testid="hr-forwarding-rate"]')).toContainText('33%');
|
||||
await expect(
|
||||
page.locator('[data-testid="hr-forwarding-rate"]')
|
||||
).toContainText("33%");
|
||||
});
|
||||
});
|
||||
|
||||
@ -209,7 +251,10 @@ test.describe("CSV Processing Workflow", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Import test data
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -226,49 +271,55 @@ test.describe("CSV Processing Workflow", () => {
|
||||
|
||||
// Check session details
|
||||
const firstSession = page.locator('[data-testid="session-item"]').first();
|
||||
await expect(firstSession).toContainText('session1');
|
||||
await expect(firstSession).toContainText('positive');
|
||||
await expect(firstSession).toContainText('US');
|
||||
await expect(firstSession).toContainText("session1");
|
||||
await expect(firstSession).toContainText("positive");
|
||||
await expect(firstSession).toContainText("US");
|
||||
});
|
||||
|
||||
test("should filter sessions by sentiment", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/sessions");
|
||||
|
||||
// Filter by positive sentiment
|
||||
await page.selectOption('[data-testid="sentiment-filter"]', 'POSITIVE');
|
||||
await page.selectOption('[data-testid="sentiment-filter"]', "POSITIVE");
|
||||
|
||||
// Should show only positive sessions
|
||||
await expect(page.locator('[data-testid="session-item"]')).toHaveCount(1);
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText('session1');
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText(
|
||||
"session1"
|
||||
);
|
||||
});
|
||||
|
||||
test("should filter sessions by country", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/sessions");
|
||||
|
||||
// Filter by Germany
|
||||
await page.selectOption('[data-testid="country-filter"]', 'DE');
|
||||
await page.selectOption('[data-testid="country-filter"]', "DE");
|
||||
|
||||
// Should show only German sessions
|
||||
await expect(page.locator('[data-testid="session-item"]')).toHaveCount(1);
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText('session3');
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText(
|
||||
"session3"
|
||||
);
|
||||
});
|
||||
|
||||
test("should search sessions by content", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/sessions");
|
||||
|
||||
// Search for "vacation"
|
||||
await page.fill('[data-testid="search-input"]', 'vacation');
|
||||
await page.fill('[data-testid="search-input"]', "vacation");
|
||||
|
||||
// Should show matching sessions
|
||||
await expect(page.locator('[data-testid="session-item"]')).toHaveCount(1);
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText('vacation time');
|
||||
await expect(page.locator('[data-testid="session-item"]')).toContainText(
|
||||
"vacation time"
|
||||
);
|
||||
});
|
||||
|
||||
test("should paginate sessions", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/sessions");
|
||||
|
||||
// Set small page size
|
||||
await page.selectOption('[data-testid="page-size"]', '2');
|
||||
await page.selectOption('[data-testid="page-size"]', "2");
|
||||
|
||||
// Should show pagination
|
||||
await expect(page.locator('[data-testid="pagination"]')).toBeVisible();
|
||||
@ -284,7 +335,10 @@ test.describe("CSV Processing Workflow", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Import test data
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -302,10 +356,18 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await expect(page).toHaveURL(/\/dashboard\/sessions\/[^/]+/);
|
||||
|
||||
// Check session details
|
||||
await expect(page.locator('[data-testid="session-id"]')).toContainText('session1');
|
||||
await expect(page.locator('[data-testid="sentiment-badge"]')).toContainText('positive');
|
||||
await expect(page.locator('[data-testid="country-badge"]')).toContainText('US');
|
||||
await expect(page.locator('[data-testid="session-summary"]')).toContainText('vacation time');
|
||||
await expect(page.locator('[data-testid="session-id"]')).toContainText(
|
||||
"session1"
|
||||
);
|
||||
await expect(
|
||||
page.locator('[data-testid="sentiment-badge"]')
|
||||
).toContainText("positive");
|
||||
await expect(page.locator('[data-testid="country-badge"]')).toContainText(
|
||||
"US"
|
||||
);
|
||||
await expect(
|
||||
page.locator('[data-testid="session-summary"]')
|
||||
).toContainText("vacation time");
|
||||
});
|
||||
|
||||
test("should display session timeline", async ({ page }) => {
|
||||
@ -317,9 +379,15 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await expect(timeline).toBeVisible();
|
||||
|
||||
// Should show start and end times
|
||||
await expect(page.locator('[data-testid="start-time"]')).toContainText('10:00');
|
||||
await expect(page.locator('[data-testid="end-time"]')).toContainText('10:30');
|
||||
await expect(page.locator('[data-testid="duration"]')).toContainText('30 minutes');
|
||||
await expect(page.locator('[data-testid="start-time"]')).toContainText(
|
||||
"10:00"
|
||||
);
|
||||
await expect(page.locator('[data-testid="end-time"]')).toContainText(
|
||||
"10:30"
|
||||
);
|
||||
await expect(page.locator('[data-testid="duration"]')).toContainText(
|
||||
"30 minutes"
|
||||
);
|
||||
});
|
||||
|
||||
test("should display extracted questions", async ({ page }) => {
|
||||
@ -327,13 +395,17 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.click('[data-testid="session-item"]');
|
||||
|
||||
// Check questions section
|
||||
const questionsSection = page.locator('[data-testid="extracted-questions"]');
|
||||
const questionsSection = page.locator(
|
||||
'[data-testid="extracted-questions"]'
|
||||
);
|
||||
await expect(questionsSection).toBeVisible();
|
||||
|
||||
// Should show AI-extracted questions (if any)
|
||||
const questionsList = page.locator('[data-testid="questions-list"]');
|
||||
if (await questionsList.isVisible()) {
|
||||
await expect(questionsList.locator('[data-testid="question-item"]')).toHaveCount.greaterThan(0);
|
||||
await expect(
|
||||
questionsList.locator('[data-testid="question-item"]')
|
||||
).toHaveCount.greaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -344,7 +416,10 @@ test.describe("CSV Processing Workflow", () => {
|
||||
|
||||
// Configure CSV
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
// Start import and monitor status
|
||||
@ -352,23 +427,36 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.click('[data-testid="refresh-data-button"]');
|
||||
|
||||
// Should show real-time status updates
|
||||
await expect(page.locator('[data-testid="status-importing"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="status-importing"]')
|
||||
).toBeVisible();
|
||||
|
||||
// Status should progress through stages
|
||||
await page.waitForSelector('[data-testid="status-processing"]', { timeout: 10000 });
|
||||
await page.waitForSelector('[data-testid="status-analyzing"]', { timeout: 10000 });
|
||||
await page.waitForSelector('[data-testid="status-complete"]', { timeout: 30000 });
|
||||
await page.waitForSelector('[data-testid="status-processing"]', {
|
||||
timeout: 10000,
|
||||
});
|
||||
await page.waitForSelector('[data-testid="status-analyzing"]', {
|
||||
timeout: 10000,
|
||||
});
|
||||
await page.waitForSelector('[data-testid="status-complete"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
});
|
||||
|
||||
test("should update metrics in real-time", async ({ page }) => {
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
|
||||
// Get initial metrics
|
||||
const initialSessions = await page.locator('[data-testid="total-sessions"]').textContent();
|
||||
const initialSessions = await page
|
||||
.locator('[data-testid="total-sessions"]')
|
||||
.textContent();
|
||||
|
||||
// Import data
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -376,7 +464,9 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await waitForDataProcessing(page);
|
||||
|
||||
// Metrics should be updated
|
||||
const updatedSessions = await page.locator('[data-testid="total-sessions"]').textContent();
|
||||
const updatedSessions = await page
|
||||
.locator('[data-testid="total-sessions"]')
|
||||
.textContent();
|
||||
expect(updatedSessions).not.toBe(initialSessions);
|
||||
});
|
||||
});
|
||||
@ -384,16 +474,19 @@ test.describe("CSV Processing Workflow", () => {
|
||||
test.describe("Error Handling", () => {
|
||||
test("should handle CSV parsing errors", async ({ page }) => {
|
||||
// Mock invalid CSV data
|
||||
await page.route('**/invalid-csv', (route) => {
|
||||
await page.route("**/invalid-csv", (route) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/csv',
|
||||
body: 'invalid,csv,format\nwithout,proper,headers',
|
||||
contentType: "text/csv",
|
||||
body: "invalid,csv,format\nwithout,proper,headers",
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/invalid-csv');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/invalid-csv"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -401,21 +494,24 @@ test.describe("CSV Processing Workflow", () => {
|
||||
|
||||
// Should show parsing error
|
||||
await expect(page.locator('[data-testid="parsing-error"]')).toContainText(
|
||||
'Invalid CSV format'
|
||||
"Invalid CSV format"
|
||||
);
|
||||
});
|
||||
|
||||
test("should handle AI processing failures", async ({ page }) => {
|
||||
// Mock AI service failure
|
||||
await page.route('**/api/openai/**', (route) => {
|
||||
await page.route("**/api/openai/**", (route) => {
|
||||
route.fulfill({
|
||||
status: 500,
|
||||
body: JSON.stringify({ error: 'AI service unavailable' }),
|
||||
body: JSON.stringify({ error: "AI service unavailable" }),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/company");
|
||||
await page.fill('[data-testid="csv-url"]', 'http://localhost:3000/api/test-csv-data');
|
||||
await page.fill(
|
||||
'[data-testid="csv-url"]',
|
||||
"http://localhost:3000/api/test-csv-data"
|
||||
);
|
||||
await page.click('[data-testid="save-settings"]');
|
||||
|
||||
await page.goto("http://localhost:3000/dashboard/overview");
|
||||
@ -423,7 +519,7 @@ test.describe("CSV Processing Workflow", () => {
|
||||
|
||||
// Should show AI processing error
|
||||
await expect(page.locator('[data-testid="ai-error"]')).toContainText(
|
||||
'AI analysis failed'
|
||||
"AI analysis failed"
|
||||
);
|
||||
});
|
||||
|
||||
@ -431,12 +527,15 @@ test.describe("CSV Processing Workflow", () => {
|
||||
let attemptCount = 0;
|
||||
|
||||
// Mock failing then succeeding API
|
||||
await page.route('**/api/process-batch', (route) => {
|
||||
await page.route("**/api/process-batch", (route) => {
|
||||
attemptCount++;
|
||||
if (attemptCount === 1) {
|
||||
route.fulfill({ status: 500, body: 'Server error' });
|
||||
route.fulfill({ status: 500, body: "Server error" });
|
||||
} else {
|
||||
route.fulfill({ status: 200, body: JSON.stringify({ success: true }) });
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
body: JSON.stringify({ success: true }),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -444,11 +543,15 @@ test.describe("CSV Processing Workflow", () => {
|
||||
await page.click('[data-testid="refresh-data-button"]');
|
||||
|
||||
// Should show retry attempt
|
||||
await expect(page.locator('[data-testid="retry-indicator"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="retry-indicator"]')
|
||||
).toBeVisible();
|
||||
|
||||
// Should eventually succeed
|
||||
await waitForDataProcessing(page);
|
||||
await expect(page.locator('[data-testid="import-success"]')).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[data-testid="import-success"]')
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user