Test/delegate all - #1841
Conversation
📝 WalkthroughWalkthroughThis PR removes debug console logs from the delegation API, moves per-test cleanup into a specific E2E spec (and removes a global fixture cleanup), restructures and consolidates client-delegation E2E flows, and adds bulk-customer UI actions to the ClientDelegation page object. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@playwright/e2eTests/accessPackageDelegation/accessPackageDirectdelegatation.spec.ts`:
- Line 6: Replace the empty destructuring in the test.afterEach callback to
satisfy the linter: change the async parameter list used in
accessPackageDirectdelegatation.spec.ts's test.afterEach to either omit fixtures
or use a placeholder for the fixtures object (e.g., use "_" for the first
parameter) so the signature becomes async (_, testInfo) => { ... } (or remove
the first parameter entirely if fixtures are not required) while keeping the use
of testInfo intact.
🧹 Nitpick comments (3)
playwright/pages/systemuser/ClientDelegation.ts (1)
98-107:addAllCustomers()doesn't close the modal—intentional?This method verifies
confirmAndCloseButtonis visible but doesn't click it. Looking at the test usage (line 62-63 in the spec), the caller explicitly clicksconfirmAndCloseButtonafterward. This differs fromaddCustomer()(lines 94-95) which closes the modal internally.Consider either:
- Closing the modal here for consistency with
addCustomer()- Adding a comment explaining why the caller is responsible for closing
Option 1: Close modal for consistency
async addAllCustomers() { await expect(this.customersButton).toBeVisible(); await this.customersButton.click(); await expect(this.addAllCustomersButton).toBeVisible(); await this.addAllCustomersButton.click(); await expect(this.addAllCustomersSuccessText).toBeVisible(); await expect(this.confirmAndCloseButton).toBeVisible(); + await this.confirmAndCloseButton.click(); }playwright/e2eTests/systemuser/clientDelegation.spec.ts (2)
66-69: Cleanup as a test step won't run if earlier steps fail.If any step fails before reaching the cleanup step, the system user remains in the environment. Since these tests run scheduled against tt02 (per PR description), orphaned test data could accumulate.
Consider moving cleanup to
test.afterEachwith error handling similar toaccessPackageDirectdelegatation.spec.ts:test.afterEach(async () => { try { await clientDelegationPage.deleteSystemUser(name); } catch (err) { console.warn(`[afterEach] cleanup failed for ${name}`, err); } });
16-70: Significant duplication across role test blocks.The three
test.describeblocks share nearly identical structure—only the role constants and delegation method (addAllCustomersvsaddCustomerloop) differ. This could be refactored into a parameterized test or shared helper.If reducing duplication isn't a priority now, this is fine to defer.
Example: Parameterized approach
const roleConfigs = [ { role: FacilitatorRole.Revisor, apiName: 'ansvarlig-revisor', displayName: 'Ansvarlig revisor', delegateAll: true }, { role: FacilitatorRole.Regnskapsfoerer, apiName: 'regnskapsforer-lonn', displayName: 'Regnskapsfører lønn', delegateAll: false }, { role: FacilitatorRole.Forretningsfoerer, apiName: 'forretningsforer-eiendom', displayName: 'Forretningsforer eiendom', delegateAll: false }, ]; for (const config of roleConfigs) { test.describe(config.displayName, () => { // shared setup and test logic using config }); }Also applies to: 72-134, 136-198
bør kanskje ikke merges før onsdag, siden testene kjører schedulert mot tt02
Summary by CodeRabbit
New Features
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.