سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 4, 03:00 UTC
test: align identity OTP DOM contract
Davood Mehraban committed
Oct 7, 2026 at 21:22 UTC
391c6242ead7f0f5858647f6f3dc8b80493f25eb
1 file changed
+1
-1
scripts/identity-wave5a.spec.js
+1
-1
@@ -1,4 +1,4 @@
1
const {test,expect}=require('@playwright/test');
2
-test('Wave 5a exposes explicit OTP login and signup modes',async({page})=>{await page.goto('http://127.0.0.1:4173/index.html',{waitUntil:'domcontentloaded'});await page.waitForFunction(()=>typeof startEmailOtp==='function');expect(await page.getByRole('button',{name:'ورود با کد ایمیل'}).count()).toBe(1);expect(await page.getByRole('button',{name:'ثبتنام با کد ایمیل'}).count()).toBe(1);});
2
+test('Wave 5a exposes explicit OTP login and signup modes',async({page})=>{await page.goto('http://127.0.0.1:4173/index.html',{waitUntil:'domcontentloaded'});await page.waitForFunction(()=>typeof startIdentityOtp==='function');expect(await page.getByRole('button',{name:'ورود با کد یکبارمصرف'}).count()).toBe(1);expect(await page.getByRole('button',{name:'ثبتنام با کد یکبارمصرف'}).count()).toBe(1);});
3
test('Wave 5a OTP login cannot silently create a user',async({page})=>{await page.goto('http://127.0.0.1:4173/index.html',{waitUntil:'domcontentloaded'});await page.waitForFunction(()=>typeof startEmailOtp==='function');const result=await page.evaluate(async()=>{const calls=[],old=sb.auth.signInWithOtp,oldAlert=window.alert;window.alert=()=>{};sb.auth.signInWithOtp=async args=>{calls.push(args);return {error:null}};document.getElementById('auth-email').value='existing@example.com';try{await startEmailOtp(false,false);}finally{sb.auth.signInWithOtp=old;window.alert=oldAlert;}return calls;});expect(result).toEqual([{email:'existing@example.com',options:{shouldCreateUser:false}}]);});
4
test('Wave 5a explicit signup is the email OTP creation path',async({page})=>{await page.goto('http://127.0.0.1:4173/index.html',{waitUntil:'domcontentloaded'});await page.waitForFunction(()=>typeof startEmailOtp==='function');const result=await page.evaluate(async()=>{const calls=[],old=sb.auth.signInWithOtp,oldAlert=window.alert;window.alert=()=>{};sb.auth.signInWithOtp=async args=>{calls.push(args);return {error:null}};document.getElementById('auth-email').value='new@example.com';try{await startEmailOtp(false,true);}finally{sb.auth.signInWithOtp=old;window.alert=oldAlert;}return calls;});expect(result).toEqual([{email:'new@example.com',options:{shouldCreateUser:true}}]);});