mirror of https://github.com/nocodb/nocodb
Pranav C
3 years ago
19 changed files with 598 additions and 234 deletions
@ -0,0 +1,155 @@
|
||||
const genTest = (type) => { |
||||
|
||||
describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => { |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
if (type === 'rest') { |
||||
cy.openOrCreateRestProject({ |
||||
new: true |
||||
}); |
||||
} else { |
||||
cy.openOrCreateGqlProject({ |
||||
new: true |
||||
}); |
||||
} |
||||
|
||||
// open country table
|
||||
cy.openTableTab('Country'); |
||||
// cy.intercept({
|
||||
// method: "GET",
|
||||
// url: "/nc/**/api/v1/Country**",
|
||||
// hostname: 'localhost',
|
||||
// port: 8080
|
||||
// }).as("dataGetFirst");
|
||||
// cy.wait("@dataGetFirst");
|
||||
// todo: wait until api call completes
|
||||
cy.wait(2000) |
||||
|
||||
}) |
||||
|
||||
// check pagination
|
||||
it('Check country table - ', () => { |
||||
cy.get('.nc-pagination').should('exist'); |
||||
cy.get('.nc-pagination .v-pagination > li:last-child').click() |
||||
cy.get('.nc-pagination .v-pagination > li:contains(2) button').should('have.class', 'v-pagination__item--active') |
||||
|
||||
cy.get('.nc-pagination .v-pagination > li:first-child').click() |
||||
}); |
||||
|
||||
// create new row
|
||||
it('Create new row', () => { |
||||
cy.get('.nc-add-new-row-btn').click(); |
||||
|
||||
cy.get('#data-table-form-Country > input').first().type('Test Country'); |
||||
|
||||
cy.contains('Save Row').filter('button').click() |
||||
|
||||
// todo: verify
|
||||
}) |
||||
|
||||
// Test sort
|
||||
it('Add sort option', () => { |
||||
cy.get('.nc-sort-menu-btn').click() |
||||
cy.contains('Add Sort Option').click(); |
||||
cy.get('.nc-sort-field-select div').first().click() |
||||
cy.get('.menuable__content__active .v-list-item:contains(Country)').click() |
||||
cy.get('.nc-sort-dir-select div').first().click() |
||||
cy.get('.menuable__content__active .v-list-item:contains("Z -> A")').click() |
||||
cy.contains('Zambia').should('exist') |
||||
|
||||
// remove sort and check
|
||||
cy.get('.nc-sort-item-remove-btn').click() |
||||
cy.contains('Zambia').should('not.exist') |
||||
}) |
||||
|
||||
|
||||
// Test fields
|
||||
it.only('Add fields options', () => { |
||||
|
||||
cy.get('th:contains(LastUpdate)').should('be.visible') |
||||
|
||||
// toggle and confirm it's hidden
|
||||
cy.get('.nc-fields-menu-btn').click() |
||||
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click() |
||||
cy.get('th:contains(LastUpdate)').should('not.be.visible') |
||||
|
||||
|
||||
// toggle and confirm it's visible
|
||||
// cy.get('.nc-fields-menu-btn').click()
|
||||
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click() |
||||
cy.get('th:contains(LastUpdate)').should('be.visible') |
||||
|
||||
|
||||
// drag fields
|
||||
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({force: true}); |
||||
cy.get('.nc-column-name-input input').clear().type('new_column1') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({force: true}); |
||||
cy.get('.nc-column-name-input input').clear().type('new_column2') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
|
||||
// cy.get('.menuable__content__active .v-list-item label:contains(Country)').closest('.v-list-item').dragTo('.v-list-item:has(.menuable__content__active .v-list-item label:contains(LastUpdate)')
|
||||
/* cy.get('.nc-fields-menu-btn').click() |
||||
|
||||
|
||||
cy.get('.menuable__content__active .v-list-item').eq(1).invoke('attr','draggable', 'true') |
||||
|
||||
cy.get('.menuable__content__active .v-list-item').eq(1).drag('.menuable__content__active .v-list > d') |
||||
cy.get('.menuable__content__active .v-list-item').eq(1).move({x: 100, y: 100}) |
||||
|
||||
|
||||
cy.get('.menuable__content__active .v-list-item').then($el => { |
||||
const draggable = $el[1]; // Cypress.$('.menuable__content__active .v-list-item label:contains(Country)').closest('.v-list-item')[0] // Pick up this
|
||||
const droppable = $el[$el.length - 3]; |
||||
draggable.setAttribute('draggable', 'true') |
||||
// console.log(draggable, droppable)
|
||||
// const coords = droppable.getBoundingClientRect()
|
||||
// cy.wrap(draggable).click().dragTo(droppable)
|
||||
|
||||
|
||||
// cy.wrap(draggable).trigger("dragstart");
|
||||
// cy.wrap(droppable).trigger("drop");
|
||||
|
||||
// cy.wrap(draggable).drop(droppable);
|
||||
|
||||
|
||||
// draggable.parentElement.dispatchEvent(new MouseEvent('dragenter'))
|
||||
// draggable.parentElement.dispatchEvent(new MouseEvent('dragover'))
|
||||
// draggable.dispatchEvent(new MouseEvent('pointerdown'))
|
||||
// draggable.dispatchEvent(new MouseEvent('mousemove'));
|
||||
// draggable.dispatchEvent(new MouseEvent('mousedown'));
|
||||
// draggable.dispatchEvent(new MouseEvent('mousemove', {clientX: 10, clientY: 0}));
|
||||
// draggable.dispatchEvent(new MouseEvent('mousemove', {clientX: coords.x + 10, clientY: coords.y + 10}));
|
||||
// draggable.dispatchEvent(new MouseEvent('mouseup'));
|
||||
})*/ |
||||
|
||||
}) |
||||
|
||||
|
||||
// Test filter
|
||||
it('Add filter options', () => { |
||||
cy.get('.nc-filter-menu-btn').click() |
||||
cy.contains('Add Filter').click(); |
||||
|
||||
cy.get('.nc-filter-field-select').last().click(); |
||||
cy.get('.menuable__content__active .v-list-item:contains(Country)').click() |
||||
cy.get('.nc-filter-operation-select').last().click(); |
||||
cy.get('.menuable__content__active .v-list-item:contains("is equal")').click() |
||||
cy.get('.nc-filter-value-select input:text').last().type('India'); |
||||
|
||||
cy.get('td:contains(India)').should('exist') |
||||
|
||||
|
||||
// remove sort and check
|
||||
cy.get('.nc-filter-item-remove-btn').click() |
||||
cy.contains('td:contains(India)').should('not.exist') |
||||
|
||||
}) |
||||
|
||||
}) |
||||
} |
||||
|
||||
|
||||
genTest('rest') |
||||
genTest('graphql') |
@ -0,0 +1,174 @@
|
||||
const genTest = (type) => { |
||||
|
||||
describe(`${type.toUpperCase()} api - Table`, () => { |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
if (type === 'rest') { |
||||
cy.openOrCreateRestProject({ |
||||
new: true |
||||
}); |
||||
} else { |
||||
cy.openOrCreateGqlProject({ |
||||
new: true |
||||
}); |
||||
} |
||||
|
||||
const randVal = 'Test' + Date.now(); |
||||
const updatedRandVal = 'Updated' + Date.now(); |
||||
const name = 'Test' + Date.now(); |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
cy.openOrCreateRestProject(); |
||||
}) |
||||
|
||||
// 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) |
||||
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}&`) |
||||
}); |
||||
|
||||
|
||||
// create new row
|
||||
it('Create/Edit/Delete row', () => { |
||||
// add new row
|
||||
cy.get('.nc-add-new-row-btn').click(); |
||||
|
||||
cy.get('#data-table-form-Title > input').first().type(randVal); |
||||
|
||||
cy.contains('Save Row').filter('button').click() |
||||
|
||||
cy.get('td').contains(randVal).should('exist'); |
||||
|
||||
// update row
|
||||
cy.get('td').contains(randVal) |
||||
.closest('tr') |
||||
.find('.nc-row-expand-icon') |
||||
.click(); |
||||
|
||||
|
||||
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal); |
||||
cy.contains('Save Row').filter('button').click() |
||||
|
||||
cy.get('td').contains(updatedRandVal).should('exist'); |
||||
cy.get('td').contains(randVal).should('not.exist'); |
||||
|
||||
cy.get('td').contains(updatedRandVal).rightclick() |
||||
|
||||
// delete row
|
||||
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click() |
||||
cy.wait(1000) |
||||
cy.get('td').contains(randVal).should('not.exist'); |
||||
}) |
||||
|
||||
|
||||
// add new column to newly created table
|
||||
it('Create Table Column', () => { |
||||
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('.v-window-item--active .nc-grid tr > th:last button').click({force: true}); |
||||
cy.get('.nc-column-name-input input').clear().type('new_column') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
cy |
||||
.get('th:contains(new_column)') |
||||
.should('exist'); |
||||
}); |
||||
|
||||
// edit the newly created column
|
||||
it('Edit table column - rename & uidt update', () => { |
||||
|
||||
|
||||
cy.get('th:contains(new_column) .mdi-menu-down') |
||||
.trigger('mouseover', {force: true}) |
||||
.click({force: true}) |
||||
|
||||
cy.get('.nc-column-edit').click() |
||||
|
||||
|
||||
// change column type and verify
|
||||
cy.get('.nc-ui-dt-dropdown').click() |
||||
cy.contains('LongText').click() |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
|
||||
cy.get('th[data-col="new_column"] .mdi-text-subject').should('exist') |
||||
|
||||
|
||||
cy.get('th:contains(new_column) .mdi-menu-down') |
||||
.trigger('mouseover', {force: true}) |
||||
.click({force: true}) |
||||
|
||||
cy.get('.nc-column-edit').click() |
||||
|
||||
// rename column and verify
|
||||
cy.get('.nc-column-name-input input').clear().type('updated_column') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
|
||||
|
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('exist'); |
||||
cy |
||||
.get('th:contains(new_column)') |
||||
.should('not.exist'); |
||||
|
||||
|
||||
}) |
||||
|
||||
|
||||
// delete the newly created column
|
||||
it('Delete table column', () => { |
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('exist'); |
||||
|
||||
cy.get('th:contains(updated_column) .mdi-menu-down') |
||||
.trigger('mouseover') |
||||
.click() |
||||
|
||||
cy.get('.nc-column-delete').click() |
||||
cy.get('button:contains(Confirm)').click() |
||||
|
||||
|
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('not.exist'); |
||||
|
||||
}) |
||||
|
||||
|
||||
// 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') |
||||
}); |
||||
|
||||
|
||||
}) |
||||
}); |
||||
} |
||||
|
||||
|
||||
genTest('rest') |
||||
genTest('graphql') |
||||
|
@ -1,74 +0,0 @@
|
||||
describe('Rest api - CRUD/Filter', () => { |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
cy.openOrCreateRestProject(); |
||||
|
||||
// open country table
|
||||
cy.openTableTab('Country'); |
||||
// cy.intercept({
|
||||
// method: "GET",
|
||||
// url: "/nc/**/api/v1/Country**",
|
||||
// hostname: 'localhost',
|
||||
// port: 8080
|
||||
// }).as("dataGetFirst");
|
||||
// cy.wait("@dataGetFirst");
|
||||
// todo: wait until api call completes
|
||||
cy.wait(2000) |
||||
|
||||
}) |
||||
|
||||
// check pagination
|
||||
it('Check country table - ', () => { |
||||
cy.get('.nc-pagination').should('exist'); |
||||
cy.get('.nc-pagination .v-pagination > li:last-child').click() |
||||
cy.get('.nc-pagination .v-pagination > li:contains(2)').should('have.class', 'v-pagination__item--active') |
||||
}); |
||||
|
||||
// create new row
|
||||
it('Create new row', () => { |
||||
cy.get('.nc-add-new-row-btn').click(); |
||||
|
||||
cy.get('#data-table-form-Country > input').first().type('Test Country'); |
||||
|
||||
cy.contains('Save Row').filter('button').click() |
||||
|
||||
// todo: verify
|
||||
}) |
||||
|
||||
// Test sort
|
||||
it('Add sort option', () => { |
||||
cy.get('.nc-sort-menu-btn').click() |
||||
cy.contains('Add Sort Option').click(); |
||||
cy.get('.nc-sort-field-select div').first().click() |
||||
cy.get('.menuable__content__active .v-list-item:contains(Country)').click() |
||||
cy.get('.nc-sort-dir-select div').first().click() |
||||
cy.get('.menuable__content__active .v-list-item:contains("Z -> A")').click() |
||||
cy.contains('Zambia').should('exist') |
||||
}) |
||||
|
||||
|
||||
// Test fields
|
||||
it('Add fields options', () => { |
||||
cy.get('.nc-fields-menu-btn').click() |
||||
cy.get('.menuable__content__active .v-list-item label:contains(LastUpdate)').click() |
||||
cy.get('th:contains(LastUpdate)').should('not.exist') |
||||
}) |
||||
|
||||
|
||||
// Test filter
|
||||
it('Add filter options', () => { |
||||
cy.get('.nc-filter-menu-btn').click() |
||||
cy.contains('Add Filter').click(); |
||||
|
||||
cy.get('.nc-filter-field-select').last().click(); |
||||
cy.get('.menuable__content__active .v-list-item:contains(Country)').click() |
||||
cy.get('.nc-filter-operation-select').last().click(); |
||||
cy.get('.menuable__content__active .v-list-item:contains("is equal")').click() |
||||
cy.get('.nc-filter-value-select input:text').last().type('India'); |
||||
|
||||
cy.get('td:contains(India)').should('exist') |
||||
|
||||
}) |
||||
|
||||
}) |
@ -1,120 +0,0 @@
|
||||
describe('Rest api - Table', () => { |
||||
|
||||
const name = 'Test' + Date.now(); |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
cy.openOrCreateRestProject(); |
||||
}) |
||||
|
||||
// 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) |
||||
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}&`) |
||||
}); |
||||
|
||||
|
||||
// add new column to newly created table
|
||||
it('Create Table Column', () => { |
||||
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('.v-window-item--active .nc-grid tr > th:last button').click({force: true}); |
||||
cy.get('.nc-column-name-input input').clear().type('new_column') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
cy |
||||
.get('th:contains(new_column)') |
||||
.should('exist'); |
||||
}); |
||||
|
||||
// edit the newly created column
|
||||
it('Edit table column - rename & uidt update', () => { |
||||
|
||||
|
||||
cy.get('th:contains(new_column) .mdi-menu-down') |
||||
.trigger('mouseover') |
||||
.click() |
||||
|
||||
cy.get('.nc-column-edit').click() |
||||
|
||||
|
||||
// change column type and verify
|
||||
cy.get('.nc-ui-dt-dropdown').click() |
||||
cy.contains('LongText').click() |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
|
||||
cy.get('th[data-col="new_column"] .mdi-text-subject').should('exist') |
||||
|
||||
|
||||
cy.get('th:contains(new_column) .mdi-menu-down') |
||||
.trigger('mouseover') |
||||
.click() |
||||
|
||||
cy.get('.nc-column-edit').click() |
||||
|
||||
// rename column and verify
|
||||
cy.get('.nc-column-name-input input').clear().type('updated_column') |
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click() |
||||
|
||||
|
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('exist'); |
||||
cy |
||||
.get('th:contains(new_column)') |
||||
.should('not.exist'); |
||||
|
||||
|
||||
}) |
||||
|
||||
|
||||
// delete the newly created column
|
||||
it('Delete table column', () => { |
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('exist'); |
||||
|
||||
cy.get('th:contains(updated_column) .mdi-menu-down') |
||||
.trigger('mouseover') |
||||
.click() |
||||
|
||||
cy.get('.nc-column-delete').click() |
||||
cy.get('button:contains(Confirm)').click() |
||||
|
||||
|
||||
cy |
||||
.get('th:contains(updated_column)') |
||||
.should('not.exist'); |
||||
|
||||
}) |
||||
|
||||
|
||||
// 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') |
||||
}); |
||||
|
||||
|
||||
|
||||
|
||||
}) |
@ -0,0 +1,36 @@
|
||||
describe('Rest api - Table', () => { |
||||
|
||||
const name = 'Test' + Date.now(); |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
cy.openOrCreateRestProject(); |
||||
cy.openTableTab('Country'); |
||||
}) |
||||
|
||||
it('Create grid view', () => { |
||||
cy.get('.nc-create-grid-view').click(); |
||||
cy.getActiveModal().find('button:contains(Submit)').click() |
||||
cy.get('.nc-view-item.nc-grid-view-item').should('exist') |
||||
}) |
||||
it('Create gallery view', () => { |
||||
cy.get('.nc-create-gallery-view').click(); |
||||
cy.getActiveModal().find('button:contains(Submit)').click() |
||||
cy.get('.nc-view-item.nc-gallery-view-item').should('exist') |
||||
}) |
||||
/* it('Delete grid view', () => { |
||||
cy.get('.nc-view-item.nc-grid-view-item').then($items => { |
||||
cy.get('.nc-view-item.nc-grid-view-item .nc-view-delete-icon').last().invoke('show').click() |
||||
expect(Cypress.$('.nc-view-item.nc-grid-view-item').length).to.be.lt($items.length) |
||||
}) |
||||
}) |
||||
it('Delete gallery view', () => { |
||||
cy.get('.nc-view-item.nc-gallery-view-item').then($items => { |
||||
cy.get('.nc-view-item.nc-gallery-view-item .nc-view-delete-icon').last().invoke('show').click() |
||||
expect(Cypress.$('.nc-view-item.nc-gallery-view-item').length).to.be.lt($items.length) |
||||
}) |
||||
|
||||
})*/ |
||||
|
||||
|
||||
}) |
@ -0,0 +1,25 @@
|
||||
describe('User mana', () => { |
||||
const email = `noco${Date.now()}@gmail.com`; |
||||
|
||||
before(() => { |
||||
cy.waitForSpinners(); |
||||
cy.openOrCreateRestProject(); |
||||
}) |
||||
|
||||
|
||||
it('Add new user', () => { |
||||
cy.get('.v-list-item:contains("Team & Auth")').click(); |
||||
|
||||
cy.get(`.project-tab:contains("Team & Auth"):visible`).should('exist') |
||||
cy.get(`td:contains("pranavc@gmail.com")`).should('exist') |
||||
|
||||
cy.get('button:contains("New User")').first().click() |
||||
|
||||
cy.get('label:contains(Email)').next('input').type(email) |
||||
|
||||
cy.get('.nc-invite-or-save-btn').click() |
||||
|
||||
}) |
||||
|
||||
|
||||
}) |
Loading…
Reference in new issue