90 lines
2.5 KiB
JavaScript
90 lines
2.5 KiB
JavaScript
describe(
|
|
"Entering payment for the job",
|
|
{
|
|
defaultCommandTimeout: 5000,
|
|
},
|
|
() => {
|
|
beforeEach(() => {
|
|
cy.visit("/manage");
|
|
|
|
cy.get("body").then(($body) => {
|
|
if ($body.text().includes("Login")) {
|
|
// Log in
|
|
cy.get('[data-cy="username"]').type("john@imex.dev");
|
|
cy.get('[data-cy="password"]').type("john123");
|
|
cy.get('[data-cy="sign-in-button"]').click();
|
|
}
|
|
|
|
cy.get(".ant-table-tbody")
|
|
.should("be.visible")
|
|
.find("tr")
|
|
.should("not.have.class", "ant-table-placeholder");
|
|
|
|
cy.get(".ant-table-row")
|
|
.not(':contains("Open")')
|
|
.first()
|
|
.find("a")
|
|
.first()
|
|
.click();
|
|
|
|
cy.url().should("include", "/manage/jobs");
|
|
|
|
// Go to totals data tab
|
|
cy.get('[data-cy="tab-totals"]').should("be.visible").click();
|
|
});
|
|
});
|
|
|
|
it("enters a payment manually", () => {
|
|
cy.get('[data-cy="job-payment-button"]').should("be.visible").click();
|
|
|
|
// fill out form
|
|
cy.get('[data-cy="payment-amount"]').type(100);
|
|
cy.get('[data-cy="payment-transactionid"]').type("QBD-P-03");
|
|
cy.get('[data-cy="payment-memo"]').type("e2e testing");
|
|
cy.get('[data-cy="payment-date"]').click();
|
|
cy.get('[title="2023-07-03"]').should("be.visible").click();
|
|
|
|
cy.antdSelect("payer");
|
|
cy.antdSelect("type");
|
|
|
|
cy.get('[data-cy="payment-form-save"]').click();
|
|
});
|
|
|
|
// TODO Add payment using intellipay
|
|
|
|
it("marks payment as exported", () => {
|
|
cy.get('[data-cy="payments-table"]')
|
|
.find(".ant-table-tbody")
|
|
.find("> tr:not(.ant-table-measure-row)")
|
|
.as("payments-table")
|
|
.should("not.have.class", "ant-table-placeholder");
|
|
|
|
cy.get("@payments-table")
|
|
.first()
|
|
.find('[data-cy="edit-payment-button"]')
|
|
.click();
|
|
|
|
cy.get('[data-cy="payment-markexported"]')
|
|
.should("not.be.disabled")
|
|
.click();
|
|
});
|
|
|
|
it("marks payment for re-export", () => {
|
|
cy.get('[data-cy="payments-table"]')
|
|
.find(".ant-table-tbody")
|
|
.find("> tr:not(.ant-table-measure-row)")
|
|
.as("payments-table")
|
|
.should("not.have.class", "ant-table-placeholder");
|
|
|
|
cy.get("@payments-table")
|
|
.last()
|
|
.find('[data-cy="edit-payment-button"]')
|
|
.click();
|
|
|
|
cy.get('[data-cy="payment-markforreexport"]')
|
|
.should("not.be.disabled")
|
|
.click();
|
|
});
|
|
}
|
|
);
|