From fdb4d22d81be6c07d607882577f7a6addba2f1cc Mon Sep 17 00:00:00 2001 From: Ryan Bogan Date: Tue, 23 Jan 2024 17:10:36 -0800 Subject: [PATCH] Fix broken build and failing tests (#572) * Fix broken build and failing tests Signed-off-by: Ryan Bogan --- .babelrc | 4 ++-- .github/workflows/cypress-workflow.yml | 5 +++-- CHANGELOG.md | 1 + babel.config.js | 4 ++-- cypress.config.js | 1 + cypress/e2e/documentsLayer.cy.js | 4 ++-- cypress/plugins/index.js | 7 +++++++ .../vector_upload_options.test.tsx.snap | 16 ++++++++++++---- .../__snapshots__/filter-by_shape.test.tsx.snap | 6 +++++- public/components/vector_upload_options.tsx | 2 +- 10 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.babelrc b/.babelrc index a14d6b62..368a96df 100644 --- a/.babelrc +++ b/.babelrc @@ -13,7 +13,7 @@ "@babel/plugin-syntax-jsx", "@babel/plugin-transform-modules-commonjs", ["@babel/plugin-transform-runtime", { "regenerator": true }], - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-object-rest-spread" + "@babel/plugin-transform-class-properties", + "@babel/plugin-transform-object-rest-spread" ] } diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 85f7a049..cd2bf864 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -111,7 +111,7 @@ jobs: - name: Run OpenSearch Dashboards server run: | cd OpenSearch-Dashboards - yarn start --no-base-path --no-watch & + yarn start --no-base-path --no-watch --server.host="0.0.0.0" & shell: bash - name: Sleep until OSD server starts - windows @@ -155,8 +155,9 @@ jobs: uses: cypress-io/github-action@v5 with: working-directory: OpenSearch-Dashboards/plugins/dashboards-maps - command: yarn run cypress run --browser chrome + command: yarn run cypress run --browser electron wait-on: 'http://localhost:5601' + wait-on-timeout: 300 env: CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cc6c097..47a3792f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,4 +20,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Infrastructure ### Documentation ### Maintenance +* Fix broken build and failing tests [#572](https://github.com/opensearch-project/dashboards-maps/pull/572) ### Refactoring diff --git a/babel.config.js b/babel.config.js index fa274ac8..909f5b18 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,8 +10,8 @@ module.exports = { require('@babel/preset-typescript'), ], plugins: [ - require('@babel/plugin-proposal-class-properties'), - require('@babel/plugin-proposal-object-rest-spread'), + require('@babel/plugin-transform-class-properties'), + require('@babel/plugin-transform-object-rest-spread'), ['@babel/plugin-transform-modules-commonjs', { allowTopLevelThis: true }], [require('@babel/plugin-transform-runtime'), { regenerator: true }], ], diff --git a/cypress.config.js b/cypress.config.js index 10f29496..1bba18a4 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,6 +1,7 @@ const { defineConfig } = require('cypress') module.exports = defineConfig({ + video: true, defaultCommandTimeout: 120000, env: { opensearch_url: 'localhost:9200', diff --git a/cypress/e2e/documentsLayer.cy.js b/cypress/e2e/documentsLayer.cy.js index 79059d16..2355f468 100644 --- a/cypress/e2e/documentsLayer.cy.js +++ b/cypress/e2e/documentsLayer.cy.js @@ -36,9 +36,9 @@ describe('Documents layer', () => { cy.get(`button[testSubj="styleTab"]`).click(); cy.contains('Fill color').click(); cy.get(`button[aria-label="Select #E7664C as the color"]`).click(); - cy.contains('Border color').click(); + cy.wait(1000).contains('Border color').click(); cy.get(`button[aria-label="Select #DA8B45 as the color"]`).click(); - cy.get(`button[testSubj="settingsTab"]`).click(); + cy.wait(1000).get(`button[testSubj="settingsTab"]`).click(); cy.get('[name="layerName"]').clear().type('Documents layer 1'); cy.get(`button[data-test-subj="updateButton"]`).click(); cy.get('[data-test-subj="layerControlPanel"]').should('contain', 'Documents layer 1'); diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index f58b65e0..947eb458 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -24,6 +24,13 @@ * @type {Cypress.PluginConfig} */ module.exports = (on, config) => { + on('before:browser:launch', (browser = {}, launchOptions) => { + if (browser.family === 'chromium') { + launchOptions.args.push('--disable-dev-shm-usage'); + } + + return launchOptions; + }); // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config }; diff --git a/public/components/__snapshots__/vector_upload_options.test.tsx.snap b/public/components/__snapshots__/vector_upload_options.test.tsx.snap index 0c36eed6..b2cfd5f8 100644 --- a/public/components/__snapshots__/vector_upload_options.test.tsx.snap +++ b/public/components/__snapshots__/vector_upload_options.test.tsx.snap @@ -75,7 +75,11 @@ Object { viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
@@ -166,7 +170,7 @@ Object { Map name guidleines:
  • - Map name prefix must contain 1-250 characters. + Map name prefix must contain 1-250 characters.
  • Map name prefix must start with a-z. @@ -294,7 +298,11 @@ Object { viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg" - /> + > + +
    @@ -385,7 +393,7 @@ Object { Map name guidleines:
    • - Map name prefix must contain 1-250 characters. + Map name prefix must contain 1-250 characters.
    • Map name prefix must start with a-z. diff --git a/public/components/toolbar/spatial_filter/__snapshots__/filter-by_shape.test.tsx.snap b/public/components/toolbar/spatial_filter/__snapshots__/filter-by_shape.test.tsx.snap index fc92ba44..c6ba9cc3 100644 --- a/public/components/toolbar/spatial_filter/__snapshots__/filter-by_shape.test.tsx.snap +++ b/public/components/toolbar/spatial_filter/__snapshots__/filter-by_shape.test.tsx.snap @@ -73,7 +73,11 @@ exports[`render polygon renders filter by polygon option 1`] = ` viewBox="0 0 16 16" width={16} xmlns="http://www.w3.org/2000/svg" - /> + > + +
diff --git a/public/components/vector_upload_options.tsx b/public/components/vector_upload_options.tsx index 9cb34aac..89ce3d59 100644 --- a/public/components/vector_upload_options.tsx +++ b/public/components/vector_upload_options.tsx @@ -373,7 +373,7 @@ const VectorUploadOptions = (props: RegionMapOptionsProps) => { Map name guidleines:
    -
  • Map name prefix must contain 1-250 characters.
  • +
  • Map name prefix must contain 1-250 characters.
  • Map name prefix must start with a-z.
  • Valid characters are a-z, 0-9, - and _ .