test(cypress) retry-ability, remove static delays- phase:1/5

Signed-off-by: Raju Udava <sivadstala@gmail.com>
This commit is contained in:
Raju Udava
2021-11-26 00:32:25 +05:30
parent 32c307f7cc
commit 4e51b87186
12 changed files with 105 additions and 125 deletions

View File

@@ -67,6 +67,9 @@ Cypress.Commands.add('signinOrSignup', (_args) => {
}
})
})
// indicates page-load complete
cy.get('.nc-noco-brand-icon', { timeout: 12000 }).should('exist')
});
// for opening/creating a rest project
@@ -193,9 +196,9 @@ Cypress.Commands.add('createTable', (name) => {
cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.toastWait(`Create table.${name} successful`)
cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `name=${name}`)
cy.wait(3000)
})
Cypress.Commands.add('deleteTable', (name) => {
@@ -205,7 +208,7 @@ Cypress.Commands.add('deleteTable', (name) => {
cy.get(`.project-tab:contains(${name}):visible`).should('exist')
cy.get('.nc-table-delete-btn:visible').click()
cy.get('button:contains(Submit)').click()
cy.get(`.project-tab:contains(${name}):visible`).first().should('not.exist')
cy.toastWait(`Delete table.${name} successful`)
})
Cypress.Commands.add('renameTable', (oldName, newName) => {
@@ -238,15 +241,15 @@ Cypress.Commands.add('renameTable', (oldName, newName) => {
.find('button')
.contains('Submit')
.click()
cy.toastWait('Table renamed successfully')
// close expanded project tree
cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)', { timeout: 10000 })
.first()
.click()
cy.wait(2000)
})
})
Cypress.Commands.add('createColumn', (table, columnName) => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
@@ -261,6 +264,15 @@ Cypress.Commands.add('createColumn', (table, columnName) => {
.should('exist');
})
Cypress.Commands.add('toastWait', (msg) => {
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('exist')
cy.get('.toasted:visible', { timout: 6000 })
.contains(msg)
.should('not.exist')
})
// Drag n Drop
// refer: https://stackoverflow.com/a/55409853