IO-2327 posting bill test cases

This commit is contained in:
swtmply
2023-08-15 12:05:10 +08:00
parent 8bddfdc104
commit 619e7ca469
2 changed files with 68 additions and 7 deletions

View File

@@ -5,10 +5,10 @@ import Dinero from "dinero.js";
const uuid = () => Cypress._.random(0, 1e6);
describe(
describe.only(
"Billing job parts orders",
{
defaultCommandTimeout: 5000,
defaultCommandTimeout: 10000,
},
() => {
const today = moment(new Date()).format("YYYY-MM-DD");
@@ -61,6 +61,13 @@ describe(
cy.get("#bill-form-date").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="bill-form-parts-bin"]').find("input").click();
cy.get("#location_list")
.next()
.find(".ant-select-item-option-content")
.first()
.click();
cy.get('[data-cy="bill-line-table"]').each(($row) => {
// get retail amount
cy.wrap($row)
@@ -77,7 +84,7 @@ describe(
cy.get('[data-cy="bill-form-bill-total"]').type(sum);
});
// // Click save
// Click save
cy.get('[data-cy="bill-form-save-button"]').click();
cy.get(".ant-notification-notice-message").contains(
@@ -102,6 +109,13 @@ describe(
cy.get("#bill-form-date").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="bill-form-parts-bin"]').find("input").click();
cy.get("#location_list")
.next()
.find(".ant-select-item-option-content")
.first()
.click();
cy.get('[data-cy="bill-line-table"]').each(($row) => {
// get retail amount
cy.wrap($row)
@@ -146,6 +160,13 @@ describe(
cy.get("#bill-form-date").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="bill-form-parts-bin"]').find("input").click();
cy.get("#location_list")
.next()
.find(".ant-select-item-option-content")
.first()
.click();
cy.get('[data-cy="bill-line-table"]').each(($row) => {
// get retail amount
cy.wrap($row)
@@ -248,7 +269,7 @@ describe(
}
);
describe.only(
describe(
"Validating and calculating bills",
{
defaultCommandTimeout: 10000,
@@ -310,6 +331,13 @@ describe.only(
cy.get("#bill-form-date").click();
cy.get(`[title="${today}"]`).should("be.visible").click({ force: true });
cy.get('[data-cy="bill-form-parts-bin"]').find("input").click();
cy.get("#location_list")
.next()
.find(".ant-select-item-option-content")
.first()
.click();
cy.get('[data-cy="bill-line-table"]').each(($row) => {
// get retail amount
cy.wrap($row)
@@ -501,7 +529,7 @@ describe.only(
}
);
// cy.get('[data-cy="bill-form-save-button"]').click();
cy.get('[data-cy="bill-form-save-button"]').click();
cy.get("#totalReturns")
.invoke("text")
@@ -637,7 +665,7 @@ describe.only(
// TODO add more assertions to the parts table
// location, status
it.only("views the row expander if it has the order and bill", () => {
it("views the row expander if it has the order and bill", () => {
cy.get('[data-cy="tab-repairdata"]').should("be.visible").click();
cy.get('[data-cy="filter-parts-button"]')
@@ -652,6 +680,34 @@ describe.only(
.first()
.click();
// TODO find location from bodyshop config
// cy.get('[data-cy="repair-data-table"]')
// .find(".ant-table-tbody")
// .find("> tr:not(.ant-table-measure-row)")
// .first()
// .find("td")
// .eq(13)
// .find("div")
// .should("exist");
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find("td")
.eq(14)
.find("div")
.should("exist");
cy.get('[data-cy="repair-data-table"]')
.find(".ant-table-tbody")
.find("> tr:not(.ant-table-measure-row)")
.first()
.find("td")
.eq(15)
.find("div")
.should("have.text", "Returned");
cy.get('[data-cy="parts-bills-order"]')
.should("be.visible")
.find("li")

View File

@@ -321,7 +321,12 @@ export function BillFormComponent({
</Form.Item>
{!billEdit && (
<Form.Item label={t("bills.fields.allpartslocation")} name="location">
<Select style={{ width: "10rem" }} disabled={disabled} allowClear>
<Select
data-cy="bill-form-parts-bin"
style={{ width: "10rem" }}
disabled={disabled}
allowClear
>
{bodyshop.md_parts_locations.map((loc, idx) => (
<Select.Option key={idx} value={loc}>
{loc}