Browse Source

Merge branch 'develop' into feat/kanban-view

pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
ac750fb3a0
  1. 122
      packages/nc-gui/lang/de.json
  2. 5
      packages/nc-gui/lib/enums.ts
  3. 8
      packages/nc-gui/plugins/a.i18n.ts
  4. 6
      packages/nc-gui/plugins/state.ts
  5. 8
      packages/noco-docs/content/en/FAQs.md
  6. 14
      packages/noco-docs/content/en/setup-and-usages/share-base.md
  7. 735
      scripts/cypress/integration/common/9b_ERD.js
  8. 3
      scripts/cypress/integration/test/pg-restMisc.js
  9. 4
      scripts/cypress/integration/test/xcdb-restMisc.js
  10. 263
      scripts/cypress/support/page_objects/projectConstants.js

122
packages/nc-gui/lang/de.json

@ -6,7 +6,7 @@
"close": "Schließen",
"yes": "Ja",
"no": "Nein",
"ok": "OK",
"ok": "Ok",
"and": "Und",
"or": "Oder",
"add": "Hinzufügen",
@ -55,19 +55,19 @@
"notification": "Benachrichtigung",
"reference": "Referenz",
"function": "Funktion",
"confirm": "Confirm",
"generate": "Generate",
"copy": "Copy",
"misc": "Miscellaneous",
"lock": "Lock",
"unlock": "Unlock",
"credentials": "Credentials",
"help": "Help",
"questions": "Questions",
"reachOut": "Reach out here",
"betaNote": "This feature is currently in beta.",
"moreInfo": "More information can be found here",
"logs": "Logs"
"confirm": "Bestätigen",
"generate": "Generieren",
"copy": "Kopieren",
"misc": "Sonstiges",
"lock": "Sperren",
"unlock": "Entsperren",
"credentials": "Anmeldeinformationen",
"help": "Hilfe",
"questions": "Fragen",
"reachOut": "Erreichen sie uns hier",
"betaNote": "Diese Funktion befindet sich derzeit in der Beta.",
"moreInfo": "Mehr Informationen können hier gefunden werden",
"logs": "Protokolle"
},
"objects": {
"project": "Projekt",
@ -104,10 +104,10 @@
"commenter": "Kommentator",
"viewer": "Zuschauer"
},
"sqlVIew": "SQL View"
"sqlVIew": "SQL Ansicht"
},
"datatype": {
"ID": "ID",
"ID": "Nummer",
"ForeignKey": "Unbekannter Schlüssel",
"SingleLineText": "Einzeiliger Text",
"LongText": "Langer Text",
@ -129,7 +129,7 @@
"Duration": "Dauer",
"Rating": "Klassifizierung",
"Formula": "Formel",
"Rollup": "Rollup",
"Rollup": "Zusammenfassung",
"Count": "Zählen",
"Lookup": "Nachschlagen",
"DateTime": "Datum/Zeit",
@ -158,7 +158,7 @@
"isNotNull": "ist nicht Null"
},
"title": {
"erdView": "ERD View",
"erdView": "ERD Ansicht",
"newProj": "Neues Projekt",
"myProject": "Meine Projekte",
"formTitle": "Formular Titel",
@ -166,7 +166,7 @@
"lockedView": "Gesperrte Ansicht",
"personalView": "Persönliche Ansicht",
"appStore": "App-Store",
"teamAndAuth": "Team & Auth",
"teamAndAuth": "Team & Authentifizierung",
"rolesUserMgmt": "Rollen- & Benutzermanagement",
"userMgmt": "Benutzermanagement",
"apiTokenMgmt": "API-Tokens-Management",
@ -177,7 +177,7 @@
"exportImportMeta": "Metadaten exportieren / importieren",
"uiACL": "UI-Zugangskontrolle",
"metaOperations": "Metadatenoperationen",
"audit": "Audit",
"audit": "Revisionen",
"auditLogs": "Audit-Log",
"sqlMigrations": "SQL-Migrationen",
"dbCredentials": "Datenbank-Anmeldeinformationen",
@ -185,17 +185,17 @@
"headCreateProject": "Projekt erstellen | NocoDB",
"headLogin": "Anmelden | NocoDB",
"resetPassword": "Passwort zurücksetzen",
"teamAndSettings": "Team & Settings",
"apiDocs": "API Docs",
"teamAndSettings": "Team & Einstellungen",
"apiDocs": "API Dokumentation",
"importFromAirtable": "Import aus Airtable",
"generateToken": "Generate Token",
"generateToken": "Token generieren",
"APIsAndSupport": "APIs & Support",
"helpCenter": "Help center",
"swaggerDocumentation": "Swagger Documentation",
"quickImportFrom": "Quick Import From",
"quickImport": "Quick Import",
"advancedSettings": "Advanced Settings",
"codeSnippet": "Code Snippet"
"helpCenter": "Hilfecenter",
"swaggerDocumentation": "Swagger Dokumentation",
"quickImportFrom": "Schnell importieren von",
"quickImport": "Schnell Importieren",
"advancedSettings": "Erweiterte Einstellungen",
"codeSnippet": "Code Ausschnitt"
},
"labels": {
"notifyVia": "Benachrichtigen mit",
@ -230,7 +230,7 @@
"chat": "Chat",
"email": "Email",
"storage": "Speicher",
"uiAcl": "UI-ACL",
"uiAcl": "Oberflächenzugriffskontrollliste",
"models": "Modelle",
"syncState": "Sync-Status",
"created": "Erstellt",
@ -239,7 +239,7 @@
"aggregateFunction": "Globale Funktion",
"dbCreateIfNotExists": "Datenbank: Erstellen, falls nicht vorhanden",
"clientKey": "Client-Schlüssel",
"clientCert": "Client Cert",
"clientCert": "Client Zertifikat",
"serverCA": "Server CA",
"requriedCa": "Erforderliches CA",
"requriedIdentity": "Erforderliche Identität",
@ -263,15 +263,15 @@
"childColumn": "Child-Spalte",
"onUpdate": "Update",
"onDelete": "Löschen",
"account": "Account",
"language": "Language",
"primaryColor": "Primary Color",
"accentColor": "Accent Color",
"customTheme": "Custom Theme",
"requestDataSource": "Request a data source you need?",
"apiKey": "API Key",
"sharedBase": "Shared Base",
"importData": "Import Data",
"account": "Benutzerkonto",
"language": "Sprache",
"primaryColor": "Primärfarbe",
"accentColor": "Akzentfarbe",
"customTheme": "Benutzerdefiniertes Theme",
"requestDataSource": "Eine benötigte Datenquelle anfragen?",
"apiKey": "API Schlüssel",
"sharedBase": "Geteilte Basis",
"importData": "Daten Importieren",
"importSecondaryViews": "Import Secondary Views",
"importRollupColumns": "Import Rollup Columns",
"importLookupColumns": "Import Lookup Columns",
@ -569,17 +569,17 @@
"requriedFieldsCantBeMoved": "Required field can't be moved",
"updateNotAllowedWithoutPK": "Update not allowed for table which doesn't have primary key",
"autoIncFieldNotEditable": "Auto increment field is not editable",
"editingPKnotSupported": "Editing primary key not supported",
"deletedCache": "Deleted cache successfully",
"cacheEmpty": "Cache is empty",
"exportedCache": "Exported Cache Successfully",
"valueAlreadyInList": "This value is already in the list",
"noColumnsToUpdate": "No columns to update",
"tableDeleted": "Deleted table successfully",
"generatePublicShareableReadonlyBase": "Generate publicly shareable readonly base",
"deleteViewConfirmation": "Are you sure you want to delete this view?",
"deleteTableConfirmation": "Do you want to delete the table",
"showM2mTables": "Show M2M Tables"
"editingPKnotSupported": "Bearbeiten des Primärschlüssels nicht unterstützt",
"deletedCache": "Cache erfolgreich gelöscht",
"cacheEmpty": "Cache ist leer",
"exportedCache": "Cache erfolgreich exportiert",
"valueAlreadyInList": "Dieser Wert ist bereits in der Liste vorhanden",
"noColumnsToUpdate": "Keine Spalten zu aktualisieren",
"tableDeleted": "Tabelle erfolgreich gelöscht",
"generatePublicShareableReadonlyBase": "Öffentlich lesbare Basis generieren",
"deleteViewConfirmation": "Sind Sie sicher, dass Sie diese Ansicht löschen möchten?",
"deleteTableConfirmation": "Möchten Sie die Tabelle löschen",
"showM2mTables": "M2M Tabellen anzeigen"
},
"error": {
"searchProject": "Ihre Suche nach {search} fand keine Ergebnisse",
@ -595,17 +595,17 @@
"passwdRequired": "Passwort ist erforderlich",
"passwdLength": "Ihr Passwort muß mindestens 8 Zeichen haben",
"passwdMismatch": "Passwörter stimmen nicht überein",
"completeRuleSet": "At least 8 characters with one Uppercase, one number and one special character",
"atLeast8Char": "At least 8 characters",
"atLeastOneUppercase": "One Uppercase letter",
"atLeastOneNumber": "One Number",
"atLeastOneSpecialChar": "One special character",
"allowedSpecialCharList": "Allowed special character list"
"completeRuleSet": "Mindestens 8 Zeichen mit einem Großbuchstaben, einer Zahl und einem Sonderzeichen",
"atLeast8Char": "Mindestens 8 Zeichen",
"atLeastOneUppercase": "Ein Großbuchstaben",
"atLeastOneNumber": "Eine Nummer",
"atLeastOneSpecialChar": "Ein Sonderzeichen",
"allowedSpecialCharList": "Erlaubte Sonderzeichenliste"
},
"invalidURL": "Invalid URL",
"internalError": "Some internal error occurred",
"templateGeneratorNotFound": "Template Generator cannot be found!",
"fileUploadFailed": "Failed to upload file",
"invalidURL": "Ungültige URL",
"internalError": "Interner Fehler aufgetreten",
"templateGeneratorNotFound": "Template-Generator kann nicht gefunden werden!",
"fileUploadFailed": "Fehler beim Hochladen der Datei",
"primaryColumnUpdateFailed": "Failed to update primary column",
"formDescriptionTooLong": "Data too long for Form Description",
"columnsRequired": "Following columns are required",

5
packages/nc-gui/lib/enums.ts

@ -55,6 +55,11 @@ export enum Language {
'zh-Hant' = '繁體中文',
}
export enum LanguageAlias {
zn_CN = 'zh-Hans',
zh_TW = 'zh-Hant',
}
export enum NavigateDir {
NEXT,
PREV,

8
packages/nc-gui/plugins/a.i18n.ts

@ -2,6 +2,7 @@ import { defineNuxtPlugin } from 'nuxt/app'
import { createI18n } from 'vue-i18n'
import { nextTick } from 'vue'
import type { Language, NocoI18n } from '~/lib'
import { LanguageAlias } from '~/lib'
let globalI18n: NocoI18n
@ -26,7 +27,12 @@ export async function setI18nLanguage(locale: keyof typeof Language, i18n = glob
i18n.global.locale.value = locale
}
export async function loadLocaleMessages(locale: keyof typeof Language, i18n: NocoI18n = globalI18n) {
export async function loadLocaleMessages(
locale: keyof typeof Language | keyof typeof LanguageAlias,
i18n: NocoI18n = globalI18n,
) {
if (Object.keys(LanguageAlias).includes(locale)) locale = LanguageAlias[locale as keyof typeof LanguageAlias]
// load locale messages with dynamic import
const messages = await import(`../lang/${locale}.json`)

6
packages/nc-gui/plugins/state.ts

@ -1,5 +1,6 @@
import { defineNuxtPlugin, useApi, useGlobal } from '#imports'
import { loadLocaleMessages, setI18nLanguage } from '~/plugins/a.i18n'
import { Language, LanguageAlias } from '~/lib'
/**
* Initialize global state and watches for changes
@ -18,7 +19,10 @@ export default defineNuxtPlugin(async () => {
const { api } = useApi()
const currentLang = state.lang.value
let currentLang = state.lang.value
/** fall back to EN language if the current language cannot be found in Language or LanguagesAlias */
if (![...Object.keys(Language), ...Object.keys(LanguageAlias)].includes(currentLang)) state.lang.value = currentLang = 'en'
/** force load initial locale messages */
await loadLocaleMessages(currentLang)

8
packages/noco-docs/content/en/FAQs.md

@ -23,13 +23,13 @@ menuTitle: 'FAQs'
- You can hover the NocoDB icon on the top left corner or check ``PackageVersion`` in Project info.
![image](https://user-images.githubusercontent.com/35857179/164968969-da53adda-97fc-4a79-9331-039ddef75a13.png)
![image](https://user-images.githubusercontent.com/35857179/192435277-1b1715b9-5885-4e15-861f-4f95bb60294b.png)
## How to check my Project info ?
- You can click on top right icon and click ``Copy Project Info``.
![image](https://user-images.githubusercontent.com/35857179/164968940-6c987863-e7d8-4b44-a46d-2f755825af0a.png)
![image](https://user-images.githubusercontent.com/35857179/192435381-e01013b1-7f87-4d3f-b443-420e685f8c41.png)
You should see the similar result as below.
@ -39,9 +39,9 @@ Arch: **arm64**
Platform: **darwin**
Docker: **false**
Database: **mysql2**
ProjectOnRootDB: **false**
ProjectOnRootDB: **true**
RootDB: **mysql2**
PackageVersion: **0.90.0**
PackageVersion: **0.97.0**
```
## What is available in free version ?

14
packages/noco-docs/content/en/setup-and-usages/share-base.md

@ -6,22 +6,22 @@ category: "Product"
menuTitle: "Share Base"
---
## Generate `Share base`
## Generate Share base
- Open Project
- Click on `Share` button on top right tool bar
- Click on `Invite Team` button on bottom left tool bar
![image](https://user-images.githubusercontent.com/35857179/161957411-ee9ec53d-4745-43c3-99f2-600cb20923e7.png)
![image](https://user-images.githubusercontent.com/35857179/192435607-ee00326e-3890-4478-8260-e5c7c286f03a.png)
- Under `Shared base link` tab and toggle from `Disabled Share base` to `Anyone with the link`
![Screenshot 2022-02-19 at 11 16 02 AM](https://user-images.githubusercontent.com/86527202/154789352-87e65fcc-fbe5-48f0-a1e1-e54dce91a1f3.png)
![image](https://user-images.githubusercontent.com/35857179/192435735-71fc161b-48fc-49e2-94ad-55713932f10a.png)
- Share base link generated is displayed over & can be used to share this project to others in the team [Selection (2) in the image below]
![Screenshot 2022-02-19 at 12 01 58 PM](https://user-images.githubusercontent.com/86527202/154789725-a1194e30-3101-423a-bd5c-25009c361b96.png)
## Modify `Share base`
## Modify Share base
Modifying `Share base` will invalidate the `Share base` link generated previously and will generate a new link.
@ -29,7 +29,7 @@ Modifying `Share base` will invalidate the `Share base` link generated previousl
- Click on 'Share' button on top right tool bar
- Click on 'Reload' button on Quick menu (next to Shared base link)
## Disable `Share base`
## Disable Share base
Disabling `Share base` will invalidate the generated `Share base` link
@ -37,7 +37,7 @@ Disabling `Share base` will invalidate the generated `Share base` link
- Click on 'Share' button on top right tool bar
- Under `Shared base link` and toggle from `Anyone with the link` to `Disable Share base`
## `Share base` Access Permissions
## Share base Access Permissions
Shared base can be configured as

735
scripts/cypress/integration/common/9b_ERD.js

@ -1,28 +1,45 @@
import { mainPage, settingsPage } from "../../support/page_objects/mainPage";
import { loginPage, projectsPage } from "../../support/page_objects/navigation";
import {
isTestSuiteActive,
sakilaSqlViews,
sakilaTables,
} from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
import {loginPage} from "../../support/page_objects/navigation";
import { isTestSuiteActive, mysqlSakilaSqlViews, mysqlSakilaTables, pgSakilaSqlViews, pgSakilaTables, sqliteSakilaSqlViews } from "../../support/page_objects/projectConstants";
import {getProjectString} from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
let projectId;
let sakilaTables, sakilaSqlViews;
describe(`${apiType.toUpperCase()} ERD`, () => {
// before(() => {
// loginPage.loginAndOpenProject(apiType, dbType);
// cy.openTableTab("Country", 25);
// cy.saveLocalStorage();
// });
before(() => {
cy.restoreLocalStorage();
// loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25);
projectId = getProjectString()
cy.log('erd:getProjectString' + projectId)
if (dbType === "postgres") {
sakilaTables = pgSakilaTables;
sakilaSqlViews = pgSakilaSqlViews;
} else if(dbType === "mysql") {
sakilaTables = mysqlSakilaTables;
sakilaSqlViews = mysqlSakilaSqlViews;
} else if(dbType === "xcdb") {
sakilaTables = mysqlSakilaTables.map((tableName) => `${projectId}${tableName}`);
sakilaSqlViews = sqliteSakilaSqlViews.map((viewName) => `${projectId}${viewName}`);
}
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
});
})
afterEach(() => {
cy.saveLocalStorage();
});
})
after(() => {
cy.restoreLocalStorage();
@ -33,417 +50,509 @@ export const genTest = (apiType, dbType) => {
// Test cases
it(`Enable MM setting Open Table ERD`, () => {
cy.openTableTab("Country", 25);
// cy.openTableTab("Country", 25);
mainPage.toggleShowMMSetting();
mainPage.openErdTab();
mainPage.closeMetaTab();
});
it(`Verify ERD Context menu in all table view`, () => {
mainPage.openErdTab();
cy.get(".nc-erd-context-menu").should("be.visible");
cy.get(".nc-erd-context-menu")
.get(".nc-erd-histogram")
.should("be.visible");
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.should("have.length", 3);
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.eq(0)
.should("have.class", "ant-checkbox-checked");
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.eq(1)
.should("have.class", "ant-checkbox-checked");
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.eq(2)
.should("not.have.class", "ant-checkbox-checked");
cy.get(".nc-erd-context-menu")
.find(".nc-erd-showColumns-label")
.dblclick();
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.should("have.length", 5);
cy.get('.nc-erd-context-menu').should('be.visible');
cy.get('.nc-erd-context-menu').get('.nc-erd-histogram').should('be.visible');
cy.get('.nc-erd-context-menu').find('.ant-checkbox').should('have.length', 3);
cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(0).should('have.class', 'ant-checkbox-checked');
cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(1).should('have.class', 'ant-checkbox-checked');
cy.get('.nc-erd-context-menu').find('.ant-checkbox').eq(2).should('not.have.class', 'ant-checkbox-checked');
cy.get('.nc-erd-context-menu').find('.nc-erd-showColumns-label').dblclick();
cy.get('.nc-erd-context-menu').find('.ant-checkbox').should('have.length', 5);
});
it("Verify ERD of all tables view and verify columns of actor and payment with default config", () => {
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-table-node")
.should("have.length", 12);
cy.get(".nc-erd-vue-flow")
.find(".vue-flow__edge")
.should("have.length", 14);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-circle")
.should("have.length", 11);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-rect")
.should("have.length", 17);
for (const tableName of sakilaTables) {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-${tableName}`)
.should("exist");
if(dbType === "mysql") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 12)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 14)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 11)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 17)
} else if (dbType === "postgres") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 17)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 32)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 29)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 35)
} else {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 12)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 14)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 11)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 17)
}
for(const tableName of sakilaTables) {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${tableName}`).should('exist');
}
// Actor table
[
"actor_id",
"first_name",
"last_name",
"last_update",
"film_list",
'actor_id',
'first_name',
'last_name',
'last_update',
'film_list'
].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-actor`)
.find(`.nc-erd-table-node-actor-column-${colTitle}`)
.should("exist");
if (dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}actor`).find(`.nc-erd-table-node-${projectId}actor-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-actor`).find(`.nc-erd-table-node-actor-column-${colTitle}`).should('exist');
}
});
// Payment table
[
"payment_id",
"customer_id",
"staff_id",
"rental_id",
"amount",
"payment_date",
"last_update",
"customer",
"rental",
"staff",
].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-payment`)
.find(`.nc-erd-table-node-payment-column-${colTitle}`)
.should("exist");
});
if(dbType === "mysql") {
[
'payment_id',
'customer_id',
'staff_id',
'rental_id',
'amount',
'payment_date',
'last_update',
'customer',
'rental',
'staff'
]
.forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-payment`).find(`.nc-erd-table-node-payment-column-${colTitle}`).should('exist');
});
} else if(dbType === "postgres") {
[
'payment_id',
'customer_id',
'staff_id',
'rental_id',
'amount',
'payment_date',
'customer',
'rental',
'staff'
]
.forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-payment`).find(`.nc-erd-table-node-payment-column-${colTitle}`).should('exist');
});
} else {
[
'payment_id',
'customer_id',
'staff_id',
'rental_id',
'amount',
'payment_date',
'last_update',
'customer',
'rental',
'staff'
]
.forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}payment`).find(`.nc-erd-table-node-${projectId}payment-column-${colTitle}`).should('exist');
});
}
});
it("Verify ERD of all tables view and verify columns of actor and payment with default config with showAllColumn disabled", () => {
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showColumns-checkbox")
.click();
cy.get(".nc-erd-showPkAndFk-checkbox-disabled").should("exist");
cy.get(".nc-erd-showPkAndFk-checkbox-unchecked").should("exist");
cy.get('.nc-erd-context-menu').get('.nc-erd-showColumns-checkbox').click();
cy.get('.nc-erd-showPkAndFk-checkbox-disabled').should('exist');
cy.get('.nc-erd-showPkAndFk-checkbox-unchecked').should('exist');
// Actor table
["film_list"].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-actor`)
.find(`.nc-erd-table-node-actor-column-${colTitle}`)
.should("exist");
[
'film_list'
].forEach((colTitle) => {
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}actor`).find(`.nc-erd-table-node-${projectId}actor-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-actor`).find(`.nc-erd-table-node-actor-column-${colTitle}`).should('exist');
}
});
// Payment table
["customer", "rental", "staff"].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-payment`)
.find(`.nc-erd-table-node-payment-column-${colTitle}`)
.should("exist");
[
'customer',
'rental',
'staff'
].forEach((colTitle) => {
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}payment`).find(`.nc-erd-table-node-${projectId}payment-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-payment`).find(`.nc-erd-table-node-payment-column-${colTitle}`).should('exist');
}
});
});
it("Verify ERD of all tables view and verify columns of actor and payment with default config with showPkAndFk disabled", () => {
// enable showAllColumn
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showColumns-checkbox")
.click();
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showPkAndFk-checkbox")
.click();
cy.get('.nc-erd-context-menu').get('.nc-erd-showColumns-checkbox').click();
cy.get('.nc-erd-context-menu').get('.nc-erd-showPkAndFk-checkbox').click();
// Actor table
["last_name", "last_update", "film_list"].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-actor`)
.find(`.nc-erd-table-node-actor-column-${colTitle}`)
.should("exist");
});
// Payment table
[
"amount",
"payment_date",
"last_update",
"customer",
"rental",
"staff",
'last_name',
'last_update',
'film_list'
].forEach((colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-payment`)
.find(`.nc-erd-table-node-payment-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}actor`).find(`.nc-erd-table-node-${projectId}actor-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-actor`).find(`.nc-erd-table-node-actor-column-${colTitle}`).should('exist');
}
});
// Payment table
if(dbType === "mysql") {
[
'amount',
'payment_date',
'last_update',
'customer',
'rental',
'staff'
].forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-payment`).find(`.nc-erd-table-node-payment-column-${colTitle}`).should('exist');
});
} else if(dbType === "postgres") {
[
'amount',
'payment_date',
'customer',
'rental',
'staff'
].forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-payment`).find(`.nc-erd-table-node-payment-column-${colTitle}`).should('exist');
});
} else {
[
'amount',
'payment_date',
'last_update',
'customer',
'rental',
'staff'
].forEach((colTitle) => {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}payment`).find(`.nc-erd-table-node-${projectId}payment-column-${colTitle}`).should('exist');
});
}
});
it("Verify ERD of all tables view with sql grid on and verify columns of ActorInfo", () => {
cy.get(".nc-erd-context-menu").get(".nc-erd-showViews-checkbox").click();
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-table-node")
.should("have.length", 19);
cy.get(".nc-erd-vue-flow")
.find(".vue-flow__edge")
.should("have.length", 14);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-circle")
.should("have.length", 11);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-rect")
.should("have.length", 17);
for (const tableName of sakilaTables) {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-${tableName}`)
.should("exist");
cy.get('.nc-erd-context-menu').get('.nc-erd-showViews-checkbox').click();
if(dbType === "mysql") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 19)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 14)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 11)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 17)
} else if(dbType === "postgres") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 24)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 32)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 29)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 35)
} else {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 19)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 14)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 11)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 17)
}
for (const tableName of sakilaSqlViews) {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-${tableName}`)
.should("exist");
for(const tableName of sakilaTables) {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${tableName}`).should('exist');
}
for(const tableName of sakilaSqlViews) {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${tableName}`).should('exist');
}
// ActorInfo SQL View
["actor_id", "first_name", "last_name", "film_info"].forEach(
(colTitle) => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-actor_info`)
.find(`.nc-erd-table-node-actor_info-column-${colTitle}`)
.should("exist");
let actorInfoColumns;
if(dbType === "xcdb") {
actorInfoColumns = [
'ID',
'name',
'address',
'zip_code',
'phone',
'city',
'country',
'SID',
];
} else {
actorInfoColumns = [
'actor_id',
'first_name',
'last_name',
'film_info'
];
}
actorInfoColumns.forEach((colTitle) => {
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}actor_info`).find(`.nc-erd-table-node-${projectId}actor_info-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-actor_info`).find(`.nc-erd-table-node-actor_info-column-${colTitle}`).should('exist');
}
);
})
});
it("Verify show MM tables", () => {
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-store`)
.should("not.exist");
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}store`).should('not.exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-store`).should('not.exist');
}
// disable showViews
cy.get(".nc-erd-context-menu").get(".nc-erd-showViews-checkbox").click();
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showMMTables-checkbox")
.click();
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-table-node")
.should("have.length", 16);
cy.get(".nc-erd-vue-flow")
.find(".vue-flow__edge")
.should("have.length", 26);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-circle")
.should("have.length", 22);
cy.get(".nc-erd-vue-flow")
.find(".nc-erd-edge-rect")
.should("have.length", 30);
cy.get('.nc-erd-context-menu').get('.nc-erd-showViews-checkbox').click();
cy.get('.nc-erd-context-menu').get('.nc-erd-showMMTables-checkbox').click();
if(dbType === "mysql") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 16)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 26)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 22)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 30)
} else if(dbType === "postgres") {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 21)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 44)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 40)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 48)
} else {
cy.get('.nc-erd-vue-flow').find('.nc-erd-table-node').should('have.length', 16)
cy.get('.nc-erd-vue-flow').find('.vue-flow__edge').should('have.length', 26)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-circle').should('have.length', 22)
cy.get('.nc-erd-vue-flow').find('.nc-erd-edge-rect').should('have.length', 30)
}
// Check if store table is present
cy.get(".nc-erd-vue-flow")
.find(`.nc-erd-table-node-store`)
.should("exist");
});
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-${projectId}store`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').find(`.nc-erd-table-node-store`).should('exist');
}
})
it("Verify show junction table names", () => {
// disable showViews
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showJunctionTableNames-checkbox")
.click();
cy.get('.nc-erd-context-menu').get('.nc-erd-showJunctionTableNames-checkbox').click();
cy.get(".nc-erd-vue-flow")
.get(".nc-erd-table-label-filmactor-film_actor")
.should("exist");
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow').get(`.nc-erd-table-label-filmactor-${projectId}film_actor`).should('exist');
} else {
cy.get('.nc-erd-vue-flow').get('.nc-erd-table-label-filmactor-film_actor').should('exist');
}
mainPage.closeMetaTab();
});
})
it("Verify table ERD view of country", () => {
it('Verify table ERD view of country', () => {
mainPage.openTableErdView();
cy.get(".nc-erd-vue-flow-single-table")
.find(".nc-erd-table-node")
.should("have.length", 2);
cy.get(".nc-erd-vue-flow-single-table")
.find(".vue-flow__edge")
.should("have.length", 1);
cy.get(".nc-erd-vue-flow-single-table")
.find(".nc-erd-edge-circle")
.should("have.length", 1);
cy.get(".nc-erd-vue-flow-single-table")
.find(".nc-erd-edge-rect")
.should("have.length", 1);
cy.get('.nc-erd-vue-flow-single-table').find('.nc-erd-table-node').should('have.length', 2)
cy.get('.nc-erd-vue-flow-single-table').find('.vue-flow__edge').should('have.length', 1)
cy.get('.nc-erd-vue-flow-single-table').find('.nc-erd-edge-circle').should('have.length', 1)
cy.get('.nc-erd-vue-flow-single-table').find('.nc-erd-edge-rect').should('have.length', 1)
const countryColumns = [
"country_id",
"country",
"last_update",
"city_list",
];
'country_id',
'country',
'last_update',
'city_list'
]
// Country table
countryColumns.forEach((colTitle) => {
cy.get(".nc-erd-vue-flow-single-table")
.find(`.nc-erd-table-node-country`)
.find(`.nc-erd-table-node-country-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow-single-table').find(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow-single-table').find(`.nc-erd-table-node-country`).find(`.nc-erd-table-node-country-column-${colTitle}`).should('exist');
}
});
const cityColumns = [
"city_id",
"city",
"last_update",
"country",
"address_list",
];
'city_id',
'city',
'last_update',
'country',
'address_list'
]
// City table
cityColumns.forEach((colTitle) => {
cy.get(".nc-erd-vue-flow-single-table")
.find(`.nc-erd-table-node-city`)
.find(`.nc-erd-table-node-city-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get('.nc-erd-vue-flow-single-table').find(`.nc-erd-table-node-${projectId}city`).find(`.nc-erd-table-node-${projectId}city-column-${colTitle}`).should('exist');
} else {
cy.get('.nc-erd-vue-flow-single-table').find(`.nc-erd-table-node-city`).find(`.nc-erd-table-node-city-column-${colTitle}`).should('exist');
}
});
});
it("Verify table ERD view of country showAllColumn disabled", () => {
cy.get(".nc-erd-vue-flow-single-table").within(() => {
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showColumns-checkbox")
.click();
cy.get(".nc-erd-showPkAndFk-checkbox-disabled").should("exist");
cy.get(".nc-erd-showPkAndFk-checkbox-unchecked").should("exist");
const countryColumns = ["city_list"];
})
it('Verify table ERD view of country showAllColumn disabled', () => {
cy.get('.nc-erd-vue-flow-single-table').within(() => {
cy.get('.nc-erd-context-menu').get('.nc-erd-showColumns-checkbox').click();
cy.get('.nc-erd-showPkAndFk-checkbox-disabled').should('exist');
cy.get('.nc-erd-showPkAndFk-checkbox-unchecked').should('exist');
const countryColumns = [
'city_list'
]
// Country table
countryColumns.forEach((colTitle) => {
cy.get(`.nc-erd-table-node-country`)
.find(`.nc-erd-table-node-country-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-${colTitle}`).should('exist');
} else {
cy.get(`.nc-erd-table-node-country`).find(`.nc-erd-table-node-country-column-${colTitle}`).should('exist');
}
});
const cityColumns = ["country", "address_list"];
const cityColumns = [
'country',
'address_list'
]
// City table
cityColumns.forEach((colTitle) => {
cy.get(`.nc-erd-table-node-city`)
.find(`.nc-erd-table-node-city-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}city`).find(`.nc-erd-table-node-${projectId}city-column-${colTitle}`).should('exist');
} else {
cy.get(`.nc-erd-table-node-city`).find(`.nc-erd-table-node-city-column-${colTitle}`).should('exist');
}
});
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showColumns-checkbox")
.click();
});
});
it("Verify table ERD view of country show PK AND FK disabled", () => {
cy.get(".nc-erd-vue-flow-single-table").within(() => {
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showPkAndFk-checkbox")
.click();
cy.get('.nc-erd-context-menu').get('.nc-erd-showColumns-checkbox').click();
})
})
const countryColumns = ["country", "last_update", "city_list"];
it('Verify table ERD view of country show PK AND FK disabled', () => {
cy.get('.nc-erd-vue-flow-single-table').within(() => {
cy.get('.nc-erd-context-menu').get('.nc-erd-showPkAndFk-checkbox').click();
const countryColumns = [
'country',
'last_update',
'city_list'
]
// Country table
countryColumns.forEach((colTitle) => {
cy.get(`.nc-erd-table-node-country`)
.find(`.nc-erd-table-node-country-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-${colTitle}`).should('exist');
} else {
cy.get(`.nc-erd-table-node-country`).find(`.nc-erd-table-node-country-column-${colTitle}`).should('exist');
}
});
const cityColumns = ["city", "last_update", "country", "address_list"];
const cityColumns = [
'city',
'last_update',
'country',
'address_list'
]
// City table
cityColumns.forEach((colTitle) => {
cy.get(`.nc-erd-table-node-city`)
.find(`.nc-erd-table-node-city-column-${colTitle}`)
.should("exist");
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}city`).find(`.nc-erd-table-node-${projectId}city-column-${colTitle}`).should('exist');
} else {
cy.get(`.nc-erd-table-node-city`).find(`.nc-erd-table-node-city-column-${colTitle}`).should('exist');
}
});
cy.get(".nc-erd-context-menu")
.get(".nc-erd-showPkAndFk-checkbox")
.click();
});
cy.getActiveModal().find(".nc-modal-close").click({ force: true });
});
cy.get('.nc-erd-context-menu').get('.nc-erd-showPkAndFk-checkbox').click();
})
cy.getActiveModal().find('.nc-modal-close').click({ force: true });
})
it("create column and check if the change is in the schema", () => {
mainPage.addColumn("test_column", "country");
it('create column and check if the change is in the schema', () => {
mainPage.addColumn('test_column', 'country')
// table view
mainPage.openTableErdView();
cy.get(".nc-erd-vue-flow-single-table").within(() => {
cy.get(".nc-erd-table-node-country")
.find(".nc-erd-table-node-country-column-test_column")
.should("exist");
});
cy.getActiveModal().find(".nc-modal-close").click({ force: true });
cy.get('.nc-erd-vue-flow-single-table').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-test_column`).should('exist');
} else {
cy.get('.nc-erd-table-node-country').find('.nc-erd-table-node-country-column-test_column').should('exist');
}
})
cy.getActiveModal().find('.nc-modal-close').click({ force: true });
// All table view
mainPage.openErdTab();
cy.get(".nc-erd-vue-flow").within(() => {
cy.get(".nc-erd-table-node-country")
.find(".nc-erd-table-node-country-column-test_column")
.should("exist");
});
cy.get('.nc-erd-vue-flow').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-test_column`).should('exist');
} else {
cy.get('.nc-erd-table-node-country').find('.nc-erd-table-node-country-column-test_column').should('exist');
}
})
mainPage.closeMetaTab();
mainPage.deleteColumn("test_column");
mainPage.deleteColumn('test_column')
// table view
mainPage.openTableErdView();
cy.get(".nc-erd-vue-flow-single-table").within(() => {
cy.get(".nc-erd-table-node-country")
.find(".nc-erd-table-node-country-column-test_column")
.should("not.exist");
});
cy.getActiveModal().find(".nc-modal-close").click({ force: true });
cy.get('.nc-erd-vue-flow-single-table').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-test_column`).should('not.exist');
} else {
cy.get('.nc-erd-table-node-country').find('.nc-erd-table-node-country-column-test_column').should('not.exist');
}
})
cy.getActiveModal().find('.nc-modal-close').click({ force: true });
// All table view
mainPage.openErdTab();
cy.get(".nc-erd-vue-flow").within(() => {
cy.get(".nc-erd-table-node-country")
.find(".nc-erd-table-node-country-column-test_column")
.should("not.exist");
});
cy.get('.nc-erd-vue-flow').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}country`).find(`.nc-erd-table-node-${projectId}country-column-test_column`).should('not.exist');
} else {
cy.get('.nc-erd-table-node-country').find('.nc-erd-table-node-country-column-test_column').should('not.exist');
}
})
mainPage.closeMetaTab();
});
})
it("Create table should reflected in ERD", () => {
cy.createTable("new");
it('Create table should reflected in ERD', () => {
cy.createTable('new')
mainPage.openErdTab();
cy.get(".nc-erd-vue-flow").within(() => {
cy.get(".nc-erd-table-node-new").should("exist");
});
cy.get('.nc-erd-vue-flow').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}new`).should('exist');
} else {
cy.get('.nc-erd-table-node-new').should('exist');
}
})
mainPage.closeMetaTab();
cy.deleteTable("new");
cy.deleteTable('new')
mainPage.openErdTab();
cy.get(".nc-erd-vue-flow").within(() => {
cy.get(".nc-erd-table-node-new").should("not.exist");
});
cy.get('.nc-erd-vue-flow').within(() => {
if(dbType === "xcdb") {
cy.get(`.nc-erd-table-node-${projectId}new`).should('not.exist');
} else {
cy.get('.nc-erd-table-node-new').should('not.exist');
}
})
mainPage.closeMetaTab();
});
})
it(`Disable MM setting Open Table ERD and check easter egg should not work`, () => {
mainPage.toggleShowMMSetting();
mainPage.openErdTab();
cy.get(".nc-erd-vue-flow").within(() => {
cy.get(".nc-erd-context-menu")
.find(".nc-erd-showColumns-label")
.dblclick();
cy.get(".nc-erd-context-menu")
.find(".ant-checkbox")
.should("have.length", 3);
});
cy.get('.nc-erd-vue-flow').within(() => {
cy.get('.nc-erd-context-menu').find('.nc-erd-showColumns-label').dblclick();
cy.get('.nc-erd-context-menu').find('.ant-checkbox').should('have.length', 3);
})
mainPage.closeMetaTab();
});
@ -470,4 +579,4 @@ export const genTest = (apiType, dbType) => {
* 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
scripts/cypress/integration/test/pg-restMisc.js

@ -11,6 +11,7 @@ const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
const t8a = require("../common/8a_webhook");
const t9b = require("../common/9b_ERD");
const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
@ -31,7 +32,7 @@ const nocoTestSuite = (apiType, dbType) => {
t6f.genTest(apiType, dbType);
// ERD:
// t9b.genTest(apiType, dbType);
t9b.genTest(apiType, dbType);
// Webhook tests
t8a.genTest(apiType, dbType);

4
scripts/cypress/integration/test/xcdb-restMisc.js

@ -8,11 +8,11 @@ let t6f = require("../common/6f_attachments");
let t6g = require("../common/6g_base_share");
let t7a = require("../common/7a_create_project_from_excel");
let t8a = require("../common/8a_webhook");
const t9b = require("../common/9b_ERD");
const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
const t9b = require("../common/9b_ERD");
const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
@ -33,7 +33,7 @@ const nocoTestSuite = (apiType, dbType) => {
t6f.genTest(apiType, dbType);
// ERD:
// t9b.genTest(apiType, dbType);
t9b.genTest(apiType, dbType);
// Webhook tests
t8a.genTest(apiType, dbType);

263
scripts/cypress/support/page_objects/projectConstants.js

@ -1,19 +1,19 @@
export const defaultDbParams = {
databaseType: 0, // MySQL
hostAddress: "localhost",
portNumber: "3306",
username: "root",
password: "password",
databaseName: "sakila",
databaseType: 0, // MySQL
hostAddress: "localhost",
portNumber: "3306",
username: "root",
password: "password",
databaseName: "sakila",
};
export const defaultPgDbParams = {
databaseType: 1, // Postgres
hostAddress: "localhost",
portNumber: "5432",
username: "postgres",
password: "password",
databaseName: "postgres",
databaseType: 1, // Postgres
hostAddress: "localhost",
portNumber: "5432",
username: "postgres",
password: "password",
databaseName: "postgres",
};
// database
@ -24,162 +24,157 @@ export const defaultPgDbParams = {
// editComment: add comment
// shareView: right navigation bar (share options)
export const roles = {
owner: {
name: "owner",
credentials: { username: "user@nocodb.com", password: "Password123." },
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
owner: {
name: "owner",
credentials: { username: "user@nocodb.com", password: "Password123." },
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
},
},
},
creator: {
name: "creator",
credentials: {
username: "creator@nocodb.com",
password: "Password123.",
creator: {
name: "creator",
credentials: {
username: "creator@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
},
},
validations: {
advSettings: true,
editSchema: true,
editData: true,
editComment: true,
shareView: true,
editor: {
name: "editor",
credentials: {
username: "editor@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: false,
editSchema: false,
editData: true,
editComment: true,
shareView: false,
},
},
},
editor: {
name: "editor",
credentials: {
username: "editor@nocodb.com",
password: "Password123.",
commenter: {
name: "commenter",
credentials: {
username: "commenter@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: true,
shareView: false,
},
},
validations: {
advSettings: false,
editSchema: false,
editData: true,
editComment: true,
shareView: false,
viewer: {
name: "viewer",
credentials: {
username: "viewer@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: false,
shareView: false,
},
},
},
commenter: {
name: "commenter",
credentials: {
username: "commenter@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: true,
shareView: false,
},
},
viewer: {
name: "viewer",
credentials: {
username: "viewer@nocodb.com",
password: "Password123.",
},
validations: {
advSettings: false,
editSchema: false,
editData: false,
editComment: false,
shareView: false,
},
},
};
// default projects
//
export const staticProjects = {
sampleREST: {
basic: { dbType: "none", apiType: "REST", name: "sampleREST" },
config: {},
},
sampleGQL: {
basic: { dbType: "none", apiType: "GQL", name: "sampleGQL" },
config: {},
},
externalREST: {
basic: { dbType: "external", apiType: "REST", name: "externalREST" },
config: defaultDbParams,
},
externalGQL: {
basic: { dbType: "external", apiType: "GQL", name: "externalGQL" },
config: defaultDbParams,
},
pgExternalREST: {
basic: { dbType: "external", apiType: "REST", name: "pgExtREST" },
config: defaultPgDbParams,
},
pgExternalGQL: {
basic: { dbType: "external", apiType: "GQL", name: "pgExternalGQL" },
config: defaultPgDbParams,
},
sampleREST: {
basic: { dbType: "none", apiType: "REST", name: "sampleREST" },
config: {},
},
sampleGQL: {
basic: { dbType: "none", apiType: "GQL", name: "sampleGQL" },
config: {},
},
externalREST: {
basic: { dbType: "external", apiType: "REST", name: "externalREST" },
config: defaultDbParams,
},
externalGQL: {
basic: { dbType: "external", apiType: "GQL", name: "externalGQL" },
config: defaultDbParams,
},
pgExternalREST: {
basic: { dbType: "external", apiType: "REST", name: "pgExtREST" },
config: defaultPgDbParams,
},
pgExternalGQL: {
basic: { dbType: "external", apiType: "GQL", name: "pgExternalGQL" },
config: defaultPgDbParams,
},
};
// return TRUE if test suite specified is activated from env-variables
//
export const isTestSuiteActive = (apiType, dbType) => {
const env = Cypress.env("testMode");
return env.some(
(element) => element.apiType === apiType && element.dbType === dbType
);
const env = Cypress.env("testMode");
return env.some(
(element) => element.apiType === apiType && element.dbType === dbType
);
};
let currentTestMode = { apiType: null, dbType: null };
let xcdbProjectString = ``;
export function setCurrentMode(apiType, dbType) {
currentTestMode = { apiType: apiType, dbType: dbType };
currentTestMode = { apiType: apiType, dbType: dbType };
}
export function getCurrentMode() {
return currentTestMode;
return currentTestMode;
}
export function isXcdb() {
return currentTestMode.dbType === "xcdb";
return currentTestMode.dbType === "xcdb";
}
export function isPostgres() {
return currentTestMode.dbType === "postgres";
return currentTestMode.dbType === "postgres";
}
export function setProjectString(projStr) {
xcdbProjectString = projStr;
xcdbProjectString = projStr;
}
export function getProjectString() {
return xcdbProjectString;
return xcdbProjectString;
}
const sakilaTables = [
"actor",
"address",
"category",
"city",
"country",
"customer",
"film",
"film_text",
"language",
"payment",
"rental",
"staff",
];
const sakilaSqlViews = [
"actor_info",
"customer_list",
"film_list",
"nicer_but_slower_film_list",
"sales_by_film_category",
"sales_by_store",
"staff_list",
];
export { sakilaTables, sakilaSqlViews };
const mysqlSakilaTables = [
'actor', 'address', 'category', 'city', 'country', 'customer', 'film', 'film_text', 'language', 'payment', 'rental', 'staff'
]
const mysqlSakilaSqlViews = [
'actor_info', 'customer_list', 'film_list', 'nicer_but_slower_film_list', 'sales_by_film_category', 'sales_by_store', 'staff_list'
]
const pgSakilaTables = [
'actor', 'address', 'category', 'city', 'country', 'customer', 'film', 'language', 'payment', 'payment_p2007_01', 'payment_p2007_02', 'payment_p2007_03', 'payment_p2007_04', 'payment_p2007_05', 'payment_p2007_06', 'rental', 'staff'
]
const pgSakilaSqlViews = [
'actor_info', 'customer_list', 'film_list', 'nicer_but_slower_film_list', 'sales_by_film_category', 'sales_by_store', 'staff_list'
]
const sqliteSakilaSqlViews = [
'actor_info', 'customer_list', 'film_list', 'nice_but_slower_film_list', 'sales_by_film_category', 'sales_by_store', 'staff_list'
]
export { mysqlSakilaTables, mysqlSakilaSqlViews, pgSakilaTables, pgSakilaSqlViews, sqliteSakilaSqlViews }
Loading…
Cancel
Save