Correct configuration E2E and isolate native playback dialog rejection
This commit is contained in:
+7
-13
@@ -121,20 +121,14 @@ async function frames(page) {
|
||||
});
|
||||
}
|
||||
await check('administrator plugin configuration loads current receiver settings',async()=>{
|
||||
const policy=ssh(admin+`u=api('/Users/${accounts[1].id}');p=u['Policy'];p['IsAdministrator']=True;api('/Users/${accounts[1].id}/Policy',p);print(json.dumps({'administrator':api('/Users/${accounts[1].id}')['Policy']['IsAdministrator']}))`);
|
||||
assert(policy.administrator,'Temporary user did not gain admin rights');
|
||||
// The old client session caches its original non-admin policy; sign in afresh.
|
||||
const config=await (await browser.newContext()).newPage();await config.goto(web);await config.locator('#txtManualName').fill(accounts[1].name);await config.locator('#txtManualPassword').fill(accounts[1].password);await config.getByRole('checkbox').check();await config.getByRole('button',{name:'Sign In',exact:true}).click();await config.waitForURL(/home/,{timeout:20000});
|
||||
await config.waitForFunction(()=>window.ApiClient?.getCurrentUserId());
|
||||
const user=ssh(admin+`n='decoder-e2e-'+secrets.token_hex(4);p=secrets.token_urlsafe(24);u=api('/Users/New',{'Name':n});print(json.dumps({'id':u['Id'],'name':n,'password':p}))`);accounts.push(user);
|
||||
ssh(admin+`api('/Users/${user.id}/Password',{'CurrentPw':'','NewPw':${JSON.stringify(user.password)}});u=api('/Users/${user.id}');p=u['Policy'];p['IsAdministrator']=True;api('/Users/${user.id}/Policy',p);print('{}')`);
|
||||
// Set administrator permissions before this account's first authentication.
|
||||
const config=await (await browser.newContext()).newPage();await config.goto(web);await config.locator('#txtManualName').fill(user.name);await config.locator('#txtManualPassword').fill(user.password);await config.getByRole('checkbox').check();await config.getByRole('button',{name:'Sign In',exact:true}).click();await config.waitForURL(/home/,{timeout:20000});
|
||||
await config.waitForFunction(()=>JSON.parse(localStorage.getItem('jellyfin_credentials')||'{}').Servers?.some(s=>s.AccessToken&&s.UserId));
|
||||
await config.locator('#txtManualPassword:visible').waitFor({state:'hidden',timeout:10000});
|
||||
await config.waitForTimeout(1000);
|
||||
await config.evaluate(()=>window.location.hash='#/configurationpage?name=enigma2');
|
||||
// Jellyfin 12 can request a separate elevated administrator sign-in.
|
||||
const elevated=config.locator('#txtManualPassword:visible');
|
||||
try {
|
||||
await elevated.waitFor({timeout:5000});
|
||||
const name=config.locator('#txtManualName:visible');if(await name.count()&&await name.isEditable())await name.fill(accounts[1].name);
|
||||
await elevated.fill(accounts[1].password);await config.getByRole('button',{name:'Sign In',exact:true}).last().click();
|
||||
await config.evaluate(()=>window.location.hash='#/configurationpage?name=enigma2');
|
||||
} catch {}
|
||||
try {await config.locator('#txtHostName').waitFor({timeout:20000});}
|
||||
catch {throw Error(JSON.stringify(await config.evaluate(async()=>({route:location.hash,admin:(await window.ApiClient.getCurrentUser()).Policy.IsAdministrator,headings:[...document.querySelectorAll('h1,h2')].map(e=>e.textContent).slice(0,5),input_ids:[...document.querySelectorAll('input')].map(i=>i.id).slice(0,20)}))));}
|
||||
await config.waitForFunction(()=>document.querySelector('#txtHostName')?.value==='192.168.10.20');assert(await config.locator('#txtStreamingPort').inputValue()==='8001','Unexpected configured source port');
|
||||
|
||||
Reference in New Issue
Block a user