mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-28 19:15:50 +00:00
[chore] cypress folder re-org
Signed-off-by: Raju Udava <sivadstala@gmail.com>
This commit is contained in:
256
scripts/cypress/support/page_objects/mainPage.js
Normal file
256
scripts/cypress/support/page_objects/mainPage.js
Normal file
@@ -0,0 +1,256 @@
|
||||
|
||||
// main page
|
||||
export class _mainPage {
|
||||
|
||||
constructor() {
|
||||
|
||||
// Top Right items
|
||||
this.SHARE = 0
|
||||
this.THEME_BODY = 1
|
||||
this.THEME_HEADER = 2
|
||||
this.ALERT = 3
|
||||
this.LANGUAGE = 4
|
||||
this.USER = 5
|
||||
|
||||
// Top Left items
|
||||
this.HOME = 0
|
||||
this.GIT_HOME = 1
|
||||
this.GIT_STAR = 2
|
||||
this.GIT_DOCS = 3
|
||||
|
||||
this.AUDIT = 0
|
||||
this.APPSTORE = 2
|
||||
this.TEAM_N_AUTH = 3
|
||||
this.PROJ_METADATA = 4
|
||||
this.ROLE_VIEW = 5
|
||||
|
||||
this.roleURL = {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
toolBarTopLeft(toolBarItem) {
|
||||
return cy.get('header.v-toolbar', {timeout: 20000}).eq(0).find('a').eq(toolBarItem)
|
||||
}
|
||||
|
||||
toolBarTopRight(toolBarItem) {
|
||||
return cy.get('header.v-toolbar', {timeout: 20000}).eq(0).find('button').eq(toolBarItem)
|
||||
}
|
||||
|
||||
navigationDraw(item) {
|
||||
if (item == this.ROLE_VIEW)
|
||||
return cy.get('.nc-nav-drawer').find('.v-list').last()
|
||||
else
|
||||
return cy.get('.nc-nav-drawer').find('.v-list > .v-list-item').eq(item)
|
||||
}
|
||||
|
||||
|
||||
// add new user to specified role
|
||||
//
|
||||
addNewUserToProject = (userCred, roleType) => {
|
||||
|
||||
let linkText
|
||||
|
||||
// click on New User button, feed details
|
||||
cy.get('button:contains("New User")').first().click()
|
||||
cy.get('label:contains("Email")').next('input').type(userCred.username).trigger('input')
|
||||
cy.get('label:contains("Select User roles")').click()
|
||||
|
||||
// opt-in requested role & submit
|
||||
// note that, 'editor' is set by default
|
||||
//
|
||||
cy.getActiveMenu().contains(roleType).click()
|
||||
cy.getActiveMenu().contains('editor').click()
|
||||
cy.get('.mdi-menu-down').last().click()
|
||||
cy.get('.nc-invite-or-save-btn').click()
|
||||
|
||||
// get URL, invoke
|
||||
cy.getActiveModal().find('.v-alert').then(($obj) => {
|
||||
linkText = $obj.text()
|
||||
cy.log(linkText)
|
||||
this.roleURL[roleType] = linkText
|
||||
|
||||
cy.get('body').click('right')
|
||||
|
||||
// cy.visit(linkText)
|
||||
|
||||
// cy.wait(3000)
|
||||
|
||||
// // Redirected to new URL, feed details
|
||||
// //
|
||||
// cy.get('input[type="text"]').type(userCred.username)
|
||||
// cy.get('input[type="password"]').type(userCred.password)
|
||||
// cy.get('button:contains("SIGN UP")').click()
|
||||
|
||||
// cy.url({ timeout: 6000 }).should('contain', '#/project')
|
||||
// cy.wait(1000)
|
||||
})
|
||||
}
|
||||
|
||||
addExistingUserToProject = (emailId, role) => {
|
||||
|
||||
cy.get('.v-list-item:contains("Team & Auth")').click()
|
||||
cy.get(`tr:contains(${emailId})`).find('.mdi-plus', { timeout: 2000 }).click()
|
||||
cy.get(`tr:contains(${emailId})`).find('.mdi-pencil-outline', { timeout: 2000 }).click()
|
||||
|
||||
cy.get('label:contains(Select User roles)').click()
|
||||
|
||||
// opt-in requested role & submit
|
||||
// note that, 'editor' is set by default
|
||||
//
|
||||
cy.getActiveMenu().contains(role).click()
|
||||
cy.getActiveMenu().contains('editor').click()
|
||||
cy.get('.mdi-menu-down').click()
|
||||
cy.get('.nc-invite-or-save-btn').click()
|
||||
cy.wait(1000)
|
||||
|
||||
this.roleURL[role] = "http://localhost:3000/#/user/authentication/signin"
|
||||
}
|
||||
|
||||
getCell = (columnHeader, cellNumber) => {
|
||||
return cy.get(`tbody > :nth-child(${cellNumber}) > [data-col="${columnHeader}"]`)
|
||||
}
|
||||
|
||||
getPagination = (pageNumber) => {
|
||||
if (pageNumber == '<')
|
||||
return cy.get('.nc-pagination .v-pagination > li:first-child')
|
||||
if (pageNumber == '>')
|
||||
return cy.get('.nc-pagination .v-pagination > li:last-child')
|
||||
|
||||
return cy.get(`.nc-pagination .v-pagination > li:contains(${pageNumber}) button`)
|
||||
}
|
||||
|
||||
getRow = (rowIndex) => {
|
||||
return cy.get('.xc-row-table').find('tr').eq(rowIndex)
|
||||
}
|
||||
|
||||
addColumn = (colName) => {
|
||||
cy.get('.v-window-item--active .nc-grid tr > th:last button').click({ force: true });
|
||||
cy.get('.nc-column-name-input input', { timeout: 3000 }).clear().type(colName)
|
||||
cy.get('.nc-col-create-or-edit-card').contains('Save').click()
|
||||
}
|
||||
|
||||
getAuthToken = () => {
|
||||
let obj = JSON.parse(localStorage['vuex'])
|
||||
return obj["users"]["token"]
|
||||
}
|
||||
|
||||
configureSMTP = (from, host, port, secure) => {
|
||||
cy.get('.v-card__title.title')
|
||||
.contains('SMTP')
|
||||
.parents('.elevatio')
|
||||
.find('button')
|
||||
.contains(" Install ")
|
||||
.click({ force: true })
|
||||
cy.getActiveModal().find('[placeholder="eg: admin@example.com"]').click().type(from)
|
||||
cy.getActiveModal().find('[placeholder="eg: smtp.example.com"]').click().type(host)
|
||||
cy.getActiveModal().find('[placeholder="Port"]').click().type(port)
|
||||
cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure)
|
||||
cy.getActiveModal().find('button').contains('Save').click()
|
||||
}
|
||||
|
||||
resetSMTP = () => {
|
||||
cy.get('.v-card__title.title')
|
||||
.contains('SMTP')
|
||||
.parents('.elevatio')
|
||||
.find('button')
|
||||
.contains(" Reset ")
|
||||
.click({ force: true })
|
||||
cy.getActiveModal().find('button').contains('Submit').click()
|
||||
}
|
||||
|
||||
hideUnhideField = (field) => {
|
||||
cy.get('.nc-fields-menu-btn').click()
|
||||
cy.get(`.menuable__content__active .v-list-item label:contains(${field})`).click()
|
||||
cy.get('.nc-fields-menu-btn').click()
|
||||
}
|
||||
|
||||
sortField = (field, criteria) => {
|
||||
cy.get('.nc-sort-menu-btn').click()
|
||||
cy.contains('Add Sort Option').click();
|
||||
cy.get('.nc-sort-field-select div').first().click()
|
||||
cy.get(`.menuable__content__active .v-list-item:contains(${field})`).click()
|
||||
cy.get('.nc-sort-dir-select div').first().click()
|
||||
cy.get(`.menuable__content__active .v-list-item:contains(${criteria})`).click()
|
||||
cy.get('.nc-sort-menu-btn').click()
|
||||
}
|
||||
|
||||
clearSort = () => {
|
||||
cy.get('.nc-sort-menu-btn').click()
|
||||
cy.get('.nc-sort-item-remove-btn').click()
|
||||
cy.get('.nc-sort-menu-btn').click()
|
||||
}
|
||||
|
||||
filterField = (field, operation, value) => {
|
||||
cy.get('.nc-filter-menu-btn').click()
|
||||
cy.contains('Add Filter').click();
|
||||
|
||||
cy.get('.nc-filter-field-select').last().click();
|
||||
cy.getActiveMenu().find(`.v-list-item:contains(${field})`).first().click()
|
||||
cy.get('.nc-filter-operation-select').last().click();
|
||||
cy.getActiveMenu().find(`.v-list-item:contains(${operation})`).click()
|
||||
cy.get('.nc-filter-value-select input:text').last().type(`${value}`);
|
||||
cy.get('.nc-filter-menu-btn').click()
|
||||
}
|
||||
|
||||
filterReset = () => {
|
||||
cy.get('.nc-filter-menu-btn').click()
|
||||
cy.get('.nc-filter-item-remove-btn').click()
|
||||
cy.get('.nc-filter-menu-btn').click()
|
||||
}
|
||||
|
||||
// delete created views
|
||||
//
|
||||
deleteCreatedViews = () => {
|
||||
cy.get('.v-navigation-drawer__content > .container')
|
||||
.find('.v-list > .v-list-item')
|
||||
.contains('Share View')
|
||||
.parent().find('button.mdi-dots-vertical').click()
|
||||
|
||||
cy.getActiveMenu().find('.v-list-item').contains('Views List').click()
|
||||
|
||||
cy.wait(1000)
|
||||
|
||||
// cy.get('.container').find('button.mdi-delete-outline')
|
||||
|
||||
cy.get('th:contains("View Link")').parent().parent()
|
||||
.next().find('tr').each(($tableRow) => {
|
||||
cy.log($tableRow[0].childElementCount)
|
||||
|
||||
// one of the row would contain seggregation header ('other views)
|
||||
if (4 == $tableRow[0].childElementCount) {
|
||||
cy.wrap($tableRow).find('button').last().click()
|
||||
cy.wait(1000)
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
cy.get('.v-overlay__content > .d-flex > .v-icon').click()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const mainPage = new _mainPage;
|
||||
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||||
*
|
||||
* @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/>.
|
||||
*
|
||||
*/
|
||||
297
scripts/cypress/support/page_objects/navigation.js
Normal file
297
scripts/cypress/support/page_objects/navigation.js
Normal file
@@ -0,0 +1,297 @@
|
||||
|
||||
import { roles, staticProjects, defaultDbParams } from "./projectConstants"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Sign in/ Sign up page
|
||||
|
||||
|
||||
// list of hard-wired URL that can be used by nocodb
|
||||
// suffix to baseUrl needs to be defined here
|
||||
//
|
||||
const urlPool = {
|
||||
ncUrlBase: "/",
|
||||
ncUrlSignUp: "#/user/authentication/signup",
|
||||
ncUrlSignIn: "#/user/authentication/signin"
|
||||
}
|
||||
|
||||
export class _loginPage {
|
||||
|
||||
// prefix: baseUrl
|
||||
go(urlKey) {
|
||||
cy.visit(urlKey)
|
||||
}
|
||||
|
||||
// visit SignIn URL, enter credentials passed as parameters
|
||||
//
|
||||
signIn(userCredentials) {
|
||||
this.go(urlPool.ncUrlSignIn)
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
// delay/ wait utility routines
|
||||
//
|
||||
waitProjectPageLoad() {
|
||||
cy.url({ timeout: 6000 }).should('contain', '#/project')
|
||||
cy.wait(1000)
|
||||
}
|
||||
|
||||
// standard pre-project activity
|
||||
//
|
||||
loginAndOpenProject(apiType, xcdb) {
|
||||
loginPage.signIn(roles.owner.credentials)
|
||||
|
||||
if(!xcdb) {
|
||||
if ('rest' == apiType)
|
||||
projectsPage.openProject(staticProjects.externalREST.basic.name)
|
||||
else
|
||||
projectsPage.openProject(staticProjects.externalGQL.basic.name)
|
||||
}
|
||||
else {
|
||||
if ('rest' == apiType)
|
||||
projectsPage.openProject(staticProjects.sampleREST.basic.name)
|
||||
else
|
||||
projectsPage.openProject(staticProjects.sampleGQL.basic.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Projects page
|
||||
|
||||
export class _projectsPage {
|
||||
|
||||
// Project creation options
|
||||
//
|
||||
|
||||
// {dbType, apiType, name}
|
||||
// for external database, {databaseType, hostAddress, portNumber, username, password, databaseName}
|
||||
|
||||
// Open existing project
|
||||
// TODO: add projectName validation
|
||||
//
|
||||
openProject(projectName) {
|
||||
cy.get('tbody').contains('tr', projectName).click()
|
||||
|
||||
// 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(':nth-child(5) > .v-btn', {timeout: 20000}).click()
|
||||
|
||||
if ('none' == projectData.dbType) {
|
||||
|
||||
// Subsequent form, select (+ Create) option
|
||||
cy.get('.nc-create-xc-db-project', {timeout: 20000}).click({ force: true })
|
||||
|
||||
// feed project name
|
||||
cy.get('.nc-metadb-project-name', {timeout: 20000}).type(projectName)
|
||||
|
||||
// Radio button: defaults to NC_REST
|
||||
if ('GQL' == projectData.apiType) {
|
||||
cy.contains('GRAPHQL APIs').closest('label').click();
|
||||
}
|
||||
|
||||
// Submit
|
||||
cy.contains('button', 'Create', { timeout: 20000 }).click()
|
||||
|
||||
// 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}).click({ force: true })
|
||||
|
||||
// feed project name
|
||||
//cy.get('.nc-metadb-project-name').type(projectName)
|
||||
cy.contains('Enter Project Name', {timeout: 20000}).parent().find('input').clear().type(projectName)
|
||||
|
||||
// Radio button: defaults to NC_REST
|
||||
if ('GQL' == projectData.apiType) {
|
||||
cy.contains('GRAPHQL APIs').closest('label').click();
|
||||
}
|
||||
|
||||
// External database credentials
|
||||
// cy.contains('Database Type').parent().find('input').eq(1).click()
|
||||
// cy.wait(100)
|
||||
// cy.get('body').contains(' MySQL ').parents('div').click()
|
||||
|
||||
if (cred.hostAddress != '') cy.contains('Host Address').parent().find('input').clear().type(cred.hostAddress)
|
||||
if (cred.portNumber != '') cy.contains('Port Number').parent().find('input').clear().type(cred.portNumber)
|
||||
if (cred.username != '') cy.contains('Username').parent().find('input').clear().type(cred.username)
|
||||
if (cred.password != '') cy.contains('Password').parent().find('input').clear().type(cred.password)
|
||||
if (cred.databaseName != '') cy.contains('Database : create if not exists').parent().find('input').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()
|
||||
|
||||
// takes a while to load project
|
||||
this.waitHomePageLoad()
|
||||
|
||||
return projectName
|
||||
}
|
||||
}
|
||||
|
||||
// create REST default project (sakila DB)
|
||||
//
|
||||
createDefaulRestProject() {
|
||||
return this.createProject({ dbType: 1, apiType: 0, name: '' }, defaultDbParams )
|
||||
}
|
||||
|
||||
// create GraphQL default project (sakila DB)
|
||||
//
|
||||
createDefaultGraphQlProject() {
|
||||
return this.createProject({ dbType: 1, apiType: 1, name: '' }, defaultDbParams )
|
||||
}
|
||||
|
||||
// Click on refresh key on projects page
|
||||
//
|
||||
refreshProject() {
|
||||
cy.contains('My Projects').parent().find('button').click();
|
||||
cy.wait(1000)
|
||||
}
|
||||
|
||||
// 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
|
||||
// TODO: error handling
|
||||
//
|
||||
deleteProject(name) {
|
||||
|
||||
// delete icon
|
||||
cy.get('tbody').contains('tr', name).find('.mdi-delete-circle-outline').click()
|
||||
this.waitDeletePageLoad()
|
||||
|
||||
// pop-up, submit
|
||||
cy.get('body').then((body) => {
|
||||
cy.wrap(body).find('button').contains('Submit').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() {
|
||||
|
||||
const projectName = []
|
||||
|
||||
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 => {
|
||||
|
||||
// bring back the DOM to normalcy
|
||||
cy.get('div').parentsUntil('body')
|
||||
this.deleteProject(element)
|
||||
|
||||
// wait needed for pop up to disapper
|
||||
this.waitDeletePageLoad()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
waitHomePageLoad() {
|
||||
cy.url({ timeout: 50000 }).should('contain', '?type=roles')
|
||||
}
|
||||
|
||||
waitDeletePageLoad() {
|
||||
cy.wait(1000)
|
||||
}
|
||||
}
|
||||
|
||||
export const loginPage = new _loginPage;
|
||||
export const projectsPage = new _projectsPage;
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||||
*
|
||||
* @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/>.
|
||||
*
|
||||
*/
|
||||
107
scripts/cypress/support/page_objects/projectConstants.js
Normal file
107
scripts/cypress/support/page_objects/projectConstants.js
Normal file
@@ -0,0 +1,107 @@
|
||||
|
||||
export const defaultDbParams = {
|
||||
databaseType: 0, // MySQL
|
||||
hostAddress: 'localhost',
|
||||
portNumber: '3306',
|
||||
username: 'root',
|
||||
password: 'password',
|
||||
databaseName: 'sakila'
|
||||
}
|
||||
|
||||
// database
|
||||
// validation details
|
||||
// advSettings: left navigation bar (audit, metadata, auth, transient view modes)
|
||||
// editSchema: create table, add/update/delete column
|
||||
// editData: add/ update/ delete row, cell contents
|
||||
// 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 }
|
||||
},
|
||||
creator: {
|
||||
name: 'creator',
|
||||
credentials: { username: 'creator@nocodb.com', password: 'Password123.' },
|
||||
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 }
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// return TRUE if test suite specified is activated from env-variables
|
||||
//
|
||||
export const isTestSuiteActive = (type, xcdb) => {
|
||||
const env = Cypress.env('testMode')
|
||||
if( !xcdb ) {
|
||||
switch( type ) {
|
||||
case 'rest': return env.includes('extREST')?true:false;
|
||||
case 'graphql': return env.includes('extGQL')?true:false;
|
||||
}
|
||||
} else {
|
||||
switch( type ) {
|
||||
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 = (proj, xcdb) => {
|
||||
if(!isTestSuiteActive(proj, xcdb))
|
||||
return false;
|
||||
|
||||
const env = Cypress.env('testMode').split('.')
|
||||
|
||||
switch(env[0]) {
|
||||
case 'extREST': return (proj=='rest' && !xcdb)?false:true;
|
||||
case 'extGQL': return (proj=='graphql' && !xcdb)?false:true;
|
||||
case 'xcdbREST': return (proj=='rest' && xcdb)?false:true;
|
||||
case 'xcdbGQL': return (proj=='graphql' && xcdb)?false:true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user