From ccace74a6f220a91c5d5ade93c85ade40f29469b Mon Sep 17 00:00:00 2001 From: William Wu <105890943+williamw04@users.noreply.github.com> Date: Sat, 11 Jan 2025 23:42:53 -0500 Subject: [PATCH] fix to health issue and addressed other comments --- .gitignore | 2 +- cypress.config.ts | 6 ++-- docker-compose.yml | 16 +++++++-- package-lock.json | 2 +- src/cypress/e2e/test.cy.ts | 70 -------------------------------------- 5 files changed, 18 insertions(+), 78 deletions(-) delete mode 100644 src/cypress/e2e/test.cy.ts diff --git a/.gitignore b/.gitignore index b226eced6..dfe96eab9 100644 --- a/.gitignore +++ b/.gitignore @@ -58,4 +58,4 @@ nohup.out src/server/tmp/* #ui-testing screenshots -cypress/screenshots/ \ No newline at end of file +src/cypress/screenshots/* \ No newline at end of file diff --git a/cypress.config.ts b/cypress.config.ts index 0dd06742d..340228efb 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -1,8 +1,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - import { defineConfig } from "cypress"; + +import { defineConfig } from "cypress"; export default defineConfig({ e2e: { @@ -13,4 +13,4 @@ export default defineConfig({ supportFile: 'src/cypress/support/e2e.ts', screenshotsFolder: 'cypress/screenshots/e2e', }, -}); +}); \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c364ff979..1b354cf39 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,6 +16,11 @@ services: - POSTGRES_PASSWORD=pleaseChange # default postgres password that should be changed for security. volumes: - ./postgres-data:/var/lib/postgresql/data/pgdata + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 10s + retries: 3 # ports: # - "5432:5432" # Uncomment the above lines to enable access to the PostgreSQL server @@ -68,10 +73,15 @@ services: # and comment out the debug port and 3000:3000 line above # Don't bring this up without the DB depends_on: - - database - # database: + # - database + database: # We need the database and it has to be ready for work (see healthcheck above). - # condition: service_healthy + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:3000"] + interval: 10s + timeout: 5s + retries: 5 # Lets docker compose up work right # If environment variable install_args is not set then it becomes blank without warning user. command: diff --git a/package-lock.json b/package-lock.json index 629ecbb91..68bc1cd28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10799,4 +10799,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/cypress/e2e/test.cy.ts b/src/cypress/e2e/test.cy.ts deleted file mode 100644 index 81864a827..000000000 --- a/src/cypress/e2e/test.cy.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - - describe("template spec", () => { - beforeEach(() => { - // Visit the OED application - cy.visit("/"); - }); - - // it('should display the "Graph Type" button and toggle the dropdown', () => { - // // Check if the "Graph Type" button is present - // cy.get('[data-cy="graph-type-title"]').should("be.visible"); - // cy.get('[data-cy="graph-type-button"]').should("be.visible"); - // cy.wait(3000); - // // Click the "Graph Type" button - // cy.get('[data-cy="graph-type-button"]').click(); - // cy.wait(3000); - // // Click the "Graph Type Bar" button - // cy.get('[data-cy="graph-type-button-selected-bar"]').click(); - // cy.wait(3000); - - // cy.get("#react-select-2-input").should("be.visible"); - // cy.get("#react-select-2-input") - // .type("Electric kW + 2-6 kW") - // .type("{enter}"); - - // // Check if the "Bar Stacking" title is present - // cy.get('[data-cy="bar-stacking"]').should("be.visible"); - // cy.wait(3000); - // // Click the "Bar Stacking" checkbox - // cy.get('[data-cy="bar-stacking"]').click(); - // cy.wait(3000); - // // Check if the "Bar Interval" title is present - // cy.get('[data-cy="bar-interval"]').should("be.visible"); - // cy.wait(3000); - // // Click the "Bar Interval - Day" button - // cy.get('[data-cy="day-button"]').click(); - // cy.wait(3000); - // // Check if the "Export Graph" button is present - // cy.get('[data-cy="export-graph"]').should("be.visible"); - // cy.wait(3000); - // // Click the "Export Graph" button - // cy.get('[data-cy="export-graph"]').click(); - // cy.wait(3000); - // // Read the exported CSV file - Actual path may vary (actual path to downloads folder) - // cy.readFile( - // "/Users/roshanpraveenshetty/Desktop/Navya/CST499/OED/cypress/downloads/oedExport_bar_June_1_2021_12_00_00_AM_to_June_6_2021_12_00_00_AM_Electric kW + 2-6 kW_kW.csv" - // ); - // }); - - // it('should display the "Radar Graph Type" button and toggle the dropdown', () => { - // // Check if the "Graph Type" button is present - // cy.get('[data-cy="graph-type-title"]').should("be.visible"); - // cy.get('[data-cy="graph-type-button"]').should("be.visible"); - // cy.wait(3000); - // // Click the "Graph Type" button - // cy.get('[data-cy="graph-type-button"]').click(); - // cy.wait(3000); - // // Click the "Graph Type Bar" button - // cy.get('[data-cy="graph-type-button-selected-radar"]').click(); - // cy.wait(3000); - - // cy.get("#react-select-2-input").should("be.visible"); - // cy.get("#react-select-2-input") - // .type("Electric kW + 2-6 kW") - // .type("{enter}"); - // cy.wait(3000); - // }); -}); \ No newline at end of file