|
|
|
@ -28,7 +28,10 @@ export const roles = {
|
|
|
|
|
}, |
|
|
|
|
creator: { |
|
|
|
|
name: "creator", |
|
|
|
|
credentials: { username: "creator@nocodb.com", password: "Password123." }, |
|
|
|
|
credentials: { |
|
|
|
|
username: "creator@nocodb.com", |
|
|
|
|
password: "Password123.", |
|
|
|
|
}, |
|
|
|
|
validations: { |
|
|
|
|
advSettings: true, |
|
|
|
|
editSchema: true, |
|
|
|
@ -39,7 +42,10 @@ export const roles = {
|
|
|
|
|
}, |
|
|
|
|
editor: { |
|
|
|
|
name: "editor", |
|
|
|
|
credentials: { username: "editor@nocodb.com", password: "Password123." }, |
|
|
|
|
credentials: { |
|
|
|
|
username: "editor@nocodb.com", |
|
|
|
|
password: "Password123.", |
|
|
|
|
}, |
|
|
|
|
validations: { |
|
|
|
|
advSettings: false, |
|
|
|
|
editSchema: false, |
|
|
|
@ -50,7 +56,10 @@ export const roles = {
|
|
|
|
|
}, |
|
|
|
|
commenter: { |
|
|
|
|
name: "commenter", |
|
|
|
|
credentials: { username: "commenter@nocodb.com", password: "Password123." }, |
|
|
|
|
credentials: { |
|
|
|
|
username: "commenter@nocodb.com", |
|
|
|
|
password: "Password123.", |
|
|
|
|
}, |
|
|
|
|
validations: { |
|
|
|
|
advSettings: false, |
|
|
|
|
editSchema: false, |
|
|
|
@ -61,7 +70,10 @@ export const roles = {
|
|
|
|
|
}, |
|
|
|
|
viewer: { |
|
|
|
|
name: "viewer", |
|
|
|
|
credentials: { username: "viewer@nocodb.com", password: "Password123." }, |
|
|
|
|
credentials: { |
|
|
|
|
username: "viewer@nocodb.com", |
|
|
|
|
password: "Password123.", |
|
|
|
|
}, |
|
|
|
|
validations: { |
|
|
|
|
advSettings: false, |
|
|
|
|
editSchema: false, |
|
|
|
@ -97,65 +109,15 @@ export const staticProjects = {
|
|
|
|
|
//
|
|
|
|
|
export const isTestSuiteActive = (apiType, dbType) => { |
|
|
|
|
const env = Cypress.env("testMode"); |
|
|
|
|
if (!dbType) { |
|
|
|
|
switch (apiType) { |
|
|
|
|
case "rest": |
|
|
|
|
return env.includes("extREST") ? true : false; |
|
|
|
|
case "graphql": |
|
|
|
|
return env.includes("extGQL") ? true : false; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
switch (apiType) { |
|
|
|
|
case "rest": |
|
|
|
|
return env.includes("xcdbREST") ? true : false; |
|
|
|
|
case "graphql": |
|
|
|
|
return env.includes("xcdbGQL") ? true : false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// expecting different modes to be seperated by a .
|
|
|
|
|
export const getPrimarySuite = () => { |
|
|
|
|
const env = Cypress.env("testMode").split("."); |
|
|
|
|
switch (env[0]) { |
|
|
|
|
case "extREST": |
|
|
|
|
return staticProjects.externalREST; |
|
|
|
|
case "extGQL": |
|
|
|
|
return staticProjects.externalGQL; |
|
|
|
|
case "xcdbREST": |
|
|
|
|
return staticProjects.sampleREST; |
|
|
|
|
case "xcdbGQL": |
|
|
|
|
return staticProjects.sampleGQL; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const isSecondarySuite = (apiType, dbType) => { |
|
|
|
|
if (!isTestSuiteActive(apiType, dbType)) return false; |
|
|
|
|
|
|
|
|
|
const env = Cypress.env("testMode").split("."); |
|
|
|
|
|
|
|
|
|
switch (env[0]) { |
|
|
|
|
case "extREST": |
|
|
|
|
return apiType == "rest" && !dbType ? false : true; |
|
|
|
|
case "extGQL": |
|
|
|
|
return apiType == "graphql" && !dbType ? false : true; |
|
|
|
|
case "xcdbREST": |
|
|
|
|
return apiType == "rest" && dbType ? false : true; |
|
|
|
|
case "xcdbGQL": |
|
|
|
|
return apiType == "graphql" && dbType ? false : true; |
|
|
|
|
} |
|
|
|
|
return env.some( |
|
|
|
|
(element) => element.apiType === apiType && element.dbType === dbType |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
let currentTestMode = ``; |
|
|
|
|
let currentTestMode = { apiType: null, dbType: null }; |
|
|
|
|
let xcdbProjectString = ``; |
|
|
|
|
export function setCurrentMode(apiType, dbType) { |
|
|
|
|
if (!dbType) { |
|
|
|
|
if (apiType == "rest") currentTestMode = "extREST"; |
|
|
|
|
else currentTestMode = "extGQL"; |
|
|
|
|
} else { |
|
|
|
|
if (apiType == "rest") currentTestMode = "xcdbREST"; |
|
|
|
|
else currentTestMode = "xcdbGQL"; |
|
|
|
|
} |
|
|
|
|
currentTestMode = { apiType: apiType, dbType: dbType }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function getCurrentMode() { |
|
|
|
@ -163,9 +125,7 @@ export function getCurrentMode() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function isXcdb() { |
|
|
|
|
if (currentTestMode === "xcdbREST" || currentTestMode === "xcdbGQL") |
|
|
|
|
return true; |
|
|
|
|
return false; |
|
|
|
|
return currentTestMode.dbType === "xcdb"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function setProjectString(projStr) { |
|
|
|
|