mirror of
https://github.com/VladSez/easy-invoice-pdf
synced 2026-04-21 13:37:40 +00:00
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:
parent
5ffef43756
commit
cb1045c75b
3 changed files with 30 additions and 29 deletions
36
.github/workflows/e2e.yml
vendored
36
.github/workflows/e2e.yml
vendored
|
|
@ -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
21
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:
|
||||

|
||||
|
||||
example:
|
||||

|
||||
|
||||
---
|
||||
|
||||
- [ ] 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)
|
||||
|
|
|
|||
|
|
@ -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", {
|
||||
|
|
|
|||
Loading…
Reference in a new issue