|
|
@ -1,6 +1,6 @@ |
|
|
|
import { isTestSuiteActive } from "../../support/page_objects/projectConstants"; |
|
|
|
import { isTestSuiteActive } from '../../support/page_objects/projectConstants'; |
|
|
|
import { loginPage } from "../../support/page_objects/navigation"; |
|
|
|
import { loginPage } from '../../support/page_objects/navigation'; |
|
|
|
import { mainPage } from "../../support/page_objects/mainPage"; |
|
|
|
import { mainPage } from '../../support/page_objects/mainPage'; |
|
|
|
|
|
|
|
|
|
|
|
function capitalizeFirstLetter(string) { |
|
|
|
function capitalizeFirstLetter(string) { |
|
|
|
return string.charAt(0).toUpperCase() + string.slice(1); |
|
|
|
return string.charAt(0).toUpperCase() + string.slice(1); |
|
|
@ -17,7 +17,7 @@ function capitalizeFirstLetter(string) { |
|
|
|
function verifyExpandFormHeader(title) { |
|
|
|
function verifyExpandFormHeader(title) { |
|
|
|
cy.get( |
|
|
|
cy.get( |
|
|
|
`.nc-drawer-expanded-form .nc-expanded-form-header :contains("${title}")` |
|
|
|
`.nc-drawer-expanded-form .nc-expanded-form-header :contains("${title}")` |
|
|
|
).should("exist"); |
|
|
|
).should('exist'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const genTest = (apiType, dbType) => { |
|
|
|
export const genTest = (apiType, dbType) => { |
|
|
@ -29,7 +29,7 @@ export const genTest = (apiType, dbType) => { |
|
|
|
|
|
|
|
|
|
|
|
// open a table to work on views
|
|
|
|
// open a table to work on views
|
|
|
|
//
|
|
|
|
//
|
|
|
|
cy.openTableTab("Country", 25); |
|
|
|
cy.openTableTab('Country', 25); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
|
beforeEach(() => { |
|
|
@ -42,7 +42,7 @@ export const genTest = (apiType, dbType) => { |
|
|
|
|
|
|
|
|
|
|
|
after(() => { |
|
|
|
after(() => { |
|
|
|
cy.restoreLocalStorage(); |
|
|
|
cy.restoreLocalStorage(); |
|
|
|
cy.closeTableTab("Country"); |
|
|
|
cy.closeTableTab('Country'); |
|
|
|
cy.saveLocalStorage(); |
|
|
|
cy.saveLocalStorage(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -55,93 +55,92 @@ export const genTest = (apiType, dbType) => { |
|
|
|
cy.get(`.nc-create-${viewType}-view`).click(); |
|
|
|
cy.get(`.nc-create-${viewType}-view`).click(); |
|
|
|
|
|
|
|
|
|
|
|
// Pop up window, click Submit (accepting default name for view)
|
|
|
|
// Pop up window, click Submit (accepting default name for view)
|
|
|
|
cy.getActiveModal(".nc-modal-view-create") |
|
|
|
cy.getActiveModal('.nc-modal-view-create') |
|
|
|
.find(".ant-btn-primary") |
|
|
|
.find('.ant-btn-primary') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
cy.toastWait("View created successfully"); |
|
|
|
cy.toastWait('View created successfully'); |
|
|
|
|
|
|
|
|
|
|
|
// validate if view was created && contains default name 'Country1'
|
|
|
|
// validate if view was created && contains default name 'Country1'
|
|
|
|
cy.get(`.nc-${viewType}-view-item`) |
|
|
|
cy.get(`.nc-${viewType}-view-item`) |
|
|
|
.contains(`${capitalizeFirstLetter(viewType)}-1`) |
|
|
|
.contains(`${capitalizeFirstLetter(viewType)}-1`) |
|
|
|
.should("exist"); |
|
|
|
.should('exist'); |
|
|
|
|
|
|
|
|
|
|
|
if (viewType === "gallery") { |
|
|
|
if (viewType === 'gallery') { |
|
|
|
cy.intercept('/api/v1/db/meta/galleries/*').as('getGalleryView'); |
|
|
|
// cy.intercept('/api/v1/db/meta/galleries/*').as('getGalleryView');
|
|
|
|
|
|
|
|
|
|
|
|
// mainPage.unhideField("City List");
|
|
|
|
// mainPage.unhideField("City List");
|
|
|
|
cy.get(".nc-fields-menu-btn").click(); |
|
|
|
cy.get('.nc-fields-menu-btn').click(); |
|
|
|
cy.getActiveMenu(".nc-dropdown-fields-menu") |
|
|
|
cy.getActiveMenu('.nc-dropdown-fields-menu') |
|
|
|
.find(`.nc-fields-list label:contains("City List"):visible`) |
|
|
|
.find(`.nc-fields-list label:contains("City List"):visible`) |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
cy.get(".nc-fields-menu-btn").click(); |
|
|
|
cy.get('.nc-fields-menu-btn').click(); |
|
|
|
|
|
|
|
|
|
|
|
cy.get('.ant-card-body [title="City List"]').should("exist"); |
|
|
|
cy.get('.ant-card-body [title="City List"]').should('exist'); |
|
|
|
// cy.wait(5000);
|
|
|
|
cy.wait(1000); |
|
|
|
|
|
|
|
// cy.wait(['@getGalleryView'])
|
|
|
|
cy.wait(['@getGalleryView']) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it(`Expand a row in ${viewType} and verify url`, () => { |
|
|
|
it(`Expand a row in ${viewType} and verify url`, () => { |
|
|
|
// click on first row-expand if grid & first card if its gallery
|
|
|
|
// click on first row-expand if grid & first card if its gallery
|
|
|
|
if (viewType === "grid") { |
|
|
|
if (viewType === 'grid') { |
|
|
|
cy.get(".nc-row-expand").first().click({ force: true }); |
|
|
|
cy.get('.nc-row-expand').first().click({ force: true }); |
|
|
|
} else if (viewType === "gallery") { |
|
|
|
} else if (viewType === 'gallery') { |
|
|
|
cy.get(".nc-gallery-container .ant-card").first().click(); |
|
|
|
cy.get('.nc-gallery-container .ant-card').first().click(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ensure expand draw is open
|
|
|
|
// ensure expand draw is open
|
|
|
|
verifyExpandFormHeader("Afghanistan"); |
|
|
|
verifyExpandFormHeader('Afghanistan'); |
|
|
|
cy.url().should("include", "rowId=1"); |
|
|
|
cy.url().should('include', 'rowId=1'); |
|
|
|
|
|
|
|
|
|
|
|
// spy on clipboard to verify copied text
|
|
|
|
// spy on clipboard to verify copied text
|
|
|
|
// creating alias for clipboard
|
|
|
|
// creating alias for clipboard
|
|
|
|
cy.window().then((win) => { |
|
|
|
cy.window().then((win) => { |
|
|
|
cy.spy(win.navigator.clipboard, "writeText").as("copy"); |
|
|
|
cy.spy(win.navigator.clipboard, 'writeText').as('copy'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// copy url
|
|
|
|
// copy url
|
|
|
|
cy.getActiveDrawer(".nc-drawer-expanded-form") |
|
|
|
cy.getActiveDrawer('.nc-drawer-expanded-form') |
|
|
|
.should("exist") |
|
|
|
.should('exist') |
|
|
|
.find(".nc-copy-row-url") |
|
|
|
.find('.nc-copy-row-url') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
// use alias; verify if clipboard was called with correct text
|
|
|
|
// use alias; verify if clipboard was called with correct text
|
|
|
|
cy.get("@copy").should("be.calledWithMatch", `?rowId=1`); |
|
|
|
cy.get('@copy').should('be.calledWithMatch', `?rowId=1`); |
|
|
|
|
|
|
|
|
|
|
|
// close expanded form
|
|
|
|
// close expanded form
|
|
|
|
cy.getActiveDrawer(".nc-drawer-expanded-form") |
|
|
|
cy.getActiveDrawer('.nc-drawer-expanded-form') |
|
|
|
.find(".nc-expand-form-close-btn") |
|
|
|
.find('.nc-expand-form-close-btn') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it(`Visit a ${viewType} row url and verify expanded form`, () => { |
|
|
|
it(`Visit a ${viewType} row url and verify expanded form`, () => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.visit( |
|
|
|
cy.visit( |
|
|
|
"/" + url.split("/").slice(3).join("/").split("?")[0] + "?rowId=2" |
|
|
|
'/' + url.split('/').slice(3).join('/').split('?')[0] + '?rowId=2' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
verifyExpandFormHeader("Algeria"); |
|
|
|
verifyExpandFormHeader('Algeria'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it(`Visit an invalid ${viewType} row url and verify expanded form`, () => { |
|
|
|
it(`Visit an invalid ${viewType} row url and verify expanded form`, () => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.visit( |
|
|
|
cy.visit( |
|
|
|
"/" + |
|
|
|
'/' + |
|
|
|
url.split("/").slice(3).join("/").split("?")[0] + |
|
|
|
url.split('/').slice(3).join('/').split('?')[0] + |
|
|
|
"?rowId=99999999" |
|
|
|
'?rowId=99999999' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
cy.toastWait("Record not found"); |
|
|
|
cy.toastWait('Record not found'); |
|
|
|
|
|
|
|
|
|
|
|
cy.get(`.nc-drawer-expanded-form .ant-drawer-content:visible`).should( |
|
|
|
cy.get(`.nc-drawer-expanded-form .ant-drawer-content:visible`).should( |
|
|
|
"not.exist" |
|
|
|
'not.exist' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// defaults to corresponding grid / gallery view
|
|
|
|
// defaults to corresponding grid / gallery view
|
|
|
|
cy.get(viewType === "grid" ? ".nc-grid" : ".nc-gallery").should( |
|
|
|
cy.get(viewType === 'grid' ? '.nc-grid' : '.nc-gallery').should( |
|
|
|
"exist" |
|
|
|
'exist' |
|
|
|
); |
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -149,54 +148,54 @@ export const genTest = (apiType, dbType) => { |
|
|
|
it(`Visit a ${viewType} row url and verify nested expanded form`, () => { |
|
|
|
it(`Visit a ${viewType} row url and verify nested expanded form`, () => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.url().then((url) => { |
|
|
|
cy.visit( |
|
|
|
cy.visit( |
|
|
|
"/" + url.split("/").slice(3).join("/").split("?")[0] + "?rowId=1" |
|
|
|
'/' + url.split('/').slice(3).join('/').split('?')[0] + '?rowId=1' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
verifyExpandFormHeader("Afghanistan"); |
|
|
|
verifyExpandFormHeader('Afghanistan'); |
|
|
|
|
|
|
|
|
|
|
|
cy.get(".nc-drawer-expanded-form .ant-drawer-content").should( |
|
|
|
cy.get('.nc-drawer-expanded-form .ant-drawer-content').should( |
|
|
|
"exist" |
|
|
|
'exist' |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
cy.getActiveDrawer(".nc-drawer-expanded-form") |
|
|
|
cy.getActiveDrawer('.nc-drawer-expanded-form') |
|
|
|
.find(".ant-card-body") |
|
|
|
.find('.ant-card-body') |
|
|
|
.first() |
|
|
|
.first() |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
cy.get(".nc-drawer-expanded-form .ant-drawer-content").should( |
|
|
|
cy.get('.nc-drawer-expanded-form .ant-drawer-content').should( |
|
|
|
"have.length", |
|
|
|
'have.length', |
|
|
|
2 |
|
|
|
2 |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
cy.wait(1000); |
|
|
|
cy.wait(1000); |
|
|
|
|
|
|
|
|
|
|
|
verifyExpandFormHeader("Kabul"); |
|
|
|
verifyExpandFormHeader('Kabul'); |
|
|
|
|
|
|
|
|
|
|
|
// close expanded forms
|
|
|
|
// close expanded forms
|
|
|
|
cy.getActiveDrawer(".nc-drawer-expanded-form") |
|
|
|
cy.getActiveDrawer('.nc-drawer-expanded-form') |
|
|
|
.find(".ant-btn") |
|
|
|
.find('.ant-btn') |
|
|
|
.contains("Cancel") |
|
|
|
.contains('Cancel') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
|
|
|
|
|
|
|
|
verifyExpandFormHeader("Afghanistan"); |
|
|
|
verifyExpandFormHeader('Afghanistan'); |
|
|
|
|
|
|
|
|
|
|
|
cy.getActiveDrawer(".nc-drawer-expanded-form") |
|
|
|
cy.getActiveDrawer('.nc-drawer-expanded-form') |
|
|
|
.find(".ant-btn") |
|
|
|
.find('.ant-btn') |
|
|
|
.contains("Cancel") |
|
|
|
.contains('Cancel') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it("Delete view", () => { |
|
|
|
it('Delete view', () => { |
|
|
|
cy.get(".nc-view-delete-icon").click({ force: true }); |
|
|
|
cy.get('.nc-view-delete-icon').click({ force: true }); |
|
|
|
cy.getActiveModal(".nc-modal-view-delete") |
|
|
|
cy.getActiveModal('.nc-modal-view-delete') |
|
|
|
.find(".ant-btn-dangerous") |
|
|
|
.find('.ant-btn-dangerous') |
|
|
|
.click(); |
|
|
|
.click(); |
|
|
|
cy.toastWait("View deleted successfully"); |
|
|
|
cy.toastWait('View deleted successfully'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// viewTest("grid"); // grid view
|
|
|
|
// viewTest("grid"); // grid view
|
|
|
|
viewTest("gallery"); // gallery view
|
|
|
|
viewTest('gallery'); // gallery view
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|