github.com/replicatedhq/ship@v0.55.0/web/app/cypress/integration/init/testchart.spec.js (about) 1 const buildRepeatKeyString = (key, length) => Array.from({ length }).fill(key).join(""); 2 const SECONDS = 1000; 3 describe("Ship Init test-charts/modify-chart", () => { 4 before(() => { 5 cy.visit(Cypress.env("HOST")); 6 }) 7 8 context("intro", () => { 9 it("allows navigation to the Helm step", () => { 10 cy.get(".btn").click(); 11 cy.location("pathname").should("eq", "/values") 12 }); 13 }); 14 15 context("values", () => { 16 context("required Helm values entered", () => { 17 it("successfully saves Helm values", () => { 18 const downArrowsToRequiredHelmValue = buildRepeatKeyString("{downarrow}", 16); 19 const rightArrowsToRequiredHelmValue = buildRepeatKeyString("{rightarrow}", 16); 20 const backspacesToDeleteValue = buildRepeatKeyString("{backspace}", 5); 21 cy.get(".ace_text-input").first().type( 22 `${downArrowsToRequiredHelmValue}${rightArrowsToRequiredHelmValue}${backspacesToDeleteValue}true`, 23 { force: true, delay: 0 } 24 ); 25 cy.get(".primary").click(); 26 cy.get(".u-color--vidaLoca").contains("Values saved"); 27 }); 28 29 it("allows navigation to the render step", () => { 30 cy.get(".secondary.hv-save").click(); 31 cy.location("pathname").should("eq", "/render") 32 }) 33 }); 34 }); 35 36 context("render", () => { 37 it("allows navigation to the kustomize-intro step", () => { 38 cy.location("pathname").should("eq", "/kustomize-intro"); 39 }); 40 }); 41 42 context("kustomize-intro", () => { 43 it("allows navigation to the kustomize step", () => { 44 cy.get(".renderActions-wrapper .btn.primary").click(); 45 cy.location("pathname").should("eq", "/kustomize"); 46 }); 47 }); 48 context("kustomize", () => { 49 context("valid line clicked in editor", () => { 50 it("generates a stubbed overlay", () => { 51 cy.get(".FileTree-wrapper > ul > li").first().click(); 52 cy.get(".file-contents-wrapper > #brace-editor > .ace_scroller > .ace_content > .ace_text-layer > :nth-child(1)").as("replicaKey"); 53 cy.get("@replicaKey").trigger("mousemove", { force: true }); 54 cy.get("@replicaKey").click({ force: true }); 55 }); 56 57 it("allows the stubbed overlay to be edited", () => { 58 cy.get(".ace_text-input").last().type( 59 `{end}{backspace}2`, 60 { force: true } 61 ) 62 }); 63 context("valid Kustomize overlay written", () => { 64 it("allows the overlay to be saved", () => { 65 cy.get(".save-btn").click(); 66 }); 67 68 it("allows navigation to the overlay finalization step", () => { 69 cy.get(".finalize-btn").click(); 70 cy.wait(10.5 * SECONDS); 71 cy.location("pathname", {timeout: 10000}).should("eq", "/outro"); 72 }) 73 }) 74 }) 75 }); 76 77 context("outro", () => { 78 it("allows the user to complete wizard", () => { 79 cy.get(".btn.primary", {timeout: 10000}).first().click({force: true}); 80 }) 81 }) 82 });