Browse Source

test: import verification tests

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/2505/head
Raju Udava 2 years ago
parent
commit
1d78689733
  1. 4
      .github/workflows/ci-cd.yml
  2. 2
      scripts/cypress/cypress.json
  3. 13
      scripts/cypress/integration/common/7b_import_from_airtable.js
  4. 120
      scripts/cypress/integration/common/9a_QuickTest.js
  5. 11
      scripts/cypress/integration/test/quickTest.js

4
.github/workflows/ci-cd.yml

@ -581,7 +581,7 @@ jobs:
npm run start:api:cache
npm run start:web
docker-compose -f ./scripts/docker-compose-cypress.yml up -d
spec: "./scripts/cypress/integration/common/9a_QuickTest.js"
spec: "./scripts/cypress/integration/test/quickTest.js"
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json
@ -625,7 +625,7 @@ jobs:
docker-compose -f ./scripts/cypress/docker-compose-pg-cy-quick.yml up -d
npm run start:api:cache:pg:cyquick
npm run start:web
spec: "./scripts/cypress/integration/common/9a_QuickTest.js"
spec: "./scripts/cypress/integration/test/quickTest.js"
wait-on: "http://localhost:8080, http://localhost:3000/_nuxt/runtime.js"
wait-on-timeout: 1200
config-file: scripts/cypress/cypress.json

2
scripts/cypress/cypress.json

@ -21,7 +21,7 @@
"test/pg-restViews.js",
"test/pg-restRoles.js",
"test/pg-restMisc.js",
"common/9a_QuickTest.js"
"test/quickTest.js"
],
"defaultCommandTimeout": 13000,
"pageLoadTimeout": 600000,

13
scripts/cypress/integration/common/7b_import_from_airtable.js

@ -2,6 +2,9 @@
//
import { isTestSuiteActive } from "../../support/page_objects/projectConstants";
import { projectsPage } from "../../support/page_objects/navigation";
import { mainPage } from "../../support/page_objects/mainPage";
let apiKey = ""
let sharedBase = ""
@ -12,6 +15,11 @@ export const genTest = (apiType, dbType) => {
before(() => {
apiKey = Cypress.env("airtable").apiKey;
sharedBase = Cypress.env("airtable").sharedBase;
mainPage.toolBarTopLeft(mainPage.HOME).click({force: true})
projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {})
// projectsPage.openProject("importSample")
// cy.openTableTab("Film", 3)
});
after(() => {});
@ -31,14 +39,13 @@ export const genTest = (apiType, dbType) => {
cy.getActiveModal().find(".nc-btn-airtable-import").should('exist').click()
// it will take a while for import to finish
cy.getActiveModal().find(".nc-btn-go-dashboard", {timeout: 120000}).should('exist').click()
cy.getActiveModal().find(".nc-btn-go-dashboard", {timeout: 180000}).should('exist').click()
});
it("Verify Schema", () => {});
it("Verify Data", () => {});
});
};
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*

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

@ -32,6 +32,12 @@ let records2 = {
Producer: ["P1", "P2"]
};
let tn = [ "Film", "Actor", "Producer", ]
let cn = [ "Name", "Notes", "Status", "Tags", "Done", "Date", "Phone",
"Email", "URL", "Number", "Percent", "Duration", "Rating",
"Actor", "Status (from Actor)", "RollUp", "Computation", "Producer" ]
function openWebhook(index) {
cy.get(".nc-btn-webhook").should("exist").click();
cy.get(".nc-hook").eq(index).click({ force: true });
@ -62,28 +68,51 @@ function verifyWebhook(config) {
cy.get(".nc-icon-hook-navigate-left").click({force:true})
}
export const genTest = (apiType, dbType) => {
export const genTest = (apiType, dbType, testMode) => {
if (!isTestSuiteActive(apiType, dbType)) return;
describe(`Webhook`, () => {
describe(`Quick Tests`, () => {
let cellIdx = 1;
let columnCount = cn.length
if(testMode === 'AT_IMPORT') {
cellIdx = 3;
columnCount -= 3;
}
before(() => {
if( testMode === 'CY_QUICK') {
// cy.task("copyFile")
loginPage.signIn(roles.owner.credentials);
projectsPage.openProject("sample");
}
});
after(() => {});
it("Verify Schema", () => {
cy.openTableTab("Film", 3)
// verify if all tables exist
for(let i=0; i<tn.length; i++)
cy.get(".nc-project-tree").contains(tn[i]).should('exist')
// for Film table, verify columns
for(let i=0; i<columnCount; i++)
cy.get(".nc-grid-header-row").find(`[data-col="${cn[i]}"]`).should('exist')
});
it("Verify Data types", () => {
cy.openTableTab("Film", 3);
// normal cells
for (let [key, value] of Object.entries(records)) {
mainPage.getCell(key, 1).contains(value).should("exist");
mainPage.getCell(key, cellIdx).contains(value).should("exist");
}
// checkbox
mainPage
.getCell("Done", 1)
.getCell("Done", cellIdx)
.find(".mdi-check-circle-outline")
.should(records2.Done ? "exist" : "not.exist");
@ -96,65 +125,68 @@ export const genTest = (apiType, dbType) => {
// rating
mainPage
.getCell("Rating", 1)
.getCell("Rating", cellIdx)
.find("button.mdi-star")
.should("have.length", records2.Rating);
// verifying only one instance as its different for PG & SQLite
// for PG: its Actor1, Actor1
// for SQLite: its Actor1, Actor2
// LinkToAnotherRecord
mainPage.getCell("Actor", 1).scrollIntoView();
mainPage.getCell("Actor", cellIdx).scrollIntoView();
cy.get(
':nth-child(1) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name'
`:nth-child(${cellIdx}) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name`
)
.contains(records2.Actor[0])
.should("exist");
cy.get(
':nth-child(1) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name'
)
.contains(records2.Actor[1])
.should("exist");
// mainPage.getCell("Actor", 1).find(".nc-virtual-cell > .v-lazy > .d-100 > .chips").eq(0).contains("Actor1").should('exist')
// mainPage.getCell("Actor", 1).find(".nc-virtual-cell > .v-lazy > .d-100 > .chips").eq(1).contains("Actor2").should('exist')
// cy.get(
// `:nth-child(${cellIdx}) > [data-col="Actor"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name`
// )
// .contains(records2.Actor[1])
// .should("exist");
// lookup
mainPage.getCell("Status (from Actor)", 1).scrollIntoView();
mainPage.getCell("Status (from Actor)", cellIdx).scrollIntoView();
cy.get(
':nth-child(1) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(1) > .v-chip__content > div > .set-item'
`:nth-child(${cellIdx}) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(1) > .v-chip__content > div > .set-item`
)
.contains(records2["Status (from Actor)"][0])
.should("exist");
cy.get(
':nth-child(1) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(2) > .v-chip__content > div > .set-item'
)
.contains(records2["Status (from Actor)"][1])
.should("exist");
// cy.get(
// `:nth-child(${cellIdx}) > [data-col="Status (from Actor)"] > .nc-virtual-cell > .v-lazy > .d-flex > :nth-child(2) > .v-chip__content > div > .set-item`
// )
// .contains(records2["Status (from Actor)"][1])
// .should("exist");
// rollup
mainPage.getCell("RollUp", 1).scrollIntoView();
// cy.get(':nth-child(1) > [data-col="RollUp"] > .nc-virtual-cell > .v-lazy > span').contains(records2.RollUp).should('exist')
cy.get(`:nth-child(1) > [data-col="RollUp"] > .nc-virtual-cell`)
if( testMode === 'CY_QUICK') {
mainPage.getCell("RollUp", cellIdx).scrollIntoView();
cy.get(`:nth-child(${cellIdx}) > [data-col="RollUp"] > .nc-virtual-cell`)
.contains(records2.RollUp)
.should("exist");
// formula
mainPage.getCell("Computation", 1).scrollIntoView();
mainPage.getCell("Computation", cellIdx).scrollIntoView();
cy.get(
`:nth-child(1) > [data-col="Computation"] > .nc-virtual-cell`
`:nth-child(${cellIdx}) > [data-col="Computation"] > .nc-virtual-cell`
)
.contains(records2.Computation)
.should("exist");
// ltar hm relation
mainPage.getCell("Producer", 1).scrollIntoView();
mainPage.getCell("Producer", cellIdx).scrollIntoView();
cy.get(
':nth-child(1) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name'
`:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name`
)
.contains(records2.Producer[0])
.should("exist");
cy.get(
':nth-child(1) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name'
`:nth-child(${cellIdx}) > [data-col="Producer"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(2) > .v-chip__content > .name`
)
.contains(records2.Producer[1])
.should("exist");
}
cy.closeTableTab("Film");
});
@ -215,6 +247,7 @@ export const genTest = (apiType, dbType) => {
});
it("Verify Webhooks", () => {
if( testMode === 'CY_QUICK') {
cy.openTableTab("Actor", 25);
openWebhook(0)
verifyWebhook({
@ -250,7 +283,7 @@ export const genTest = (apiType, dbType) => {
cy.get("body").type("{esc}");
cy.closeTableTab("Actor");
}
});
it("Pagination", () => {
@ -279,7 +312,8 @@ export const genTest = (apiType, dbType) => {
cy.get(".nc-grid-header-cell").contains('Name').should("be.visible");
cy.get(".nc-grid-header-cell").contains('Notes').should("be.visible");
cy.get(".nc-grid-header-cell").contains('Attachments').should("not.be.visible");
// fix me!
if(testMode !== 'AT_IMPORT') cy.get(".nc-grid-header-cell").contains('Attachments').should("not.be.visible");
cy.get(".nc-grid-header-cell").contains('Status').should("be.visible");
cy.get(".nc-grid-header-cell").contains('Film').should("be.visible");
@ -320,6 +354,8 @@ export const genTest = (apiType, dbType) => {
});
it("Views, bt relation", () => {
if( testMode === 'CY_QUICK') {
cy.openTableTab("Producer", 3)
cy.get('.nc-grid-view-item').should('have.length', 4)
cy.get('.nc-form-view-item').should('have.length', 4)
@ -334,11 +370,31 @@ export const genTest = (apiType, dbType) => {
.should("exist");
cy.closeTableTab("Producer")
}
})
it("Delete Project", () => {
if( testMode === 'AT_IMPORT') {
mainPage.toolBarTopLeft(mainPage.HOME).click({force:true})
cy.get(`.mdi-delete-outline`, {
timeout: 10000,
})
.should("exist")
.last()
.click();
cy.getActiveModal()
.find("button")
.contains("Submit")
.should("exist")
.click();
cy.toastWait("deleted successfully");
}
});
});
};
genTest("rest", "xcdb");
// genTest("rest", "xcdb");
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd

11
scripts/cypress/integration/test/quickTest.js

@ -1,14 +1,17 @@
let t7b = require("../common/7b_import_from_airtable");
let t9a = require("../common/9a_QuickTest");
const {
setCurrentMode,
} = require("../../support/page_objects/projectConstants");
// use 0 as mode to execute individual files (debug mode, skip pre-configs)
// use 1 mode if noco.db doesnt contain user credentials (full run over GIT)
const nocoTestSuite = (apiType, dbType) => {
setCurrentMode(apiType, dbType);
t9a.genTest(apiType, dbType);
// CY Migration verification / Quick test
t9a.genTest(apiType, dbType, "CY_QUICK");
// AT Import verification
t7b.genTest(apiType, dbType)
t9a.genTest(apiType, dbType, "AT_IMPORT");
};
nocoTestSuite("rest", "xcdb");

Loading…
Cancel
Save