7 lines
1.9 KiB
TypeScript
7 lines
1.9 KiB
TypeScript
import {test,expect} from '@playwright/test'
|
|
for(const width of [1440,320])test(`GRE: IPsec выключает FastPath перед PATCH ${width}`,async({page})=>{
|
|
let writes=0;const tunnel={id:'*1',serverId:'1',name:'own212-gre',localAddress:'192.0.2.1',remoteAddress:'192.0.2.2',localInnerIp:'',remoteInnerIp:'',poolId:'live',ipsec:null,mtu:1476,keepaliveInterval:10,keepaliveRetries:3,dscp:'inherit',clampTcpMss:true,allowFastPath:true,comment:'',enabled:false,status:'down'}
|
|
await page.route('**/health',r=>r.fulfill({json:{ok:true}}));await page.route('**/api/**',r=>{if(r.request().method()==='PATCH'){writes++;expect(r.request().postDataJSON()).toMatchObject({ipsecSecret:'own212-synthetic-psk',allowFastPath:false});return r.fulfill({json:{ok:true}})}const p=new URL(r.request().url()).pathname;return r.fulfill({json:p==='/api/auth/config'?{required:false}:p==='/api/servers'?[{id:1,name:'Own212 router',host:'192.0.2.1',enabled:true,country:'RU'}]:p==='/api/gre/tunnels'?{tunnels:[tunnel]}:{}})})
|
|
await page.setViewportSize({width,height:1000});await page.goto('/gre?server=1');await page.getByRole('button',{name:'Действия: own212-gre',exact:true}).click();await page.getByRole('menuitem',{name:'Редактировать',exact:true}).click();const form=page.getByRole('dialog');await form.getByRole('button',{name:'Дополнительно',exact:true}).click();await expect(form.getByRole('switch',{name:'Allow Fast Path',exact:true})).toBeChecked();await form.getByRole('switch',{name:'Включить IPsec',exact:true}).click();await expect(form.getByRole('switch',{name:'Allow Fast Path',exact:true})).not.toBeChecked();await expect(form.getByRole('switch',{name:'Allow Fast Path',exact:true})).toBeDisabled();await form.getByLabel('Пароль (PSK)').fill('own212-synthetic-psk');await form.getByRole('button',{name:'Сохранить',exact:true}).click();await expect(form).toHaveCount(0);expect(writes).toBe(1)
|
|
})
|