|
|
@ -5,30 +5,31 @@ Cypress.on("uncaught:exception", () => { |
|
|
// ACCOUNTS & USERS
|
|
|
// ACCOUNTS & USERS
|
|
|
Cypress.Commands.add("login", (email, password) => { |
|
|
Cypress.Commands.add("login", (email, password) => { |
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) |
|
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) |
|
|
cy.wait(2000) |
|
|
cy.url() |
|
|
cy.url().then(url => { |
|
|
.should("include", "/builder/") |
|
|
if (url.includes("builder/admin")) { |
|
|
.then(url => { |
|
|
// create admin user
|
|
|
if (url.includes("builder/admin")) { |
|
|
cy.get("input").first().type("test@test.com") |
|
|
// create admin user
|
|
|
cy.get('input[type="password"]').first().type("test") |
|
|
cy.get("input").first().type("test@test.com") |
|
|
cy.get('input[type="password"]').eq(1).type("test") |
|
|
cy.get('input[type="password"]').first().type("test") |
|
|
cy.contains("Create super admin user").click({ force: true }) |
|
|
cy.get('input[type="password"]').eq(1).type("test") |
|
|
} |
|
|
cy.contains("Create super admin user").click({ force: true }) |
|
|
if (url.includes("builder/auth/login") || url.includes("builder/admin")) { |
|
|
} |
|
|
// login
|
|
|
if (url.includes("builder/auth") || url.includes("builder/admin")) { |
|
|
cy.contains("Sign in to Budibase").then(() => { |
|
|
// login
|
|
|
if (email == null) { |
|
|
cy.contains("Sign in to Budibase").then(() => { |
|
|
cy.get("input").first().type("test@test.com") |
|
|
if (email == null) { |
|
|
cy.get('input[type="password"]').type("test") |
|
|
cy.get("input").first().type("test@test.com") |
|
|
} else { |
|
|
cy.get('input[type="password"]').type("test") |
|
|
cy.get("input").first().type(email) |
|
|
} else { |
|
|
cy.get('input[type="password"]').type(password) |
|
|
cy.get("input").first().type(email) |
|
|
} |
|
|
cy.get('input[type="password"]').type(password) |
|
|
cy.get("button").first().click({ force: true }) |
|
|
} |
|
|
cy.wait(1000) |
|
|
cy.get("button").first().click({ force: true }) |
|
|
}) |
|
|
cy.wait(1000) |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Cypress.Commands.add("logOut", () => { |
|
|
Cypress.Commands.add("logOut", () => { |
|
|
@ -50,23 +51,36 @@ Cypress.Commands.add("logoutNoAppGrid", () => { |
|
|
cy.wait(2000) |
|
|
cy.wait(2000) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Cypress.Commands.add("createUser", email => { |
|
|
Cypress.Commands.add("createUser", (email, permission) => { |
|
|
// quick hacky recorded way to create a user
|
|
|
|
|
|
cy.contains("Users").click() |
|
|
cy.contains("Users").click() |
|
|
cy.get(`[data-cy="add-user"]`).click() |
|
|
cy.get(`[data-cy="add-user"]`).click() |
|
|
cy.get(".spectrum-Dialog-grid").within(() => { |
|
|
cy.get(".spectrum-Dialog-grid").within(() => { |
|
|
cy.get(".spectrum-Picker-label").click() |
|
|
// Enter email
|
|
|
cy.get( |
|
|
cy.get(".spectrum-Textfield-input").clear().click().type(email) |
|
|
".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel" |
|
|
|
|
|
).click() |
|
|
|
|
|
|
|
|
|
|
|
// Onboarding type selector
|
|
|
// Select permission, if applicable
|
|
|
cy.get(".spectrum-Textfield-input") |
|
|
// Default is App User
|
|
|
.eq(0) |
|
|
if (permission != null) { |
|
|
.first() |
|
|
cy.get(".spectrum-Picker-label").click() |
|
|
.type(email, { force: true }) |
|
|
cy.get(".spectrum-Menu").within(() => { |
|
|
cy.get(".spectrum-Button--cta").click({ force: true }) |
|
|
cy.get(".spectrum-Menu-item") |
|
|
|
|
|
.contains(permission) |
|
|
|
|
|
.click({ force: true }) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
// Add user and wait for modal to change
|
|
|
|
|
|
cy.get(".spectrum-Button").contains("Add user").click({ force: true }) |
|
|
|
|
|
cy.get(".spectrum-ActionButton").contains("Add email").should("not.exist") |
|
|
}) |
|
|
}) |
|
|
|
|
|
// Onboarding modal
|
|
|
|
|
|
cy.get(".spectrum-Dialog-grid").within(() => { |
|
|
|
|
|
cy.get(".onboarding-type").eq(1).click() |
|
|
|
|
|
cy.get(".spectrum-Button").contains("Done").click({ force: true }) |
|
|
|
|
|
cy.get(".spectrum-Button").contains("Cancel").should("not.exist") |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// Accounts created modal - Click Done button
|
|
|
|
|
|
cy.get(".spectrum-Button").contains("Done").click({ force: true }) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Cypress.Commands.add("deleteUser", email => { |
|
|
Cypress.Commands.add("deleteUser", email => { |
|
|
@ -74,18 +88,13 @@ Cypress.Commands.add("deleteUser", email => { |
|
|
cy.contains("Users", { timeout: 2000 }).click() |
|
|
cy.contains("Users", { timeout: 2000 }).click() |
|
|
cy.contains(email).click() |
|
|
cy.contains(email).click() |
|
|
|
|
|
|
|
|
// Click Delete user button
|
|
|
cy.get(".title").within(() => { |
|
|
cy.get(".spectrum-Button") |
|
|
cy.get(".spectrum-Icon").click({ force: true }) |
|
|
.contains("Delete user") |
|
|
}) |
|
|
.click({ force: true }) |
|
|
cy.get(".spectrum-Menu").within(() => { |
|
|
.then(() => { |
|
|
cy.get(".spectrum-Menu-item").contains("Delete").click({ force: true }) |
|
|
// Confirm deletion within modal
|
|
|
}) |
|
|
cy.get(".spectrum-Dialog-grid", { timeout: 500 }).within(() => { |
|
|
cy.get(".spectrum-Dialog-grid").contains("Delete user").click({ force: true }) |
|
|
cy.get(".spectrum-Button") |
|
|
|
|
|
.contains("Delete user") |
|
|
|
|
|
.click({ force: true }) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { |
|
|
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { |
|
|
@ -120,7 +129,25 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { |
|
|
.blur() |
|
|
.blur() |
|
|
} |
|
|
} |
|
|
cy.get("button").contains("Update information").click({ force: true }) |
|
|
cy.get("button").contains("Update information").click({ force: true }) |
|
|
|
|
|
cy.get(".spectrum-Dialog-grid").should("not.exist") |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
Cypress.Commands.add("setUserRole", (user, role) => { |
|
|
|
|
|
cy.contains("Users").click() |
|
|
|
|
|
cy.contains(user).click() |
|
|
|
|
|
|
|
|
|
|
|
// Set Role
|
|
|
|
|
|
cy.wait(500) |
|
|
|
|
|
cy.get(".spectrum-Form-itemField") |
|
|
|
|
|
.eq(2) |
|
|
|
|
|
.within(() => { |
|
|
|
|
|
cy.get(".spectrum-Picker-label").click({ force: true }) |
|
|
|
|
|
}) |
|
|
|
|
|
cy.get(".spectrum-Menu").within(() => { |
|
|
|
|
|
cy.get(".spectrum-Menu-itemLabel").contains(role).click({ force: true }) |
|
|
}) |
|
|
}) |
|
|
|
|
|
cy.get(".spectrum-Form-itemField").eq(2).should("contain", role) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// APPLICATIONS
|
|
|
// APPLICATIONS
|
|
|
@ -516,15 +543,22 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => { |
|
|
// DESIGN SECTION
|
|
|
// DESIGN SECTION
|
|
|
Cypress.Commands.add("searchAndAddComponent", component => { |
|
|
Cypress.Commands.add("searchAndAddComponent", component => { |
|
|
// Open component menu
|
|
|
// Open component menu
|
|
|
cy.get(".spectrum-Button").contains("Component").click({ force: true }) |
|
|
cy.get(".icon-side-nav").within(() => { |
|
|
|
|
|
cy.get(".icon-side-nav-item").eq(1).click() |
|
|
// Search and add component
|
|
|
}) |
|
|
cy.wait(500) |
|
|
cy.get(".add-component > .spectrum-Button") |
|
|
cy.get(".spectrum-Textfield-input").clear().type(component) |
|
|
.contains("Add component") |
|
|
cy.get(".body").within(() => { |
|
|
.click({ force: true }) |
|
|
cy.get(".component") |
|
|
cy.get(".container", { timeout: 1000 }).within(() => { |
|
|
.contains(new RegExp("^" + component + "$"), { timeout: 3000 }) |
|
|
cy.get(".title").should("contain", "Add component") |
|
|
.click({ force: true }) |
|
|
|
|
|
|
|
|
// Search and add component
|
|
|
|
|
|
cy.get(".spectrum-Textfield-input").clear().type(component) |
|
|
|
|
|
cy.get(".body").within(() => { |
|
|
|
|
|
cy.get(".component") |
|
|
|
|
|
.contains(new RegExp("^" + component + "$"), { timeout: 3000 }) |
|
|
|
|
|
.click({ force: true }) |
|
|
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
cy.wait(1000) |
|
|
cy.wait(1000) |
|
|
cy.location().then(loc => { |
|
|
cy.location().then(loc => { |
|
|
@ -570,7 +604,7 @@ Cypress.Commands.add("getComponent", componentId => { |
|
|
Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { |
|
|
Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { |
|
|
// Blank Screen
|
|
|
// Blank Screen
|
|
|
cy.contains("Design").click() |
|
|
cy.contains("Design").click() |
|
|
cy.get(".header > .add-button").click() |
|
|
cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get("[data-cy='blank-screen']").click() |
|
|
cy.get("[data-cy='blank-screen']").click() |
|
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) |
|
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) |
|
|
@ -595,7 +629,7 @@ Cypress.Commands.add( |
|
|
"createDatasourceScreen", |
|
|
"createDatasourceScreen", |
|
|
(datasourceNames, accessLevelLabel) => { |
|
|
(datasourceNames, accessLevelLabel) => { |
|
|
cy.contains("Design").click() |
|
|
cy.contains("Design").click() |
|
|
cy.get(".header > .add-button").click() |
|
|
cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get(".item").contains("Autogenerated screens").click() |
|
|
cy.get(".item").contains("Autogenerated screens").click() |
|
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) |
|
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) |
|
|
@ -715,7 +749,7 @@ Cypress.Commands.add("navigateToDataSection", () => { |
|
|
Cypress.Commands.add("navigateToAutogeneratedModal", () => { |
|
|
Cypress.Commands.add("navigateToAutogeneratedModal", () => { |
|
|
// Screen name must already exist within data source
|
|
|
// Screen name must already exist within data source
|
|
|
cy.contains("Design").click() |
|
|
cy.contains("Design").click() |
|
|
cy.get(".header > .add-button").click() |
|
|
cy.get(".spectrum-Button").contains("Add screen").click({ force: true }) |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get(".spectrum-Modal").within(() => { |
|
|
cy.get(".item", { timeout: 2000 }) |
|
|
cy.get(".item", { timeout: 2000 }) |
|
|
.contains("Autogenerated screens") |
|
|
.contains("Autogenerated screens") |
|
|
|