Commit 141510b0 authored by Håvard Farestveit's avatar Håvard Farestveit
Browse files

Refactored boundary test for user registration


Refactored boundary tests
parent 36d70178
Pipeline #114759 failed with stage
in 13 seconds
...@@ -119,63 +119,63 @@ describe("Register new user", () => { ...@@ -119,63 +119,63 @@ describe("Register new user", () => {
cy.get(".alert").contains("Registration failed!"); cy.get(".alert").contains("Registration failed!");
}); });
it("Checking for boundary error with country", () => { it("Valid max length country", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
cy.get('input[name="email"]').type("test@mail.it"); cy.get('input[name="email"]').type("test@mail.it");
cy.get('input[name="password"]').type("123456789"); cy.get('input[name="password"]').type("123456789");
cy.get('input[name="password1"]').type("123456789"); cy.get('input[name="password1"]').type("123456789");
cy.get('input[name="country"]').type("x".repeat(51)); cy.get('input[name="country"]').type("x".repeat(50));
cy.get('input[name="city"]').type("Testheim"); cy.get('input[name="city"]').type("Testheim");
cy.get('input[name="street_address"]').type("Testing street"); cy.get('input[name="street_address"]').type("Testing street");
}); });
cy.get("#btn-create-account").click(); cy.get("#btn-create-account").click();
cy.contains("Registration failed!"); cy.url().should("include", "/workouts.html");
}); });
it("Checking for boundry error with street", () => { it("Too long country", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
cy.get('input[name="email"]').type("test@mail.it"); cy.get('input[name="email"]').type("test@mail.it");
cy.get('input[name="password"]').type("123456789"); cy.get('input[name="password"]').type("123456789");
cy.get('input[name="password1"]').type("123456789"); cy.get('input[name="password1"]').type("123456789");
cy.get('input[name="street_address"]').type("x".repeat(51)); cy.get('input[name="country"]').type("x".repeat(51));
cy.get('input[name="city"]').type("Testheim");
cy.get('input[name="street_address"]').type("Testing street");
}); });
cy.get("#btn-create-account").click(); cy.get("#btn-create-account").click();
cy.contains("Registration failed!"); cy.contains("Registration failed!");
}); });
it("Checking for max length boundary for country", () => { it("Valid Max lenth street", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
cy.get('input[name="email"]').type("test@mail.it"); cy.get('input[name="email"]').type("test@mail.it");
cy.get('input[name="password"]').type("123456789"); cy.get('input[name="password"]').type("123456789");
cy.get('input[name="password1"]').type("123456789"); cy.get('input[name="password1"]').type("123456789");
cy.get('input[name="country"]').type("x".repeat(50)); cy.get('input[name="street_address"]').type("x".repeat(50));
cy.get('input[name="city"]').type("Testheim");
cy.get('input[name="street_address"]').type("Testing street");
}); });
cy.get("#btn-create-account").click(); cy.get("#btn-create-account").click();
cy.contains("View Workouts"); cy.url().should("include", "/workouts.html");
}); });
it("Checking for max boundary with street", () => { it("Too long street", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
cy.get('input[name="email"]').type("test@mail.it"); cy.get('input[name="email"]').type("test@mail.it");
cy.get('input[name="password"]').type("123456789"); cy.get('input[name="password"]').type("123456789");
cy.get('input[name="password1"]').type("123456789"); cy.get('input[name="password1"]').type("123456789");
cy.get('input[name="street_address"]').type("x".repeat(50)); cy.get('input[name="street_address"]').type("x".repeat(51));
}); });
cy.get("#btn-create-account").click(); cy.get("#btn-create-account").click();
cy.contains("View Workouts"); cy.contains("Registration failed!");
}); });
it("Checking for boundry error with phone number", () => { it("Too long phone number", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
...@@ -188,7 +188,7 @@ describe("Register new user", () => { ...@@ -188,7 +188,7 @@ describe("Register new user", () => {
cy.contains("Registration failed!"); cy.contains("Registration failed!");
}); });
it("Checking for max length boundary with phone number", () => { it("Valid max length phone number", () => {
cy.register(); cy.register();
cy.get("#form-register-user").within(($form) => { cy.get("#form-register-user").within(($form) => {
cy.get('input[name="username"]').type("testUser" + Date.now()); cy.get('input[name="username"]').type("testUser" + Date.now());
...@@ -198,6 +198,6 @@ describe("Register new user", () => { ...@@ -198,6 +198,6 @@ describe("Register new user", () => {
cy.get('input[name="street_address"]').type("x".repeat(50)); cy.get('input[name="street_address"]').type("x".repeat(50));
}); });
cy.get("#btn-create-account").click(); cy.get("#btn-create-account").click();
cy.contains("View Workouts"); cy.url().should("include", "/workouts.html");
}); });
}); });
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment