@davoodmehraban89 / Factor-easy / commits / 93cd912
Fork 0

سامانه صدور فاکتور و حسابداری

Add failing ELI-3 invitation Real-DOM coverage

davoodmehraban89 committed Sep 30, 2026 at 08:51 UTC 93cd9120eaaca8f0a42f25dbb8bd842f8a658999
2 files changed +28 -1
.github/workflows/quality.yml
+1 -1
@@ -55,4 +55,4 @@ jobs:
55 - name: Real DOM smoke
56 run: |
57 python3 -m http.server 4173 >/tmp/finora-http.log 2>&1 &
58 - npx playwright test scripts/dom-smoke.spec.js scripts/platform-office.spec.js scripts/enterprise-license.spec.js scripts/enterprise-role.spec.js --reporter=line --workers=1
58 + npx playwright test scripts/dom-smoke.spec.js scripts/platform-office.spec.js scripts/enterprise-license.spec.js scripts/enterprise-role.spec.js scripts/enterprise-invitation.spec.js --reporter=line --workers=1
scripts/enterprise-invitation.spec.js new
+27
@@ -0,0 +1,27 @@
1 +const {test,expect}=require('@playwright/test');
2 +
3 +test('ELI-3 exposes invitation UI actions and URL acceptance hook',async({page})=>{
4 + const errs=[];page.on('pageerror',e=>errs.push(String(e)));
5 + await page.goto('http://127.0.0.1:4173/index.html',{waitUntil:'domcontentloaded'});
6 + await page.waitForFunction(()=>typeof window.finoraCanManageOrganization==='function');
7 + expect(await page.evaluate(()=>typeof window.organizationCreateInvitationFromUi)).toBe('function');
8 + expect(await page.evaluate(()=>typeof window.organizationRevokeInvitationFromUi)).toBe('function');
9 + expect(await page.evaluate(()=>typeof window.processFinoraInvitationFromUrl)).toBe('function');
10 + expect(errs.filter(x=>!x.includes('ResizeObserver'))).toEqual([]);
11 +});
12 +
13 +test('ELI-3 invitation URL processor accepts token once and removes it from address bar',async({page})=>{
14 + await page.goto('http://127.0.0.1:4173/index.html?invite=eli3-test-token',{waitUntil:'domcontentloaded'});
15 + await page.waitForFunction(()=>typeof window.processFinoraInvitationFromUrl==='function');
16 + const result=await page.evaluate(async()=>{
17 + const calls=[];
18 + const oldRpc=sb.rpc.bind(sb);
19 + sb.rpc=async(name,args)=>{calls.push({name,args});return {data:'member-id',error:null}};
20 + const oldAlert=window.alert;window.alert=()=>{};
21 + try{await window.processFinoraInvitationFromUrl();}
22 + finally{sb.rpc=oldRpc;window.alert=oldAlert;}
23 + return {calls,search:location.search};
24 + });
25 + expect(result.calls).toEqual([{name:'organization_accept_invitation',args:{p_token:'eli3-test-token'}}]);
26 + expect(result.search).not.toContain('invite=');
27 +});