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

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'