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

* Added detailed requirements for implementing a per-item discount feature in the TODO list, including design considerations and examples.
* Updated e2e workflow to ensure concurrency management, allowing only one Playwright test workflow to run per branch or pull request at a time.
* Simplified Playwright test execution steps by removing unnecessary duration calculations, enhancing clarity and efficiency.
* Improved test reliability by adjusting URL handling in e2e tests.
This commit is contained in:
Vlad Sazonau 2026-03-09 00:05:50 +01:00 committed by GitHub
parent 5ffef43756
commit cb1045c75b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 29 deletions

View file

@ -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 }}

21
TODO.md
View file

@ -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)

View file

@ -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", {