From 05855e835719bb2c87f71b66d62972985fd2622a Mon Sep 17 00:00:00 2001 From: Rachel Elysia Perkins Date: Thu, 15 Apr 2021 19:43:02 -0400 Subject: [PATCH 1/5] Fill out form, pseudocode check updated fields --- cypress/integration/app/settingsflow.spec.ts | 108 +++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 cypress/integration/app/settingsflow.spec.ts diff --git a/cypress/integration/app/settingsflow.spec.ts b/cypress/integration/app/settingsflow.spec.ts new file mode 100644 index 00000000000..67e8572c8a7 --- /dev/null +++ b/cypress/integration/app/settingsflow.spec.ts @@ -0,0 +1,108 @@ +describe("Settings flow", () => { + beforeEach(() => { + cy.setup(); + cy.login(); + }); + + it("Modifies and updates all setting successfully", () => { + cy.visit("/settings/organization"); + + cy.findByLabelText(/organization name/i) + .click() + .type("{selectall}{backspace}TJ's Run"); + + cy.findByLabelText(/organization avatar url/i) + .click() + .type("http://tjsrun.com/img/logo.png"); + + cy.findByLabelText(/fleet app url/i) + .click() + .type("{selectall}{backspace}https://localhost:5000"); + + cy.findByLabelText(/enable single sign on/i).check({ force: true }); + + cy.findByLabelText(/identity provider name/i) + .click() + .type("Rachel"); + + cy.findByLabelText(/entity id/i) + .click() + .type("my entity id"); + + cy.findByLabelText(/issuer uri/i) + .click() + .type("my issuer uri"); + + cy.findByLabelText(/idp image url/i) + .click() + .type("https://http.cat/100"); + + // only allowed to fill in either metadata || metadata url + cy.findByLabelText(/metadata url/i) + .click() + .type("http://github.com/fleetdm/fleet"); + + cy.findByLabelText(/allow sso login initiated/i).check({ force: true }); + + cy.findByLabelText(/enable smtp/i).check({ force: true }); + + cy.findByLabelText(/sender address/i) + .click() + .type("rachel@fleetdm.com"); + + cy.findByLabelText(/smtp server/i) + .click() + .type("localhost"); + + cy.get("#port").click().type("{selectall}{backspace}1025"); + + cy.findByLabelText(/use ssl\/tls/i).check({ force: true }); + + cy.findByLabelText(/smtp username/i) + .click() + .type("rachelsusername"); + + cy.findByLabelText(/smtp password/i) + .click() + .type("rachelspassword"); + + // Update settings + cy.findByRole("button", { name: /update settings/i }).click(); + + cy.findByText(/settings updated/i).should("exist"); + + // // Now check + // UNFINISHED + + // cy.findByLabelText(/organization name/i) + // .click() + // .type("{selectall}{backspace}TJ's Run"); + + // cy.findByLabelText(/organization avatar url/i) + // .click() + // .type("http://tjsrun.com/img/logo.png"); + + // cy.findByLabelText(/fleet app url/i) + // .click() + // .type("{selectall}{backspace}https://localhost:5000"); + + // cy.findByLabelText(/entity id/i).should("have.value", /my entity id/i); + + // cy.findByLabelText(/issuer uri/i).should("have.value", /my issuer uri/i); + + // cy.findByLabelText(/idp image url/i).should( + // "have.value", + // "https://http.cat/100" + // ); + + // cy.findByLabelText(/metadata url/i).should( + // "have.value", + // "http://github.com/fleetdm/fleet" + // ); + + // cy.findByLabelText(/identity provider name/i).should( + // "have.value", + // /rachel/ + // ); + }); +}); From e3c6d59fc81ab91010b175e653ff15f22826b567 Mon Sep 17 00:00:00 2001 From: Rachel Elysia Perkins Date: Fri, 16 Apr 2021 09:43:33 -0400 Subject: [PATCH 2/5] Create update assertions --- cypress/integration/app/settingsflow.spec.ts | 61 ++++++++++++-------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/cypress/integration/app/settingsflow.spec.ts b/cypress/integration/app/settingsflow.spec.ts index 67e8572c8a7..4bbc717b1bc 100644 --- a/cypress/integration/app/settingsflow.spec.ts +++ b/cypress/integration/app/settingsflow.spec.ts @@ -71,38 +71,49 @@ describe("Settings flow", () => { cy.findByText(/settings updated/i).should("exist"); - // // Now check - // UNFINISHED + cy.findByLabelText(/organization name/i).should("have.value", "TJ's Run"); - // cy.findByLabelText(/organization name/i) - // .click() - // .type("{selectall}{backspace}TJ's Run"); + cy.findByLabelText(/organization avatar url/i).should( + "have.value", + "http://tjsrun.com/img/logo.png" + ); - // cy.findByLabelText(/organization avatar url/i) - // .click() - // .type("http://tjsrun.com/img/logo.png"); + cy.findByLabelText(/fleet app url/i).should( + "have.value", + "https://localhost:5000" + ); - // cy.findByLabelText(/fleet app url/i) - // .click() - // .type("{selectall}{backspace}https://localhost:5000"); + cy.findByLabelText(/identity provider name/i).should( + "have.value", + "Rachel" + ); - // cy.findByLabelText(/entity id/i).should("have.value", /my entity id/i); + cy.findByLabelText(/entity id/i).should("have.value", "my entity id"); - // cy.findByLabelText(/issuer uri/i).should("have.value", /my issuer uri/i); + cy.findByLabelText(/issuer uri/i).should("have.value", "my issuer uri"); - // cy.findByLabelText(/idp image url/i).should( - // "have.value", - // "https://http.cat/100" - // ); + cy.findByLabelText(/idp image url/i).should( + "have.value", + "https://http.cat/100" + ); - // cy.findByLabelText(/metadata url/i).should( - // "have.value", - // "http://github.com/fleetdm/fleet" - // ); + cy.findByLabelText(/metadata url/i).should( + "have.value", + "http://github.com/fleetdm/fleet" + ); - // cy.findByLabelText(/identity provider name/i).should( - // "have.value", - // /rachel/ - // ); + cy.findByLabelText(/sender address/i).should( + "have.value", + "rachel@fleetdm.com" + ); + + cy.findByLabelText(/smtp server/i).should("have.value", "localhost"); + + cy.get("#port").should("have.value", "1025"); + + cy.findByLabelText(/smtp username/i).should( + "have.value", + "rachelsusername" + ); }); }); From 0f713b486278586c8c132d70475f51cecc864bf1 Mon Sep 17 00:00:00 2001 From: Rachel Elysia Perkins Date: Fri, 16 Apr 2021 12:20:41 -0400 Subject: [PATCH 3/5] Update page before assertions --- cypress/integration/app/settingsflow.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cypress/integration/app/settingsflow.spec.ts b/cypress/integration/app/settingsflow.spec.ts index 4bbc717b1bc..880e33740ef 100644 --- a/cypress/integration/app/settingsflow.spec.ts +++ b/cypress/integration/app/settingsflow.spec.ts @@ -71,6 +71,8 @@ describe("Settings flow", () => { cy.findByText(/settings updated/i).should("exist"); + cy.visit("/settings/organization"); + cy.findByLabelText(/organization name/i).should("have.value", "TJ's Run"); cy.findByLabelText(/organization avatar url/i).should( From 69aa713d086c975215729edf4f6c15dc5725f7fa Mon Sep 17 00:00:00 2001 From: Rachel Elysia Perkins Date: Fri, 16 Apr 2021 14:01:06 -0400 Subject: [PATCH 4/5] Start advanced options --- cypress/integration/app/settingsflow.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cypress/integration/app/settingsflow.spec.ts b/cypress/integration/app/settingsflow.spec.ts index 880e33740ef..1ebdc47e81f 100644 --- a/cypress/integration/app/settingsflow.spec.ts +++ b/cypress/integration/app/settingsflow.spec.ts @@ -66,6 +66,16 @@ describe("Settings flow", () => { .click() .type("rachelspassword"); + cy.get("#advancedoptions").click(); + + cy.findByLabelText(/domain/i) + .click() + .type("http://www.fleetdm.com"); + + cy.findByLabelText(/verify ssl certs/i) + .findByRole("button") + .click(); + // Update settings cy.findByRole("button", { name: /update settings/i }).click(); From c873ea1cd8078125b3233791efd80844bed2c461 Mon Sep 17 00:00:00 2001 From: Rachel Elysia Perkins Date: Fri, 16 Apr 2021 17:38:23 -0400 Subject: [PATCH 5/5] Add advance options --- cypress/integration/app/settingsflow.spec.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cypress/integration/app/settingsflow.spec.ts b/cypress/integration/app/settingsflow.spec.ts index 1ebdc47e81f..7db503b7b6e 100644 --- a/cypress/integration/app/settingsflow.spec.ts +++ b/cypress/integration/app/settingsflow.spec.ts @@ -66,15 +66,20 @@ describe("Settings flow", () => { .click() .type("rachelspassword"); - cy.get("#advancedoptions").click(); + cy.get("#advanced-options").click(); cy.findByLabelText(/domain/i) .click() .type("http://www.fleetdm.com"); - cy.findByLabelText(/verify ssl certs/i) - .findByRole("button") - .click(); + // can't grab button from the label because the button is a child element and doesn't have a for attribute + // couldn't figure out how to write a for attribute on kolide button + // Repeated Error Message: Timed out retrying after 4000ms: Found a label with the text of: /verify ssl certs/i, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly. + cy.get(".kolide-slider__dot").click({ multiple: true }); + + cy.findByLabelText(/host expiry window/i) + .click() + .type("{selectall}{backspace}5"); // Update settings cy.findByRole("button", { name: /update settings/i }).click(); @@ -127,5 +132,9 @@ describe("Settings flow", () => { "have.value", "rachelsusername" ); + + cy.get("#advanced-options").click(); + + cy.findByLabelText(/host expiry window/i).should("have.value", "5"); }); });