|
|
|
@ -21,35 +21,13 @@ export const genTest = (type, xcdb) => {
|
|
|
|
|
|
|
|
|
|
// create a new random table
|
|
|
|
|
it('Create Table', () => { |
|
|
|
|
cy.get('.add-btn').click(); |
|
|
|
|
cy.get('.nc-create-table-card .nc-table-name input[type="text"]') |
|
|
|
|
.first().click().clear().type(name) |
|
|
|
|
|
|
|
|
|
if (!xcdb) { |
|
|
|
|
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]') |
|
|
|
|
.first().should('have.value', name.toLowerCase()) |
|
|
|
|
} |
|
|
|
|
//cy.wait(5000)
|
|
|
|
|
|
|
|
|
|
cy.get('.nc-create-table-card .nc-create-table-submit').first().click() |
|
|
|
|
cy.get(`.project-tab:contains(${name})`).should('exist') |
|
|
|
|
cy.url().should('contain', `name=${name}`) |
|
|
|
|
|
|
|
|
|
//cy.wait(5000)
|
|
|
|
|
cy.createTable(name) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete newly created table
|
|
|
|
|
it('Delete Table', () => { |
|
|
|
|
|
|
|
|
|
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000}) |
|
|
|
|
.first().click() |
|
|
|
|
|
|
|
|
|
cy.get('.nc-project-tree').contains(name, {timeout: 6000}).first().click({force: true}); |
|
|
|
|
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.deleteTable(name) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const getAuditCell = (row, col) => { |
|
|
|
@ -72,15 +50,50 @@ export const genTest = (type, xcdb) => {
|
|
|
|
|
getAuditCell(1,0).contains('TABLE').should('exist') |
|
|
|
|
getAuditCell(1,1).contains('CREATED').should('exist') |
|
|
|
|
getAuditCell(1,3).contains('user@nocodb.com').should('exist')
|
|
|
|
|
})
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Table Rename operation', () => { |
|
|
|
|
|
|
|
|
|
cy.renameTable('City', 'CityX') |
|
|
|
|
|
|
|
|
|
// genTest('rest', false)
|
|
|
|
|
// genTest('graphql', false)
|
|
|
|
|
// genTest('rest', true)
|
|
|
|
|
// genTest('graphql', true)
|
|
|
|
|
// verify
|
|
|
|
|
// 1. Table name in project tree has changed
|
|
|
|
|
cy.get('.nc-project-tree') |
|
|
|
|
.contains('CityX') |
|
|
|
|
.should('exist') |
|
|
|
|
|
|
|
|
|
// 2. Table tab name has changed
|
|
|
|
|
cy.get(`.project-tab:contains('CityX'):visible`) |
|
|
|
|
.should('exist') |
|
|
|
|
|
|
|
|
|
// 3. contents of the table are valid
|
|
|
|
|
mainPage.getCell(`City`, 1) |
|
|
|
|
.contains('A Corua (La Corua)') |
|
|
|
|
.should('exist') |
|
|
|
|
|
|
|
|
|
cy.closeTableTab('CityX') |
|
|
|
|
|
|
|
|
|
// 4. verify linked contents in other table
|
|
|
|
|
// 4a. Address table, has many field
|
|
|
|
|
cy.openTableTab('Address') |
|
|
|
|
cy.wait(2000).then(() => { |
|
|
|
|
mainPage.getCell('City <= Address', 1).scrollIntoView() |
|
|
|
|
mainPage.getCell('City <= Address', 1).find('.name').contains('Lethbridge').should('exist')
|
|
|
|
|
}) |
|
|
|
|
cy.closeTableTab('Address') |
|
|
|
|
|
|
|
|
|
// 4b. Country table, belongs to field
|
|
|
|
|
cy.openTableTab('Country') |
|
|
|
|
cy.wait(2000).then(() => { |
|
|
|
|
mainPage.getCell('Country => City', 1).find('.name').contains('Kabul').should('exist') |
|
|
|
|
})
|
|
|
|
|
cy.closeTableTab('Country') |
|
|
|
|
|
|
|
|
|
// revert re-name operation to not impact rest of test suite
|
|
|
|
|
cy.renameTable('CityX', 'City') |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
|
|
|
|