AutoScreensUI test changes
Changes related to the UI redesign - Also added new command to filter screens by access level
This commit is contained in:
parent
8f499d0810
commit
1373710065
|
@ -17,7 +17,7 @@ filterTests(['all'], () => {
|
||||||
it("should add form with multi select picker, containing 5 options", () => {
|
it("should add form with multi select picker, containing 5 options", () => {
|
||||||
cy.navigateToFrontend()
|
cy.navigateToFrontend()
|
||||||
// Add data provider
|
// Add data provider
|
||||||
cy.get(interact.CATEGORY_DATA, { timeout: 500 }).click()
|
cy.get(interact.CATEGORY_DATA, { timeout: 2000 }).click()
|
||||||
cy.get(interact.COMPONENT_DATA_PROVIDER).click()
|
cy.get(interact.COMPONENT_DATA_PROVIDER).click()
|
||||||
cy.get(interact.DATASOURCE_PROP_CONTROL).click()
|
cy.get(interact.DATASOURCE_PROP_CONTROL).click()
|
||||||
cy.get(interact.DROPDOWN).contains("Multi Data").click()
|
cy.get(interact.DROPDOWN).contains("Multi Data").click()
|
||||||
|
|
|
@ -14,11 +14,8 @@ filterTests(['smoke', 'all'], () => {
|
||||||
cy.closeModal();
|
cy.closeModal();
|
||||||
|
|
||||||
cy.contains("Design").click()
|
cy.contains("Design").click()
|
||||||
cy.get(interact.LABEL_ADD_CIRCLE).click()
|
cy.navigateToAutogeneratedModal()
|
||||||
cy.get(interact.SPECTRUM_MODAL).within(() => {
|
cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled')
|
||||||
cy.get(interact.ITEM_DISABLED).contains("Autogenerated screens")
|
|
||||||
cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled')
|
|
||||||
})
|
|
||||||
|
|
||||||
cy.deleteAllApps()
|
cy.deleteAllApps()
|
||||||
});
|
});
|
||||||
|
@ -45,25 +42,25 @@ filterTests(['smoke', 'all'], () => {
|
||||||
// Create Autogenerated screens from the internal table
|
// Create Autogenerated screens from the internal table
|
||||||
cy.createDatasourceScreen(["Cypress Tests"])
|
cy.createDatasourceScreen(["Cypress Tests"])
|
||||||
// Confirm screens have been auto generated
|
// Confirm screens have been auto generated
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").click({ force: true })
|
cy.get(interact.BODY).should('contain', "cypress-tests")
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'cypress-tests/:id')
|
.and('contain', 'cypress-tests/:id')
|
||||||
.and('contain', 'cypress-tests/new/row')
|
.and('contain', 'cypress-tests/new/row')
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should generate multiple internal table screens at once", () => {
|
it("should generate multiple internal table screens at once", () => {
|
||||||
// Create a second internal table
|
|
||||||
const initialTable = "Cypress Tests"
|
const initialTable = "Cypress Tests"
|
||||||
const secondTable = "Table Two"
|
const secondTable = "Table Two"
|
||||||
|
// Create a second internal table
|
||||||
cy.createTable(secondTable)
|
cy.createTable(secondTable)
|
||||||
// Create Autogenerated screens from the internal tables
|
// Create Autogenerated screens from the internal tables
|
||||||
cy.createDatasourceScreen([initialTable, secondTable])
|
cy.createDatasourceScreen([initialTable, secondTable])
|
||||||
// Confirm screens have been auto generated
|
// Confirm screens have been auto generated
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").click({ force: true })
|
|
||||||
// Previously generated tables are suffixed with numbers - as expected
|
// Previously generated tables are suffixed with numbers - as expected
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'cypress-tests-2/:id')
|
cy.get(interact.BODY).should('contain', 'cypress-tests-2')
|
||||||
|
.and('contain', 'cypress-tests-2/:id')
|
||||||
.and('contain', 'cypress-tests-2/new/row')
|
.and('contain', 'cypress-tests-2/new/row')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-two").click()
|
.and('contain', 'table-two')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-two/:id')
|
.and('contain', 'table-two/:id')
|
||||||
.and('contain', 'table-two/new/row')
|
.and('contain', 'table-two/new/row')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -73,17 +70,17 @@ filterTests(['smoke', 'all'], () => {
|
||||||
cy.createTable("Table Four")
|
cy.createTable("Table Four")
|
||||||
cy.createDatasourceScreen(["Table Three", "Table Four"], "Admin")
|
cy.createDatasourceScreen(["Table Three", "Table Four"], "Admin")
|
||||||
|
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-three").click()
|
// Filter screens to Admin
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-three/:id')
|
cy.filterScreensAccessLevel('Admin')
|
||||||
|
|
||||||
|
cy.get(interact.BODY).should('contain', 'table-three')
|
||||||
|
.and('contain', 'table-three/:id')
|
||||||
.and('contain', 'table-three/new/row')
|
.and('contain', 'table-three/new/row')
|
||||||
|
.and('contain', 'table-four')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-four").click()
|
.and('contain', 'table-four/:id')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-four/:id')
|
|
||||||
.and('contain', 'table-four/new/row')
|
.and('contain', 'table-four/new/row')
|
||||||
|
.and('not.contain', 'table-two')
|
||||||
//The access level should now be set to admin. Previous screens should be filtered.
|
.and('not.contain', 'cypress-tests')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-two").should('not.exist')
|
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").should('not.exist')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if (Cypress.env("TEST_ENV")) {
|
if (Cypress.env("TEST_ENV")) {
|
||||||
|
@ -96,8 +93,8 @@ filterTests(['smoke', 'all'], () => {
|
||||||
// Create Autogenerated screens from a MySQL table - MySQL contains books table
|
// Create Autogenerated screens from a MySQL table - MySQL contains books table
|
||||||
cy.createDatasourceScreen(["books"])
|
cy.createDatasourceScreen(["books"])
|
||||||
|
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).contains("books").click()
|
cy.get(interact.BODY).should('contain', 'books')
|
||||||
cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'books/:id')
|
.and('contain', 'books/:id')
|
||||||
.and('contain', 'books/new/row')
|
.and('contain', 'books/new/row')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -510,8 +510,10 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// DESIGN AREA
|
// DESIGN SECTION
|
||||||
Cypress.Commands.add("addComponent", (category, component) => {
|
Cypress.Commands.add("addComponent", (category, component) => {
|
||||||
|
cy.get(".spectrum-Button").contains("Component").click()
|
||||||
|
|
||||||
if (category) {
|
if (category) {
|
||||||
cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({
|
cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({
|
||||||
force: true,
|
force: true,
|
||||||
|
@ -546,7 +548,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("[aria-label=AddCircle]").click()
|
cy.get(".header > .add-button").click()
|
||||||
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 })
|
||||||
|
@ -571,7 +573,7 @@ Cypress.Commands.add(
|
||||||
"createDatasourceScreen",
|
"createDatasourceScreen",
|
||||||
(datasourceNames, accessLevelLabel) => {
|
(datasourceNames, accessLevelLabel) => {
|
||||||
cy.contains("Design").click()
|
cy.contains("Design").click()
|
||||||
cy.get("[aria-label=AddCircle]").click()
|
cy.get(".header > .add-button").click()
|
||||||
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 })
|
||||||
|
@ -626,13 +628,23 @@ Cypress.Commands.add(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Cypress.Commands.add("filterScreensAccessLevel", accessLevel => {
|
||||||
|
// Filters screens by access level dropdown
|
||||||
|
cy.get(".body").within(() => {
|
||||||
|
cy.get(".spectrum-Form-item").eq(1).click()
|
||||||
|
})
|
||||||
|
cy.get(".spectrum-Menu").within(() => {
|
||||||
|
cy.contains(accessLevel).click()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// NAVIGATION
|
// NAVIGATION
|
||||||
Cypress.Commands.add("navigateToFrontend", () => {
|
Cypress.Commands.add("navigateToFrontend", () => {
|
||||||
// Clicks on Design tab and then the Home nav item
|
// Clicks on Design tab and then the Home nav item
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.contains("Design").click()
|
cy.contains("Design").click()
|
||||||
cy.get(".spectrum-Search", { timeout: 2000 }).type("/")
|
cy.get(".spectrum-Search", { timeout: 2000 }).type("/")
|
||||||
cy.get(".nav-item", { timeout: 2000 }).contains("home").click()
|
cy.get(".nav-item", { timeout: 2000 }).contains("home").click({ force: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("navigateToDataSection", () => {
|
Cypress.Commands.add("navigateToDataSection", () => {
|
||||||
|
@ -644,9 +656,11 @@ 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("[aria-label=AddCircle]").click()
|
cy.get(".header > .add-button").click()
|
||||||
cy.get(".spectrum-Modal").within(() => {
|
cy.get(".spectrum-Modal").within(() => {
|
||||||
cy.get(".item").contains("Autogenerated screens").click()
|
cy.get(".item", { timeout: 2000 })
|
||||||
|
.contains("Autogenerated screens")
|
||||||
|
.click({ force: true })
|
||||||
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
cy.get(".spectrum-Button").contains("Continue").click({ force: true })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
})
|
})
|
||||||
|
|
|
@ -51,7 +51,7 @@ export const LABEL_ADD_CIRCLE = "[aria-label=AddCircle]"
|
||||||
export const ITEM_DISABLED = ".item.disabled"
|
export const ITEM_DISABLED = ".item.disabled"
|
||||||
export const CONFIRM_WRAP_SPE_BUTTON = ".confirm-wrap .spectrum-Button"
|
export const CONFIRM_WRAP_SPE_BUTTON = ".confirm-wrap .spectrum-Button"
|
||||||
export const DATA_SOURCE_ENTRY = ".data-source-entry"
|
export const DATA_SOURCE_ENTRY = ".data-source-entry"
|
||||||
export const NAV_ITEMS_CONTAINER = ".nav-items-container"
|
export const BODY = ".body"
|
||||||
|
|
||||||
//publishWorkFlow
|
//publishWorkFlow
|
||||||
export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]"
|
export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]"
|
||||||
|
|
Loading…
Reference in New Issue