Browse Source

test(cypress): test corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/510/head
Pranav C 3 years ago
parent
commit
da5b4537ee
  1. 14
      cypress/integration/common/table_column_operations_spec.js
  2. 12
      cypress/integration/common/table_row_operations_spec.js
  3. 1
      cypress/support/commands.js
  4. 4
      docker-compose-cypress.yml
  5. 2
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts
  6. 2
      packages/nocodb/src/lib/noco/rest/RestAuthCtrl.ts
  7. 2
      packages/nocodb/src/lib/noco/rest/RestAuthCtrlEE.ts

14
cypress/integration/common/table_column_operations_spec.js

@ -1,9 +1,7 @@
const genTest = (type) => {
describe(`${type.toUpperCase()} api - Table Column`, () => {
const randVal = 'Test' + Date.now();
const updatedRandVal = 'Updated' + Date.now();
const name = 'Test' + Date.now();
const name = 'Table' + Date.now();
before(() => {
cy.waitForSpinners();
@ -26,10 +24,10 @@ const genTest = (type) => {
});
it('Create Table Column', () => {
cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
.first().click()
cy.get('.nc-project-tree').contains(name, {timeout: 6000}).first().click({force: true});
// cy.get('.nc-project-tree').find('.v-list-item__title:contains(Tables)', {timeout: 10000})
// .first().click()
//
// cy.get('.nc-project-tree').contains(name, {timeout: 6000}).first().click({force: true});
cy.get(`.project-tab:contains(${name}):visible`).should('exist')
@ -78,6 +76,8 @@ const genTest = (type) => {
.trigger('mouseover', {force: true})
.click({force: true})
cy.get('.nc-column-edit').click()
// rename column and verify
cy.get('.nc-column-name-input input').clear().type('updated_column')
cy.get('.nc-col-create-or-edit-card').contains('Save').click()

12
cypress/integration/common/table_row_operations_spec.js

@ -3,7 +3,7 @@ const genTest = (type) => {
describe(`${type.toUpperCase()} api - Table Row`, () => {
const randVal = 'Test' + Date.now();
const updatedRandVal = 'Updated' + Date.now();
const name = 'Test' + Date.now();
const name = 'Tablerow' + Date.now();
before(() => {
cy.waitForSpinners();
@ -30,7 +30,7 @@ const genTest = (type) => {
cy.get('#data-table-form-Title > input').first().type(randVal);
cy.contains('Save Row').filter('button').click()
cy.contains('Save Row').filter('button').click({force:true})
cy.get('td').contains(randVal).should('exist');
@ -40,11 +40,11 @@ const genTest = (type) => {
cy.get('td').contains(randVal)
.closest('tr')
.find('.nc-row-expand-icon')
.click();
.click({force:true});
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal);
cy.contains('Save Row').filter('button').click()
cy.contains('Save Row').filter('button').click({force:true})
cy.get('td').contains(updatedRandVal).should('exist');
@ -54,10 +54,10 @@ const genTest = (type) => {
it('Delete row', () => {
cy.get('td').contains(updatedRandVal).rightclick()
cy.get('td').contains(updatedRandVal).rightclick({force:true})
// delete row
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click()
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click({force:true})
cy.wait(1000)
cy.get('td').contains(randVal).should('not.exist');
})

1
cypress/support/commands.js

@ -86,7 +86,6 @@ Cypress.Commands.add('openOrCreateRestProject', (_args) => {
} else {
cy.get('.nc-create-external-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project')
cy.contains('GRAPHQL APIs').closest('label').click()
cy.get('.database-field input').click().clear().type('sakila')
cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click()

4
docker-compose-cypress.yml

@ -24,8 +24,8 @@ services:
# cp -r /home/app1/ /home/app/
rm /home/app/package-lock.json
rm /home/app/noco.db
# cd /home/app/ && npm i && EE=true npm run run
cd /home/app/ && npm i && EE=true npm run watch:run
cd /home/app/ && npm i && EE=true npm run run
# cd /home/app/ && npm i && EE=true npm run watch:run
xc-cypress-nc-gui:
network_mode: host
image: node:14-alpine

2
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSql.ts

@ -76,7 +76,7 @@ class BaseModelSql extends BaseModel {
limitDefault: process.env.DB_QUERY_LIMIT_DEFAULT || 10,
limitMax: process.env.DB_QUERY_LIMIT_MAX || 500,
limitMin: process.env.DB_QUERY_LIMIT_MIN || 1,
log: true,
log: false,
explain: false,
hasManyMax: 5,
bulkLengthMax: 1000,

2
packages/nocodb/src/lib/noco/rest/RestAuthCtrl.ts

@ -492,11 +492,9 @@ export default class RestAuthCtrl {
protected initJwtStrategy() {
passport.use(new Strategy(this.jwtOptions, (jwtPayload, done) => {
console.time('fetch user')
this.users.where({
email: jwtPayload?.email
}).first().then(user => {
console.timeEnd('fetch user')
if (user) {
user.roles = 'owner,creator'
return done(null, user);

2
packages/nocodb/src/lib/noco/rest/RestAuthCtrlEE.ts

@ -159,7 +159,6 @@ export default class RestAuthCtrlEE extends RestAuthCtrl {
...this.jwtOptions,
passReqToCallback: true
}, (req, jwtPayload, done) => {
console.time('fetch user')
const keyVals = [jwtPayload?.email]
if (req.ncProjectId) {
@ -185,7 +184,6 @@ export default class RestAuthCtrlEE extends RestAuthCtrl {
} else {
// const roles = projectUser?.roles ? JSON.parse(projectUser.roles) : {guest: true};
console.timeEnd('fetch user')
if (user) {
XcCache.set(key, user);
return done(null, user);

Loading…
Cancel
Save