Tell us what’s happening:
It doesn’t work, I’ve done all different methods but sadly it doesn’t work.
I’ve passed all the other test but just the first test is not working can someone help me here? I have even tried refreshing my code and the fCC website to see if it could help but it couldn’t. I have even closed my browser and reopened it and it doesn’t work as well. Could this be a problem with the fCC website?
###Your project link(s)
code: Glitch :・゚✧
Full code:
const chai = require('chai');
const assert = chai.assert;
const server = require('../server');
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
suite('Functional Tests', function () {
this.timeout(5000);
suite('Integration tests with chai-http', function () {
// #1
test('Test GET /hello with no name', function (done) {
chai
.request(server)
.keepOpen()
.get('/hello')
.end(function (err, res) {
assert.equal(res.status, 200);
assert.equal(res.text, 'hello Guest');
done();
});
});
// #2
test('Test GET /hello with your name', function (done) {
chai
.request(server)
.keepOpen()
.get('/hello?name=xy_z')
.end(function (err, res) {
assert.equal(res.status, 200);
assert.equal(res.text, 'hello xy_z');
done();
});
});
// #3
test('Send {surname: "Colombo"}', function (done) {
chai
.request(server)
.keepOpen()
.put('/travellers')
.send({surname: "Colombo"})
.end(function (err, res) {
assert.equal(res.status, 200, 'response status should be 200');
assert.equal(res.type, 'application/json', 'Response should be json')
assert.equal(res.body.name, "Cristoforo", 'res.body.name should be "Cristoforo"')
assert.equal(res.body.surname, "Colombo", 'res.body.surname should be "Colombo"')
done();
});
});
// #4
test('Send {surname: "da Verrazzano"}', function (done) {
chai
.request(server)
.put('/travellers')
.send({surname: 'da Verrazzano'})
.end(function(err, res) {
assert.equal(res.status, 200, 'response status should be 200')
assert.equal(res.type, 'application/json', 'Response should be json')
assert.equal(res.body.name, 'Giovanni', 'res.body.name should be "Gioovanni"')
assert.equal(res.body.surname, 'da Verrazzano', 'res.body.surname should be "da Verrazzano"')
done();
});
done();
});
});
});
const Browser = require('zombie');
Browser.site = 'https://resonant-excessive-frog.glitch.me/';
suite('Functional Tests with Zombie.js', function () {
this.timeout(5000);
const browser = new Browser();
suiteSetup(function(done) {
return browser.visit('/', done);
});
suite('Headless browser', function () {
test('should have a working "site" property', function() {
assert.isNotNull(browser.site);
});
});
suite('"Famous Italian Explorers" form', function () {
// #5
test('Submit the surname "Colombo" in the HTML form', function (done) {
browser.fill('surname', 'Colombo').pressButton('submit', function() {
browser.assert.success();
browser.assert.text('span#name', 'Cristoforo');
browser.assert.text('span#surname', 'Colombo');
browser.assert.element('span#dates', 1);
done();
});
});
// #6
test('submit "surname" : "Vespucci" - write your e2e test...', function (done) {
browser.fill('surname','Vespucci')
.pressButton('submit', ()=> {
browser.assert.success();
browser.assert.text('span#name','Amerigo');
browser.assert.text('span#surname','Vespucci');
browser.assert.elements('span#dates', 1);
done();
});
});
});
});
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Challenge Information:
Quality Assurance and Testing with Chai - Run Functional Tests Using a Headless Browser II