Browse Source

[test] cypress: lock view validation

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/614/head
Raju Udava 3 years ago
parent
commit
76bd4a8300
  1. 95
      cypress/integration/common/4d_table_view_grid_locked.js
  2. 6
      packages/nc-gui/components/project/spreadsheet/components/lockMenu.vue
  3. 12
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

95
cypress/integration/common/4d_table_view_grid_locked.js

@ -0,0 +1,95 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
import { mainPage } from "../../support/page_objects/mainPage"
const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table views`, () => {
// Run once before test- create project (rest/graphql)
//
before(() => {
loginPage.loginAndOpenProject(type)
// open a table to work on views
//
cy.openTableTab('Country');
})
const lockViewTest = (enabled) => {
it.only(`Grid: lock view set to ${enabled}: validation`, () => {
let vString = enabled ? 'not.' : ''
let menuOption = enabled ? 1 : 0
// on menu, collaboration view appears first (at index 0)
// followed by Locked view (at index 1)
cy.get('.xc-toolbar').find('.nc-view-lock-menu:enabled').click()
cy.getActiveMenu().find('[role="menuitem"]').eq(menuOption).click()
// expected toolbar for Lock view: Only lock-view menu, reload, toggle-nav-drawer to be enabled
//
cy.get('.xc-toolbar').find('.nc-view-lock-menu:enabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-table-reload-btn:enabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-add-new-row-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-save-new-row-btn:disabled') .should('exist')
cy.get('.xc-toolbar').find('.nc-fields-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-sort-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-filter-menu-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-table-delete-btn:enabled') .should(`${vString}exist`)
cy.get('.xc-toolbar').find('.nc-toggle-nav-drawer:enabled') .should('exist')
// dblClick on a cell & see if we can edit
mainPage.getCell('Country', 1).dblclick()
mainPage.getCell('Country', 1).find('input').should(`${vString}exist`)
// check if expand row option is available?
cy.get('td').find('.nc-row-expand-icon').should(`${vString}exist`)
// alt validation: mainPage.getRow(1).find('.nc-row-expand-icon').should(`${vString}exist`)
// check if add/ expand options available for 'has many' column type
mainPage.getCell('Country => City', 1).click().find('button.mdi-plus').should(`${vString}exist`)
mainPage.getCell('Country => City', 1).click().find('button.mdi-arrow-expand').should(`${vString}exist`)
// update row option (right click) - should not be available for Lock view
mainPage.getCell('Country => City', 1).rightclick()
cy.get('.menuable__content__active').should(`${vString}be.visible`)
})
}
// Locked view
lockViewTest(true)
// collaboration view
lockViewTest(false)
})
}
// invoke for different API types supported
//
genTest('rest', false)
genTest('graphql', false)
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Pranav C Balan <pranavxc@gmail.com>
* @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/>.
*
*/

6
packages/nc-gui/components/project/spreadsheet/components/lockMenu.vue

@ -1,13 +1,13 @@
<template> <template>
<v-menu offset-y max-width="350"> <v-menu offset-y max-width="350">
<template #activator="{on}"> <template #activator="{on}">
<v-icon v-if="value === 'locked'" small class="mr-5" v-on="on"> <v-icon v-if="value === 'locked'" small class="mr-5 nc-view-lock-menu" v-on="on">
mdi-lock mdi-lock
</v-icon> </v-icon>
<v-icon v-else-if="value === 'personal'" small class="mr-5" v-on="on"> <v-icon v-else-if="value === 'personal'" small class="mr-5 nc-view-lock-menu" v-on="on">
mdi-account mdi-account
</v-icon> </v-icon>
<v-icon v-else small class="mr-5" v-on="on"> <v-icon v-else small class="mr-5 nc-view-lock-menu" v-on="on">
mdi-account-group mdi-account-group
</v-icon> </v-icon>
</template> </template>

12
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -74,7 +74,14 @@
</v-tooltip> </v-tooltip>
<lock-menu v-if="_isUIAllowed('view-type')" v-model="viewStatus.type" /> <lock-menu v-if="_isUIAllowed('view-type')" v-model="viewStatus.type" />
<x-btn tooltip="Reload view data" outlined small text @click="reload"> <x-btn
tooltip="Reload view data"
outlined
small
text
btn.class="nc-table-reload-btn"
@click="reload"
>
<v-icon small class="mr-1" color="grey darken-3"> <v-icon small class="mr-1" color="grey darken-3">
mdi-reload mdi-reload
</v-icon> </v-icon>
@ -96,6 +103,7 @@
<x-btn <x-btn
small small
text text
btn.class="nc-save-new-row-btn"
outlined outlined
tooltip="Save new rows" tooltip="Save new rows"
:disabled="!edited || isLocked" :disabled="!edited || isLocked"
@ -184,7 +192,7 @@
outlined outlined
small small
text text
:btn-class="{ 'primary lighten-5' : !toggleDrawer}" :btn-class="{ 'primary lighten-5 nc-toggle-nav-drawer' : !toggleDrawer}"
@click="toggleDrawer = !toggleDrawer" @click="toggleDrawer = !toggleDrawer"
> >
<v-icon <v-icon

Loading…
Cancel
Save