Skip to content

Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.

feat: update Playwright configuration and enhance e2e tests (#176)

Vlad Sazonau616294b564e7
diff --git a/README.md b/README.md
index 5c7eb76..2a9605d 100644
--- a/README.md
+++ b/README.md
@@ -105,10 +105,6 @@ Watch a quick demo of EasyInvoicePDF in action to see how easy it is to create p
https://github.com/user-attachments/assets/d46c6e4e-b78a-4aa1-ab44-d20d6485b682
-## 🌟 Star History
-
-[![RepoStars](https://repostars.dev/api/embed?repo=VladSez%2Feasy-invoice-pdf&theme=dark)](https://repostars.dev/?repos=VladSez%2Feasy-invoice-pdf&theme=dark)
-
## πŸ‘¨β€πŸ’» Made By
Built by [Vlad Sazonau](https://x.com/vladsazonau)
@@ -117,6 +113,10 @@ Built by [Vlad Sazonau](https://x.com/vladsazonau)
- πŸ’Ό LinkedIn: [Vlad Sazonau](https://www.linkedin.com/in/vlad-sazonau-22a9a9126/)
- 🌐 Website: [vladsazon.com](https://vladsazon.com)
+## 🌟 Star History
+
+[![RepoStars](https://repostars.dev/api/embed?repo=VladSez%2Feasy-invoice-pdf&theme=dark)](https://repostars.dev/?repos=VladSez%2Feasy-invoice-pdf&theme=dark)
+
## ❀️ Support the Project
If you find EasyInvoicePDF useful, please consider:
diff --git a/e2e/default-invoice-template/default-invoice-template.test.ts b/e2e/default-invoice-template/default-invoice-template.test.ts
index 06dbd0c..923c6ec 100644
--- a/e2e/default-invoice-template/default-invoice-template.test.ts
+++ b/e2e/default-invoice-template/default-invoice-template.test.ts
@@ -10,6 +10,9 @@ import {
renderMultiPagePdfOnCanvas,
} from "../utils/render-pdf-on-canvas";
+// IMPORTANT: we want to run tests in serial mode for enhanced stability
+test.describe.configure({ mode: "serial" });
+
test.describe("Default Invoice Template", () => {
test.beforeEach(async ({ page }) => {
// we set the system time to a fixed date, so that the invoice number and other dates are consistent across tests
diff --git a/e2e/stripe-invoice-template/share-logic.test.ts b/e2e/stripe-invoice-template/share-logic.test.ts
index aecabfc..260eb26 100644
--- a/e2e/stripe-invoice-template/share-logic.test.ts
+++ b/e2e/stripe-invoice-template/share-logic.test.ts
@@ -2,6 +2,9 @@ import { PDF_DATA_LOCAL_STORAGE_KEY, type InvoiceData } from "@/app/schema";
import { expect, test } from "@playwright/test";
import { SMALL_TEST_IMAGE_BASE64, uploadBase64LogoAsFile } from "./utils";
+// IMPORTANT: we want to run tests in serial mode for enhanced stability
+test.describe.configure({ mode: "serial" });
+
test.describe("Stripe Invoice Sharing Logic", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/");
diff --git a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
index ddf5904..e123043 100644
--- a/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
+++ b/e2e/stripe-invoice-template/stripe-invoice-template.test.ts
@@ -16,6 +16,9 @@ import {
} from "../utils/render-pdf-on-canvas";
import { STATIC_ASSETS_URL } from "@/config";
+// IMPORTANT: we want to run tests in serial mode for enhanced stability
+test.describe.configure({ mode: "serial" });
+
test.describe("Stripe Invoice Template", () => {
test.beforeEach(async ({ page }) => {
// we set the system time to a fixed date, so that the invoice number and other dates are consistent across tests
diff --git a/playwright.config.ts b/playwright.config.ts
index 24727b1..a011d8d 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -32,7 +32,7 @@ export default defineConfig({
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 1 : undefined, // IMPORTANT: if tests are flaky locally, make `workers: 1` or `workers: 2`
+ workers: process.env.CI ? 2 : undefined, // IMPORTANT: if tests are flaky locally, make `workers: 1` or `workers: 2`
/* timeout for expect assertions */
expect: {
timeout: isLocal ? 40_000 : 60_000,
diff --git a/src/app/(app)/page.client.tsx b/src/app/(app)/page.client.tsx
index 73e49b6..065c72c 100644
--- a/src/app/(app)/page.client.tsx
+++ b/src/app/(app)/page.client.tsx
@@ -148,7 +148,11 @@ export function AppPageClient({
};
}, [invoiceDataState?.qrCodeData, invoiceDataState?.qrCodeIsVisible]);
- useShowRandomCTAToastOnIdle();
+ // Only show CTA toast on idle in non-CI environments
+ if (!process.env.CI) {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ useShowRandomCTAToastOnIdle();
+ }
// Helper function to load from localStorage
const loadFromLocalStorage = useCallback(() => {
@@ -505,7 +509,7 @@ export function AppPageClient({
// prevent sharing invoice if there are form errors
if (invoiceFormHasErrors) {
toast.error("Unable to Share Invoice", {
- id: "unable-to-share-invoice-form-errors-error-toast",
+ id: "unable-to-share-invoice-form-errors-toast",
duration: 6000,
position: isMobile ? "top-center" : "bottom-right",
description: (
@@ -591,7 +595,7 @@ export function AppPageClient({
// dismiss other toasts when navigator.share is successful (for better UX)
setTimeout(() => {
toast.dismiss();
- }, 1000);
+ }, 1_500);
// show CTA toast after x seconds
setTimeout(() => {
diff --git a/src/components/buyer-management.tsx b/src/components/buyer-management.tsx
index 091c7c2..fc4b2a0 100644
--- a/src/components/buyer-management.tsx
+++ b/src/components/buyer-management.tsx
@@ -132,6 +132,7 @@ export function BuyerManagement({
}
toast.success("Buyer added successfully", {
+ id: "add_buyer_success_toast",
richColors: true,
});
@@ -141,6 +142,7 @@ export function BuyerManagement({
console.error("Failed to add buyer:", error);
toast.error("Failed to add buyer", {
+ id: "add_buyer_error_toast",
closeButton: true,
});
@@ -167,6 +169,7 @@ export function BuyerManagement({
setEditingBuyer(null);
toast.success("Buyer updated successfully", {
+ id: "edit_buyer_success_toast",
richColors: true,
});
@@ -176,6 +179,7 @@ export function BuyerManagement({
console.error("Failed to edit buyer:", error);
toast.error("Failed to edit buyer", {
+ id: "edit_buyer_error_toast",
closeButton: true,
});
@@ -227,6 +231,7 @@ export function BuyerManagement({
setIsDeleteDialogOpen(false);
toast.success("Buyer deleted successfully", {
+ id: "delete_buyer_success_toast",
richColors: true,
});
@@ -236,6 +241,7 @@ export function BuyerManagement({
console.error("Failed to delete buyer:", error);
toast.error("Failed to delete buyer", {
+ id: "delete_buyer_error_toast",
closeButton: true,
});
diff --git a/src/components/seller-dialog.tsx b/src/components/seller-dialog.tsx
index 078dcd6..ac11eb8 100644
--- a/src/components/seller-dialog.tsx
+++ b/src/components/seller-dialog.tsx
@@ -137,6 +137,7 @@ export function SellerDialog({
// Show error toast
toast.error("Error loading existing sellers", {
+ id: "error-loading-existing-sellers-error-toast",
richColors: true,
description: "Please try again",
});
@@ -166,7 +167,9 @@ export function SellerDialog({
// Show error toast
toast.error("A seller with this name already exists", {
+ id: "seller-name-already-exists-error-toast",
richColors: true,
+ description: "Please try again",
});
return;
@@ -189,6 +192,7 @@ export function SellerDialog({
console.error("Failed to save seller:", error);
toast.error("Failed to save seller", {
+ id: "failed-to-save-seller-error-toast",
description: "Please try again",
richColors: true,
});
diff --git a/src/components/seller-management.tsx b/src/components/seller-management.tsx
index fac936b..6c5e016 100644
--- a/src/components/seller-management.tsx
+++ b/src/components/seller-management.tsx
@@ -148,6 +148,7 @@ export function SellerManagement({
}
toast.success("Seller added successfully", {
+ id: "add_seller_success_toast",
richColors: true,
});
@@ -157,6 +158,7 @@ export function SellerManagement({
console.error("Failed to add seller:", error);
toast.error("Failed to add seller", {
+ id: "add_seller_error_toast",
closeButton: true,
});
@@ -183,6 +185,7 @@ export function SellerManagement({
setEditingSeller(null);
toast.success("Seller updated successfully", {
+ id: "edit_seller_success_toast",
richColors: true,
});
@@ -192,6 +195,7 @@ export function SellerManagement({
console.error("Failed to edit seller:", error);
toast.error("Failed to edit seller", {
+ id: "edit_seller_error_toast",
closeButton: true,
});
@@ -243,6 +247,7 @@ export function SellerManagement({
setIsDeleteDialogOpen(false);
toast.success("Seller deleted successfully", {
+ id: "delete_seller_success_toast",
richColors: true,
});
@@ -252,6 +257,7 @@ export function SellerManagement({
console.error("Failed to delete seller:", error);
toast.error("Failed to delete seller", {
+ id: "delete_seller_error_toast",
closeButton: true,
});