optimised a few test and prepare some feed for reader tests.

This commit is contained in:
Thoscellen 2019-08-23 12:23:00 +02:00
parent bb819b15b5
commit d5e7b71d62
2 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,14 @@
{
"xkcd" : {
"rss" : "https://xkcd.com/rss.xml",
"website" : "https://xkcd.com/",
},
"css-tricks" : {
"rss" : "https://css-tricks.com/feed/?post_type=newsletters",
"website" : "https://css-tricks.com/"
},
"bbcnews" : {
"rss" : "http://feeds.bbci.co.uk/news/rss.xml",
"website" : "https://www.bbc.com/news"
}
}

View File

@ -49,14 +49,16 @@ describe('As a visitor, I can only register the right way.', function () {
it('Prevent to create an account with empty fields', function () { it('Prevent to create an account with empty fields', function () {
// Arrange // Arrange
cy.get('.menu-reg').first().find('a[href$="action=register"]').click(); cy.get('.menu-reg').first().find('a[href$="action=register"]').click();
// Assert everything is fine before acting
cy.get('input#register-email').should('have.not.class', 'input_error'); cy.get('input#register-email').should('have.not.class', 'input_error');
cy.get('input#register-password').should('have.not.class', 'input_error'); cy.get('input#register-password').should('have.not.class', 'input_error');
cy.get('div#register-error').should("not.be.visible");
// Act // Act
cy.get('#register-form').find(":submit").click(); cy.get('#register-form').find(":submit").click();
// Assert // Assert
cy.get('div#register-error') // Message d'erreur cy.get('div#register-error') // Message d'erreur
.should('have.class', 'register__error') .should('have.class', 'register__error')
.and('be.not.visible'); .and('be.visible');
cy.get('input#register-email').should('have.class', 'input_error'); // Champs surlignés cy.get('input#register-email').should('have.class', 'input_error'); // Champs surlignés
cy.get('input#register-password').should('have.class', 'input_error'); cy.get('input#register-password').should('have.class', 'input_error');
}) })
@ -85,7 +87,7 @@ describe('As a visitor, I can only register the right way.', function () {
}); });
}) })
it.only('Check that it explain correclty to the user when he try to create an already existing account', function () { it('Check that it explain correclty to the user when he try to create an already existing account', function () {
cy.server(); cy.server();
cy.fixture("users.json").as("users").then((users) => { cy.fixture("users.json").as("users").then((users) => {
let mutoid = users["Mutoid"]; let mutoid = users["Mutoid"];
@ -98,6 +100,8 @@ describe('As a visitor, I can only register the right way.', function () {
failOnStatusCode: false, failOnStatusCode: false,
qs: { "t": new Date().getTime() } qs: { "t": new Date().getTime() }
}).then((response) => { }).then((response) => {
cy.log(response);
cy.expect(response.status).to.be.eq(400);
cy.expect(response.body.status).to.be.eq('error'); cy.expect(response.body.status).to.be.eq('error');
cy.expect(response.body.errors[0]).to.be.eq('This email is already registered, please choose another one.'); cy.expect(response.body.errors[0]).to.be.eq('This email is already registered, please choose another one.');
}); });
@ -114,9 +118,6 @@ describe("As a user, I can only log in and out the right way", function () {
before(function () { before(function () {
cy.fixture("users.json").as("users").then((users) => { cy.fixture("users.json").as("users").then((users) => {
mutoid = users["Mutoid"]; mutoid = users["Mutoid"];
//expect(mutoid.email).to.exist;
//expect(mutoid.password).to.exist;
//expect(mutoid.type).eq("user");
}); });
}) })
@ -189,14 +190,16 @@ describe("As a user, I can only log in and out the right way", function () {
// Assert // Assert
cy.url().should('contain', '/online/#/reader/category/all/') cy.url().should('contain', '/online/#/reader/category/all/')
cy.get("div#user").find("a.user__settings").click(); cy.get("div#user").find("a.user__settings").click();
cy.logout(); cy.getCookie('session').should('exist');
}); });
it.skip('Logs Mutoid in via API', function () { it('Logs Mutoid in via API', function () {
// act // act
cy.login(mutoid); cy.login(mutoid);
cy.visit("/online"); cy.visit("/online");
// assert // assert
cy.url().should('contain', '/online/#/reader/category/all/')
cy.get("div#user").find("a.user__settings").click();
cy.getCookie('session').should('exist'); cy.getCookie('session').should('exist');
}); });
@ -204,6 +207,7 @@ describe("As a user, I can only log in and out the right way", function () {
// Arrange // Arrange
cy.login(mutoid) cy.login(mutoid)
cy.visit('/online'); cy.visit('/online');
cy.getCookie('session').should('exist');
// act // act
cy.get("div#user").find("a.user__settings").click(); cy.get("div#user").find("a.user__settings").click();
cy.get("div#user-menu").find('.logout').click(); cy.get("div#user-menu").find('.logout').click();