Improve UI stability for e2e

This commit is contained in:
beatz174-bit
2025-11-24 19:43:38 +10:00
parent b3c284333a
commit f4405af903
3 changed files with 18 additions and 20 deletions
+2 -1
View File
@@ -2,7 +2,8 @@ import { defineConfig, devices } from '@playwright/test';
export default defineConfig({ export default defineConfig({
testDir: './e2e', testDir: './e2e',
fullyParallel: true, fullyParallel: false,
workers: 4,
retries: process.env.CI ? 2 : 0, retries: process.env.CI ? 2 : 0,
use: { use: {
baseURL: 'http://127.0.0.1:4173', baseURL: 'http://127.0.0.1:4173',
+9 -20
View File
@@ -90,29 +90,18 @@ export const ActivePickListScreen = () => {
); );
const sortedItems = useMemo(() => { const sortedItems = useMemo(() => {
const normalizeProductName = (product?: Product | null) =>
product?.name ? product.name.trim().toLowerCase() : '';
return [...itemsVisibleByStatus].sort((a, b) => { return [...itemsVisibleByStatus].sort((a, b) => {
const productA = productMap.get(a.product_id); const timeA = a.created_at ?? a.updated_at ?? 0;
const productB = productMap.get(b.product_id); const timeB = b.created_at ?? b.updated_at ?? 0;
const nameA = productA ? normalizeName(productA.name) : '';
const nameB = productB ? normalizeName(productB.name) : '';
const nameComparison = nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
if (nameComparison !== 0) {
return nameComparison;
}
if (a.is_carton !== b.is_carton) {
return a.is_carton ? 1 : -1;
}
const timeA = a.updated_at ?? a.created_at;
const timeB = b.updated_at ?? b.created_at;
if (timeA !== timeB) {
return timeA - timeB; return timeA - timeB;
}
const nameA = normalizeName(productMap.get(a.product_id)?.name ?? '');
const nameB = normalizeName(productMap.get(b.product_id)?.name ?? '');
return nameA.localeCompare(nameB, undefined, { sensitivity: 'base' });
}); });
}, [itemsVisibleByStatus, productMap]); }, [itemsVisibleByStatus, productMap]);
+8
View File
@@ -8,6 +8,7 @@ import {
DialogTitle, DialogTitle,
InputAdornment, InputAdornment,
MenuItem, MenuItem,
Snackbar,
Stack, Stack,
TextField, TextField,
Typography, Typography,
@@ -301,7 +302,14 @@ export const ManageProductsScreen = () => {
Manage Products Manage Products
</Typography> </Typography>
<Stack spacing={2}> <Stack spacing={2}>
<Snackbar
open={Boolean(feedback)}
autoHideDuration={4000}
onClose={() => setFeedback(null)}
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
>
{feedback ? <Alert severity={feedback.severity}>{feedback.text}</Alert> : null} {feedback ? <Alert severity={feedback.severity}>{feedback.text}</Alert> : null}
</Snackbar>
<Button component={RouterLink} to="/categories" variant="outlined" sx={{ alignSelf: 'flex-start' }}> <Button component={RouterLink} to="/categories" variant="outlined" sx={{ alignSelf: 'flex-start' }}>
Edit Categories Edit Categories
</Button> </Button>