Cypress: Smoke Build: Test Changes
createComponents - Updated how the test gets nav-items from the side nav bar commands - Updating maximum timeout value for cy.visit instances (this seems specific to the CI runs) - Updated createUser command to ensure better timing between the create user modals
This commit is contained in:
parent
30bbb5e0d8
commit
c459730348
|
@ -20,7 +20,7 @@ filterTests(["all"], () => {
|
||||||
//Use the tree to delete a selected component
|
//Use the tree to delete a selected component
|
||||||
const deleteSelectedComponent = () => {
|
const deleteSelectedComponent = () => {
|
||||||
cy.get(
|
cy.get(
|
||||||
".nav-items-container .nav-item.selected .actions > div > .icon"
|
".nav-item.selected .actions > div > .icon"
|
||||||
).click({
|
).click({
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
|
@ -91,7 +91,7 @@ filterTests(["all"], () => {
|
||||||
cy.searchAndAddComponent("Paragraph").then(componentId => {
|
cy.searchAndAddComponent("Paragraph").then(componentId => {
|
||||||
cy.get("[data-cy=setting-_instanceName] input").type(componentId).blur()
|
cy.get("[data-cy=setting-_instanceName] input").type(componentId).blur()
|
||||||
cy.get(
|
cy.get(
|
||||||
".nav-items-container .nav-item.selected .actions > div > .icon"
|
".nav-item.selected .actions > div > .icon"
|
||||||
).click({
|
).click({
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
|
@ -145,7 +145,7 @@ filterTests(["all"], () => {
|
||||||
return testFieldFocusOnCreate(label)
|
return testFieldFocusOnCreate(label)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.get(".nav-items-container .nav-item")
|
cy.get(".nav-item")
|
||||||
.contains(formId)
|
.contains(formId)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
deleteSelectedComponent()
|
deleteSelectedComponent()
|
||||||
|
@ -195,7 +195,7 @@ filterTests(["all"], () => {
|
||||||
return testFocusOnCreate(label)
|
return testFocusOnCreate(label)
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.get(".nav-items-container .nav-item")
|
cy.get(".nav-item")
|
||||||
.contains(providerId)
|
.contains(providerId)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
deleteSelectedComponent()
|
deleteSelectedComponent()
|
||||||
|
@ -218,7 +218,7 @@ filterTests(["all"], () => {
|
||||||
.find(".component-placeholder")
|
.find(".component-placeholder")
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
cy.getComponent(imageId).find(`img[alt=${imageId}]`).should("exist")
|
cy.getComponent(imageId).find(`img[alt=${imageId}]`).should("exist")
|
||||||
cy.get(".nav-items-container .nav-item")
|
cy.get(".nav-item")
|
||||||
.contains(imageId)
|
.contains(imageId)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
deleteSelectedComponent()
|
deleteSelectedComponent()
|
||||||
|
@ -242,7 +242,7 @@ filterTests(["all"], () => {
|
||||||
cy.getComponent(markdownId)
|
cy.getComponent(markdownId)
|
||||||
.find(".editor-preview-full h1")
|
.find(".editor-preview-full h1")
|
||||||
.contains("Hi")
|
.contains("Hi")
|
||||||
cy.get(".nav-items-container .nav-item")
|
cy.get(".nav-item")
|
||||||
.contains(markdownId)
|
.contains(markdownId)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
deleteSelectedComponent()
|
deleteSelectedComponent()
|
||||||
|
@ -265,7 +265,7 @@ filterTests(["all"], () => {
|
||||||
.find(".component-placeholder")
|
.find(".component-placeholder")
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
cy.getComponent(iconId).find("i.ri-save-fill").should("exist")
|
cy.getComponent(iconId).find("i.ri-save-fill").should("exist")
|
||||||
cy.get(".nav-items-container .nav-item")
|
cy.get(".nav-item")
|
||||||
.contains(iconId)
|
.contains(iconId)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
deleteSelectedComponent()
|
deleteSelectedComponent()
|
||||||
|
|
|
@ -4,7 +4,7 @@ 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: 30000 })
|
||||||
cy.url()
|
cy.url()
|
||||||
.should("include", "/builder/")
|
.should("include", "/builder/")
|
||||||
.then(url => {
|
.then(url => {
|
||||||
|
@ -33,7 +33,7 @@ Cypress.Commands.add("login", (email, password) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("logOut", () => {
|
Cypress.Commands.add("logOut", () => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.get(".user-dropdown .avatar > .icon").click({ force: true })
|
cy.get(".user-dropdown .avatar > .icon").click({ force: true })
|
||||||
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
|
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
|
||||||
cy.get("li[data-cy='user-logout']").click({ force: true })
|
cy.get("li[data-cy='user-logout']").click({ force: true })
|
||||||
|
@ -43,7 +43,7 @@ Cypress.Commands.add("logOut", () => {
|
||||||
|
|
||||||
Cypress.Commands.add("logoutNoAppGrid", () => {
|
Cypress.Commands.add("logoutNoAppGrid", () => {
|
||||||
// Logs user out when app grid is not present
|
// Logs user out when app grid is not present
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.get(".avatar > .icon").click({ force: true })
|
cy.get(".avatar > .icon").click({ force: true })
|
||||||
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
|
cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => {
|
||||||
cy.get(".spectrum-Menu-item").contains("Log out").click({ force: true })
|
cy.get(".spectrum-Menu-item").contains("Log out").click({ force: true })
|
||||||
|
@ -68,11 +68,14 @@ Cypress.Commands.add("createUser", (email, permission) => {
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// Add user and wait for modal to change
|
// Add user
|
||||||
cy.get(".spectrum-Button").contains("Add user").click({ force: true })
|
cy.get(".spectrum-Button").contains("Add users").click({ force: true })
|
||||||
cy.get(".spectrum-ActionButton").contains("Add email").should("not.exist")
|
cy.get(".spectrum-ActionButton").contains("Add email").should("not.exist")
|
||||||
})
|
})
|
||||||
// Onboarding modal
|
// Onboarding modal
|
||||||
|
cy.get(".spectrum-Dialog-grid", { timeout: 5000 }).contains(
|
||||||
|
"Choose your onboarding"
|
||||||
|
)
|
||||||
cy.get(".spectrum-Dialog-grid").within(() => {
|
cy.get(".spectrum-Dialog-grid").within(() => {
|
||||||
cy.get(".onboarding-type").eq(1).click()
|
cy.get(".onboarding-type").eq(1).click()
|
||||||
cy.get(".spectrum-Button").contains("Done").click({ force: true })
|
cy.get(".spectrum-Button").contains("Done").click({ force: true })
|
||||||
|
@ -163,7 +166,7 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => {
|
||||||
const shouldCreateDefaultTable =
|
const shouldCreateDefaultTable =
|
||||||
typeof addDefaultTable != "boolean" ? true : addDefaultTable
|
typeof addDefaultTable != "boolean" ? true : addDefaultTable
|
||||||
|
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.url({ timeout: 30000 }).should("include", "/apps")
|
cy.url({ timeout: 30000 }).should("include", "/apps")
|
||||||
cy.get(`[data-cy="create-app-btn"]`, { timeout: 5000 }).click({ force: true })
|
cy.get(`[data-cy="create-app-btn"]`, { timeout: 5000 }).click({ force: true })
|
||||||
|
|
||||||
|
@ -197,7 +200,7 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("deleteApp", name => {
|
Cypress.Commands.add("deleteApp", name => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
|
@ -254,7 +257,7 @@ Cypress.Commands.add("deleteApp", name => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("deleteAllApps", () => {
|
Cypress.Commands.add("deleteAllApps", () => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.wait(500)
|
cy.wait(500)
|
||||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`, {
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`, {
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
|
@ -351,7 +354,7 @@ Cypress.Commands.add("alterAppVersion", (appId, version) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("importApp", (exportFilePath, name) => {
|
Cypress.Commands.add("importApp", (exportFilePath, name) => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
|
|
||||||
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`)
|
||||||
.its("body")
|
.its("body")
|
||||||
|
@ -386,7 +389,7 @@ Cypress.Commands.add("importApp", (exportFilePath, name) => {
|
||||||
|
|
||||||
// Filters visible with 1 or more
|
// Filters visible with 1 or more
|
||||||
Cypress.Commands.add("searchForApplication", appName => {
|
Cypress.Commands.add("searchForApplication", appName => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`)
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.wait(2000)
|
cy.wait(2000)
|
||||||
|
|
||||||
// No app filter functionality if only 1 app exists
|
// No app filter functionality if only 1 app exists
|
||||||
|
@ -409,7 +412,7 @@ Cypress.Commands.add("searchForApplication", appName => {
|
||||||
|
|
||||||
// Assumes there are no others
|
// Assumes there are no others
|
||||||
Cypress.Commands.add("applicationInAppTable", appName => {
|
Cypress.Commands.add("applicationInAppTable", appName => {
|
||||||
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 })
|
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
|
||||||
cy.get(".appTable", { timeout: 5000 }).within(() => {
|
cy.get(".appTable", { timeout: 5000 }).within(() => {
|
||||||
cy.get(".title").contains(appName).should("exist")
|
cy.get(".title").contains(appName).should("exist")
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue