From cd0d63edac910de6511392506ed0843478b5e391 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 24 Aug 2021 16:17:47 +0530 Subject: [PATCH] test(cypress): table creation and relation check Signed-off-by: Pranav C --- ...n_spec.js => app_rest_api_project_spec.js} | 43 ++++++++++++++-- docker-compose-cypress.yml | 51 +++++++++++-------- .../project/spreadsheet/views/xcGridView.vue | 15 +++--- packages/nc-lib-gui/package.json | 2 +- 4 files changed, 78 insertions(+), 33 deletions(-) rename cypress/integration/{firsttime_run_spec.js => app_rest_api_project_spec.js} (59%) diff --git a/cypress/integration/firsttime_run_spec.js b/cypress/integration/app_rest_api_project_spec.js similarity index 59% rename from cypress/integration/firsttime_run_spec.js rename to cypress/integration/app_rest_api_project_spec.js index 068bce0b4b..8c0638f687 100644 --- a/cypress/integration/firsttime_run_spec.js +++ b/cypress/integration/app_rest_api_project_spec.js @@ -1,7 +1,7 @@ -describe('My First Test', () => { +describe('Rest api project test', () => { before(() => { - cy.visit('http://localhost:3000') + cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000}) cy.waitForSpinners(); }) @@ -55,13 +55,48 @@ describe('My First Test', () => { it('Create Table', () => { cy.get('.add-btn').click(); - const name= 'Test' + Date.now(); + const name = 'Test' + Date.now(); cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name) cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase()) - cy.wait(3000) + cy.wait(5000) cy.get('.nc-create-table-card .nc-create-table-submit').first().click() cy.get(`.project-tab:contains(${name})`).should('exist') cy.url().should('contain', `?name=${name}&`) }); + + it('Open and check country table', () => { + cy.contains('Country').first().click({force: true}); + + cy.get(`.project-tab:contains(Country):visible`).should('exist') + cy.url().should('contain', `?name=Country&`) + + cy.get('td[data-col="Country => City"] div:visible').first().click() + cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click() + + cy.get(":contains(Link to 'City'):visible").should('exist') + + cy.get(":contains(Link to 'City'):visible").first().click() + }); + + it('Open and check actor table for m2m', () => { + cy.contains('Actor').first().click({force: true}); + + cy.get(`.project-tab:contains(Actor)`).should('exist') + cy.url().should('contain', `?name=Actor&`) + + cy.get('td[data-col="Actor <=> Film"] div:visible').first().click({force: true}) + cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click({force: true}) + // + // cy.get(":contains(Link to 'City')").should('exist') + // + // cy.get(":contains(Link to 'City'):visible").click() + + cy.get('.child-card:visible').should('exist').first().click() + + cy.contains('Save Row').should('exist'); + cy.contains('Save Row').should('exist'); + + }); + }) diff --git a/docker-compose-cypress.yml b/docker-compose-cypress.yml index eb191e03e5..0c102ce351 100644 --- a/docker-compose-cypress.yml +++ b/docker-compose-cypress.yml @@ -1,34 +1,43 @@ version: "3.5" services: - mysql: - image: mysql:5.7 - restart: always - environment: - MYSQL_ROOT_PASSWORD: password - ports: - - 3306:3306 - volumes: - - ./packages/nocodb/tests/mysql-sakila-db:/docker-entrypoint-initdb.d - healthcheck: - test: "/etc/init.d/mysql status" - interval: 1s - retries: 240 + db80: + network_mode: host + image: mysql:8.0 + restart: always + environment: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + volumes: + - ./packages/nocodb/tests/mysql-sakila-db:/docker-entrypoint-initdb.d xc-cypress-nocodb: + network_mode: host image: node:12.22.1-slim ports: - "8080:8080" volumes: - - ./packages/:/home/packages/ - depends_on: - - mysql + - ./packages/nocodb:/home/app + command: + - /bin/bash + - -c + - | + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + cd /home/app/ && npm i && npm run run + xc-cypress-nc-gui: + network_mode: host + image: node:12.22.1-slim + ports: + - "3000:3000" + environment: + - HOST=0.0.0.0 + - PORT=3000 + volumes: + - ./packages/nc-gui:/home/app + - ./packages/nc-lib-gui:/home/nc-lib-gui command: - /bin/bash - -c - | echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" - apt-get update && apt-get install rsync -y - cp -r /home/packages/ /home/app/ - cd /home/app/nc-gui && npm i && npm run build:copy && cd ../nc-lib-gui && npm i - rm -rf /home/app/nocodb/node_modules/nc-lib-gui - cd /home/app/nocodb && npm i ../nc-lib-gui ; npm i && npm run run + cd /home/app/ && npm i && npm run dev diff --git a/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue b/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue index c198784c62..54d24de61f 100644 --- a/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue +++ b/packages/nc-gui/components/project/spreadsheet/views/xcGridView.vue @@ -2,11 +2,11 @@
- + -
@@ -134,7 +135,7 @@ v-for="(columnObj,col) in availableColumns" v-show="showFields[columnObj.alias]" :key="row + columnObj.alias" - class="cell pointer" + class="cell pointer nc-grid-cell" :class="{ 'active' :!isPublicView && selected.col === col && selected.row === row && isEditable , 'primary-column' : primaryValueColumn === columnObj._cn, @@ -196,7 +197,7 @@
+