Browse Source

Merge pull request #3704 from nocodb/test/cy-stability-column-edit

test: cy-stability-column edit operations
pull/3709/head
Raju Udava 2 years ago committed by GitHub
parent
commit
4c28f4f2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      scripts/cypress/integration/common/1b_table_column_operations.js
  2. 30
      scripts/cypress/integration/common/3b_formula_column.js
  3. 33
      scripts/cypress/integration/common/3c_lookup_column.js
  4. 80
      scripts/cypress/integration/common/3d_rollup_column.js
  5. 51
      scripts/cypress/integration/common/3e_duration_column.js
  6. 20
      scripts/cypress/integration/common/3f_link_to_another_record.js
  7. 40
      scripts/cypress/support/commands.js
  8. 21
      scripts/cypress/support/page_objects/mainPage.js

36
scripts/cypress/integration/common/1b_table_column_operations.js

@ -65,13 +65,26 @@ export const genTest = (apiType, dbType) => {
.trigger("mouseover", { force: true }) .trigger("mouseover", { force: true })
.click({ force: true }); .click({ force: true });
cy.get(".nc-column-edit").click(); // cy.get(".nc-column-edit").click();
cy.get(".nc-column-edit").should("not.be.visible"); // cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// change column type and verify // change column type and verify
cy.get(".nc-column-type-input").last().click(); // cy.get(".nc-column-type-input").last().click();
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains("LongText").click(); cy.getActiveMenu('.nc-dropdown-edit-column')
cy.get(".ant-btn-primary:visible").contains("Save").click(); .find(".nc-column-type-input")
.last()
.click();
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("LongText")
.click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated"); cy.toastWait("Column updated");
} }
@ -83,15 +96,22 @@ export const genTest = (apiType, dbType) => {
.trigger("mouseover", { force: true }) .trigger("mouseover", { force: true })
.click({ force: true }); .click({ force: true });
cy.get(".nc-column-edit").click(); // cy.get(".nc-column-edit").click();
cy.get(".nc-column-edit").should("not.be.visible"); // cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify // rename column and verify
cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 })
.should('exist') .should('exist')
.clear() .clear()
.type(updatedColName); .type(updatedColName);
cy.get(".ant-btn-primary:visible").contains("Save").click(); // cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated"); cy.toastWait("Column updated");

30
scripts/cypress/integration/common/3b_formula_column.js

@ -57,10 +57,25 @@ export const genTest = (apiType, dbType) => {
.should('exist') .should('exist')
.clear() .clear()
.type(columnName); .type(columnName);
cy.get(".nc-column-type-input").last().click().type("Formula"); // cy.get(".nc-column-type-input").last().click().type("Formula");
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains("Formula").click(); cy.getActiveMenu('.nc-dropdown-grid-add-column')
cy.get('textarea.nc-formula-input').click().type(formula, { parseSpecialCharSequences: false }); .find(".nc-column-type-input")
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); .last()
.click()
.type("Formula");
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("Formula")
.click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find('textarea.nc-formula-input')
.click()
.type(formula, { parseSpecialCharSequences: false });
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
// cy.toastWait(`Column created`); // cy.toastWait(`Column created`);
cy.closeTableTab("City"); cy.closeTableTab("City");
@ -82,8 +97,11 @@ export const genTest = (apiType, dbType) => {
.trigger("mouseover", { force: true }) .trigger("mouseover", { force: true })
.click({ force: true }); .click({ force: true });
cy.get(".nc-column-edit").click(); // cy.get(".nc-column-edit").click();
cy.get(".nc-column-edit").should("not.be.visible"); // cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-edit-column").find('input.nc-column-name-input', { timeout: 3000 })
.should('exist') .should('exist')

33
scripts/cypress/integration/common/3c_lookup_column.js

@ -48,21 +48,40 @@ export const genTest = (apiType, dbType) => {
force: true, force: true,
}); });
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input')
.should('exist') .should('exist')
.clear() .clear()
.type(childCol); .type(childCol);
cy.get(".nc-column-type-input").last().click().type("Lookup"); // cy.get(".nc-column-type-input").last().click().type("Lookup");
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains("Lookup").click(); cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click()
.type("Lookup");
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("Lookup")
.click();
// Configure Child table & column names // Configure Child table & column names
fetchParentFromLabel("Child table"); fetchParentFromLabel("Child table");
cy.getActiveSelection('.nc-dropdown-relation-table').find('.ant-select-item-option').contains(childTable).click(); cy.getActiveSelection('.nc-dropdown-relation-table')
.find('.ant-select-item-option')
.contains(childTable)
.click();
fetchParentFromLabel("Child column"); fetchParentFromLabel("Child column");
cy.getActiveSelection('.nc-dropdown-relation-column').find('.ant-select-item-option').contains(childCol).click(); cy.getActiveSelection('.nc-dropdown-relation-column')
.find('.ant-select-item-option')
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); .contains(childCol)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${childCol}"]`).should("exist"); cy.get(`th[data-title="${childCol}"]`).should("exist");

80
scripts/cypress/integration/common/3d_rollup_column.js

@ -54,24 +54,46 @@ export const genTest = (apiType, dbType) => {
force: true, force: true,
}); });
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input')
.should('exist') .should('exist')
.clear() .clear()
.type(columnName); .type(columnName);
cy.get(".nc-column-type-input").last().click().type("RollUp"); // cy.get(".nc-column-type-input").last().click().type("RollUp");
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains("Rollup").click(); cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click()
.type("RollUp")
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("Rollup")
.click();
// Configure Child table & column names // Configure Child table & column names
fetchParentFromLabel("Child table"); fetchParentFromLabel("Child table");
cy.getActiveSelection('.nc-dropdown-relation-table').find('.ant-select-item-option').contains(childTable).click(); cy.getActiveSelection('.nc-dropdown-relation-table')
.find('.ant-select-item-option')
.contains(childTable)
.click();
fetchParentFromLabel("Child column"); fetchParentFromLabel("Child column");
cy.getActiveSelection('.nc-dropdown-relation-column').find('.ant-select-item-option').contains(childCol).click(); cy.getActiveSelection('.nc-dropdown-relation-column')
.find('.ant-select-item-option')
.contains(childCol)
.click();
fetchParentFromLabel("Aggregate function"); fetchParentFromLabel("Aggregate function");
cy.getActiveSelection('.nc-dropdown-rollup-function').find('.ant-select-item-option').contains(aggregateFunc).click(); cy.getActiveSelection('.nc-dropdown-rollup-function')
.find('.ant-select-item-option')
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); .contains(aggregateFunc)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${columnName}"]`).should("exist"); cy.get(`th[data-title="${columnName}"]`).should("exist");
@ -85,26 +107,26 @@ export const genTest = (apiType, dbType) => {
// routine to edit column // routine to edit column
// //
const editColumnByName = (oldName, newName) => { // const editColumnByName = (oldName, newName) => {
// verify if column exists before delete // // verify if column exists before delete
cy.get(`th:contains(${oldName})`).should("exist"); // cy.get(`th:contains(${oldName})`).should("exist");
//
// delete opiton visible on mouse-over // // delete opiton visible on mouse-over
cy.get(`th:contains(${oldName}) .mdi-menu-down`) // cy.get(`th:contains(${oldName}) .mdi-menu-down`)
.trigger("mouseover") // .trigger("mouseover")
.click(); // .click();
//
// edit/ save on pop-up // // edit/ save on pop-up
cy.get(".nc-column-edit").click(); // cy.get(".nc-column-edit").click();
cy.get(".nc-column-name-input input").clear().type(newName); // cy.get(".nc-column-name-input input").clear().type(newName);
cy.get(".nc-col-create-or-edit-card").contains("Save").click(); // cy.get(".nc-col-create-or-edit-card").contains("Save").click();
//
cy.toastWait("Successfully updated alias"); // cy.toastWait("Successfully updated alias");
//
// validate if deleted (column shouldnt exist) // // validate if deleted (column shouldnt exist)
cy.get(`th:contains(${oldName})`).should("not.exist"); // cy.get(`th:contains(${oldName})`).should("not.exist");
cy.get(`th:contains(${newName})`).should("exist"); // cy.get(`th:contains(${newName})`).should("exist");
}; // };
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Test case // Test case
@ -134,7 +156,7 @@ export const genTest = (apiType, dbType) => {
.contains("2") .contains("2")
.should("exist"); .should("exist");
editColumnByName("RollUpCol_1", "RollUpCol_New"); // editColumnByName("RollUpCol_1", "RollUpCol_New");
deleteColumnByName("RollUpCol_New"); deleteColumnByName("RollUpCol_New");
}); });
}); });

51
scripts/cypress/integration/common/3e_duration_column.js

@ -44,18 +44,34 @@ export const genTest = (apiType, dbType) => {
force: true, force: true,
}); });
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input', { timeout: 3000 })
.should('exist') .should('exist')
.clear() .clear()
.type(columnName); .type(columnName);
cy.get(".nc-column-type-input").last().click().type("Duration"); // cy.get(".nc-column-type-input").last().click().type("Duration");
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains("Duration").click(); cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click()
.type("Duration")
cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option')
.contains("Duration")
.click();
// Configure Duration format // Configure Duration format
fetchParentFromLabel("Duration Format"); fetchParentFromLabel("Duration Format");
cy.getActiveSelection('.nc-dropdown-duration-option').find('.ant-select-item-option').contains(durationFormat).click(); cy.getActiveSelection('.nc-dropdown-duration-option')
.find('.ant-select-item-option')
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); .contains(durationFormat)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${columnName}"]`).should("exist"); cy.get(`th[data-title="${columnName}"]`).should("exist");
@ -75,19 +91,30 @@ export const genTest = (apiType, dbType) => {
.trigger("mouseover", { force: true }) .trigger("mouseover", { force: true })
.click({ force: true }); .click({ force: true });
cy.get(".nc-column-edit").click(); // cy.get(".nc-column-edit").click();
cy.get(".nc-column-edit").should("not.be.visible"); // cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
// rename column and verify // rename column and verify
cy.getActiveMenu(".nc-dropdown-column-operations").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-edit-column")
.find('input.nc-column-name-input', { timeout: 3000 })
.should('exist') .should('exist')
.clear() .clear()
.type(newName); .type(newName);
// Configure Duration format // Configure Duration format
fetchParentFromLabel("Duration Format"); fetchParentFromLabel("Duration Format");
cy.getActiveSelection('.nc-dropdown-duration-option').find('.ant-select-item-option').contains(newDurationFormat).click(); cy.getActiveSelection('.nc-dropdown-duration-option')
.find('.ant-select-item-option')
cy.get(".ant-btn-primary:visible").contains("Save").click(); .contains(newDurationFormat)
.click();
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu('.nc-dropdown-edit-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait("Column updated"); cy.toastWait("Column updated");

20
scripts/cypress/integration/common/3f_link_to_another_record.js

@ -37,12 +37,18 @@ export const genTest = (apiType, dbType) => {
.type(columnName); .type(columnName);
// Column type // Column type
cy.get(".nc-column-type-input").last() // cy.get(".nc-column-type-input").last()
// .click()
// .type("Link");
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click() .click()
.type("Link"); .type("Link")
cy.getActiveSelection('.nc-dropdown-column-type') cy.getActiveSelection('.nc-dropdown-column-type')
.find('.ant-select-item-option') .find('.ant-select-item-option')
.contains("LinkToAnotherRecord").click(); .contains("LinkToAnotherRecord")
.click();
// relation type (hm/ mm) // relation type (hm/ mm)
cy.get('.nc-ltar-relation-type') cy.get('.nc-ltar-relation-type')
@ -62,9 +68,13 @@ export const genTest = (apiType, dbType) => {
.click(); .click();
// Save // Save
cy.get(".ant-btn-primary") // cy.get(".ant-btn-primary")
// .contains("Save")
// .should('exist')
// .click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save") .contains("Save")
.should('exist')
.click(); .click();
// Toast // Toast

40
scripts/cypress/support/commands.js

@ -352,26 +352,26 @@ Cypress.Commands.add('renameTable', (oldName, newName) => {
}); });
Cypress.Commands.add('createColumn', (table, columnName) => { // Cypress.Commands.add('createColumn', (table, columnName) => {
cy.get('.nc-project-tree') // cy.get('.nc-project-tree')
.find('.v-list-item__title:contains(Tables)') // .find('.v-list-item__title:contains(Tables)')
.should('exist') // .should('exist')
.first() // .first()
.click(); // .click();
cy.get('.nc-project-tree') // cy.get('.nc-project-tree')
.contains(table) // .contains(table)
.should('exist') // .should('exist')
.first() // .first()
.click({ force: true }); // .click({ force: true });
cy.get(`.project-tab:contains(${table}):visible`).should('exist'); // cy.get(`.project-tab:contains(${table}):visible`).should('exist');
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({ // cy.get('.v-window-item--active .nc-grid tr > th:last button').click({
force: true, // force: true,
}); // });
cy.get('.nc-column-name-input input').clear().type(columnName); // cy.get('.nc-column-name-input input').clear().type(columnName);
cy.getActiveMenu('Menu_CreateColumn'); // cy.getActiveMenu('Menu_CreateColumn');
cy.get('.nc-col-create-or-edit-card').contains('Save').click(); // cy.get('.nc-col-create-or-edit-card').contains('Save').click();
cy.get('th:contains(new_column)').should('exist'); // cy.get('th:contains(new_column)').should('exist');
}); // });
Cypress.Commands.add('toastWait', (msg) => { Cypress.Commands.add('toastWait', (msg) => {
cy.get('.ant-message-notice-content:visible', { timeout: 60000 }).contains(msg).should('exist'); cy.get('.ant-message-notice-content:visible', { timeout: 60000 }).contains(msg).should('exist');

21
scripts/cypress/support/page_objects/mainPage.js

@ -183,11 +183,13 @@ export class _mainPage {
force: true, force: true,
}); });
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input')
.should('exist') .should('exist')
.clear() .clear()
.type(colName); .type(colName);
cy.get(".ant-btn-primary").contains("Save").should('exist').click(); cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".ant-btn-primary").contains("Save").should('exist').click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${colName}"]`).should("exist"); cy.get(`th[data-title="${colName}"]`).should("exist");
}; };
@ -197,15 +199,24 @@ export class _mainPage {
force: true, force: true,
}); });
cy.getActiveMenu(".nc-dropdown-grid-add-column").find('input.nc-column-name-input', { timeout: 3000 }) cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find('input.nc-column-name-input')
.should('exist') .should('exist')
.clear() .clear()
.type(colName); .type(colName);
// change column type and verify // change column type and verify
cy.get(".nc-column-type-input").last().click(); // cy.get(".nc-column-type-input").last().click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".nc-column-type-input")
.last()
.click()
cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains(colType).click(); cy.getActiveSelection('.nc-dropdown-column-type').find('.ant-select-item-option').contains(colType).click();
cy.get(".ant-btn-primary:visible").contains("Save").click(); // cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu('.nc-dropdown-grid-add-column')
.find(".ant-btn-primary:visible")
.contains("Save")
.click();
cy.toastWait(`Column created`); cy.toastWait(`Column created`);
cy.get(`th[data-title="${colName}"]`).should("exist"); cy.get(`th[data-title="${colName}"]`).should("exist");

Loading…
Cancel
Save