mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.4 KiB
129 lines
4.4 KiB
3 years ago
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
|
||
3 years ago
|
import { mainPage } from "../../support/page_objects/mainPage";
|
||
3 years ago
|
|
||
3 years ago
|
export const genTest = (apiType, dbType) => {
|
||
3 years ago
|
if (!isTestSuiteActive(apiType, dbType)) return;
|
||
|
|
||
|
describe(`${
|
||
|
dbType === "xcdb" ? "Meta - " : ""
|
||
|
}${apiType.toUpperCase()} api - Table`, () => {
|
||
|
before(() => {
|
||
|
cy.get(".mdi-close").click({ multiple: true });
|
||
|
});
|
||
|
|
||
|
after(() => {
|
||
3 years ago
|
cy.get(".mdi-close").click({ multiple: true, force: true });
|
||
3 years ago
|
});
|
||
|
|
||
|
const name = "tablex";
|
||
|
|
||
|
// create a new random table
|
||
|
it("Create Table", () => {
|
||
|
cy.createTable(name);
|
||
|
});
|
||
|
|
||
|
// delete newly created table
|
||
|
it("Delete Table", () => {
|
||
3 years ago
|
cy.deleteTable(name, dbType);
|
||
3 years ago
|
});
|
||
|
|
||
|
const getAuditCell = (row, col) => {
|
||
|
return cy.get("table > tbody > tr").eq(row).find("td").eq(col);
|
||
|
};
|
||
|
|
||
|
it("Open Audit tab", () => {
|
||
|
mainPage.navigationDraw(mainPage.AUDIT).click();
|
||
|
|
||
3 years ago
|
cy.snip("AuditPage");
|
||
|
|
||
3 years ago
|
// wait for column headers to appear
|
||
|
//
|
||
|
cy.get("thead > tr > th.caption").should("have.length", 5);
|
||
|
|
||
|
// 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");
|
||
3 years ago
|
|
||
|
// click on home icon to close modal
|
||
|
// cy.get(".nc-noco-brand-icon").click({ force: true });
|
||
|
cy.get("body").click("bottomRight");
|
||
3 years ago
|
});
|
||
|
|
||
|
it("Table Rename operation", () => {
|
||
|
cy.renameTable("City", "CityX");
|
||
|
|
||
|
// 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");
|
||
|
|
||
2 years ago
|
// revert re-name operation to not impact rest of test suite
|
||
|
cy.renameTable("CityX", "City");
|
||
|
|
||
3 years ago
|
// 4. verify linked contents in other table
|
||
|
// 4a. Address table, has many field
|
||
|
cy.openTableTab("Address", 25);
|
||
|
|
||
3 years ago
|
mainPage.getCell("City", 1).scrollIntoView();
|
||
3 years ago
|
mainPage
|
||
3 years ago
|
.getCell("City", 1)
|
||
3 years ago
|
.find(".name")
|
||
|
.contains("Lethbridge")
|
||
|
.should("exist");
|
||
|
cy.closeTableTab("Address");
|
||
|
|
||
|
// 4b. Country table, belongs to field
|
||
|
cy.openTableTab("Country", 25);
|
||
|
|
||
|
mainPage
|
||
3 years ago
|
.getCell("City List", 1)
|
||
3 years ago
|
.find(".name")
|
||
|
.contains("Kabul")
|
||
|
.should("exist");
|
||
|
cy.closeTableTab("Country");
|
||
|
});
|
||
3 years ago
|
});
|
||
|
};
|
||
3 years ago
|
|
||
3 years ago
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
|
* @author Raju Udava <sivadstala@gmail.com>
|
||
|
*
|
||
|
* @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 <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
3 years ago
|
*/
|