Fixing create user test case, fixed part of create table and made a start on create components.
This commit is contained in:
parent
1631aa698b
commit
8e8223e3bb
|
@ -5,9 +5,9 @@ context("Create Components", () => {
|
|||
cy.login()
|
||||
cy.createTestApp()
|
||||
cy.createTable("dog")
|
||||
cy.addColumn("dog", "name", "string")
|
||||
cy.addColumn("dog", "age", "number")
|
||||
cy.addColumn("dog", "type", "options")
|
||||
cy.addColumn("dog", "name", "Text")
|
||||
cy.addColumn("dog", "age", "Number")
|
||||
cy.addColumn("dog", "type", "Options")
|
||||
cy.navigateToFrontend()
|
||||
})
|
||||
|
||||
|
|
|
@ -22,45 +22,40 @@ context("Create a Table", () => {
|
|||
})
|
||||
|
||||
it("updates a column on the table", () => {
|
||||
cy.contains("header", "name")
|
||||
.trigger("mouseover")
|
||||
.find(".ri-pencil-line")
|
||||
.click({ force: true })
|
||||
cy.get(".actions input")
|
||||
.first()
|
||||
.type("updated")
|
||||
cy.get(".title").click()
|
||||
cy.get(".spectrum-Table-editIcon > use").click()
|
||||
cy.get("input")
|
||||
.eq(1)
|
||||
.type("updated", { force: true })
|
||||
// Unset table display column
|
||||
cy.contains("display column").click()
|
||||
cy.get(".spectrum-Switch-input").eq(1).click()
|
||||
cy.contains("Save Column").click()
|
||||
cy.contains("nameupdated ").should("have.text", "nameupdated ")
|
||||
cy.contains("nameupdated ").should("contain", "nameupdated")
|
||||
})
|
||||
|
||||
it("edits a row", () => {
|
||||
cy.contains("button", "Edit").click({ force: true })
|
||||
cy.wait(1000)
|
||||
cy.get(".modal input").type("Updated")
|
||||
cy.get(".spectrum-Modal input").type("Updated")
|
||||
cy.contains("Save").click()
|
||||
cy.contains("RoverUpdated").should("have.text", "RoverUpdated")
|
||||
})
|
||||
|
||||
it("deletes a row", () => {
|
||||
cy.get(".ag-checkbox-input").check({ force: true })
|
||||
cy.get(".spectrum-Checkbox-input").check({ force: true })
|
||||
cy.contains("Delete 1 row(s)").click()
|
||||
cy.get(".modal")
|
||||
cy.get(".spectrum-Modal")
|
||||
.contains("Delete")
|
||||
.click()
|
||||
cy.contains("RoverUpdated").should("not.exist")
|
||||
})
|
||||
|
||||
it("deletes a column", () => {
|
||||
cy.contains("header", "name")
|
||||
.trigger("mouseover")
|
||||
.find(".ri-pencil-line")
|
||||
.click({ force: true })
|
||||
cy.get(".title").click()
|
||||
cy.get(".spectrum-Table-editIcon > use").click()
|
||||
cy.contains("Delete").click()
|
||||
cy.wait(50)
|
||||
cy.get(".buttons")
|
||||
.contains("Delete")
|
||||
cy.contains("Delete Column")
|
||||
.click()
|
||||
cy.contains("nameupdated").should("not.exist")
|
||||
})
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
context("Create a User", () => {
|
||||
before(() => {
|
||||
cy.login()
|
||||
cy.createTestApp()
|
||||
})
|
||||
|
||||
it("should create a user", () => {
|
||||
cy.createUser("bbuser@test.com", "test", "ADMIN")
|
||||
cy.createUser("bbuser@test.com")
|
||||
cy.contains("bbuser").should("be.visible")
|
||||
})
|
||||
})
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
// ***********************************************
|
||||
//
|
||||
|
||||
function isFirstApp() {
|
||||
const firstAppHeader = Object.values(Cypress.$("h1")).filter(
|
||||
$h1 => $h1.outerHTML && $h1.outerHTML.includes("Create your first app")
|
||||
)
|
||||
return firstAppHeader.length !== 0
|
||||
}
|
||||
|
||||
Cypress.Commands.add("login", () => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.wait(500)
|
||||
|
@ -30,8 +37,9 @@ Cypress.Commands.add("login", () => {
|
|||
Cypress.Commands.add("createApp", name => {
|
||||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
// wait for init API calls on visit
|
||||
const buttonText = isFirstApp() ? "Create app" : "Create new app"
|
||||
cy.wait(100)
|
||||
cy.contains("Create app").click()
|
||||
cy.contains(buttonText).click()
|
||||
cy.get("body").then(() => {
|
||||
cy.get(".spectrum-Modal")
|
||||
.within(() => {
|
||||
|
@ -50,10 +58,7 @@ Cypress.Commands.add("deleteApp", () => {
|
|||
cy.visit(`localhost:${Cypress.env("PORT")}/builder`)
|
||||
cy.wait(1000)
|
||||
|
||||
const firstAppHeader = Object.values(Cypress.$("h1")).filter(
|
||||
$h1 => typeof $h1 === "string" && $h1.includes("Create your first app")
|
||||
)
|
||||
if (firstAppHeader.length === 0) {
|
||||
if (!isFirstApp()) {
|
||||
cy.get(".hoverable > use").click()
|
||||
cy.contains("Delete").click()
|
||||
cy.get(".spectrum-Button--warning").click()
|
||||
|
@ -110,18 +115,14 @@ Cypress.Commands.add("addRow", values => {
|
|||
})
|
||||
})
|
||||
|
||||
Cypress.Commands.add("createUser", (email, password, role) => {
|
||||
// Create User
|
||||
Cypress.Commands.add("createUser", email => {
|
||||
// quick hacky recorded way to create a user
|
||||
cy.contains("Users").click()
|
||||
cy.contains("Create user").click()
|
||||
cy.get(".spectrum-Modal").within(() => {
|
||||
cy.get("input").first().type(email).blur()
|
||||
cy.get("input").eq(1).type(password).blur()
|
||||
cy.get("select").first().select(role)
|
||||
|
||||
// Save
|
||||
cy.get(".spectrum-ButtonGroup").contains("Create User").click()
|
||||
})
|
||||
cy.get(".spectrum-Button--primary").click()
|
||||
cy.get(".spectrum-Picker-label").click()
|
||||
cy.get(".spectrum-Menu-item:nth-child(2) > .spectrum-Menu-itemLabel").click()
|
||||
cy.get(".spectrum-Modal input").eq(1).type(email, { force: true })
|
||||
cy.get(".spectrum-Button--cta").click({ force: true })
|
||||
})
|
||||
|
||||
Cypress.Commands.add("addComponent", (category, component) => {
|
||||
|
|
Loading…
Reference in New Issue