diff --git a/cypress/integration/common/audit.js b/cypress/integration/common/audit.js new file mode 100644 index 0000000000..3ed1d40142 --- /dev/null +++ b/cypress/integration/common/audit.js @@ -0,0 +1,65 @@ + +import { mainPage } from "../../support/page_objects/mainPage" +import { loginPage } from "../../support/page_objects/navigation" + +const genTest = (type) => { + + describe(`${type.toUpperCase()} api - Filter, Fields, Sort`, () => { + before(() => { + loginPage.loginAndOpenProject(type) + cy.get('.mdi-close').click({ multiple: true }) + }) + + const getAuditCell = (row, col) => { + return cy.get('table > tbody > tr').eq(row).find('td').eq(col) + } + + it('Open Audit tab', ()=> { + cy.createTable('Table-x') + cy.deleteTable('Table-x') + cy.wait(2000) + + mainPage.navigationDraw(mainPage.AUDIT).click() + cy.wait(2000) + + // Audit table entries + // [Header] Operation Type, Operation Sub Type, Description, User, Created + // [0] TABLE, DELETED, delete table table-x, user@nocodb.com, ... + // [1] TABLE, Created, created table table-x, user@nocodb.com, ... + + getAuditCell(0,0).contains('TABLE').should('exist') + getAuditCell(0,1).contains('DELETED').should('exist') + getAuditCell(0,3).contains('user@nocodb.com').should('exist') + + getAuditCell(1,0).contains('TABLE').should('exist') + getAuditCell(1,1).contains('CREATED').should('exist') + getAuditCell(1,3).contains('user@nocodb.com').should('exist') + }) + }) +} + +genTest('rest') +genTest('graphql') + +/** + * @copyright Copyright (c) 2021, Xgene Cloud Ltd + * + * @author Pranav C Balan + * @author Raju Udava + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 9437a317f0..b6acc71e98 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -176,7 +176,7 @@ Cypress.Commands.add('createTable', (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.get(`.project-tab:contains(${name})`).should('exist') - cy.url().should('contain', `?name=${name}&`) + cy.url().should('contain', `name=${name}`) cy.wait(3000) }) diff --git a/cypress/support/page_objects/mainPage.js b/cypress/support/page_objects/mainPage.js index ca09542a65..fd2a080b77 100644 --- a/cypress/support/page_objects/mainPage.js +++ b/cypress/support/page_objects/mainPage.js @@ -33,7 +33,6 @@ export class _mainPage { return cy.get('header.v-toolbar').eq(0).find('button').eq(toolBarItem) } - navigationDraw(item) { if (item == this.ROLE_VIEW) return cy.get('.nc-nav-drawer').find('.v-list').last()