Browse Source

test: add new suite for db-independent tests

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/3773/head
Raju Udava 2 years ago
parent
commit
a71e22b56c
  1. 47
      .github/workflows/ci-cd.yml
  2. 3
      scripts/cypress/cypress.json
  3. 25
      scripts/cypress/integration/common/6d_language_validation.js
  4. 18
      scripts/cypress/integration/test/db-independent.js
  5. 5
      scripts/cypress/integration/test/restMisc.js

47
.github/workflows/ci-cd.yml

@ -689,4 +689,49 @@ jobs:
# run: docker-compose -f ./scripts/docker-compose-cypress.yml up -d
# - name: run unit tests
# working-directory: ./packages/nocodb
# run: npm run test:unit
# run: npm run test:unit
cypress-db-independent:
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16.15.0
- 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: Set env
run: echo "NODE_ENV=test" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@v2
with:
start: |
npm run start:api:cache
npm run start:web
docker-compose -f ./scripts/docker-compose-cypress.yml up -d
spec: "./scripts/cypress/integration/test/db-independent.js"
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/assets/img/icons/512x512-trans.png"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v2
with:
name: cypress-restMisc-run-cache-snapshots
path: scripts/cypress/screenshots
retention-days: 2

3
scripts/cypress/cypress.json

@ -13,7 +13,8 @@
"test/pg-restViews.js",
"test/pg-restRoles.js",
"test/pg-restMisc.js",
"test/quickTest.js"
"test/quickTest.js",
"test/db-independent.js"
],
"defaultCommandTimeout": 13000,
"pageLoadTimeout": 600000,

25
scripts/cypress/integration/common/6d_language_validation.js

@ -1,8 +1,3 @@
import { projectsPage } from "../../support/page_objects/navigation";
const { mainPage } = require("../../support/page_objects/mainPage");
const { loginPage } = require("../../support/page_objects/navigation");
const { roles } = require("../../support/page_objects/projectConstants");
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
export const genTest = (apiType, dbType) => {
@ -23,24 +18,8 @@ export const genTest = (apiType, dbType) => {
cy.saveLocalStorage();
});
after(() => {
// // sign out
// //
// cy.restoreLocalStorage();
// cy.get(".nc-menu-accounts").should("exist").click();
// cy.getActiveMenu(".nc-dropdown-user-accounts-menu")
// .find(".ant-dropdown-menu-item")
// .eq(1)
// .click();
//
// cy.wait(5000);
// cy.get('button:contains("SIGN")').should("exist");
// cy.saveLocalStorage();
cy.restoreLocalStorage();
projectsPage.openConfiguredProject(apiType, dbType);
cy.saveLocalStorage();
});
// after(() => {
// });
const langVerification = (idx, lang) => {
// pick json from the file specified

18
scripts/cypress/integration/test/db-independent.js

@ -0,0 +1,18 @@
let t6d = require("../common/6d_language_validation");
const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
const t01 = require("../common/00_pre_configurations");
const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
// Sakila Ext DB project creation
t01.genTest(apiType, dbType);
// i18n
t6d.genTest(apiType, dbType);
};
nocoTestSuite("rest", "mysql");

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

@ -2,7 +2,6 @@ let t0 = require("./explicitLogin");
let t01 = require("../common/00_pre_configurations");
let t6b = require("../common/6b_downloadCsv");
let t6c = require("../common/6c_swagger_api");
let t6d = require("../common/6d_language_validation");
let t6e = require("../common/6e_project_operations");
let t6f = require("../common/6f_attachments");
let t6g = require("../common/6g_base_share");
@ -22,8 +21,8 @@ const nocoTestSuite = (apiType, dbType) => {
// Download CSV
t6b.genTest(apiType, dbType);
// i18n
t6d.genTest(apiType, dbType);
// // i18n
// t6d.genTest(apiType, dbType);
// Swagger API
// exclude@ncv2 t6c.genTest(apiType, dbType);

Loading…
Cancel
Save