Update other cypress helpers to work with spectrum
This commit is contained in:
parent
e7089a26cd
commit
a1c01bb905
|
@ -9,7 +9,7 @@
|
||||||
export let longPressable = false
|
export let longPressable = false
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let icon = ""
|
export let icon = ""
|
||||||
|
export let dataCy = null
|
||||||
export let size = "M"
|
export let size = "M"
|
||||||
|
|
||||||
function longPress(element) {
|
function longPress(element) {
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
data-cy={dataCy}
|
||||||
use:longPress
|
use:longPress
|
||||||
class:spectrum-ActionButton--quiet={quiet}
|
class:spectrum-ActionButton--quiet={quiet}
|
||||||
class:spectrum-ActionButton--emphasized={emphasized}
|
class:spectrum-ActionButton--emphasized={emphasized}
|
||||||
|
|
|
@ -101,11 +101,12 @@ Cypress.Commands.add("createTestTableWithData", () => {
|
||||||
Cypress.Commands.add("createTable", tableName => {
|
Cypress.Commands.add("createTable", tableName => {
|
||||||
// Enter table name
|
// Enter table name
|
||||||
cy.get("[data-cy=new-table]").click()
|
cy.get("[data-cy=new-table]").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.first()
|
.first()
|
||||||
.type(tableName)
|
.type(tableName)
|
||||||
cy.get(".buttons")
|
.blur()
|
||||||
|
cy.get(".spectrum-ButtonGroup")
|
||||||
.contains("Create")
|
.contains("Create")
|
||||||
.click()
|
.click()
|
||||||
})
|
})
|
||||||
|
@ -115,30 +116,32 @@ Cypress.Commands.add("createTable", tableName => {
|
||||||
Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
||||||
// Select Table
|
// Select Table
|
||||||
cy.contains(".nav-item", tableName).click()
|
cy.contains(".nav-item", tableName).click()
|
||||||
cy.contains("Create New Column").click()
|
cy.contains("Create column").click()
|
||||||
|
|
||||||
// Configure column
|
// Configure column
|
||||||
cy.get(".actions").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.first()
|
.first()
|
||||||
.type(columnName)
|
.type(columnName)
|
||||||
|
.blur()
|
||||||
|
|
||||||
// Unset table display column
|
// Unset table display column
|
||||||
cy.contains("display column").click()
|
cy.contains("display column").click({ force: true })
|
||||||
cy.get("select").select(type)
|
cy.get("select").select(type)
|
||||||
cy.contains("Save").click()
|
cy.contains("Save").click()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("addRow", values => {
|
Cypress.Commands.add("addRow", values => {
|
||||||
cy.contains("Create New Row").click()
|
cy.contains("Create row").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
for (let i = 0; i < values.length; i++) {
|
for (let i = 0; i < values.length; i++) {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.eq(i)
|
.eq(i)
|
||||||
.type(values[i])
|
.type(values[i])
|
||||||
|
.blur()
|
||||||
}
|
}
|
||||||
cy.get(".buttons")
|
cy.get(".spectrum-ButtonGroup")
|
||||||
.contains("Create")
|
.contains("Create")
|
||||||
.click()
|
.click()
|
||||||
})
|
})
|
||||||
|
@ -147,20 +150,22 @@ Cypress.Commands.add("addRow", values => {
|
||||||
Cypress.Commands.add("createUser", (email, password, role) => {
|
Cypress.Commands.add("createUser", (email, password, role) => {
|
||||||
// Create User
|
// Create User
|
||||||
cy.contains("Users").click()
|
cy.contains("Users").click()
|
||||||
cy.contains("Create New User").click()
|
cy.contains("Create user").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.first()
|
.first()
|
||||||
.type(email)
|
.type(email)
|
||||||
|
.blur()
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.type(password)
|
.type(password)
|
||||||
|
.blur()
|
||||||
cy.get("select")
|
cy.get("select")
|
||||||
.first()
|
.first()
|
||||||
.select(role)
|
.select(role)
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
cy.get(".buttons")
|
cy.get(".spectrum-ButtonGroup")
|
||||||
.contains("Create User")
|
.contains("Create User")
|
||||||
.click()
|
.click()
|
||||||
})
|
})
|
||||||
|
@ -197,14 +202,16 @@ Cypress.Commands.add("navigateToFrontend", () => {
|
||||||
|
|
||||||
Cypress.Commands.add("createScreen", (screenName, route) => {
|
Cypress.Commands.add("createScreen", (screenName, route) => {
|
||||||
cy.get("[data-cy=new-screen]").click()
|
cy.get("[data-cy=new-screen]").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.eq(0)
|
.eq(0)
|
||||||
.type(screenName)
|
.type(screenName)
|
||||||
|
.blur()
|
||||||
if (route) {
|
if (route) {
|
||||||
cy.get("input")
|
cy.get("input")
|
||||||
.eq(1)
|
.eq(1)
|
||||||
.type(route)
|
.type(route)
|
||||||
|
.blur()
|
||||||
}
|
}
|
||||||
cy.contains("Create Screen").click()
|
cy.contains("Create Screen").click()
|
||||||
})
|
})
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<div class="add-button">
|
<div class="add-button" data-cy="new-screen">
|
||||||
<Icon hoverable name="AddCircle" on:click={modal.show} />
|
<Icon hoverable name="AddCircle" on:click={modal.show} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
quiet
|
quiet
|
||||||
size="S"
|
size="S"
|
||||||
slot="control"
|
slot="control"
|
||||||
|
dataCy={`category-${item.name}`}
|
||||||
on:click={() => onItemChosen(item)}>
|
on:click={() => onItemChosen(item)}>
|
||||||
<div class="buttonContent">
|
<div class="buttonContent">
|
||||||
{item.name}
|
{item.name}
|
||||||
|
|
Loading…
Reference in New Issue