First Commit
This commit is contained in:
43
cypress/support/commands.js
Normal file
43
cypress/support/commands.js
Normal 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
1
cypress/support/index.js
Normal file
@@ -0,0 +1 @@
|
||||
import './commands'
|
Reference in New Issue
Block a user