mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-29 07:56:37 +00:00
chore(test): JS prettier for all files
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
This commit is contained in:
@@ -7,288 +7,293 @@ import { roles, staticProjects, defaultDbParams } from "./projectConstants";
|
||||
// suffix to baseUrl needs to be defined here
|
||||
//
|
||||
const urlPool = {
|
||||
ncUrlBase: "/",
|
||||
ncUrlSignUp: "#/signup",
|
||||
ncUrlSignIn: "#/signin",
|
||||
ncUrlBase: "/",
|
||||
ncUrlSignUp: "#/signup",
|
||||
ncUrlSignIn: "#/signin",
|
||||
};
|
||||
|
||||
export class _loginPage {
|
||||
// prefix: baseUrl
|
||||
go(urlKey) {
|
||||
cy.visit(urlKey);
|
||||
}
|
||||
// prefix: baseUrl
|
||||
go(urlKey) {
|
||||
cy.visit(urlKey);
|
||||
}
|
||||
|
||||
// visit SignIn URL, enter credentials passed as parameters
|
||||
// visit SignIn URL, enter credentials passed as parameters
|
||||
//
|
||||
signIn(userCredentials) {
|
||||
this.go(urlPool.ncUrlBase);
|
||||
|
||||
cy.get('input[type="text"]', { timeout: 20000 }).type(
|
||||
userCredentials.username
|
||||
);
|
||||
cy.get('input[type="password"]').type(userCredentials.password);
|
||||
cy.get('button:contains("SIGN IN")').click();
|
||||
|
||||
this.waitProjectPageLoad();
|
||||
}
|
||||
|
||||
// visit SignUp URL, enter credentials passed as parameters
|
||||
//
|
||||
signUp(userCredentials) {
|
||||
this.go(urlPool.ncUrlSignUp);
|
||||
|
||||
cy.get('input[type="text"]', { timeout: 20000 }).type(
|
||||
userCredentials.username
|
||||
);
|
||||
cy.get('input[type="password"]').type(userCredentials.password);
|
||||
cy.get('button:contains("SIGN UP")').click();
|
||||
|
||||
this.waitProjectPageLoad();
|
||||
}
|
||||
|
||||
// logout signed up user
|
||||
//
|
||||
signOut() {
|
||||
cy.get(".nc-user-menu").click();
|
||||
cy.get(".nc-user-menu-signout").click();
|
||||
|
||||
this.waitLoginPageLoad();
|
||||
}
|
||||
|
||||
// delay/ wait utility routines
|
||||
//
|
||||
waitProjectPageLoad() {
|
||||
cy.get(".nc-new-project-menu").should("exist");
|
||||
}
|
||||
|
||||
waitLoginPageLoad() {
|
||||
cy.get(".nc-form-signin").should("exist");
|
||||
}
|
||||
|
||||
// standard pre-project activity
|
||||
//
|
||||
loginAndOpenProject(apiType, dbType) {
|
||||
loginPage.signIn(roles.owner.credentials);
|
||||
projectsPage.openConfiguredProject(apiType, dbType);
|
||||
// if (dbType === "mysql") {
|
||||
// projectsPage.openProject(staticProjects.externalREST.basic.name);
|
||||
// } else if (dbType === "xcdb") {
|
||||
// projectsPage.openProject(staticProjects.sampleREST.basic.name);
|
||||
// } else if (dbType === "postgres") {
|
||||
// projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
|
||||
// }
|
||||
//
|
||||
signIn(userCredentials) {
|
||||
this.go(urlPool.ncUrlBase);
|
||||
|
||||
cy.get('input[type="text"]', { timeout: 20000 }).type(
|
||||
userCredentials.username
|
||||
);
|
||||
cy.get('input[type="password"]').type(userCredentials.password);
|
||||
cy.get('button:contains("SIGN IN")').click();
|
||||
|
||||
this.waitProjectPageLoad();
|
||||
}
|
||||
|
||||
// visit SignUp URL, enter credentials passed as parameters
|
||||
//
|
||||
signUp(userCredentials) {
|
||||
this.go(urlPool.ncUrlSignUp);
|
||||
|
||||
cy.get('input[type="text"]', { timeout: 20000 }).type(
|
||||
userCredentials.username
|
||||
);
|
||||
cy.get('input[type="password"]').type(userCredentials.password);
|
||||
cy.get('button:contains("SIGN UP")').click();
|
||||
|
||||
this.waitProjectPageLoad();
|
||||
}
|
||||
|
||||
// logout signed up user
|
||||
//
|
||||
signOut() {
|
||||
cy.get(".nc-user-menu").click();
|
||||
cy.get(".nc-user-menu-signout").click();
|
||||
|
||||
this.waitLoginPageLoad();
|
||||
}
|
||||
|
||||
// delay/ wait utility routines
|
||||
//
|
||||
waitProjectPageLoad() {
|
||||
cy.get(".nc-new-project-menu").should("exist");
|
||||
}
|
||||
|
||||
waitLoginPageLoad() {
|
||||
cy.get(".nc-form-signin").should("exist");
|
||||
}
|
||||
|
||||
// standard pre-project activity
|
||||
//
|
||||
loginAndOpenProject(apiType, dbType) {
|
||||
loginPage.signIn(roles.owner.credentials);
|
||||
projectsPage.openConfiguredProject(apiType, dbType);
|
||||
// if (dbType === "mysql") {
|
||||
// projectsPage.openProject(staticProjects.externalREST.basic.name);
|
||||
// } else if (dbType === "xcdb") {
|
||||
// projectsPage.openProject(staticProjects.sampleREST.basic.name);
|
||||
// } else if (dbType === "postgres") {
|
||||
// projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
|
||||
// }
|
||||
//
|
||||
// // kludge: wait for page load to finish
|
||||
// cy.wait(2000);
|
||||
// // close team & auth tab
|
||||
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
|
||||
// cy.wait(1000);
|
||||
}
|
||||
// // kludge: wait for page load to finish
|
||||
// cy.wait(2000);
|
||||
// // close team & auth tab
|
||||
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
|
||||
// cy.wait(1000);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Projects page
|
||||
|
||||
export class _projectsPage {
|
||||
// Project creation options
|
||||
//
|
||||
// Project creation options
|
||||
//
|
||||
|
||||
// {dbType, apiType, name}
|
||||
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
|
||||
// {dbType, apiType, name}
|
||||
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
|
||||
|
||||
openConfiguredProject(apiType, dbType) {
|
||||
|
||||
if (dbType === "mysql") {
|
||||
projectsPage.openProject(staticProjects.externalREST.basic.name);
|
||||
} else if (dbType === "xcdb") {
|
||||
projectsPage.openProject(staticProjects.sampleREST.basic.name);
|
||||
} else if (dbType === "postgres") {
|
||||
projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
|
||||
}
|
||||
|
||||
// kludge: wait for page load to finish
|
||||
cy.wait(4000);
|
||||
// close team & auth tab
|
||||
cy.get('button.ant-tabs-tab-remove').should('exist').click();
|
||||
cy.wait(1000);
|
||||
openConfiguredProject(apiType, dbType) {
|
||||
if (dbType === "mysql") {
|
||||
projectsPage.openProject(staticProjects.externalREST.basic.name);
|
||||
} else if (dbType === "xcdb") {
|
||||
projectsPage.openProject(staticProjects.sampleREST.basic.name);
|
||||
} else if (dbType === "postgres") {
|
||||
projectsPage.openProject(staticProjects.pgExternalREST.basic.name);
|
||||
}
|
||||
|
||||
// kludge: wait for page load to finish
|
||||
cy.wait(4000);
|
||||
// close team & auth tab
|
||||
cy.get("button.ant-tabs-tab-remove").should("exist").click();
|
||||
cy.wait(1000);
|
||||
}
|
||||
|
||||
// Open existing project
|
||||
//
|
||||
openProject(projectName) {
|
||||
cy.get(".ant-table-row").contains(`${projectName}`).should("exist").click();
|
||||
// Open existing project
|
||||
//
|
||||
openProject(projectName) {
|
||||
cy.get(".ant-table-row").contains(`${projectName}`).should("exist").click();
|
||||
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
}
|
||||
|
||||
// Create new project
|
||||
// Input:
|
||||
// projectData {dbType, apiType, name}
|
||||
// dbCredentials {databaseType, hostAddress, portNumber, username, password, databaseName}
|
||||
// Returns: projectName
|
||||
//
|
||||
// To configure
|
||||
// SSL & advanced parameters
|
||||
// Database type selection
|
||||
//
|
||||
createProject(projectData, cred) {
|
||||
cy.get("body", { timeout: 2000 });
|
||||
|
||||
let projectName = projectData.name;
|
||||
if (projectData.name == "") projectName = "test_proj" + Date.now();
|
||||
|
||||
// click on "New Project"
|
||||
cy.get(".nc-new-project-menu").should("exist").click();
|
||||
|
||||
if ("none" == projectData.dbType) {
|
||||
// Subsequent form, select (+ Create) option
|
||||
cy.get(".nc-create-xc-db-project", { timeout: 20000 }).last().click({
|
||||
force: true,
|
||||
});
|
||||
|
||||
// wait for page load by verifying required elements
|
||||
cy.get(".nc-metadb-project-name").should("exist");
|
||||
cy.contains("button", "Create").should("exist");
|
||||
|
||||
cy.wait(1000);
|
||||
|
||||
// feed project name
|
||||
cy.get(".nc-metadb-project-name", { timeout: 20000 })
|
||||
.clear()
|
||||
.type(projectName);
|
||||
|
||||
// Submit
|
||||
cy.contains("button", "Create", { timeout: 20000 }).click();
|
||||
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
|
||||
return projectName;
|
||||
}
|
||||
|
||||
// Create new project
|
||||
// Input:
|
||||
// projectData {dbType, apiType, name}
|
||||
// dbCredentials {databaseType, hostAddress, portNumber, username, password, databaseName}
|
||||
// Returns: projectName
|
||||
//
|
||||
// To configure
|
||||
// SSL & advanced parameters
|
||||
// Database type selection
|
||||
//
|
||||
createProject(projectData, cred) {
|
||||
cy.get("body", { timeout: 2000 });
|
||||
// dbType == 'external'
|
||||
else {
|
||||
// Subsequent form, select (+ Create by connection to external database) option
|
||||
cy.get(".nc-create-external-db-project", { timeout: 20000 })
|
||||
.last()
|
||||
.click({
|
||||
force: true,
|
||||
});
|
||||
|
||||
let projectName = projectData.name;
|
||||
if (projectData.name == "") projectName = "test_proj" + Date.now();
|
||||
// wait for page load by verifying required elements
|
||||
cy.get(".nc-extdb-host-database").should("exist");
|
||||
cy.get(".nc-extdb-proj-name").should("exist");
|
||||
cy.get(".nc-extdb-btn-test-connection").should("exist");
|
||||
|
||||
// click on "New Project"
|
||||
cy.get(".nc-new-project-menu").should("exist").click();
|
||||
// CY goes too fast at times, so wait for the page to load
|
||||
cy.wait(1000);
|
||||
|
||||
if ("none" == projectData.dbType) {
|
||||
// Subsequent form, select (+ Create) option
|
||||
cy.get(".nc-create-xc-db-project", { timeout: 20000 }).last().click({
|
||||
force: true,
|
||||
});
|
||||
cy.get(".nc-extdb-proj-name").clear().type(projectName);
|
||||
|
||||
// wait for page load by verifying required elements
|
||||
cy.get(".nc-metadb-project-name").should("exist");
|
||||
cy.contains("button", "Create").should("exist");
|
||||
if (cred.databaseType === 1) {
|
||||
cy.get(".nc-extdb-db-type").should("exist").click();
|
||||
cy.getActiveSelection(".nc-dropdown-ext-db-type")
|
||||
.find(".ant-select-item-option")
|
||||
.contains("PostgreSQL")
|
||||
.click();
|
||||
}
|
||||
|
||||
cy.wait(1000)
|
||||
if (cred.databaseName !== "") {
|
||||
cy.get(".nc-extdb-host-database").clear().type(cred.databaseName);
|
||||
}
|
||||
|
||||
// feed project name
|
||||
cy.get(".nc-metadb-project-name", { timeout: 20000 }).clear().type(
|
||||
projectName
|
||||
);
|
||||
// Test database connection
|
||||
cy.contains("Test Database Connection", { timeout: 20000 }).click();
|
||||
|
||||
// Submit
|
||||
cy.contains("button", "Create", { timeout: 20000 }).click();
|
||||
// Create project
|
||||
cy.contains("Ok & Save Project", { timeout: 20000 }).click();
|
||||
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
cy.wait(5000);
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
|
||||
return projectName;
|
||||
}
|
||||
|
||||
// dbType == 'external'
|
||||
else {
|
||||
// Subsequent form, select (+ Create by connection to external database) option
|
||||
cy.get(".nc-create-external-db-project", { timeout: 20000 }).last().click({
|
||||
force: true,
|
||||
});
|
||||
|
||||
// wait for page load by verifying required elements
|
||||
cy.get('.nc-extdb-host-database').should('exist');
|
||||
cy.get('.nc-extdb-proj-name').should('exist');
|
||||
cy.get('.nc-extdb-btn-test-connection').should('exist');
|
||||
|
||||
// CY goes too fast at times, so wait for the page to load
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('.nc-extdb-proj-name').clear().type(projectName);
|
||||
|
||||
if (cred.databaseType === 1) {
|
||||
cy.get('.nc-extdb-db-type').should('exist').click();
|
||||
cy.getActiveSelection('.nc-dropdown-ext-db-type').find('.ant-select-item-option').contains("PostgreSQL").click();
|
||||
}
|
||||
|
||||
if (cred.databaseName !== "") {
|
||||
cy.get('.nc-extdb-host-database').clear().type(cred.databaseName);
|
||||
}
|
||||
|
||||
// Test database connection
|
||||
cy.contains("Test Database Connection", { timeout: 20000 }).click();
|
||||
|
||||
// Create project
|
||||
cy.contains("Ok & Save Project", { timeout: 20000 }).click();
|
||||
|
||||
cy.wait(5000)
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad();
|
||||
|
||||
return projectName;
|
||||
}
|
||||
return projectName;
|
||||
}
|
||||
}
|
||||
|
||||
// // create REST default project (sakila DB)
|
||||
// //
|
||||
// createDefaulRestProject() {
|
||||
// return this.createProject(
|
||||
// { dbType: 1, apiType: 0, name: "" },
|
||||
// defaultDbParams
|
||||
// );
|
||||
// }
|
||||
// // create REST default project (sakila DB)
|
||||
// //
|
||||
// createDefaulRestProject() {
|
||||
// return this.createProject(
|
||||
// { dbType: 1, apiType: 0, name: "" },
|
||||
// defaultDbParams
|
||||
// );
|
||||
// }
|
||||
|
||||
// // search project with given key
|
||||
// // return project-name array
|
||||
// //
|
||||
// searchProject(projectNameKey) {
|
||||
// cy.get('input[placeholder="Search Project"]').type(projectNameKey);
|
||||
//
|
||||
// const projectName = [];
|
||||
//
|
||||
// cy.get("table tr")
|
||||
// .each((tableRow) => {
|
||||
// cy.wrap(tableRow)
|
||||
// .find("td")
|
||||
// .eq(0)
|
||||
// .find(".title")
|
||||
// .then((input) => {
|
||||
// projectName.push(input.text());
|
||||
// });
|
||||
// })
|
||||
// .then(() => {
|
||||
// // TBD: validate project name to contain search key
|
||||
// console.log(projectName);
|
||||
// return projectName;
|
||||
// });
|
||||
// }
|
||||
// // search project with given key
|
||||
// // return project-name array
|
||||
// //
|
||||
// searchProject(projectNameKey) {
|
||||
// cy.get('input[placeholder="Search Project"]').type(projectNameKey);
|
||||
//
|
||||
// const projectName = [];
|
||||
//
|
||||
// cy.get("table tr")
|
||||
// .each((tableRow) => {
|
||||
// cy.wrap(tableRow)
|
||||
// .find("td")
|
||||
// .eq(0)
|
||||
// .find(".title")
|
||||
// .then((input) => {
|
||||
// projectName.push(input.text());
|
||||
// });
|
||||
// })
|
||||
// .then(() => {
|
||||
// // TBD: validate project name to contain search key
|
||||
// console.log(projectName);
|
||||
// return projectName;
|
||||
// });
|
||||
// }
|
||||
|
||||
// remove specified project entry
|
||||
//
|
||||
deleteProject(projectName) {
|
||||
cy.log("Delete project: " + projectName);
|
||||
cy.get(".nc-noco-brand-icon").should('exist').click();
|
||||
cy.get(".ant-table-row").contains(`${projectName}`).should("exist")
|
||||
.then(($obj) => {
|
||||
cy.log($obj)
|
||||
cy.wrap($obj).parent().parent().find('.ant-table-cell').last().click()
|
||||
})
|
||||
// remove specified project entry
|
||||
//
|
||||
deleteProject(projectName) {
|
||||
cy.log("Delete project: " + projectName);
|
||||
cy.get(".nc-noco-brand-icon").should("exist").click();
|
||||
cy.get(".ant-table-row")
|
||||
.contains(`${projectName}`)
|
||||
.should("exist")
|
||||
.then(($obj) => {
|
||||
cy.log($obj);
|
||||
cy.wrap($obj).parent().parent().find(".ant-table-cell").last().click();
|
||||
});
|
||||
|
||||
// pop-up, submit
|
||||
cy.getActiveModal().find('button:contains("Yes")').click({});
|
||||
}
|
||||
// pop-up, submit
|
||||
cy.getActiveModal().find('button:contains("Yes")').click({});
|
||||
}
|
||||
|
||||
// remove all projects created
|
||||
//
|
||||
// 1. read all project names to be deleted, store in array
|
||||
// 2. invoke delete project for each entry in array
|
||||
//
|
||||
// deleteAllProject() {
|
||||
// remove all projects created
|
||||
//
|
||||
// 1. read all project names to be deleted, store in array
|
||||
// 2. invoke delete project for each entry in array
|
||||
//
|
||||
// deleteAllProject() {
|
||||
|
||||
// const projectName = []
|
||||
// const projectName = []
|
||||
|
||||
// cy.get('table tr').each((tableRow) => {
|
||||
// cy.get('table tr').each((tableRow) => {
|
||||
|
||||
// cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
|
||||
// projectName.push(input.text())
|
||||
// })
|
||||
// })
|
||||
// .then(() => {
|
||||
// console.log(projectName)
|
||||
// projectName.forEach(element => {
|
||||
// cy.wrap(tableRow).find('td').eq(0).find('.title').then((input) => {
|
||||
// projectName.push(input.text())
|
||||
// })
|
||||
// })
|
||||
// .then(() => {
|
||||
// console.log(projectName)
|
||||
// projectName.forEach(element => {
|
||||
|
||||
// // bring back the DOM to normalcy
|
||||
// cy.get('div').parentsUntil('body')
|
||||
// this.deleteProject(element)
|
||||
// // bring back the DOM to normalcy
|
||||
// cy.get('div').parentsUntil('body')
|
||||
// this.deleteProject(element)
|
||||
|
||||
// // wait needed for pop up to disapper
|
||||
// this.waitDeletePageLoad()
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
// // wait needed for pop up to disapper
|
||||
// this.waitDeletePageLoad()
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
waitHomePageLoad() {
|
||||
cy.url({ timeout: 50000 }).should("contain", "/#/nc/p_");
|
||||
}
|
||||
waitHomePageLoad() {
|
||||
cy.url({ timeout: 50000 }).should("contain", "/#/nc/p_");
|
||||
}
|
||||
}
|
||||
|
||||
export const loginPage = new _loginPage();
|
||||
|
||||
@@ -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,145 +24,162 @@ 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.",
|
||||
},
|
||||
validations: {
|
||||
advSettings: true,
|
||||
editSchema: true,
|
||||
editData: true,
|
||||
editComment: true,
|
||||
shareView: true,
|
||||
},
|
||||
},
|
||||
creator: {
|
||||
name: "creator",
|
||||
credentials: {
|
||||
username: "creator@nocodb.com",
|
||||
password: "Password123.",
|
||||
},
|
||||
editor: {
|
||||
name: "editor",
|
||||
credentials: {
|
||||
username: "editor@nocodb.com",
|
||||
password: "Password123.",
|
||||
},
|
||||
validations: {
|
||||
advSettings: false,
|
||||
editSchema: false,
|
||||
editData: true,
|
||||
editComment: true,
|
||||
shareView: false,
|
||||
},
|
||||
validations: {
|
||||
advSettings: true,
|
||||
editSchema: true,
|
||||
editData: true,
|
||||
editComment: true,
|
||||
shareView: true,
|
||||
},
|
||||
commenter: {
|
||||
name: "commenter",
|
||||
credentials: {
|
||||
username: "commenter@nocodb.com",
|
||||
password: "Password123.",
|
||||
},
|
||||
validations: {
|
||||
advSettings: false,
|
||||
editSchema: false,
|
||||
editData: false,
|
||||
editComment: true,
|
||||
shareView: false,
|
||||
},
|
||||
},
|
||||
editor: {
|
||||
name: "editor",
|
||||
credentials: {
|
||||
username: "editor@nocodb.com",
|
||||
password: "Password123.",
|
||||
},
|
||||
viewer: {
|
||||
name: "viewer",
|
||||
credentials: {
|
||||
username: "viewer@nocodb.com",
|
||||
password: "Password123.",
|
||||
},
|
||||
validations: {
|
||||
advSettings: false,
|
||||
editSchema: false,
|
||||
editData: false,
|
||||
editComment: false,
|
||||
shareView: false,
|
||||
},
|
||||
validations: {
|
||||
advSettings: false,
|
||||
editSchema: false,
|
||||
editData: true,
|
||||
editComment: true,
|
||||
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'
|
||||
]
|
||||
"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'
|
||||
]
|
||||
"actor_info",
|
||||
"customer_list",
|
||||
"film_list",
|
||||
"nicer_but_slower_film_list",
|
||||
"sales_by_film_category",
|
||||
"sales_by_store",
|
||||
"staff_list",
|
||||
];
|
||||
|
||||
export { sakilaTables, sakilaSqlViews }
|
||||
export { sakilaTables, sakilaSqlViews };
|
||||
|
||||
Reference in New Issue
Block a user