Browse Source

test/cypress: remove hardwired timeouts

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/1950/head
Raju Udava 3 years ago
parent
commit
9fb81cb5fe
  1. 40
      scripts/cypress/support/commands.js

40
scripts/cypress/support/commands.js

@ -162,14 +162,16 @@ Cypress.Commands.add("openTableTab", (tn, rc) => {
.click({ force: true });
cy.get(".nc-project-tree")
.contains(tn, { timeout: 6000 })
.contains(tn)
.should('exist')
.first()
.click({ force: true });
cy.get(`.project-tab`).contains(tn, { timeout: 10000 }).should("exist");
cy.get(`.project-tab`).contains(tn).should("exist");
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click({ force: true });
@ -221,7 +223,7 @@ Cypress.Commands.add("openOrCreateGqlProject", (_args) => {
cy.contains("GRAPHQL APIs").closest("label").click();
cy.get(".database-field input").click().clear().type("sakila");
cy.contains("Test Database Connection").click();
cy.contains("Ok & Save Project", { timeout: 3000 }).click();
cy.contains("Ok & Save Project").should('exist').click();
}
}
});
@ -280,11 +282,13 @@ Cypress.Commands.add("createTable", (name) => {
Cypress.Commands.add("deleteTable", (name, dbType) => {
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click();
cy.get(".nc-project-tree")
.contains(name, { timeout: 6000 })
.contains(name)
.should('exist')
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${name}):visible`).should("exist");
@ -301,13 +305,15 @@ Cypress.Commands.add("deleteTable", (name, dbType) => {
Cypress.Commands.add("renameTable", (oldName, newName) => {
// expand project tree
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click();
// right click on project table name
cy.get(".nc-project-tree")
.contains(oldName, { timeout: 6000 })
.contains(oldName)
.should('exist')
.first()
.rightclick();
@ -328,18 +334,21 @@ Cypress.Commands.add("renameTable", (oldName, newName) => {
// close expanded project tree
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click();
});
Cypress.Commands.add("createColumn", (table, columnName) => {
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click();
cy.get(".nc-project-tree")
.contains(table, { timeout: 6000 })
.contains(table)
.should('exist')
.first()
.click({ force: true });
cy.get(`.project-tab:contains(${table}):visible`).should("exist");
@ -366,7 +375,7 @@ Cypress.Commands.add("openViewsTab", (vn, rc) => {
cy.task("log", `[openViewsTab] ${vn} ${rc}`);
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should("exist")
.first()
.click({ force: true });
@ -376,10 +385,11 @@ Cypress.Commands.add("openViewsTab", (vn, rc) => {
.first()
.click({ force: true });
cy.get(`.project-tab`).contains(vn, { timeout: 10000 }).should("exist");
cy.get(`.project-tab`).contains(vn).should("exist");
cy.get(".nc-project-tree")
.find(".v-list-item__title:contains(Tables)", { timeout: 10000 })
.find(".v-list-item__title:contains(Tables)")
.should('exist')
.first()
.click({ force: true });
@ -391,7 +401,7 @@ Cypress.Commands.add("openViewsTab", (vn, rc) => {
Cypress.Commands.add("closeViewsTab", (vn) => {
cy.task("log", `[closeViewsTab] ${vn}`);
cy.get(`.project-tab`).contains(vn, { timeout: 10000 }).should("exist");
cy.get(`.project-tab`).contains(vn).should("exist");
cy.get(`[href="#view||||${vn}"]`)
.find("button.mdi-close")
.click({ force: true });

Loading…
Cancel
Save