Skip to content

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

feat: expand TODO list with discounts feature and improve e2e workflow (#186)

Vlad Sazonaucb1045c75b37
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index e31bcff..b8ad049 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -2,6 +2,12 @@ name: 🎭 Playwright E2E tests
on:
deployment_status:
+# The concurrency block ensures that only one Playwright E2E test workflow runs per branch or pull request at a time.
+# If a new run is triggered (for example, by a commit push), any currently running workflow for that same branch will be cancelled.
+concurrency:
+ group: e2e-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
e2e:
# https://vercel.com/guides/how-can-i-run-end-to-end-tests-after-my-vercel-preview-deployment
@@ -33,18 +39,7 @@ jobs:
run: pnpm install
- name: πŸ“¦ Install Playwright browser binaries & OS dependencies
- id: playwright-install
- run: |
- start_time=$(date +%s)
-
- pnpm exec playwright install chromium webkit --with-deps
-
- end_time=$(date +%s)
- duration=$((end_time - start_time))
- minutes=$((duration / 60))
- seconds=$((duration % 60))
-
- echo "duration_formatted=${minutes}m ${seconds}s" >> "$GITHUB_OUTPUT"
+ run: pnpm exec playwright install chromium webkit --with-deps
- name: 🎭 Run Playwright tests
id: playwright
@@ -53,18 +48,7 @@ jobs:
SENTRY_ENABLED: false
NEXT_PUBLIC_SENTRY_ENABLED: false
continue-on-error: true
- # calculate duration of the job and runs playwright test
- run: |
- start_time=$(date +%s)
-
- pnpm exec playwright test --reporter=html,list
-
- end_time=$(date +%s)
- duration=$((end_time - start_time))
- minutes=$((duration / 60))
- seconds=$((duration % 60))
-
- echo "duration_formatted=${minutes}m ${seconds}s" >> "$GITHUB_OUTPUT"
+ run: pnpm exec playwright test --reporter=html,list
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 #4.6.1
name: 🎲 Upload Playwright report
@@ -84,7 +68,7 @@ jobs:
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ github.ref_name }}" \
- | jq -r '.[0].html_url')
+ | jq -r '.[0].html_url // empty')
echo "pr_url=$PR_URL" >> "$GITHUB_OUTPUT"
- name: πŸ“§ Send email
@@ -102,8 +86,6 @@ jobs:
E2E tests for ${{ github.repository }} have completed.
Result: ${{ steps.playwright.outcome == 'success' && 'βœ… Passed' || '❌ Failed' }}
- Playwright Browser Binaries Installation Time: ${{ steps.playwright-install.outputs.duration_formatted }}
- ${{ steps.playwright.outputs.duration_formatted && format('Playwright Tests Duration: {0}', steps.playwright.outputs.duration_formatted) || '' }}
For more details, please check:
- GitHub Actions run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
diff --git a/TODO.md b/TODO.md
index 2373307..a50d065 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,7 +1,28 @@
TODO list
+DISCOUNTS FEATURE:
+
+- should be per item based discount, not total based discount
+- display discount below each item, if applied (check stripe example image below)
+- when discount is applied, in tax column + tax summary table we should show (total amount - discount amount), check stripe example image below
+- think about design for default template (check default template example image below)
+
+example:
+![Per-item default template discount example](..wip/discount-invoice-default-example.png)
+
+example:
+![Per-item stripe template discount example](..wip/discount-invoice-stripe-example.png)
+
+---
+
+- [ ] when adding invoice item, generate unique id for the item and store in local storage (should be backward compatible with existing invoice items)
+
- [] on mobile, when switching between tabs, scroll to the last position of the invoice form section for better UX
+- [ ] add unit test for next js api routes (for generate-invoice route)
+
+- [ ] run playwright tests in docker, add local docker UBUNTU setup and re-use docker setup on ci
+
IMPORTANT:
- [ ] double check all invoice translations and fix them (if needed)
diff --git a/e2e/invoice-form.test.ts b/e2e/invoice-form.test.ts
index 551ed81..1d740f8 100644
--- a/e2e/invoice-form.test.ts
+++ b/e2e/invoice-form.test.ts
@@ -38,8 +38,6 @@ test.describe("Invoice Generator Page", () => {
test("displays correct OG meta tags for default template", async ({
page,
}) => {
- // Navigate to default template
- await page.goto("/?template=default");
await expect(page).toHaveURL("/?template=default");
const templateCombobox = page.getByRole("combobox", {