From d4f971f0739a536d207b8f9c29c9b21c3828f80e Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 29 Aug 2022 09:15:06 +0530 Subject: [PATCH] test: CY migration for pagination, airtable import Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../common/7b_import_from_airtable.js | 10 ++-- .../integration/common/9a_QuickTest.js | 58 ++++++++++++++----- .../support/page_objects/navigation.js | 2 + 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/scripts/cypress-v2/integration/common/7b_import_from_airtable.js b/scripts/cypress-v2/integration/common/7b_import_from_airtable.js index 4222b7809c..22314c8e10 100644 --- a/scripts/cypress-v2/integration/common/7b_import_from_airtable.js +++ b/scripts/cypress-v2/integration/common/7b_import_from_airtable.js @@ -13,7 +13,6 @@ export const genTest = (apiType, dbType) => { describe(`Import from airtable`, () => { before(() => { - cy.fileHook(); apiKey = Cypress.env("airtable").apiKey; sharedBase = Cypress.env("airtable").sharedBase; @@ -21,14 +20,17 @@ export const genTest = (apiType, dbType) => { projectsPage.createProject({ dbType: "none", apiType: "REST", name: "importSample" }, {}) }); - after(() => {}); + after(() => { + cy.saveLocalStorage(); + }); it("Import", () => { cy.log(apiKey, sharedBase); // trigger import - cy.get(`[data-menu-id="addORImport"]`).click(); - cy.getActivePopUp().contains("Airtable").should('exist').click(); + cy.get('.nc-add-new-table').should('exist').trigger('mouseover') + cy.get('.nc-import-menu').should('exist').click() + cy.getActiveMenu().find('.ant-dropdown-menu-item').contains('Airtable').click() cy.getActiveModal().find(".nc-input-api-key").should('exist').clear().type(apiKey) cy.getActiveModal().find(".nc-input-shared-base").should('exist').clear().type(sharedBase) diff --git a/scripts/cypress-v2/integration/common/9a_QuickTest.js b/scripts/cypress-v2/integration/common/9a_QuickTest.js index f9b3e9a52d..d3437d6610 100644 --- a/scripts/cypress-v2/integration/common/9a_QuickTest.js +++ b/scripts/cypress-v2/integration/common/9a_QuickTest.js @@ -81,7 +81,8 @@ export const genTest = (apiType, dbType, testMode) => { } before(() => { - cy.fileHook(); + cy.restoreLocalStorage(); + if( testMode === 'CY_QUICK') { // cy.task("copyFile") loginPage.signIn(roles.owner.credentials); @@ -102,7 +103,20 @@ export const genTest = (apiType, dbType, testMode) => { cy.restoreLocalStorage(); }) - after(() => {}); + // afterEach(() => { + // cy.saveLocalStorage(); + // }) + + after(() => { + // sign out + cy.visit(`/`); + cy.wait(5000); + cy.get('.nc-menu-accounts').should('exist').click(); + cy.getActiveMenu().find('.ant-dropdown-menu-item').eq(1).click(); + + cy.wait(5000); + cy.get('button:contains("SIGN")').should('exist') + }); it("Verify Schema", () => { cy.openTableTab("Film", 3) @@ -221,8 +235,10 @@ export const genTest = (apiType, dbType, testMode) => { it("Verify Views & Shared base", () => { cy.openTableTab("Film", 3); mainPage.toggleRightSidebar(); - cy.get('.nc-form-view-item').eq(0) - .click({ force: true }) + cy.get('.nc-form-view-item:visible') + .should('exist') + .eq(0) + .click({ force: true }) // Header & description should exist // cy.get(".nc-form") @@ -345,29 +361,38 @@ export const genTest = (apiType, dbType, testMode) => { mainPage.getPagination(">").click(); mainPage .getPagination(2) - .should("have.class", "v-pagination__item--active"); + .should("have.class", "ant-pagination-item-active"); // verify < pagination option mainPage.getPagination("<").click(); mainPage .getPagination(1) - .should("have.class", "v-pagination__item--active"); + .should("have.class", "ant-pagination-item-active"); cy.closeTableTab("Actor"); }); it("Verify Fields, Filter & Sort", () => { cy.openTableTab("Actor", 25); + mainPage.toggleRightSidebar(); + cy.get(".nc-grid-view-item").eq(1).click() - 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").find(`th[data-title="Name"]`).should("be.visible"); + cy.get(".nc-grid-header").find(`th[data-title="Notes"]`).should("be.visible"); + cy.get(".nc-grid-header").find(`th[data-title="Attachments"]`).should("not.exist"); + cy.get(".nc-grid-header").find(`th[data-title="Status"]`).should("be.visible"); + cy.get(".nc-grid-header").find(`th[data-title="Film"]`).should("be.visible"); + + // cy.get(".nc-grid-header").contains('Notes').should("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"); + // 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"); + + cy.wait(2000); + cy.get(".nc-fields-menu-btn").click() - cy.get(".nc-fields-menu-btn").click(); cy.getActiveMenu().find(`[type="checkbox"]`).eq(0).should('be.checked') cy.getActiveMenu().find(`[type="checkbox"]`).eq(1).should('be.checked') cy.getActiveMenu().find(`[type="checkbox"]`).eq(2).should('not.be.checked') @@ -407,15 +432,18 @@ export const genTest = (apiType, dbType, testMode) => { if( testMode === 'CY_QUICK') { cy.openTableTab("Producer", 3) + mainPage.toggleRightSidebar(); + cy.get('.nc-grid-view-item').should('have.length', 4) cy.get('.nc-form-view-item').should('have.length', 4) cy.get('.nc-gallery-view-item').should('have.length', 3) // LinkToAnotherRecord hm relation mainPage.getCell("FilmRead", 1).scrollIntoView(); - cy.get( - ':nth-child(1) > [data-col="FilmRead"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name' - ) + cy.get('[data-title="FilmRead"] > .h-full > .nc-virtual-cell > .w-full > .chips > .chip > .name') + // cy.get( + // ':nth-child(1) > [data-col="FilmRead"] > .nc-virtual-cell > .v-lazy > .d-100 > .chips > :nth-child(1) > .v-chip__content > .name' + // ) .contains('Movie-1') .should("exist"); diff --git a/scripts/cypress-v2/support/page_objects/navigation.js b/scripts/cypress-v2/support/page_objects/navigation.js index 18772f56c8..6d3d71342c 100644 --- a/scripts/cypress-v2/support/page_objects/navigation.js +++ b/scripts/cypress-v2/support/page_objects/navigation.js @@ -137,6 +137,8 @@ export class _projectsPage { cy.get(".nc-metadb-project-name").should("exist"); cy.contains("button", "Create").should("exist"); + cy.wait(1000) + // feed project name cy.get(".nc-metadb-project-name", { timeout: 20000 }).clear().type( projectName