mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 05:32:39 +01:00
36 lines
981 B
JavaScript
36 lines
981 B
JavaScript
|
import axios from 'axios';
|
||
|
|
||
|
const baseUrl = Cypress.config().baseUrl.endsWith('/')
|
||
|
? Cypress.config().baseUrl.slice(0, -1)
|
||
|
: Cypress.config().baseUrl;
|
||
|
|
||
|
Cypress.Commands.add('createAdminAccount', () => {
|
||
|
let body = {
|
||
|
first_name: "Cypress",
|
||
|
last_name: "Testing",
|
||
|
email: "cypress_testing@example.com",
|
||
|
password: "password",
|
||
|
terms_of_service: true,
|
||
|
privacy_policy: true,
|
||
|
report_errors: true,
|
||
|
};
|
||
|
|
||
|
let headers = {
|
||
|
"Content-Type": "application/json",
|
||
|
"X-Requested-With": "XMLHttpRequest"
|
||
|
};
|
||
|
|
||
|
return axios.post(`${baseUrl}/api/v1/signup?first_load=true`, body, headers)
|
||
|
.then(response => {
|
||
|
console.log('Data from the request', response.data.data[0]);
|
||
|
return response.data.data[0];
|
||
|
})
|
||
|
.catch(e => {
|
||
|
throw "Unable to create an account for admin.";
|
||
|
});
|
||
|
});
|
||
|
|
||
|
Cypress.Commands.add('createClientAccount', () => {
|
||
|
// ..
|
||
|
});
|