|
|
@@ -14,6 +14,12 @@ const assert=require('node:assert/strict');const fs=require('fs');
|
|
|
const chain=await page.evaluate(async({type,open,apply})=>{const key=type==='filter'?'filterRules':type==='nat'?'natRules':'mangleRules';state[key]=[{id:type+'-preview',chain:'CUSTOM_TEST',action:'accept',disabled:false,passthrough:true}];window[open](type+'-preview');const value=document.getElementById(type+'-modal-chain').value;await window[apply](true);return value},{type,open,apply});
|
|
|
assert.equal(chain,'CUSTOM_TEST');assert.equal(writes.at(-1).body.chain,'CUSTOM_TEST');
|
|
|
}passed.push('Custom chain preserved in all three forms');
|
|
|
+ for(const [type,prefix,open,apply] of [['filter','fw','openEditFilterModal','applyFilterRule'],['nat','nat','openEditNATModal','applyNATRule'],['mangle','mangle','openEditMangleModal','applyMangleRule']]){
|
|
|
+ const fields=await page.evaluate(async({type,prefix,open,apply})=>{const key=type==='filter'?'filterRules':type==='nat'?'natRules':'mangleRules';state[key]=[{id:type+'-all',chain:type==='nat'?'prerouting':'forward',action:'accept',protocol:'all',content:'all',packet_mark:'all',passthrough:true}];window[open](type+'-all');const v={content:document.getElementById(prefix+'-val-content').value,contentEnabled:!document.getElementById(prefix+'-field-content').classList.contains('hidden'),mark:document.getElementById(prefix+'-val-pktmark').value,markEnabled:!document.getElementById(prefix+'-field-pktmark').classList.contains('hidden'),protocolEnabled:!document.getElementById(prefix+'-field-proto').classList.contains('hidden')};await window[apply](true);return v},{type,prefix,open,apply});
|
|
|
+ assert.deepEqual(fields,{content:'all',contentEnabled:true,mark:'all',markEnabled:true,protocolEnabled:false});
|
|
|
+ assert.equal(writes.at(-1).body.content,'all');assert.equal(writes.at(-1).body.packet_mark,'all');assert.equal(writes.at(-1).body.protocol,'all');
|
|
|
+ }passed.push('Literal all survives edit and save for all three tables');
|
|
|
+ assert.equal(await page.locator('#mangle-modal-newttl').getAttribute('placeholder'),'64 (set), -1 (decrease), +1 (increase)');passed.push('TTL examples use supported syntax');
|
|
|
for(const [type,prefix,open,apply]of [['filter','fw','openAddFilterModal','applyFilterRule'],['nat','nat','openAddNATModal','applyNATRule']]){
|
|
|
await page.evaluate(async({type,prefix,open,apply})=>{window[open]();window[prefix==='fw'?'toggleFwField':'toggleNATField']('days',true);for(const d of ['sun','mon','tue','wed','thu','fri','sat'])document.getElementById(prefix+'-day-'+d).checked=d==='fri';await window[apply](true)},{type,prefix,open,apply});assert.equal(writes.at(-1).body.days,'fri');
|
|
|
}passed.push('Weekdays serialized for Filter and NAT');
|