1 function addVariable() {2 const name = document.getElementById('variable-name').value;3 const value = document.getElementById('variable-value').value;4 const list = document.getElementById('variables-list');5 6 if (name && value) {7 const li = document.createElement('li');8 li.textContent = `${name} = ${value}`;9 list.appendChild(li);10 11 document.getElementById('variable-name').value = '';12 document.getElementById('variable-value').value = '';13 }14 }15 16 function addRequest() {17 const method = document.getElementById('http-method').value;18 const url = document.getElementById('api-url').value;19 const headers = document.getElementById('headers').value;20 const body = document.getElementById('request-body').value;21 const list = document.getElementById('requests-list');22 23 if (method && url) {24 const li = document.createElement('li');25 li.innerHTML = `<strong>${method}</strong> ${url} <br> Headers: ${headers} <br> Body: ${body}`;26 list.appendChild(li);27 28 document.getElementById('api-url').value = '';29 document.getElementById('headers').value = '';30 document.getElementById('request-body').value = '';31 }32 }33 34 function addAssertion() {35 const expression = document.getElementById('assertion-expression').value;36 const list = document.getElementById('assertions-list');37 38 if (expression) {39 const li = document.createElement('li');40 li.textContent = expression;41 list.appendChild(li);42 43 document.getElementById('assertion-expression').value = '';44 }45 }46 47 function saveTest() {48 alert('Test saved!');49 }50
Enlace
El enlace para compartir es: