3.2 KiB
3.2 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
5f8884f4c46685731aabfc41 | Ejecuta pruebas funcionales usando un navegador sin interfaz gráfica II | 2 | 301594 | run-functional-tests-using-a-headless-browser-ii |
--description--
Como recordatorio, este proyecto está siendo construido con base en el siguiente proyecto inicial Replit, o clonado desde GitHub.
--instructions--
Dentro tests/2_functional-tests.js
, en 'Submit the surname "Vespucci" in the HTML form'
prueba (// #5
), automatiza lo siguiente:
- Rellena el formulario con el apellido
Vespucci
- Presiona el botón enviar
Y dentro del callback de pressButton
:
- Comprueba que el status es OK
200
- Comprueba que el texto dentro del elemento
span#name
es'Amerigo'
- Comprueba que el texto dentro del elemento
span#surname
es'Vespucci'
- Comprueba que existen elemento(s)
span#dates
y su contador es1
No olvides eliminar la llamada assert.fail()
.
--hints--
Todas las pruebas deben pasar.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=6').then(
(data) => {
assert.equal(data.state, 'passed');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Debes asegurarte que la petición del navegador sin interfaz gráfica ha sido exitosa.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=6').then(
(data) => {
assert.equal(data.assertions[0].method, 'browser.success');
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Debes comprobar que el texto dentro del elemento span#name
es 'Amerigo'
.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=6').then(
(data) => {
assert.equal(data.assertions[1].method, 'browser.text');
assert.match(data.assertions[1].args[0], /('|")span#name\1/);
assert.match(data.assertions[1].args[1], /('|")Amerigo\1/);
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Debes comprobar que el texto dentro del elemento span#surname
es 'Vespucci'
.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=6').then(
(data) => {
assert.equal(data.assertions[2].method, 'browser.text');
assert.match(data.assertions[2].args[0], /('|")span#surname\1/);
assert.match(data.assertions[2].args[1], /('|")Vespucci\1/);
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
Debes comprobar que el elemento span#dates
existe y su contador es 1.
(getUserInput) =>
$.get(getUserInput('url') + '/_api/get-tests?type=functional&n=6').then(
(data) => {
assert.equal(data.assertions[3].method, 'browser.elements');
assert.match(data.assertions[3].args[0], /('|")span#dates\1/);
assert.equal(data.assertions[3].args[1], 1);
},
(xhr) => {
throw new Error(xhr.responseText);
}
);
--solutions--
/**
Backend challenges don't need solutions,
because they would need to be tested against a full working project.
Please check our contributing guidelines to learn more.
*/