bored-bear-79292
01/24/2023, 3:16 PMjavascript
class InvoicesApi {
createInvoice(body) {
...
}
printInvoice(id) {
...
}
deleteInvoice(id) {
...
}
getInvoice(id) {
}
}
export default new InvoicesApi();
And on the tests, just invoke the "page object", the same way we do from UI.
javascript
it("create invoice and check default values", () => {
invoicesApi.createInvoice(invoiceBody).then((response) => {
expect(response.status).to.eq(201);
let invoiceId = response.body;
invoicesApi.getInvoice(invoiceId)
....
});
});
It would allow me to gain some maintenance points, but this model is made for UI (pages), not API. I wonder if there is any model to use on API to allow reuse.
What you guys think about it?