First Commit

This commit is contained in:
Thoscellen 2019-08-22 12:32:23 +02:00
commit a6fdbf3ae8
13 changed files with 2717 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

4
cypress.json Normal file
View File

@ -0,0 +1,4 @@
{
"projectId": "FeedReader Integration Tests",
"baseUrl": "https://feedreader.com/"
}

View File

@ -0,0 +1,791 @@
{
"log": {
"version": "1.2",
"creator": {
"name": "Firefox",
"version": "68.0.2"
},
"browser": {
"name": "Firefox",
"version": "68.0.2"
},
"pages": [
{
"startedDateTime": "2019-08-18T13:16:24.883+02:00",
"id": "page_1",
"pageTimings": {
"onContentLoad": -1163948,
"onLoad": -1163726
}
}
],
"entries": [
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:24.883+02:00",
"request": {
"bodySize": 0,
"method": "DELETE",
"url": "https://feedreader.com/online/api/feed/3911929/?t=1566126984863",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "t",
"value": "1566126984863"
}
],
"headersSize": 409
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 30,
"text": "{\"status\":\"success\",\"data\":[]}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 291
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 0,
"ssl": 0,
"send": 0,
"wait": 124,
"receive": 0
},
"time": 124,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
},
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:24.893+02:00",
"request": {
"bodySize": 0,
"method": "GET",
"url": "https://feedreader.com/online/api/category?t=1566126984868",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "t",
"value": "1566126984868"
}
],
"headersSize": 401
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 215,
"text": "{\"status\":\"success\",\"data\":[{\"id\":\"starred\",\"name\":\"Starred items\",\"unread\":0,\"feed\":[]},{\"id\":\"all\",\"name\":\"All items\",\"unread\":0,\"feed\":[]},{\"id\":\"0\",\"color\":\"A3A3A3\",\"name\":\"Uncategorized\",\"unread\":0,\"feed\":[]}]}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 380
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 126,
"ssl": 0,
"send": 0,
"wait": 120,
"receive": 0
},
"time": 246,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
},
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:24.893+02:00",
"request": {
"bodySize": 0,
"method": "GET",
"url": "https://feedreader.com/online/api/item?limit=40&updated_after=1565913600&feed=3911929&t=1566126984868",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "limit",
"value": "40"
},
{
"name": "updated_after",
"value": "1565913600"
},
{
"name": "feed",
"value": "3911929"
},
{
"name": "t",
"value": "1566126984868"
}
],
"headersSize": 444
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 115,
"text": "{\"status\":\"success\",\"data\":{\"items\":[],\"update_page\":\"\\/api\\/item?limit=40&updated_after=1565913600&feed=3911929\"}}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 363
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 129,
"ssl": 106,
"send": 0,
"wait": 118,
"receive": 0
},
"time": 353,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
},
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:25.058+02:00",
"request": {
"bodySize": 0,
"method": "GET",
"url": "https://feedreader.com/online/api/item?category=0&limit=40&t=1566126985035",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "category",
"value": "0"
},
{
"name": "limit",
"value": "40"
},
{
"name": "t",
"value": "1566126985035"
}
],
"headersSize": 417
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 88,
"text": "{\"status\":\"success\",\"data\":{\"items\":[],\"update_page\":\"\\/api\\/item?limit=40&category=0\"}}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 342
},
"cache": {},
"timings": {
"blocked": 70,
"dns": 0,
"connect": 0,
"ssl": 0,
"send": 0,
"wait": 122,
"receive": 0
},
"time": 192,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
},
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:25.063+02:00",
"request": {
"bodySize": 0,
"method": "GET",
"url": "https://feedreader.com/online/api/category?t=1566126985038",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "t",
"value": "1566126985038"
}
],
"headersSize": 401
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:25 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 215,
"text": "{\"status\":\"success\",\"data\":[{\"id\":\"starred\",\"name\":\"Starred items\",\"unread\":0,\"feed\":[]},{\"id\":\"all\",\"name\":\"All items\",\"unread\":0,\"feed\":[]},{\"id\":\"0\",\"color\":\"A3A3A3\",\"name\":\"Uncategorized\",\"unread\":0,\"feed\":[]}]}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 380
},
"cache": {},
"timings": {
"blocked": 1,
"dns": 0,
"connect": 99,
"ssl": 0,
"send": 0,
"wait": 127,
"receive": 0
},
"time": 227,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
},
{
"pageref": "page_1",
"startedDateTime": "2019-08-18T13:16:30.264+02:00",
"request": {
"bodySize": 0,
"method": "GET",
"url": "https://feedreader.com/online/api/item?limit=40&category=0&t=1566126990259",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Host",
"value": "feedreader.com"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Accept-Language",
"value": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
{
"name": "Accept-Encoding",
"value": "gzip, deflate, br"
},
{
"name": "DNT",
"value": "1"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Referer",
"value": "https://feedreader.com/online/"
},
{
"name": "Cookie",
"value": "session=1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"cookies": [
{
"name": "session",
"value": "1227b276aad9ca13ab53c64a6cfbf89287a43361"
}
],
"queryString": [
{
"name": "limit",
"value": "40"
},
{
"name": "category",
"value": "0"
},
{
"name": "t",
"value": "1566126990259"
}
],
"headersSize": 417
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Server",
"value": "nginx/1.10.3"
},
{
"name": "Date",
"value": "Sun, 18 Aug 2019 11:16:30 GMT"
},
{
"name": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"name": "Transfer-Encoding",
"value": "chunked"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Vary",
"value": "Accept-Encoding"
},
{
"name": "Content-Encoding",
"value": "gzip"
}
],
"cookies": [],
"content": {
"mimeType": "application/json; charset=utf-8",
"size": 88,
"text": "{\"status\":\"success\",\"data\":{\"items\":[],\"update_page\":\"\\/api\\/item?limit=40&category=0\"}}"
},
"redirectURL": "",
"headersSize": 241,
"bodySize": 342
},
"cache": {},
"timings": {
"blocked": 0,
"dns": 0,
"connect": 0,
"ssl": 0,
"send": 0,
"wait": 135,
"receive": 0
},
"time": 135,
"_securityState": "secure",
"serverIPAddress": "54.165.83.11",
"connection": "443"
}
]
}
}

View File

View File

@ -0,0 +1,4 @@
{
"email": "Mutoid@yopmail.com",
"password": "123456"
}

View 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')
})
})

View 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');
})
})

View 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
})
})

17
cypress/plugins/index.js Normal file
View File

@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@ -0,0 +1,43 @@
Cypress.Commands.add('login', function (user) {
if(user === undefined) throw new Error("Login via API failed because the user credential was not given.");
cy.request({
method: 'POST',
url: "/online/api/auth?t=" + new Date().getTime(),
body: {
"email": user.email,
"password": user.password,
"remember": false
}
}).as("response")
});
Cypress.Commands.add('logout', function () {
cy.request({
method: 'GET',
url: "/online/logout",
});
})
Cypress.Commands.add('addFeed', function (arrayOfFeed) {
arrayOfFeed.forEach(element => {
cy.request({
method: 'POST',
url: "/online/api/feed?t=" + new Date().getTime(),
body: {
"category": element.category,
"feed": element.feed
}
}).then((response) => {
if (response.status == 200) {
// collect data :
// id : number like 3911929
// category : number or 0 if not defined
}
})
});
})
Cypress.Commands.add('removeFeed', function () {
})

1
cypress/support/index.js Normal file
View File

@ -0,0 +1 @@
import './commands'

1578
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "feedreader-integration-tests",
"version": "1.0.0",
"description": "A project that perform End-2-End tests on the FeedReader website, in order to help me learn Cypress.",
"main": "index.js",
"scripts": {
"test": "npx cypress open"
},
"author": "Thoscellen",
"license": "ISC",
"devDependencies": {
"cypress": "^3.4.1"
}
}