Ankush Menat | bedb0ad | 2021-07-02 20:36:51 +0530 | [diff] [blame] | 1 | describe("Test Item Dashboard", () => { |
| 2 | before(() => { |
| 3 | cy.login(); |
| 4 | cy.visit("/app/item"); |
| 5 | cy.insert_doc( |
| 6 | "Item", |
| 7 | { |
| 8 | item_code: "e2e_test_item", |
| 9 | item_group: "All Item Groups", |
| 10 | opening_stock: 42, |
| 11 | valuation_rate: 100, |
| 12 | }, |
| 13 | true |
| 14 | ); |
| 15 | cy.go_to_doc("item", "e2e_test_item"); |
| 16 | }); |
| 17 | |
| 18 | it("should show dashboard with correct data on first load", () => { |
| 19 | cy.get(".stock-levels").contains("Stock Levels").should("be.visible"); |
| 20 | cy.get(".stock-levels").contains("e2e_test_item").should("exist"); |
| 21 | |
| 22 | // reserved and available qty |
| 23 | cy.get(".stock-levels .inline-graph-count") |
| 24 | .eq(0) |
| 25 | .contains("0") |
| 26 | .should("exist"); |
| 27 | cy.get(".stock-levels .inline-graph-count") |
| 28 | .eq(1) |
| 29 | .contains("42") |
| 30 | .should("exist"); |
| 31 | }); |
| 32 | |
| 33 | it("should persist on field change", () => { |
| 34 | cy.get('input[data-fieldname="disabled"]').check(); |
| 35 | cy.wait(500); |
| 36 | cy.get(".stock-levels").contains("Stock Levels").should("be.visible"); |
| 37 | cy.get(".stock-levels").should("have.length", 1); |
| 38 | }); |
| 39 | |
| 40 | it("should persist on reload", () => { |
| 41 | cy.reload(); |
| 42 | cy.get(".stock-levels").contains("Stock Levels").should("be.visible"); |
| 43 | }); |
| 44 | }); |