Browse Source

test(cypress): fix inconsistency- inaccessible DOM element due to pagination delay

Signed-off-by: Raju Udava <sivadstala@gmail.com>
pull/805/head
Raju Udava 3 years ago
parent
commit
2bca2be339
  1. 128
      .github/workflows/ci-cd.yml
  2. 1
      scripts/cypress/integration/common/00_pre_configurations.js
  3. 21
      scripts/cypress/integration/common/1b_table_column_operations.js
  4. 81
      scripts/cypress/integration/common/1c_table_row_operations.js
  5. 21
      scripts/cypress/integration/common/3a_filter_sort_fields_operations.js
  6. 4
      scripts/cypress/plugins/index.js

128
.github/workflows/ci-cd.yml

@ -12,38 +12,38 @@ on:
- "scripts/cypress/**"
jobs:
#cypress-restTableOps-run:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Cache node modules
# uses: actions/cache@v2
# env:
# cache-name: cache-node-modules
#
# with:
# # npm cache files are stored in `~/.npm` on Linux/macOS
# path: ~/.npm
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ env.cache-name }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-
#
# - name: Cypress run
# uses: cypress-io/github-action@v2
# with:
# start: |
# npm run start:api
# npm run start:web
# docker-compose -f ./scripts/docker-compose-cypress.yml up -d
# spec: "./scripts/cypress/integration/test/restTableOps.js"
# wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
# wait-on-timeout: 1200
# config-file: scripts/cypress/cypress.json
cypress-restTableOps-run:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cypress run
uses: cypress-io/github-action@v2
with:
start: |
npm run start:api
npm run start:web
docker-compose -f ./scripts/docker-compose-cypress.yml up -d
spec: "./scripts/cypress/integration/test/restTableOps.js"
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json
cypress-restViews-run:
runs-on: ubuntu-20.04
steps:
@ -140,38 +140,38 @@ jobs:
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json
#cypress-gqlTableOps-run:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Cache node modules
# uses: actions/cache@v2
# env:
# cache-name: cache-node-modules
#
# with:
# # npm cache files are stored in `~/.npm` on Linux/macOS
# path: ~/.npm
# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-build-${{ env.cache-name }}-
# ${{ runner.os }}-build-
# ${{ runner.os }}-
#
# - name: Cypress run
# uses: cypress-io/github-action@v2
# with:
# start: |
# npm run start:api
# npm run start:web
# docker-compose -f ./scripts/docker-compose-cypress.yml up -d
# spec: "./scripts/cypress/integration/test/gqlTableOps.js"
# wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
# wait-on-timeout: 1200
# config-file: scripts/cypress/cypress.json
cypress-gqlTableOps-run:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cypress run
uses: cypress-io/github-action@v2
with:
start: |
npm run start:api
npm run start:web
docker-compose -f ./scripts/docker-compose-cypress.yml up -d
spec: "./scripts/cypress/integration/test/gqlTableOps.js"
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json
cypress-gqlViews-run:
runs-on: ubuntu-20.04
steps:

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

@ -11,6 +11,7 @@ export const genTest = (type, xcdb) => {
describe(`Project pre-configurations`, () => {
it('Admin SignUp', () => {
cy.task('log', 'This will be output to the terminal')
cy.waitForSpinners();
cy.signinOrSignup(roles.owner.credentials)
cy.wait(2000)

21
scripts/cypress/integration/common/1b_table_column_operations.js

@ -10,8 +10,8 @@ export const genTest = (type, xcdb) => {
const name = 'tablex'
const colName = 'column_name_a'
const updatedColName = 'updated_column_name'
const randVal = 'Test'
const updatedRandVal = 'Updated'
const randVal = 'Test@1234.com'
const updatedRandVal = 'Updated@1234.com'
before(() => {
// loginPage.loginAndOpenProject(type)
@ -91,22 +91,19 @@ export const genTest = (type, xcdb) => {
cy.wait(2000)
cy.get('.nc-add-new-row-btn').click({force: true});
cy.get('#data-table-form-Title > input').first().type(randVal);
cy.contains('Save Row').filter('button').click({force: true})
cy.get('td', {timeout: 10000}).contains(randVal).should('exist');
cy.getActiveModal().find('button').contains('Save Row').click({force: true})
mainPage.getCell('Title', 1).contains(randVal).should('exist')
})
it('Update row', () => {
cy.get('td').contains(randVal)
.closest('tr')
.find('.nc-row-expand-icon')
.click({force: true});
mainPage.getRow(1).find('.nc-row-expand-icon').click({force: true})
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal);
cy.contains('Save Row').filter('button').click({force: true})
cy.getActiveModal().find('button').contains('Save Row').click({force: true})
cy.wait(3000)
cy.get('td').contains(randVal).should('not.exist');
cy.get('td').contains(updatedRandVal).should('exist');
mainPage.getCell('Title', 1).contains(randVal).should('not.exist')
mainPage.getCell('Title', 1).contains(updatedRandVal).should('exist')
})
it('Delete row', () => {

81
scripts/cypress/integration/common/1c_table_row_operations.js

@ -1,81 +0,0 @@
import { loginPage } from "../../support/page_objects/navigation"
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"
export const genTest = (type, xcdb) => {
if(!isTestSuiteActive(type, xcdb)) return;
describe(`${type.toUpperCase()} api - Table Row`, () => {
const randVal = 'Test' + Date.now();
const updatedRandVal = 'Updated' + Date.now();
const name = 'Tablerow' + Date.now();
before(() => {
//loginPage.loginAndOpenProject(type)
cy.createTable(name)
});
// delete table
after(() => {
cy.deleteTable(name)
});
it('Add new row', () => {
cy.get('.nc-add-new-row-btn').click({force: true});
cy.get('#data-table-form-Title > input').first().type(randVal);
cy.contains('Save Row').filter('button').click({force: true})
cy.get('td', {timeout: 10000}).contains(randVal).should('exist');
})
it('Update row', () => {
cy.get('td').contains(randVal)
.closest('tr')
.find('.nc-row-expand-icon')
.click({force: true});
cy.get('#data-table-form-Title > input').first().clear().type(updatedRandVal);
cy.contains('Save Row').filter('button').click({force: true})
cy.wait(3000).then(() => {
cy.get('td').contains(randVal).should('not.exist');
cy.get('td').contains(updatedRandVal).should('exist');
})
})
it('Delete row', () => {
cy.get('td').contains(updatedRandVal).rightclick({force: true})
// delete row
cy.getActiveMenu().find('.v-list-item:contains("Delete Row")').first().click({force: true})
cy.wait(1000)
cy.get('td').contains(randVal).should('not.exist');
})
});
}
// 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/>.
*
*/

21
scripts/cypress/integration/common/3a_filter_sort_fields_operations.js

@ -65,15 +65,18 @@ export const genTest = (type, xcdb) => {
// create new row using right click menu option
//
it('Add row using rightclick menu option', () => {
mainPage.getPagination(5).click()
// mainPage.getPagination(5).click({ force: true })
mainPage.getCell("Country", 9).rightclick()
cy.getActiveMenu().contains('Insert New Row').click()
mainPage.getCell("Country", 10).dblclick().type('Test Country-1{enter}')
// wait before proceeding further to ensure reload is completed
// cy.wait(1000)
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Insert New Row').click()
mainPage.getCell("Country", 11).dblclick().type('Test Country-2{enter}')
mainPage.getCell("Country", 9).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 10).dblclick().find('input').type('Test Country-1{enter}')
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Insert New Row').click({force: true})
mainPage.getCell("Country", 11).dblclick().find('input').type('Test Country-2{enter}')
// verify
mainPage.getCell("Country", 10).contains("Test Country-1").should('exist')
@ -86,8 +89,8 @@ export const genTest = (type, xcdb) => {
mainPage.getRow(10).find('.mdi-checkbox-blank-outline').click({force: true})
mainPage.getRow(11).find('.mdi-checkbox-blank-outline').click({force: true})
mainPage.getCell("Country", 10).rightclick()
cy.getActiveMenu().contains('Delete Selected Row').click()
mainPage.getCell("Country", 10).rightclick({force: true})
cy.getActiveMenu().contains('Delete Selected Row').click({force: true})
// verify
mainPage.getCell("Country", 10).should('not.exist')

4
scripts/cypress/plugins/index.js

@ -43,6 +43,10 @@ module.exports = (on, config) => {
},
'readXlsx': readXlsx.read,
'readSheetList': readXlsx.sheetList,
log(message) {
console.log(message)
return null
}
})
}

Loading…
Cancel
Save