Browse Source

Merge branch 'develop' into feat/kanban-view

pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
f2d361e73c
  1. 33
      .github/workflows/ci-cd.yml
  2. BIN
      packages/nc-gui/assets/img/icons/512x512-trans.png
  3. BIN
      packages/nc-gui/assets/img/icons/512x512.png
  4. 4
      packages/nc-gui/components/general/NocoIcon.vue
  5. 4
      packages/nc-gui/components/general/PreviewAs.vue
  6. 8
      packages/nc-gui/components/smartsheet/Form.vue
  7. 9
      packages/nc-gui/components/smartsheet/Gallery.vue
  8. 35
      packages/nc-gui/components/smartsheet/Grid.vue
  9. 11
      packages/nc-gui/components/smartsheet/column/AdvancedOptions.vue
  10. 63
      packages/nc-gui/components/smartsheet/column/SelectOptions.vue
  11. 13
      packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue
  12. 8
      packages/nc-gui/components/smartsheet/sidebar/index.vue
  13. 5
      packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue
  14. 7
      packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
  15. 16
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  16. 20
      packages/nc-gui/composables/useSharedView.ts
  17. 7
      packages/nc-gui/composables/useViewData.ts
  18. 2
      packages/nc-gui/composables/useViews.ts
  19. 20
      packages/nc-gui/lang/ja.json
  20. 4
      packages/nc-gui/pages/[projectType]/[projectId]/index.vue
  21. 2
      packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue
  22. 24
      packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue
  23. 6
      packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue
  24. 2
      packages/nc-gui/pages/index/index/index.vue
  25. BIN
      packages/nc-gui/public/favicon.ico
  26. 10
      packages/noco-docs/content/en/engineering/development-setup.md
  27. 8
      packages/nocodb-sdk/src/lib/Api.ts
  28. 26
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  29. 24
      packages/nocodb/src/lib/meta/api/columnApis.ts
  30. 2
      packages/nocodb/src/lib/meta/api/sync/helpers/job.ts
  31. 36
      packages/nocodb/tests/unit/rest/tests/tableRow.test.ts
  32. 1
      scripts/cypress/integration/common/00_pre_configurations.js
  33. 10
      scripts/cypress/integration/common/1e_pg_meta_sync.js
  34. 38
      scripts/cypress/integration/common/3e_duration_column.js
  35. 21
      scripts/cypress/integration/common/4c_form_view_detailed.js
  36. 3
      scripts/cypress/integration/common/4f_grid_view_share.js
  37. 365
      scripts/cypress/integration/common/4f_pg_grid_view_share.js
  38. 2
      scripts/cypress/integration/common/5a_user_role.js
  39. 91
      scripts/cypress/integration/common/5b_preview_role.js
  40. 88
      scripts/cypress/integration/common/5c_super_user_role.js
  41. 2
      scripts/cypress/integration/common/6g_base_share.js
  42. 5
      scripts/cypress/integration/common/7a_create_project_from_excel.js
  43. 2
      scripts/cypress/integration/common/9a_QuickTest.js
  44. 2
      scripts/cypress/integration/test/pg-restRoles.js
  45. 3
      scripts/cypress/integration/test/pg-restTableOps.js
  46. 2
      scripts/cypress/integration/test/pg-restViews.js
  47. 5
      scripts/cypress/integration/test/restRoles.js
  48. 2
      scripts/cypress/integration/test/restTableOps.js
  49. 2
      scripts/cypress/integration/test/xcdb-restRoles.js
  50. 3
      scripts/cypress/integration/test/xcdb-restTableOps.js
  51. 38
      scripts/cypress/support/commands.js
  52. 3
      scripts/cypress/support/page_objects/mainPage.js
  53. 1
      scripts/cypress/support/page_objects/navigation.js
  54. 14
      scripts/sdk/swagger.json

33
.github/workflows/ci-cd.yml

@ -12,6 +12,7 @@ on:
- "packages/nocodb/**"
- ".github/workflows/ci-cd.yml"
pull_request:
types: [opened, reopened, synchronize, ready_for_review, labeled]
branches: [develop]
paths:
- "packages/nc-gui/**"
@ -21,7 +22,7 @@ on:
jobs:
cypress-restTableOps-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -66,7 +67,7 @@ jobs:
retention-days: 2
cypress-restViews-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -111,7 +112,7 @@ jobs:
retention-days: 2
cypress-restRoles-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -156,7 +157,7 @@ jobs:
retention-days: 2
cypress-restMisc-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -201,7 +202,7 @@ jobs:
retention-days: 2
cypress-xcdb-restTableOps-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -246,7 +247,7 @@ jobs:
retention-days: 2
cypress-xcdb-restViews-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -291,7 +292,7 @@ jobs:
retention-days: 2
cypress-xcdb-restRoles-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -336,7 +337,7 @@ jobs:
retention-days: 2
cypress-xcdb-restMisc-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -381,7 +382,7 @@ jobs:
retention-days: 2
cypress-pg-restTableOps-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -426,7 +427,7 @@ jobs:
retention-days: 2
cypress-pg-restViews-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -471,7 +472,7 @@ jobs:
retention-days: 2
cypress-pg-restRoles-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -516,7 +517,7 @@ jobs:
retention-days: 2
cypress-pg-restMisc-run-cache:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -561,7 +562,7 @@ jobs:
retention-days: 2
cy-quick-sqlite:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -607,7 +608,7 @@ jobs:
retention-days: 2
cy-quick-pg:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -652,7 +653,7 @@ jobs:
retention-days: 2
unit-tests:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
@ -692,7 +693,7 @@ jobs:
run: npm run test:unit
cypress-db-independent:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1

BIN
packages/nc-gui/assets/img/icons/512x512-trans.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 241 KiB

After

Width:  |  Height:  |  Size: 114 KiB

BIN
packages/nc-gui/assets/img/icons/512x512.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 131 KiB

4
packages/nc-gui/components/general/NocoIcon.vue

@ -8,7 +8,7 @@ const { width = 90, height = 90 } = defineProps<Props>()
</script>
<template>
<div :style="{ left: `calc(50% - ${width / 2}px)`, top: `-${height * 0.6}px` }" class="absolute rounded-lg !bg-primary">
<img :width="width" :height="height" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" />
<div :style="{ left: `calc(50% - ${width / 2}px)`, top: `-${height / 2}px` }" class="absolute rounded-lg">
<img :width="width" :height="height" alt="NocoDB" src="~/assets/img/icons/512x512.png" />
</div>
</template>

4
packages/nc-gui/components/general/PreviewAs.vue

@ -82,7 +82,7 @@ watch(previewAs, (newRole) => {
<div class="divider -ml-4" />
<!-- Close -->
<div class="flex items-center gap-2 cursor-pointer" @click="previewAs = null">
<div class="flex items-center gap-2 cursor-pointer nc-preview-btn-exit-to-app" @click="previewAs = null">
<MdiExitToApp />
{{ $t('general.close') }}
</div>
@ -91,7 +91,7 @@ watch(previewAs, (newRole) => {
<template v-else>
<template v-for="role of roleList" :key="role.value">
<a-menu-item @click="previewAs = role.value">
<a-menu-item class="nc-role-preview-menu" @click="previewAs = role.value">
<div class="nc-project-menu-item group">
<component :is="roleIcon[role.value]" class="group-hover:text-accent" />

8
packages/nc-gui/components/smartsheet/Form.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import Draggable from 'vuedraggable'
import { RelationTypes, UITypes, getSystemColumns, isVirtualCol } from 'nocodb-sdk'
import { RelationTypes, UITypes, ViewTypes, getSystemColumns, isVirtualCol } from 'nocodb-sdk'
import {
ActiveViewInj,
IsFormInj,
@ -375,6 +375,12 @@ onMounted(async () => {
await loadFormView()
setFormData()
})
watch(view, (nextView) => {
if (nextView?.type === ViewTypes.FORM) {
reloadEventHook.trigger()
}
})
</script>
<template>

9
packages/nc-gui/components/smartsheet/Gallery.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { isVirtualCol } from 'nocodb-sdk'
import { ViewTypes, isVirtualCol } from 'nocodb-sdk'
import {
ActiveViewInj,
ChangePageInj,
@ -160,6 +160,13 @@ onMounted(async () => {
// provide view data reload hook as fallback to row data reload
provide(ReloadRowDataHookInj, reloadViewDataHook)
watch(view, async (nextView) => {
if (nextView?.type === ViewTypes.GALLERY) {
await loadData()
await loadGalleryData()
}
})
</script>
<template>

35
packages/nc-gui/components/smartsheet/Grid.vue

@ -163,16 +163,6 @@ openNewRecordFormHook?.on(async () => {
expandForm(newRow, undefined, true)
})
watch(
() => view.value?.id,
async (next, old) => {
if (next && old && next !== old) {
await loadData()
}
},
{ immediate: true },
)
const onresize = (colID: string, event: any) => {
updateWidth(colID, event.detail)
}
@ -241,7 +231,6 @@ useEventListener(document, 'keyup', async (e: KeyboardEvent) => {
/** On clicking outside of table reset active cell */
const smartTable = ref(null)
onClickOutside(smartTable, () => {
clearRangeRows()
if (selected.col === null) return
@ -249,6 +238,7 @@ onClickOutside(smartTable, () => {
const activeCol = fields.value[selected.col]
if (editEnabled && (isVirtualCol(activeCol) || activeCol.uidt === UITypes.JSON)) return
selected.row = null
selected.col = null
})
@ -328,7 +318,17 @@ const expandedFormOnRowIdDlg = computed({
provide(ReloadRowDataHookInj, reloadViewDataHook)
// trigger initial data load in grid
reloadViewDataHook.trigger()
// reloadViewDataHook.trigger()
watch(
() => view.value?.id,
async (next, old) => {
if (next && next !== old) {
await loadData()
}
},
{ immediate: true },
)
</script>
<template>
@ -491,12 +491,7 @@ reloadViewDataHook.trigger()
v-else
v-model="row.row[columnObj.title]"
:column="columnObj"
:edit-enabled="
isUIAllowed('xcDatatableEditable') &&
editEnabled &&
selected.col === colIndex &&
selected.row === rowIndex
"
:edit-enabled="hasEditPermission && editEnabled && selected.col === colIndex && selected.row === rowIndex"
:row-index="rowIndex"
:active="selected.col === colIndex && selected.row === rowIndex"
@update:edit-enabled="editEnabled = false"
@ -510,7 +505,7 @@ reloadViewDataHook.trigger()
</template>
</LazySmartsheetRow>
<tr v-if="!isView && !isLocked && isUIAllowed('xcDatatableEditable') && !isSqlView">
<tr v-if="!isView && !isLocked && hasEditPermission && !isSqlView">
<td
v-e="['c:row:add:grid-bottom']"
:colspan="visibleColLength + 1"
@ -529,7 +524,7 @@ reloadViewDataHook.trigger()
</tbody>
</table>
<template v-if="!isLocked && isUIAllowed('xcDatatableEditable')" #overlay>
<template v-if="!isLocked && hasEditPermission" #overlay>
<a-menu class="shadow !rounded !py-0" @click="contextMenu = false">
<a-menu-item v-if="contextMenuTarget" @click="deleteRow(contextMenuTarget.row)">
<div v-e="['a:row:delete']" class="nc-project-menu-item">

11
packages/nc-gui/components/smartsheet/column/AdvancedOptions.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { UITypes } from 'nocodb-sdk'
import { computed, onBeforeMount, useColumnCreateStoreOrThrow, useProject, useVModel } from '#imports'
import { computed, useColumnCreateStoreOrThrow, useProject, useVModel } from '#imports'
const props = defineProps<{
value: any
@ -10,7 +10,7 @@ const emit = defineEmits(['update:value'])
const vModel = useVModel(props, 'value', emit)
const { sqlUi, isPg } = useProject()
const { sqlUi } = useProject()
const { onAlter, onDataTypeChange, validateInfos } = useColumnCreateStoreOrThrow()
@ -38,13 +38,6 @@ vModel.value.pk = !!vModel.value.pk
vModel.value.un = !!vModel.value.un
vModel.value.ai = !!vModel.value.ai
vModel.value.au = !!vModel.value.au
onBeforeMount(() => {
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases
if (isPg.value && vModel.value.cdf) {
vModel.value.cdf = vModel.value.cdf.substring(vModel.value.cdf.indexOf(`'`) + 1, vModel.value.cdf.lastIndexOf(`'`))
}
})
</script>
<template>

63
packages/nc-gui/components/smartsheet/column/SelectOptions.vue

@ -11,6 +11,8 @@ const emit = defineEmits(['update:value'])
const vModel = useVModel(props, 'value', emit)
const { isPg, isMysql } = useProject()
const { setAdditionalValidations, validateInfos } = useColumnCreateStoreOrThrow()
let options = $ref<any[]>([])
@ -20,6 +22,7 @@ const colorMenus = $ref<any>({})
const colors = $ref(enumColor.light)
const inputs = ref()
const defaultOption = ref()
const isKanban = inject(IsKanbanInj, ref(false))
@ -50,6 +53,49 @@ setAdditionalValidations({
...validators,
})
onMounted(() => {
if (!vModel.value.colOptions?.options) {
vModel.value.colOptions = {
options: [],
}
}
options = vModel.value.colOptions.options
// Support for older options
for (const op of options.filter((el) => el.order === null)) {
op.title = op.title.replace(/^'/, '').replace(/'$/, '')
}
if (vModel.value.cdf) {
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases
if (isPg.value) {
vModel.value.cdf = vModel.value.cdf.substring(vModel.value.cdf.indexOf(`'`) + 1, vModel.value.cdf.lastIndexOf(`'`))
}
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped
if (!isMysql.value) {
vModel.value.cdf = vModel.value.cdf.replace(/''/g, "'")
}
}
const fndDefaultOption = options.find((el) => el.title === vModel.value.cdf)
if (fndDefaultOption) {
defaultOption.value = fndDefaultOption
}
})
const optionChanged = (changedId: string) => {
if (changedId === defaultOption.value?.id) {
vModel.value.cdf = defaultOption.value.title
}
}
const optionDropped = (changedId: string) => {
if (changedId === defaultOption.value?.id) {
vModel.value.cdf = null
defaultOption.value = null
}
}
const getNextColor = () => {
let tempColor = colors[0]
if (options.length && options[options.length - 1].color) {
@ -68,22 +114,11 @@ const addNewOption = () => {
}
const removeOption = (index: number) => {
const optionId = options[index]?.id
options.splice(index, 1)
optionDropped(optionId)
}
onMounted(() => {
if (!vModel.value.colOptions?.options) {
vModel.value.colOptions = {
options: [],
}
}
options = vModel.value.colOptions.options
// Support for older options
for (const op of options.filter((el) => el.order === null)) {
op.title = op.title.replace(/^'/, '').replace(/'$/, '')
}
})
// focus last created input
watch(inputs, () => {
if (inputs.value?.$el) {
@ -113,7 +148,7 @@ watch(inputs, () => {
<MdiArrowDownDropCircle :style="{ 'font-size': '1.5em', 'color': element.color }" class="mr-2" />
</a-dropdown>
<a-input ref="inputs" v-model:value="element.title" class="caption" />
<a-input ref="inputs" v-model:value="element.title" class="caption" @change="optionChanged(element.id)" />
<MdiClose class="ml-2" :style="{ color: 'red' }" @click="removeOption(index)" />
</div>

13
packages/nc-gui/components/smartsheet/sidebar/MenuTop.vue

@ -43,8 +43,6 @@ const { api } = useApi()
const router = useRouter()
const route = useRoute()
/** Selected view(s) for menu */
const selected = ref<string[]>([])
@ -214,12 +212,18 @@ function openDeleteDialog(view: Record<string, any>) {
close(1000)
}
}
watch(views, (nextViews) => {
if (nextViews?.length && (!activeView.value || !nextViews.includes(activeView.value))) {
activeView.value = nextViews[0]
}
})
</script>
<template>
<a-menu ref="menuRef" :class="{ dragging }" class="nc-views-menu flex-1" :selected-keys="selected">
<LazySmartsheetSidebarRenameableMenuItem
v-for="(view, index) of views"
v-for="view of views"
:id="view.id"
:key="view.id"
:view="view"
@ -227,8 +231,7 @@ function openDeleteDialog(view: Record<string, any>) {
class="transition-all ease-in duration-300"
:class="{
'bg-gray-100': isMarked === view.id,
'active':
(route.params.viewTitle && route.params.viewTitle === view.title) || (route.params.viewTitle === '' && index === 0),
'active': activeView.id === view.id,
[`nc-view-item nc-${viewTypeAlias[view.type] || view.type}-view-item`]: true,
}"
@change-view="changeView"

8
packages/nc-gui/components/smartsheet/sidebar/index.vue

@ -75,6 +75,10 @@ watch(
})
}
}
} else {
if (nextViews?.length && activeView.value !== nextViews[0]) {
activeView.value = nextViews[0]
}
}
/** if active view is not found, set it to first view */
if (!activeView.value && nextViews.length) {
@ -104,8 +108,8 @@ function openModal({
}
/** Handle view creation */
function onCreate(view: ViewType) {
views.value.push(view)
async function onCreate(view: ViewType) {
await loadViews()
router.push({ params: { viewTitle: view.title || '' } })
modalOpen = false
$e('a:view:create', { view: view.type })

5
packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue

@ -45,7 +45,10 @@ const exportFile = async (exportType: ExportTypes) => {
let res
if (isPublicView.value) {
const { exportFile: sharedViewExportFile } = useSharedView()
res = await sharedViewExportFile(fields.value, offset, exportType, responseType)
res = await sharedViewExportFile(fields.value, offset, exportType, responseType, {
sortsArr: sorts.value,
filtersArr: nestedFilters.value,
})
} else {
res = await $api.dbViewRow.export(
'noco',

7
packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue

@ -86,14 +86,16 @@ const onMove = (_event: { moved: { newIndex: number } }) => {
const coverImageColumnId = computed({
get: () =>
activeView.value?.type === ViewTypes.GALLERY ? (activeView.value?.view as GalleryType).fk_cover_image_col_id : undefined,
activeView.value?.type === ViewTypes.GALLERY && activeView.value?.view
? (activeView.value?.view as GalleryType).fk_cover_image_col_id
: undefined,
set: async (val) => {
if (val && activeView.value?.type === ViewTypes.GALLERY && activeView.value?.id && activeView.value?.view) {
await $api.dbView.galleryUpdate(activeView.value?.id, {
...activeView.value?.view,
fk_cover_image_col_id: val,
})
;(activeView.value?.view as GalleryType).fk_cover_image_col_id = val
;(activeView.value.view as GalleryType).fk_cover_image_col_id = val
reloadViewMetaHook.trigger()
}
},
@ -203,6 +205,7 @@ const getIcon = (c: ColumnType) =>
:deep(.ant-checkbox-inner) {
@apply transform scale-60;
}
:deep(.ant-checkbox) {
@apply top-auto;
}

16
packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

@ -102,9 +102,17 @@ watch(
<div class="max-h-[max(calc(100vh_-_300px)_,500px)] flex flex-col py-6">
<div class="flex mb-4 items-center gap-2 px-12">
<div class="flex-1" />
<MdiReload v-if="!isForm" class="cursor-pointer text-gray-500" @click="loadChildrenList" />
<a-button v-if="!readonly" type="primary" ghost class="!text-xs" size="small" @click="emit('attachRecord')">
<MdiReload v-if="!isForm" class="cursor-pointer text-gray-500" data-cy="nc-child-list-reload" @click="loadChildrenList" />
<a-button
v-if="!readonly"
type="primary"
ghost
class="!text-xs"
data-cy="nc-child-list-button-link-to"
size="small"
@click="emit('attachRecord')"
>
<div class="flex items-center gap-1">
<MdiLinkVariantRemove class="text-xs" type="primary" @click="unlinkRow(row)" />
Link to '{{ relatedTableMeta.title }}'
@ -135,11 +143,13 @@ watch(
<div v-if="!readonly" class="flex gap-2">
<MdiLinkVariantRemove
class="text-xs text-grey hover:(!text-red-500) cursor-pointer"
data-cy="nc-child-list-icon-unlink"
@click.stop="unlinkRow(row)"
/>
<MdiDeleteOutline
v-if="!readonly && !isPublic"
class="text-xs text-grey hover:(!text-red-500) cursor-pointer"
data-cy="nc-child-list-icon-delete"
@click.stop="deleteRelatedRow(row, unlinkIfNewRow)"
/>
</div>

20
packages/nc-gui/composables/useSharedView.ts

@ -13,10 +13,7 @@ import { UITypes } from 'nocodb-sdk'
import { computed, useGlobal, useMetas, useNuxtApp, useState } from '#imports'
export function useSharedView() {
const nestedFilters = useState<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>(
'nestedFilters',
() => [],
)
const nestedFilters = ref<(FilterType & { status?: 'update' | 'delete' | 'create'; parentId?: string })[]>([])
const { appInfo } = $(useGlobal())
@ -26,7 +23,7 @@ export function useSharedView() {
const sharedView = useState<ViewType | undefined>('sharedView', () => undefined)
const sorts = useState<SortType[]>('sorts', () => [])
const sorts = ref<SortType[]>([])
const password = useState<string | undefined>('password', () => undefined)
@ -74,7 +71,7 @@ export function useSharedView() {
Object.keys(relatedMetas).forEach((key) => setMeta(relatedMetas[key]))
}
const fetchSharedViewData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => {
const fetchSharedViewData = async ({ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] }) => {
if (!sharedView.value) return
const page = paginationData.value.page || 1
@ -84,9 +81,8 @@ export function useSharedView() {
sharedView.value.uuid!,
{
offset: (page - 1) * pageSize,
filterArrJson: JSON.stringify(nestedFilters.value),
sortArrJson: JSON.stringify(sorts.value),
...params,
filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(sortsArr ?? sorts.value),
} as any,
{
headers: {
@ -126,15 +122,15 @@ export function useSharedView() {
offset: number,
type: ExportTypes.EXCEL | ExportTypes.CSV,
responseType: 'base64' | 'blob',
{ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] },
) => {
return await $api.public.csvExport(sharedView.value!.uuid!, type, {
format: responseType,
query: {
fields: fields.map((field) => field.title),
offset,
sortArrJson: JSON.stringify(sorts.value),
filterArrJson: JSON.stringify(nestedFilters.value),
filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(sortsArr ?? sorts.value),
},
headers: {
'xc-password': password.value,

7
packages/nc-gui/composables/useViewData.ts

@ -180,7 +180,7 @@ export function useViewData(
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where: where?.value,
})
: await fetchSharedViewData()
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value })
formattedData.value = formatData(response.list)
paginationData.value = response.pageInfo
if (viewMeta.value?.type === ViewTypes.GRID) {
@ -271,7 +271,10 @@ export function useViewData(
async function changePage(page: number) {
paginationData.value.page = page
await loadData({ offset: (page - 1) * (paginationData.value.pageSize || appInfoDefaultLimit), where: where?.value } as any)
await loadData({
offset: (page - 1) * (paginationData.value.pageSize || appInfoDefaultLimit),
where: where?.value,
} as any)
$e('a:grid:pagination')
}

2
packages/nc-gui/composables/useViews.ts

@ -18,7 +18,7 @@ export function useViews(meta: MaybeRef<TableType | undefined>) {
}
}
watch(() => meta, loadViews, { immediate: true })
watch(meta, loadViews, { immediate: true })
return { views: $$(views), loadViews }
}

20
packages/nc-gui/lang/ja.json

@ -158,7 +158,7 @@
"isNotNull": "がnullでない"
},
"title": {
"erdView": "ERD View",
"erdView": "ERDビュー",
"newProj": "新規プロジェクト",
"myProject": "マイプロジェクト",
"formTitle": "フォームタイトル",
@ -185,7 +185,7 @@
"headCreateProject": "プロジェクトを作成 | NocoDB",
"headLogin": "ログイン | NocoDB",
"resetPassword": "パスワードをリセットする",
"teamAndSettings": "Team & Settings",
"teamAndSettings": "チームと設定",
"apiDocs": "API Docs",
"importFromAirtable": "Import From Airtable",
"generateToken": "Generate Token",
@ -263,8 +263,8 @@
"childColumn": "子カラム",
"onUpdate": "更新中",
"onDelete": "削除中",
"account": "Account",
"language": "Language",
"account": "アカウント",
"language": "言語",
"primaryColor": "Primary Color",
"accentColor": "Accent Color",
"customTheme": "Custom Theme",
@ -281,7 +281,7 @@
"goToDashboard": "Go to Dashboard",
"importing": "Importing",
"flattenNested": "Flatten Nested",
"downloadAllowed": "Download allowed",
"downloadAllowed": "ダウンロードを許可",
"weAreHiring": "We are Hiring!",
"primaryKey": "Primary key",
"hasMany": "has many",
@ -402,9 +402,9 @@
"sponsorUs": "スポンサーになる",
"sendEmail": "メールを送信",
"addUserToProject": "Add user to project",
"getApiSnippet": "Get API Snippet",
"getApiSnippet": "APIスニペットを取得",
"clearCell": "Clear cell",
"addFilterGroup": "Add Filter Group",
"addFilterGroup": "フィルターグループを追加",
"linkRecord": "Link record",
"addNewRecord": "Add new record",
"useConnectionUrl": "Use Connection URL",
@ -462,7 +462,7 @@
"noItemsFound": "項目は見つかりませんでした",
"defaultValue": "デフォルト値",
"filterByEmail": "メールアドレスでフィルタ",
"filterQuery": "Filter query",
"filterQuery": "クエリを入力",
"selectField": "Select field"
},
"msg": {
@ -622,8 +622,8 @@
"failedToLoadChildrenList": "Failed to load children list",
"deleteFailed": "Delete failed",
"unlinkFailed": "Unlink failed",
"rowUpdateFailed": "Row update failed",
"deleteRowFailed": "Failed to delete row",
"rowUpdateFailed": "行の更新に失敗",
"deleteRowFailed": "行の削除に失敗",
"setFormDataFailed": "Failed to set form data",
"formViewUpdateFailed": "Failed to update form view",
"tableNameRequired": "Table name is required",

4
packages/nc-gui/pages/[projectType]/[projectId]/index.vue

@ -491,10 +491,10 @@ onBeforeUnmount(reset)
</a-layout-sider>
</template>
<div :key="$route.fullPath.split('?')[0]">
<div>
<LazyDashboardSettingsModal v-model="dialogOpen" :open-key="openDialogKey" />
<NuxtPage />
<NuxtPage :page-key="$route.params.projectId" />
<LazyGeneralPreviewAs float />
</div>

2
packages/nc-gui/pages/[projectType]/[projectId]/index/index.vue

@ -79,7 +79,7 @@ function onEdit(targetKey: number, action: 'add' | 'remove' | string) {
</div>
<div class="w-full min-h-[300px] flex-auto">
<NuxtPage />
<NuxtPage :page-key="$route.name" />
</div>
</div>
</div>

24
packages/nc-gui/pages/[projectType]/[projectId]/index/index/[type]/[title]/[[viewTitle]].vue

@ -15,20 +15,22 @@ const activeTab = inject(
computed(() => ({} as TabItem)),
)
/** wait until table list loads since meta load requires table list **/
until(tables)
.toMatch((tables) => tables.length > 0)
.then(() => {
getMeta(route.params.title as string, true).finally(() => (loading.value = false))
})
watch(
() => route.params.title,
(tableTitle) => {
/** wait until table list loads since meta load requires table list **/
until(tables)
.toMatch((tables) => tables.length > 0)
.then(() => {
getMeta(tableTitle as string, true).finally(() => (loading.value = false))
})
},
{ immediate: true },
)
</script>
<template>
<div class="w-full h-full">
<div v-if="loading" class="flex items-center justify-center h-full w-full">
<a-spin size="large" />
</div>
<LazyTabsSmartsheet v-else :key="route.params.title" :active-tab="activeTab" />
<LazyTabsSmartsheet :active-tab="activeTab" />
</div>
</template>

6
packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue

@ -14,7 +14,6 @@ const {
passwordDlg,
password,
loadSharedView,
isLoading,
} = useSharedFormStoreOrThrow()
function isRequired(_columnObj: Record<string, any>, required = false) {
@ -37,10 +36,7 @@ function isRequired(_columnObj: Record<string, any>, required = false) {
class="bg-white relative flex flex-col justify-center gap-2 w-full lg:max-w-1/2 max-w-500px m-auto p-8 md:(rounded-lg border-1 border-gray-200 shadow-xl)"
>
<template v-if="sharedFormView">
<LazyGeneralNocoIcon
class="color-transition hover:(ring ring-accent)"
:class="[isLoading ? 'animated-bg-gradient' : '']"
/>
<img width="90" height="90" alt="NocoDB" class="mx-auto" src="~/assets/img/icons/512x512.png" />
<h1 class="prose-2xl font-bold self-center my-4">{{ sharedFormView?.heading }}</h1>

2
packages/nc-gui/pages/index/index/index.vue

@ -127,8 +127,6 @@ onBeforeMount(loadProjects)
<template>
<div class="bg-white relative flex flex-col justify-center gap-2 w-full p-8 md:(rounded-lg border-1 border-gray-200 shadow-xl)">
<LazyGeneralNocoIcon class="color-transition hover:(ring ring-accent)" :class="[isLoading ? 'animated-bg-gradient' : '']" />
<h1 class="flex items-center justify-center gap-2 leading-8 mb-8 mt-4">
<!-- My Projects -->
<span class="text-4xl nc-project-page-title">{{ $t('title.myProject') }}</span>

BIN
packages/nc-gui/public/favicon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 15 KiB

10
packages/noco-docs/content/en/engineering/development-setup.md

@ -166,3 +166,13 @@ npm run cypress:open
# run test script
- quickTest.js
```
## Enabling CI-CD for draft PR
CI-CD will be triggered on moving a PR from draft state to `Ready for review` state & on pushing changes to `Develop`. To verify CI-CD before requesting for review, add label `trigger-CI` on Draft PR.
## Accessing CI-CD failure screenshots
For Cypress tests, screenshots are captured on test failure. These will provide vital clues for debugging possible issues observed in CI-CD. To access screenshots, Open link associated with CI-CD run & click on `Artifacts`
![Screenshot 2022-09-29 at 12 43 37 PM](https://user-images.githubusercontent.com/86527202/192965070-dc04b952-70fb-4197-b4bd-ca7eda066e60.png)

8
packages/nocodb-sdk/src/lib/Api.ts

@ -2311,7 +2311,13 @@ export class Api<
orgs: string,
projectName: string,
tableName: string,
query?: { fields?: any[]; sort?: any[]; where?: string },
query?: {
fields?: any[];
sort?: any[];
where?: string;
offset?: string;
limit?: string;
},
params: RequestParams = {}
) =>
this.request<any, any>({

26
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -880,6 +880,14 @@ class BaseModelSqlv2 {
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await conditionV2(filterObj, qb, this.dbDriver);
// sort by primary key if not autogenerated string
// if autogenerated string sort by created_at column if present
if (childTable.primaryKey && childTable.primaryKey.ai) {
qb.orderBy(childTable.primaryKey.column_name);
} else if (childTable.columns.find((c) => c.column_name === 'created_at')) {
qb.orderBy('created_at');
}
applyPaginate(qb, rest);
const proto = await childModel.getProto();
@ -980,6 +988,14 @@ class BaseModelSqlv2 {
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await conditionV2(filterObj, qb, this.dbDriver);
// sort by primary key if not autogenerated string
// if autogenerated string sort by created_at column if present
if (childTable.primaryKey && childTable.primaryKey.ai) {
qb.orderBy(childTable.primaryKey.column_name);
} else if (childTable.columns.find((c) => c.column_name === 'created_at')) {
qb.orderBy('created_at');
}
applyPaginate(qb, rest);
const proto = await childModel.getProto();
@ -1081,6 +1097,16 @@ class BaseModelSqlv2 {
const filterObj = extractFilterFromXwhere(where, aliasColObjMap);
await conditionV2(filterObj, qb, this.dbDriver);
// sort by primary key if not autogenerated string
// if autogenerated string sort by created_at column if present
if (parentTable.primaryKey && parentTable.primaryKey.ai) {
qb.orderBy(parentTable.primaryKey.column_name);
} else if (
parentTable.columns.find((c) => c.column_name === 'created_at')
) {
qb.orderBy('created_at');
}
applyPaginate(qb, rest);
const proto = await parentModel.getProto();

24
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -524,20 +524,28 @@ export async function columnAdd(req: Request, res: Response<TableType>) {
// Handle default values
if (colBody.cdf) {
if (colBody.uidt === UITypes.SingleSelect) {
if (!optionTitles.includes(colBody.cdf)) {
if (!optionTitles.includes(colBody.cdf.replace(/'/g, "''"))) {
NcError.badRequest(
`Default value '${colBody.cdf}' is not a select option.`
);
}
} else {
for (const cdf of colBody.cdf.split(',')) {
if (!optionTitles.includes(cdf)) {
if (!optionTitles.includes(cdf.replace(/'/g, "''"))) {
NcError.badRequest(
`Default value '${cdf}' is not a select option.`
);
}
}
}
// handle single quote for default value
if (driverType === 'mysql' || driverType === 'mysql2') {
colBody.cdf = colBody.cdf.replace(/'/g, "\'");
} else {
colBody.cdf = colBody.cdf.replace(/'/g, "''");
}
if (driverType === 'pg') {
colBody.cdf = `'${colBody.cdf}'`;
}
@ -812,20 +820,28 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
);
if (colBody.cdf) {
if (colBody.uidt === UITypes.SingleSelect) {
if (!optionTitles.includes(colBody.cdf)) {
if (!optionTitles.includes(colBody.cdf.replace(/'/g, "''"))) {
NcError.badRequest(
`Default value '${colBody.cdf}' is not a select option.`
);
}
} else {
for (const cdf of colBody.cdf.split(',')) {
if (!optionTitles.includes(cdf)) {
if (!optionTitles.includes(cdf.replace(/'/g, "''"))) {
NcError.badRequest(
`Default value '${cdf}' is not a select option.`
);
}
}
}
// handle single quote for default value
if (driverType === 'mysql' || driverType === 'mysql2') {
colBody.cdf = colBody.cdf.replace(/'/g, "\'");
} else {
colBody.cdf = colBody.cdf.replace(/'/g, "''");
}
if (driverType === 'pg') {
colBody.cdf = `'${colBody.cdf}'`;
}

2
packages/nocodb/src/lib/meta/api/sync/helpers/job.ts

@ -579,7 +579,7 @@ export default async (
};
// if options are empty, configure '' as default option
ncCol.dtxp =
colOptions.data.map((el) => `'${el.title}'`).join(',') || "''";
colOptions.data.map((el) => `'${el.title.replace(/'/gi, "''")}'`).join(',') || "''";
break;
case undefined:
break;

36
packages/nocodb/tests/unit/rest/tests/tableRow.test.ts

@ -2216,6 +2216,42 @@ function tableTest() {
}
});
it('Exclude list bt', async () => {
const rowId = 1;
const addressTable = await getTable({project: sakilaProject, name: 'address'});
const cityColumn = (await addressTable.getColumns()).find(
(column) => column.title === 'City'
)!;
const response = await request(context.app)
.get(`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude`)
.set('xc-auth', context.token)
.expect(200);
expect(response.body.pageInfo.totalRows).equal(599)
expect(response.body.list[0]['City']).equal('A Corua (La Corua)')
})
it('Exclude list bt with offset', async () => {
const rowId = 1;
const addressTable = await getTable({project: sakilaProject, name: 'address'});
const cityColumn = (await addressTable.getColumns()).find(
(column) => column.title === 'City'
)!;
const response = await request(context.app)
.get(`/api/v1/db/data/noco/${sakilaProject.id}/${addressTable.id}/${rowId}/bt/${cityColumn.id}/exclude`)
.set('xc-auth', context.token)
.query({
limit: 40,
offset: 60
})
.expect(200);
expect(response.body.pageInfo.totalRows).equal(599)
expect(response.body.list[0]['City']).equal('Baybay')
})
it('Create nested hm relation with invalid table id', async () => {
const rowId = 1;
const rentalListColumn = (await customerTable.getColumns()).find(

1
scripts/cypress/integration/common/00_pre_configurations.js

@ -248,6 +248,7 @@ export const genTest = (apiType, dbType) => {
.should("be.visible")
.click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");
cy.wait(2000);
// first instance of updating local storage information
cy.saveLocalStorage();

10
scripts/cypress/integration/common/1e_pg_meta_sync.js

@ -18,14 +18,16 @@ export const genTest = (apiType, dbType) => {
// Run once before test- create project (rest/graphql)
//
before(() => {
mainPage.tabReset();
cy.restoreLocalStorage();
mainPage.openMetaTab();
});
beforeEach(() => {});
beforeEach(() => {
cy.restoreLocalStorage();
});
after(() => {
// mainPage.closeMetaTab();
afterEach(() => {
cy.saveLocalStorage();
});
it(`Create table`, () => {

38
scripts/cypress/integration/common/3e_duration_column.js

@ -13,21 +13,26 @@ export const genTest = (apiType, dbType) => {
cy.get("label").contains(label).parents(".ant-row").first().click();
};
// Run once before test- create table
//
before(() => {
mainPage.tabReset();
// // close team & auth tab
// cy.get('button.ant-tabs-tab-remove').should('exist').click();
cy.restoreLocalStorage();
cy.createTable(tableName);
cy.saveLocalStorage();
});
// Run once before test- create table
//
beforeEach(() => {
cy.restoreLocalStorage();
});
beforeEach(() => {});
afterEach(() => {
cy.saveLocalStorage();
});
after(() => {
cy.restoreLocalStorage();
cy.deleteTable(tableName);
cy.saveLocalStorage();
});
// Routine to create a new look up column
@ -42,7 +47,6 @@ export const genTest = (apiType, dbType) => {
.should("exist")
.clear()
.type(columnName);
// cy.get(".nc-column-type-input").last().click().type("Duration");
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".nc-column-type-input")
.last()
@ -53,6 +57,10 @@ export const genTest = (apiType, dbType) => {
.contains("Duration")
.click();
// fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(500);
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection(".nc-dropdown-duration-option")
@ -60,7 +68,6 @@ export const genTest = (apiType, dbType) => {
.contains(durationFormat)
.click();
// cy.get(".ant-btn-primary").contains("Save").should('exist').click();
cy.getActiveMenu(".nc-dropdown-grid-add-column")
.find(".ant-btn-primary:visible")
.contains("Save")
@ -83,8 +90,6 @@ export const genTest = (apiType, dbType) => {
.trigger("mouseover", { force: true })
.click({ force: true });
// cy.get(".nc-column-edit").click();
// cy.get(".nc-column-edit").should("not.be.visible");
cy.getActiveMenu(".nc-dropdown-column-operations")
.find(".nc-column-edit")
.click();
@ -95,6 +100,11 @@ export const genTest = (apiType, dbType) => {
.should("exist")
.clear()
.type(newName);
// fix me! wait till the modal rendering (input highlight) is completed
// focus shifts back to the input field to select text after the dropdown is rendered
cy.wait(500);
// Configure Duration format
fetchParentFromLabel("Duration Format");
cy.getActiveSelection(".nc-dropdown-duration-option")
@ -102,7 +112,6 @@ export const genTest = (apiType, dbType) => {
.contains(newDurationFormat)
.click();
// cy.get(".ant-btn-primary:visible").contains("Save").click();
cy.getActiveMenu(".nc-dropdown-edit-column")
.find(".ant-btn-primary:visible")
.contains("Save")
@ -145,9 +154,6 @@ export const genTest = (apiType, dbType) => {
.contains("Cancel")
.should("exist")
.click();
// mainPage.getCell(colName, index).find('input').then(($e) => {
// expect($e[0].value).to.equal(expectedValue)
// })
mainPage.getCell(colName, index).contains(expectedValue).should("exist");
};

21
scripts/cypress/integration/common/4c_form_view_detailed.js

@ -214,9 +214,9 @@ export const genTest = (apiType, dbType) => {
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".ant-alert-message")
.contains("Successfully submitted form data")
.should("exist");
cy.get(
".ant-alert-message :contains('Successfully submitted form data')"
).should("exist");
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
@ -238,9 +238,9 @@ export const genTest = (apiType, dbType) => {
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".ant-alert-message")
.contains("Congratulations!")
.should("exist");
cy.get(".ant-alert-message :contains('Congratulations!')").should(
"exist"
);
// end of test removes newly added rows from table. that step validates if row was successfully added.
});
@ -262,9 +262,9 @@ export const genTest = (apiType, dbType) => {
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".ant-alert-message")
.contains("Congratulations")
.should("exist");
cy.get(".ant-alert-message :contains('Congratulations!')").should(
"exist"
);
cy.get("button")
.contains("Submit Another Form")
.should("exist")
@ -288,8 +288,7 @@ export const genTest = (apiType, dbType) => {
// submit button & validate
cy.get(".nc-form").find("button").contains("Submit").click();
cy.get(".ant-alert-message")
.contains("Congratulations")
cy.get(".ant-alert-message :contains('Congratulations!')")
.should("exist")
.then(() => {
// validate if form has appeared again

3
scripts/cypress/integration/common/4f_grid_view_share.js

@ -31,7 +31,8 @@ export const genTest = (apiType, dbType) => {
.find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 })
.then(($obj) => {
cy.get("body").type("{esc}");
// cy.get("body").type("{esc}");
cy.closeActiveModal(".nc-modal-share-view");
// viewURL.push($obj.text())
viewURL[viewName] = $obj.text().trim();
});

365
scripts/cypress/integration/common/4f_pg_grid_view_share.js

@ -1,5 +1,6 @@
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { mainPage } from "../../support/page_objects/mainPage";
import { loginPage } from "../../support/page_objects/navigation";
let storedURL = "";
@ -14,13 +15,74 @@ let viewURL = {};
export const genTest = (apiType, dbType) => {
if (!isTestSuiteActive(apiType, dbType)) return;
function verifyLtarCell(columnName, index, cellValue, options) {
if (cellValue !== "")
cy.get(`:nth-child(${index}) > [data-title="${columnName}"]`)
.find(".chip")
.eq(0)
.contains(cellValue)
.should("exist");
mainPage
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-unlink-icon")
.should(`${options.unlink ? "exist" : "not.exist"}`);
mainPage
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-plus")
.should(`${options.plus ? "exist" : "not.exist"}`);
mainPage
.getCell(columnName, index)
.click()
.find(".nc-icon.nc-arrow-expand")
.should(`${options.expand ? "exist" : "not.exist"}`);
}
function actionLtarCell(columnName, index, button) {
mainPage
.getCell(columnName, index)
.click()
.find(`.nc-icon${button}`)
.click({ force: true });
}
function verifyChildListCard(cardValue, options) {
// reload button
cy.getActiveModal(".nc-modal-child-list")
.find(`[data-cy="nc-child-list-reload"]`)
.should(`${options.reload ? "exist" : "not.exist"}`);
// link-to button
cy.getActiveModal(".nc-modal-child-list")
.find(`[data-cy="nc-child-list-button-link-to"]`)
.should(`${options.linkTo ? "exist" : "not.exist"}`);
// child card
// - contents : should exist
// - link-to button : should not exist
// - delete button : should not exist
if (cardValue !== "") {
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.contains(cardValue)
.should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.find(`[data-cy="nc-child-list-icon-unlink"]`)
.should(`${options.unlink ? "exist" : "not.exist"}`);
cy.getActiveModal(".nc-modal-child-list")
.find(".ant-card")
.find(`[data-cy="nc-child-list-icon-delete"]`)
.should(`${options.delete ? "exist" : "not.exist"}`);
}
}
const generateViewLink = (viewName) => {
// click on share view
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .click();
mainPage.shareView().click({ force: true });
mainPage.shareView().click();
cy.wait(1000);
// wait, as URL initially will be /undefined
cy.getActiveModal(".nc-modal-share-view")
@ -33,23 +95,23 @@ export const genTest = (apiType, dbType) => {
.find(".share-link-box")
.contains("/nc/view/", { timeout: 10000 })
.then(($obj) => {
cy.get("body").type("{esc}");
// viewURL.push($obj.text())
// cy.get("body").type("{esc}");
cy.closeActiveModal(".nc-modal-share-view");
viewURL[viewName] = $obj.text().trim();
});
};
let clear;
describe(`${apiType.toUpperCase()} api - GRID view (Share)`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
cy.fileHook();
mainPage.tabReset();
// open a table to work on views
//
cy.restoreLocalStorage();
cy.openTableTab("Address", 25);
cy.saveLocalStorage();
clear = Cypress.LocalStorage.clear;
Cypress.LocalStorage.clear = () => {};
});
beforeEach(() => {
@ -63,7 +125,11 @@ export const genTest = (apiType, dbType) => {
after(() => {
// close table
// mainPage.deleteCreatedViews()
cy.restoreLocalStorage();
cy.closeTableTab("Address");
cy.saveLocalStorage();
Cypress.LocalStorage.clear = clear;
});
// Common routine to create/edit/delete GRID & GALLERY view
@ -85,14 +151,22 @@ export const genTest = (apiType, dbType) => {
});
it(`Share ${viewType.toUpperCase()} hide, sort, filter & verify`, () => {
cy.intercept("/api/v1/db/meta/audits/comments/**").as(
"waitForPageLoad"
);
cy.get(`.nc-view-item.nc-${viewType}-view-item`)
.contains("Address1")
.contains("Grid-1")
.click();
mainPage.hideField("Address2");
mainPage.sortField("Address", "Z → A");
mainPage.filterField("Address", "is like", "Ab");
generateViewLink("combined");
cy.log(viewURL["combined"]);
cy.wait(["@waitForPageLoad"]);
// kludge: additional wait to ensure page load is completed
cy.wait(2000);
});
it(`Share GRID view : ensure we have only one link even if shared multiple times`, () => {
@ -101,16 +175,8 @@ export const genTest = (apiType, dbType) => {
generateViewLink("combined");
// verify if only one link exists in table
// cy.get(".v-navigation-drawer__content > .container")
// .find(".v-list > .v-list-item")
// .contains("Share View")
// .parent()
// .find("button.mdi-dots-vertical")
// .click();
mainPage.shareViewList().click();
// cy.getActiveMenu().find(".v-list-item").contains("Views List").click();
cy.get('th:contains("View Link")').should("exist");
cy.get('th:contains("View Link")')
@ -121,12 +187,10 @@ export const genTest = (apiType, dbType) => {
.its("length")
.should("eq", 1)
.then(() => {
// cy.get(".v-overlay__content > .d-flex > .v-icon").click();
// close modal (fix me! add a close button to share view list modal)
cy.get(".v-overlay--active > .v-overlay__scrim").click({
force: true,
});
cy.get("button.ant-modal-close:visible").click();
});
cy.signOut();
});
it(`Share ${viewType.toUpperCase()} view : Visit URL, Verify title`, () => {
@ -134,19 +198,20 @@ export const genTest = (apiType, dbType) => {
cy.visit(viewURL["combined"], {
baseUrl: null,
});
cy.wait(5000);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 18);
// verify title
cy.get("div.model-name").contains("Address1").should("exist");
cy.get(".nc-shared-view-title").contains("Grid-1").should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields hidden/open`, () => {
// verify column headers
cy.get('[data-col="Address"]').should("exist");
cy.get('[data-col="Address2"]').should("not.exist");
cy.get('[data-col="District"]').should("exist");
cy.get('[data-title="Address"]').should("exist");
cy.get('[data-title="Address2"]').should("not.exist");
cy.get('[data-title="District"]').should("exist");
});
it(`Share ${viewType.toUpperCase()} view : verify fields sort/ filter`, () => {
@ -187,7 +252,10 @@ export const genTest = (apiType, dbType) => {
};
// download & verify
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.downloadAndVerifyCsvFromSharedView(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
@ -196,18 +264,16 @@ export const genTest = (apiType, dbType) => {
mainPage.clearSort();
mainPage
.getCell("Address", 1)
//ncv2@fixme
.contains("669 Firozabad Loop")
//.contains("217 Botshabelo Place")
.should("exist");
});
it(`Share ${viewType.toUpperCase()} view : Enable sort`, () => {
// Sort menu operations (Country Column, Z->A)
mainPage.sortField("Address", "Z → A");
mainPage.sortField("Address", "A → Z");
mainPage
.getCell("Address", 1)
.contains("669 Firozabad Loop")
.contains("1013 Tabuk Boulevard")
.should("exist");
});
@ -218,7 +284,7 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-grid-row").should("have.length", 3);
mainPage
.getCell("Address", 1)
.contains("1888 Kabul Drive")
.contains("1294 Firozabad Drive")
.should("exist");
});
@ -228,7 +294,7 @@ export const genTest = (apiType, dbType) => {
// expected output, statically configured
let storedRecords = [
`Address,District,PostalCode,Phone,Location,Customer List,Staff List,City,Staff List`,
`1888 Kabul Drive,,20936,,1,,Ife,,`,
`1294 Firozabad Drive,,70618,,2,,Pingxiang,,`,
`1661 Abha Drive,,14400,,1,,Pudukkottai,,`,
];
@ -243,13 +309,18 @@ export const genTest = (apiType, dbType) => {
expect(strCol[2]).to.be.equal(retCol[2]);
}
};
mainPage.downloadAndVerifyCsv(`Address_exported_1.csv`, verifyCsv);
mainPage.downloadAndVerifyCsvFromSharedView(
`Address_exported_1.csv`,
verifyCsv
);
mainPage.unhideField("LastUpdate");
});
it(`Share ${viewType.toUpperCase()} view : Delete Filter`, () => {
// Remove sort and Validate
mainPage.filterReset();
mainPage.clearSort();
mainPage
.getCell("Address", 1)
.contains("669 Firozabad Loop")
@ -258,103 +329,64 @@ export const genTest = (apiType, dbType) => {
it(`Share GRID view : Virtual column validation > has many`, () => {
// verify column headers
cy.get('[data-col="Customer List"]').should("exist");
cy.get('[data-col="Staff List"]').should("exist");
cy.get('[data-col="City"]').should("exist");
cy.get('[data-col="Staff List"]').should("exist");
cy.get('[data-title="Customer List"]').should("exist");
cy.get('[data-title="Staff List"]').should("exist");
cy.get('[data-title="City"]').should("exist");
cy.get('[data-title="Staff List1"]').should("exist");
// has many field validation
mainPage
.getCell("Customer List", 3)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("Customer List", 3)
.click()
.find("button.mdi-plus")
.should("not.exist");
mainPage
.getCell("Customer List", 3)
.click()
.find("button.mdi-arrow-expand")
.click();
cy.getActiveModal(".nc-modal-child-list")
.find("button.mdi-reload")
.should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find("button")
.contains("Link to")
.should("not.exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".child-card")
.contains("2")
.should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find(".child-card")
.find("button")
.should("not.exist");
cy.get("body").type("{esc}");
verifyLtarCell("Customer List", 1, "1", {
unlink: false,
plus: false,
expand: true,
});
actionLtarCell("Customer List", 1, ".nc-arrow-expand");
verifyChildListCard("1", {
reload: true,
linkTo: false,
unlink: false,
delete: false,
});
cy.closeActiveModal(".nc-modal-child-list");
});
it(`Share GRID view : Virtual column validation > belongs to`, () => {
// belongs to field validation
mainPage
.getCell("City", 1)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("City", 1)
.click()
.find("button.mdi-arrow-expand")
.should("not.exist");
mainPage
.getCell("City", 1)
.find(".v-chip")
.contains("al-Ayn")
.should("exist");
verifyLtarCell("City", 1, "al-Ayn", {
unlink: false,
plus: false,
expand: false,
});
});
it(`Share GRID view : Virtual column validation > many to many`, () => {
// many-to-many field validation
mainPage
.getCell("Staff List", 1)
.click()
.find("button.mdi-close-thick")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find("button.mdi-plus")
.should("not.exist");
mainPage
.getCell("Staff List", 1)
.click()
.find("button.mdi-arrow-expand")
.click();
cy.getActiveModal(".nc-modal-child-list")
.find("button.mdi-reload")
.should("exist");
cy.getActiveModal(".nc-modal-child-list")
.find("button")
.contains("Link to")
.should("not.exist");
cy.get("body").type("{esc}");
// many to many field verification
verifyLtarCell("Staff List1", 1, "", {
unlink: false,
plus: false,
expand: true,
});
actionLtarCell("Staff List1", 1, ".nc-arrow-expand");
verifyChildListCard("", {
reload: true,
linkTo: false,
unlink: false,
delete: false,
});
});
it(`Delete ${viewType.toUpperCase()} view`, () => {
// go back to base page
cy.visit(storedURL, {
baseUrl: null,
});
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Address", 25);
// number of view entries should be 2 before we delete
cy.get(".nc-view-item").its("length").should("eq", 2);
cy.get(".nc-view-delete-icon").eq(0).click({ force: true });
cy.getActiveModal(".nc-modal-view-delete")
.find(".ant-btn-dangerous")
.click();
cy.toastWait("View deleted successfully");
// confirm if the number of veiw entries is reduced by 1
@ -368,11 +400,11 @@ export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} api - Grid view/ row-column update verification`, () => {
before(() => {
cy.fileHook();
cy.restoreLocalStorage();
// Address table has belongs to, has many & many-to-many
cy.openTableTab("Country", 25);
cy.saveLocalStorage();
// store base URL- to re-visit and delete form view later
cy.url().then((url) => {
storedURL = url;
@ -380,60 +412,52 @@ export const genTest = (apiType, dbType) => {
});
});
after(() => {
// close table
beforeEach(() => {
cy.restoreLocalStorage();
cy.visit(storedURL, {
baseUrl: null,
});
// delete row
mainPage.getPagination(5).click();
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage
.getRow(10)
.find(".mdi-checkbox-blank-outline")
.click({ force: true });
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.contains("Delete Selected Row")
.click();
// delete column
cy.get(`th:contains('dummy') .mdi-menu-down`)
.trigger("mouseover")
.click();
cy.get(".nc-column-delete").click();
cy.get("button:contains(Confirm)").click();
cy.toastWait("Update table successful");
});
mainPage.deleteCreatedViews();
afterEach(() => {
cy.saveLocalStorage();
});
// close table
after(() => {
cy.restoreLocalStorage();
cy.closeTableTab("Country");
cy.saveLocalStorage();
});
it(`Generate default Shared GRID view URL`, () => {
// add row
cy.get(".nc-add-new-row-btn").click();
cy.get("#data-table-form-Country > input").first().click().type("a");
cy.contains("Save row").filter("button").click({ force: true });
cy.get(".nc-expand-col-Country")
.find(".nc-cell > input")
.should("exist")
.first()
.clear({ force: true })
.type("a");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Save row")
.should("exist")
.click();
cy.toastWait("updated successfully");
cy.getActiveDrawer(".nc-drawer-expanded-form")
.find("button")
.contains("Cancel")
.should("exist")
.click();
// add column
mainPage.addColumn("dummy", "Country");
cy.signOut();
// visit public view
cy.log(viewURL["rowColUpdate"]);
cy.restoreLocalStorage();
cy.visit(viewURL["rowColUpdate"], {
baseUrl: null,
});
cy.wait(5000);
//5
// wait for public view page to load!
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 25);
@ -441,15 +465,40 @@ export const genTest = (apiType, dbType) => {
it(`Share GRID view : new row visible`, () => {
// verify row
cy.get(`.v-pagination > li:contains('5') button`).click();
// cy.get(`.v-pagination > li:contains('5') button`).click();
cy.get(
`.nc-pagination > .ant-pagination-item.ant-pagination-item-5`
).click();
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).contains("a").should("exist");
});
it.skip(`Share GRID view : new column visible`, () => {
it(`Share GRID view : new column visible`, () => {
// verify column headers
cy.get('[data-col="dummy"]').should("exist");
cy.get('[data-title="dummy"]').should("exist");
});
it(`Clean up`, () => {
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("Country", 25);
// delete row
mainPage.getPagination(5).click();
// kludge: flicker on load
cy.wait(3000);
// wait for page rendering to complete
cy.get(".nc-grid-row").should("have.length", 10);
mainPage.getCell("Country", 10).rightclick();
cy.getActiveMenu(".nc-dropdown-grid-context-menu")
.find('.ant-dropdown-menu-item:contains("Delete Row")')
.first()
.click();
// delete column
mainPage.deleteColumn("dummy");
mainPage.deleteCreatedViews();
});
});
};

2
scripts/cypress/integration/common/5a_user_role.js

@ -152,7 +152,7 @@ export const genTest = (apiType, dbType) => {
cy.getSettled("button.ant-tabs-tab-remove")
.should("be.visible")
.click();
cy.wait(500);
cy.wait(2000);
}
cy.saveLocalStorage();

91
scripts/cypress/integration/common/5b_preview_role.js

@ -19,6 +19,7 @@ import {
_topRightMenu,
enableTableAccess,
_accessControl,
disableTableAccess,
} from "../spec/roleValidation.spec";
export const genTest = (apiType, dbType, roleType) => {
@ -27,52 +28,72 @@ export const genTest = (apiType, dbType, roleType) => {
///////////////////////////////////////////////////////////
//// Test Suite
let clear;
function configureAcl() {
// open Project metadata tab
//
settingsPage.openMenu(settingsPage.PROJ_METADATA);
settingsPage.openTab(settingsPage.UI_ACCESS_CONTROL);
// validate if it has 19 entries representing tables & views
if (isPostgres()) cy.get(".nc-acl-table-row").should("have.length", 24);
else if (isXcdb()) cy.get(".nc-acl-table-row").should("have.length", 19);
else cy.get(".nc-acl-table-row").should("have.length", 19);
// disable table & view access
//
disableTableAccess("Language", "editor");
disableTableAccess("Language", "commenter");
disableTableAccess("Language", "viewer");
disableTableAccess("CustomerList", "editor");
disableTableAccess("CustomerList", "commenter");
disableTableAccess("CustomerList", "viewer");
cy.get("button.nc-acl-save").click();
cy.toastWait("Updated UI ACL for tables successfully");
mainPage.closeMetaTab();
}
describe("Role preview validations", () => {
// Sign in/ open project
before(() => {
// cy.restoreLocalStorage();
loginPage.loginAndOpenProject(apiType, dbType);
cy.openTableTab("City", 25);
cy.wait(3000);
clear = Cypress.LocalStorage.clear;
Cypress.LocalStorage.clear = () => {};
// configureAcl();
cy.openTableTab("City", 25);
settingsPage.openProjectMenu();
cy.getActiveMenu(".nc-dropdown-project-menu")
.find(`[data-submenu-id="preview-as"]`)
.should("exist")
.click();
cy.wait(1000);
cy.get(".ant-dropdown-menu-submenu")
.eq(4)
.find(`[data-menu-id="editor"]`)
cy.get(".nc-role-preview-menu").should("have.length", 3);
cy.get(`.nc-role-preview-menu:contains("Editor")`)
.should("exist")
.click();
cy.wait(10000);
cy.saveLocalStorage();
});
beforeEach(() => {
cy.restoreLocalStorage();
});
after(() => {
// cy.get(".nc-preview-reset").click({ force: true });
cy.get(".mdi-exit-to-app").click();
cy.get(".nc-preview-btn-exit-to-app").click();
// wait for page rendering to complete
cy.get(".nc-grid-row", { timeout: 25000 }).should("have.length", 25);
// cy.get('.nc-preview-reset:visible').should('not-exist')
// mainPage.navigationDraw(mainPage.ROLE_VIEW).contains('Reset Preview').should('not.exist')
// cy.get('.nc-preview-reset').should('not-exist')
cy.closeTableTab("City");
// open Project metadata tab
//
mainPage.navigationDraw(mainPage.PROJ_METADATA).click();
// cy.get(".nc-exp-imp-metadata").dblclick({ force: true });
cy.get(".nc-ui-acl-tab").click({ force: true });
settingsPage.openMenu(settingsPage.PROJ_METADATA);
settingsPage.openTab(settingsPage.UI_ACCESS_CONTROL);
// validate if it has 19 entries representing tables & views
if (isPostgres()) cy.get(".nc-acl-table-row").should("have.length", 24);
@ -81,13 +102,15 @@ export const genTest = (apiType, dbType, roleType) => {
// restore access
//
enableTableAccess("language", "editor");
enableTableAccess("language", "commenter");
enableTableAccess("language", "viewer");
enableTableAccess("Language", "editor");
enableTableAccess("Language", "commenter");
enableTableAccess("Language", "viewer");
enableTableAccess("customerlist", "editor");
enableTableAccess("customerlist", "commenter");
enableTableAccess("customerlist", "viewer");
enableTableAccess("CustomerList", "editor");
enableTableAccess("CustomerList", "commenter");
enableTableAccess("CustomerList", "viewer");
cy.saveLocalStorage();
Cypress.LocalStorage.clear = clear;
});
const genTestSub = (roleType) => {
@ -97,9 +120,6 @@ export const genTest = (apiType, dbType, roleType) => {
.find(`[type="radio"][value="${roleType}"]`)
.should("exist")
.click();
cy.wait(5000);
cy.saveLocalStorage();
});
it(`Role preview: ${roleType}: Advance settings`, () => {
@ -136,13 +156,6 @@ export const genTest = (apiType, dbType, roleType) => {
_viewMenu(roleType, "preview");
});
it(`Role preview: ${roleType}: Top Right Menu bar`, () => {
// Share button is conditional
// Rest are static/ mandatory
//
_topRightMenu(roleType, "preview");
});
it(`Role preview: ${roleType}: Edit Schema`, () => {
// Schema related validations
// - Add/delete table

88
scripts/cypress/integration/common/5c_super_user_role.js

@ -1,12 +1,9 @@
import { loginPage } from '../../support/page_objects/navigation';
import { roles } from '../../support/page_objects/projectConstants';
import { loginPage } from "../../support/page_objects/navigation";
import { roles } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
describe(`${apiType.toUpperCase()} api - Super user test`, () => {
before(() => {
loginPage.signIn(roles.owner.credentials);
cy.saveLocalStorage();
});
before(() => {});
beforeEach(() => {
cy.restoreLocalStorage();
@ -16,70 +13,71 @@ export const genTest = (apiType, dbType) => {
cy.saveLocalStorage();
});
after(() => {
});
after(() => {});
it(`Open App store page and check slack app`, () => {
cy.visit('/#/apps').then(win => {
cy.get('.nc-app-store-title').should('exist');
cy.get('.nc-app-store-card-Slack').should('exist');
cy.visit("/#/apps").then((win) => {
cy.get(".nc-app-store-title").should("exist");
cy.get(".nc-app-store-card-Slack").should("exist");
// install slack app
cy.get('.nc-app-store-card-Slack .install-btn')
.invoke('attr', 'style', 'right: 10px')
cy.get(".nc-app-store-card-Slack .install-btn").invoke(
"attr",
"style",
"right: 10px"
);
cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install')
.click();
cy.get(
".nc-app-store-card-Slack .install-btn .nc-app-store-card-install"
).click();
cy.getActiveModal('.nc-modal-plugin-install')
cy.getActiveModal(".nc-modal-plugin-install")
.find('[placeholder="Channel Name"]')
.type('Test channel')
.type("Test channel");
cy.getActiveModal('.nc-modal-plugin-install')
cy.getActiveModal(".nc-modal-plugin-install")
.find('[placeholder="Webhook URL"]')
.type('http://test.com')
.type("http://test.com");
cy.getActiveModal('.nc-modal-plugin-install')
cy.getActiveModal(".nc-modal-plugin-install")
.find('button:contains("Save")')
.click()
cy.toastWait('Successfully installed')
.click();
cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-install').should('not.exist');
cy.toastWait("Successfully installed");
cy.get(
".nc-app-store-card-Slack .install-btn .nc-app-store-card-install"
).should("not.exist");
// update slack app config
cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-edit').should('exist').click()
cy.getActiveModal('.nc-modal-plugin-install')
.should('exist')
cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-edit")
.should("exist")
.click();
cy.getActiveModal(".nc-modal-plugin-install")
.should("exist")
.find('[placeholder="Channel Name"]')
.should('have.value', 'Test channel')
.should("have.value", "Test channel")
.clear()
.type('Test channel 2')
.type("Test channel 2");
cy.getActiveModal('.nc-modal-plugin-install')
cy.getActiveModal(".nc-modal-plugin-install")
.get('button:contains("Save")')
.click()
cy.toastWait('Successfully installed')
.click();
cy.toastWait("Successfully installed");
// reset slack app
cy.get('.nc-app-store-card-Slack .install-btn .nc-app-store-card-reset').should('exist').click()
cy.get(".nc-app-store-card-Slack .install-btn .nc-app-store-card-reset")
.should("exist")
.click();
cy.getActiveModal('.nc-modal-plugin-uninstall')
.should('exist')
cy.getActiveModal(".nc-modal-plugin-uninstall")
.should("exist")
.find('button:contains("Confirm")')
.click()
cy.toastWait('Plugin uninstalled successfully')
.click();
cy.toastWait("Plugin uninstalled successfully");
});
});
});
}
};

2
scripts/cypress/integration/common/6g_base_share.js

@ -22,7 +22,7 @@ export const genTest = (apiType, dbType) => {
it(`${roleType}: Visit base shared URL`, () => {
cy.log(linkText);
// http://localhost:8080/api/v1/db/meta/projects/p_4ufoizgrorwyey/tables?includeM2M=false
cy.intercept("/api/v1/db/meta/projects/**").as("waitForPageLoad");
cy.intercept("/api/v1/db/meta/projects/*/tables*").as("waitForPageLoad");
// visit URL & wait for page load to complete
cy.visit(linkText, {

5
scripts/cypress/integration/common/7a_create_project_from_excel.js

@ -174,8 +174,9 @@ export const genTest = (apiType, dbType) => {
});
cy.getActiveModal().find(".ant-btn-primary").click();
// wait for page to get loaded (issue observed in CI-CD)
cy.wait("@waitForPageLoad");
// Wait for page to get loaded (issue observed in CI-CD)
// Timeout set to 30 seconds. Default was 5 seconds. Increased due to delay in completion sometimes in CI-CD
cy.wait("@waitForPageLoad", { timeout: 30000 });
});
it("File Upload: Verify loaded data", () => {

2
scripts/cypress/integration/common/9a_QuickTest.js

@ -115,7 +115,7 @@ export const genTest = (apiType, dbType, testMode) => {
cy.wait(2000);
// close team & auth tab
cy.get("button.ant-tabs-tab-remove").should("exist").click();
cy.wait(1000);
cy.wait(2000);
} else {
cy.restoreLocalStorage();
}

2
scripts/cypress/integration/test/pg-restRoles.js

@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => {
t01.genTest(apiType, dbType);
t5a.genTest(apiType, dbType);
// t5b.genTest(apiType, dbType);
t5b.genTest(apiType, dbType);
t5c.genTest(apiType, dbType);
};

3
scripts/cypress/integration/test/pg-restTableOps.js

@ -12,6 +12,7 @@ let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
let t3e = require("../common/3e_duration_column");
let t3f = require("../common/3f_link_to_another_record");
const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
@ -31,7 +32,9 @@ const nocoTestSuite = (apiType, dbType) => {
t3b.genTest(apiType, dbType);
t3c.genTest(apiType, dbType);
t3d.genTest(apiType, dbType);
t3e.genTest(apiType, dbType);
// NcGUI v2 t3e.genTest(apiType, dbType);
t3f.genTest(apiType, dbType);
};
nocoTestSuite("rest", "postgres");

2
scripts/cypress/integration/test/pg-restViews.js

@ -21,8 +21,8 @@ const nocoTestSuite = (apiType, dbType) => {
t4b.genTest(apiType, dbType);
t4d.genTest(apiType, dbType);
t4e.genTest(apiType, dbType);
t4f.genTest(apiType, dbType);
t4g.genTest(apiType, dbType);
// tbd t4f.genTest(apiType, dbType);
};
nocoTestSuite("rest", "postgres");

5
scripts/cypress/integration/test/restRoles.js

@ -12,9 +12,8 @@ const nocoTestSuite = (apiType, dbType) => {
t01.genTest(apiType, dbType);
t5a.genTest(apiType, dbType);
// t5b.genTest(apiType, dbType);
t5c.genTest(apiType, dbType);
t5b.genTest(apiType, dbType);
t5c.genTest(apiType, dbType);
};
nocoTestSuite("rest", "mysql");

2
scripts/cypress/integration/test/restTableOps.js

@ -31,7 +31,7 @@ const nocoTestSuite = (apiType, dbType) => {
t3b.genTest(apiType, dbType);
t3c.genTest(apiType, dbType);
t3d.genTest(apiType, dbType);
// NcGUI v2 t3e.genTest(apiType, dbType);
t3e.genTest(apiType, dbType);
t3f.genTest(apiType, dbType);
};

2
scripts/cypress/integration/test/xcdb-restRoles.js

@ -12,7 +12,7 @@ const nocoTestSuite = (apiType, dbType) => {
t01.genTest(apiType, dbType);
t5a.genTest(apiType, dbType);
// t5b.genTest(apiType, dbType);
t5b.genTest(apiType, dbType);
t5c.genTest(apiType, dbType);
};

3
scripts/cypress/integration/test/xcdb-restTableOps.js

@ -11,6 +11,7 @@ let t3b = require("../common/3b_formula_column");
let t3c = require("../common/3c_lookup_column");
let t3d = require("../common/3d_rollup_column");
let t3e = require("../common/3e_duration_column");
let t3f = require("../common/3f_link_to_another_record");
const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
@ -30,7 +31,9 @@ const nocoTestSuite = (apiType, dbType) => {
t3b.genTest(apiType, dbType);
t3c.genTest(apiType, dbType);
t3d.genTest(apiType, dbType);
t3e.genTest(apiType, dbType);
// NcGUI v2 t3e.genTest(apiType, dbType);
t3f.genTest(apiType, dbType);
};
nocoTestSuite("rest", "xcdb");

38
scripts/cypress/support/commands.js

@ -30,32 +30,32 @@ import { isXcdb, isPostgres } from "./page_objects/projectConstants";
require("@4tw/cypress-drag-drop");
// recursively gets an element, returning only after it's determined to be attached to the DOM for good
Cypress.Commands.add('getSettled', (selector, opts = {}) => {
Cypress.Commands.add("getSettled", (selector, opts = {}) => {
const retries = opts.retries || 3;
const delay = opts.delay || 400;
const isAttached = (resolve, count = 0) => {
const el = Cypress.$(selector);
const el = Cypress.$(selector);
// is element attached to the DOM?
count = Cypress.dom.isAttached(el) ? count + 1 : 0;
// is element attached to the DOM?
count = Cypress.dom.isAttached(el) ? count + 1 : 0;
// hit our base case, return the element
if (count >= retries) {
return resolve(el);
}
// hit our base case, return the element
if (count >= retries) {
return resolve(el);
}
// retry after a bit of a delay
setTimeout(() => isAttached(resolve, count), delay);
// retry after a bit of a delay
setTimeout(() => isAttached(resolve, count), delay);
};
// wrap, so we can chain cypress commands off the result
return cy.wrap(null).then(() => {
return new Cypress.Promise((resolve) => {
return isAttached(resolve, 0);
}).then((el) => {
return cy.wrap(el);
});
return new Cypress.Promise((resolve) => {
return isAttached(resolve, 0);
}).then((el) => {
return cy.wrap(el);
});
});
});
@ -179,7 +179,7 @@ Cypress.Commands.add("openTableTab", (tn, rc) => {
// for some tables, linked records are not available immediately
cy.wait(1000);
cy.get(".xc-row-table.nc-grid").should("exist");
cy.get(".xc-row-table.nc-grid", { timeout: 30000 }).should("exist");
// wait for page rendering to complete
if (rc != 0) {
@ -199,7 +199,7 @@ Cypress.Commands.add("closeTableTab", (tn) => {
.click();
// subsequent tab open commands will fail if tab is not closed completely
cy.wait(100);
cy.wait(2000)
});
Cypress.Commands.add("openOrCreateGqlProject", (_args) => {
@ -280,6 +280,10 @@ Cypress.Commands.add("getActiveModal", (wrapperSelector) => {
return cy.get(".ant-modal-content:visible").last();
});
Cypress.Commands.add("closeActiveModal", (wrapperSelector) => {
cy.getActiveModal(wrapperSelector).find(".ant-modal-close-x").click();
});
Cypress.Commands.add("getActiveMenu", (overlaySelector) => {
if (overlaySelector) {
return cy.getSettled(`${overlaySelector} .ant-dropdown-content:visible`);

3
scripts/cypress/support/page_objects/mainPage.js

@ -584,8 +584,7 @@ export class _mainPage {
downloadAndVerifyCsvFromSharedView = (filename, verifyCsv) => {
cy.get(".nc-actions-menu-btn").click();
cy.get(".nc-project-menu-item")
.contains("Download as CSV")
cy.get(".nc-project-menu-item:contains('Download as CSV')")
.should("exist")
.click();

1
scripts/cypress/support/page_objects/navigation.js

@ -110,6 +110,7 @@ export class _projectsPage {
// close team & auth tab
cy.getSettled("button.ant-tabs-tab-remove").should("be.visible").click();
cy.get("button.ant-tabs-tab-remove").should("not.exist");
cy.wait(2000);
}
// Open existing project

14
scripts/sdk/swagger.json

@ -2701,6 +2701,20 @@
},
"in": "query",
"name": "where"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "offset"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "limit"
}
],
"responses": {

Loading…
Cancel
Save