First Commit
This commit is contained in:
30
cypress/integration/home_spec.js
Normal file
30
cypress/integration/home_spec.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
describe('Feedreader homepage', function () {
|
||||
it('Visits Feedreader homepage', function() {
|
||||
// Act
|
||||
cy.visit("");
|
||||
// Asset
|
||||
cy.url().should("begin", "https://feedreader.com/");
|
||||
})
|
||||
|
||||
it('Launch Feedreader online', function() {
|
||||
// Arrange
|
||||
cy.visit("");
|
||||
// Act
|
||||
cy.get('a[href="//feedreader.com/online"]').click()
|
||||
// Asset
|
||||
cy.url().should('contain', 'online')
|
||||
})
|
||||
|
||||
it('Launch Feedreader observe', function() {
|
||||
// Arrange
|
||||
cy.visit("");
|
||||
// Act
|
||||
cy.get('a[href="https://feedreader.com/observe/"]').click({force : true, multiple : true})
|
||||
// Asset
|
||||
cy.url().should('contain', 'observe')
|
||||
|
||||
})
|
||||
|
||||
})
|
210
cypress/integration/login_spec.js
Normal file
210
cypress/integration/login_spec.js
Normal file
@@ -0,0 +1,210 @@
|
||||
/// <reference types="Cypress" />
|
||||
// import userMutoid from '../../fixtures/userMutoid';
|
||||
var Mutoid;
|
||||
|
||||
describe('As a visitor, I am able to log in', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
cy.visit("/online");
|
||||
})
|
||||
|
||||
it('Ckeck that the login page is accessible', function () {
|
||||
// Asset
|
||||
cy.url().should('include', '?action=login');
|
||||
})
|
||||
|
||||
it('Check that the login tab is active by default', function () {
|
||||
// Asset
|
||||
cy.get('.menu-reg').first().find('a[href$="action=login"]').should('have.class', 'active');
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
describe('As a visitor, I can only create an account the right way.', function () {
|
||||
|
||||
before(function () {
|
||||
cy.fixture("userMutoid.json").as("Mutoid").then(() => {
|
||||
expect(this.Mutoid.email).to.exist;
|
||||
expect(this.Mutoid.password).to.exist;
|
||||
Mutoid = this.Mutoid;
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(', go to the login webpage.', function () {
|
||||
cy.visit("/online");
|
||||
});
|
||||
|
||||
it('Check that the Create Account tab is accessible', function () {
|
||||
// Assert
|
||||
cy.get('.menu-reg').first().find('a[href$="action=register"]')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('Check that the Create Account tab shows a form to fill when active', function () {
|
||||
// Act : Visiter le formulaire pour s'inscrire.
|
||||
cy.get('.menu-reg').find('a[href$="action=register"]').click();
|
||||
// Assert
|
||||
cy.url().should('include', '?action=register');
|
||||
// L'onglet "Create accout" possède la classe "active".
|
||||
cy.get('.menu-reg').find('a[href$="action=register"]').should('have.class', 'active')
|
||||
// Les formulaires existent et sont visible
|
||||
cy.get('input#register-email')
|
||||
.should('be.visible');
|
||||
cy.get('input#register-password')
|
||||
.should('be.visible');
|
||||
// Le bouton "Create Account" existe.
|
||||
cy.get('#register-form').find(":submit");
|
||||
});
|
||||
|
||||
it('Allow to land directly on the Register page', function () {
|
||||
//Act
|
||||
cy.visit('/online/#/welcome/?action=register')
|
||||
//Assert
|
||||
cy.get('.menu-reg').first().find('a[href$="action=register"]').should('have.class', 'active');
|
||||
})
|
||||
|
||||
it('Prevent to create an account with empty fields', function () {
|
||||
// Arrange
|
||||
cy.get('.menu-reg').first().find('a[href$="action=register"]').click();
|
||||
cy.get('input#register-email').should('have.not.class', 'input_error');
|
||||
cy.get('input#register-password').should('have.not.class', 'input_error');
|
||||
|
||||
// Act
|
||||
cy.get('#register-form').find(":submit").click();
|
||||
// Assert
|
||||
cy.get('div#register-error') // Message d'erreur
|
||||
.should('have.class', 'register__error')
|
||||
.and('be.not.visible');
|
||||
|
||||
cy.get('input#register-email').should('have.class', 'input_error'); // Champs surlignés
|
||||
cy.get('input#register-password').should('have.class', 'input_error');
|
||||
})
|
||||
|
||||
it('Prevent to create an account with an already existing account', function () {
|
||||
// Arrange
|
||||
cy.get('.menu-reg').first().find('a[href$="action=register"]').click();
|
||||
|
||||
// Act
|
||||
cy.get('input#register-email').type(Mutoid.email);
|
||||
cy.get('input#register-password').type(Mutoid.password);
|
||||
cy.get('#register-form').find(":submit").click();
|
||||
|
||||
// Assert
|
||||
cy.get('input#register-email').should('have.class', 'input_error');
|
||||
cy.get('input#register-password').should('have.class', 'input_error');
|
||||
cy.get('div#register-error')
|
||||
.should('be.visible')
|
||||
.and('contain', 'This email is already registered, please choose another one.')
|
||||
})
|
||||
});
|
||||
|
||||
describe("As a user, I can only log in and out the right way", function () {
|
||||
|
||||
before(function () {
|
||||
//cy.server();
|
||||
cy.fixture("userMutoid.json").as("Mutoid").then(() => {
|
||||
expect(this.Mutoid.email).to.exist;
|
||||
expect(this.Mutoid.password).to.exist;
|
||||
Mutoid = this.Mutoid;
|
||||
});
|
||||
//cy.route('GET', '/mutoid', 'fx:userMutoid').as("Mutoid");
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
cy.visit("/online");
|
||||
})
|
||||
|
||||
|
||||
it('Prevent to log in with empty credentials', function () {
|
||||
// Act
|
||||
cy.get('form#login-form').find(':submit').click();
|
||||
// Assert
|
||||
cy.url().should('include', '?action=login'); // Pas de redirection
|
||||
cy.get('div#login-error')
|
||||
.should('have.class', 'login__error')
|
||||
.and('be.visible')
|
||||
.and('contain', "Please fill the email and password fields"); // Message d'erreur de l'API
|
||||
// Champs éclairés
|
||||
cy.get('input#login-email').should('have.class', 'input_error');
|
||||
cy.get('input#login-password').should('have.class', 'input_error');
|
||||
})
|
||||
|
||||
it('Prevent to log in with just the email', function () {
|
||||
|
||||
|
||||
// Act
|
||||
cy.get("#login-email").type(Mutoid.email);
|
||||
cy.get('form#login-form').find(':submit').click();
|
||||
// Assert
|
||||
cy.url().should('include', '?action=login'); // Pas de redirection
|
||||
cy.get('div#login-error')
|
||||
.should('have.class', 'login__error')
|
||||
.and('be.visible'); // Message d'erreur
|
||||
// Champs éclairés
|
||||
cy.get('input#login-email').should('have.class', 'input_error');
|
||||
cy.get('input#login-password').should('have.class', 'input_error');
|
||||
})
|
||||
|
||||
it('Prevent to log in with just the password', function () {
|
||||
// Act
|
||||
cy.get("#login-password").type(Mutoid.password)
|
||||
cy.get('form#login-form').find(':submit').click();
|
||||
// Assert
|
||||
cy.url().should('include', '?action=login'); // Pas de redirection
|
||||
cy.get('div#login-error')
|
||||
.should('have.class', 'login__error')
|
||||
.and('be.visible'); // Message d'erreur
|
||||
// Champs éclairés
|
||||
cy.get('input#login-email').should('have.class', 'input_error');
|
||||
cy.get('input#login-password').should('have.class', 'input_error');
|
||||
})
|
||||
|
||||
it('Prevent to log in Mutoid with an invalid password', function () {
|
||||
// Act
|
||||
cy.get("#login-email").type(Mutoid.email)
|
||||
cy.get("#login-password").type(Mutoid.email)
|
||||
cy.get('form#login-form').find(':submit').click();
|
||||
// Assert
|
||||
cy.url().should('include', '?action=login'); // Pas de redirection
|
||||
cy.get('div#login-error')
|
||||
.should('have.class', 'login__error')
|
||||
.and('be.visible'); // Message d'erreur
|
||||
// Champs éclairés
|
||||
cy.get('input#login-email').should('have.class', 'input_error');
|
||||
cy.get('input#login-password').should('have.class', 'input_error');
|
||||
})
|
||||
|
||||
it('Logs Mutoid in.', function () {
|
||||
// Act
|
||||
cy.get("#login-email").type(Mutoid.email)
|
||||
cy.get("#login-password").type(Mutoid.password)
|
||||
cy.get("#login-form").find(":submit").click()
|
||||
// Assert
|
||||
cy.url().should('contain', '/online/#/reader/category/all/')
|
||||
cy.get("div#user").find("a.user__settings").click();
|
||||
cy.logout();
|
||||
});
|
||||
|
||||
it('Logs Mutoid in via API', function () {
|
||||
// act
|
||||
cy.login(Mutoid);
|
||||
cy.visit("/online");
|
||||
// assert
|
||||
cy.getCookie('session').should('exist');
|
||||
});
|
||||
|
||||
it('Logs Mutoid out.', function () {
|
||||
// Arrange
|
||||
cy.login(Mutoid)
|
||||
cy.visit('/online');
|
||||
// act
|
||||
cy.get("div#user").find("a.user__settings").click();
|
||||
cy.get("div#user-menu").find('.logout').click();
|
||||
//assert
|
||||
cy.url().should('include', '?action=login');
|
||||
cy.get('.menu-reg').first().find('a[href$="action=login"]')
|
||||
.should('have.class', 'active');
|
||||
cy.getCookie('session').should('not.exist');
|
||||
})
|
||||
|
||||
})
|
24
cypress/integration/reader_spec.js
Normal file
24
cypress/integration/reader_spec.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
describe('As a user, I can manage feeds', function () {
|
||||
|
||||
before(function () {
|
||||
cy.login();
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
cy.visite("/online/#/reader/category/all/");
|
||||
})
|
||||
|
||||
|
||||
it('Add a new feed.', function () {
|
||||
//arrange
|
||||
|
||||
//act
|
||||
cy.get(".button_add-feed").click();
|
||||
cy.get("#subscribe-form").find("#subscribe-url").type("")
|
||||
//assert
|
||||
|
||||
})
|
||||
|
||||
})
|
Reference in New Issue
Block a user