From b9ed11712ecd3a1f66475c823f5ab4f0ebb3c3f2 Mon Sep 17 00:00:00 2001 From: Peter Hudec Date: Mon, 9 Sep 2024 15:23:10 +0100 Subject: [PATCH] Just testing a flaky test --- .circleci/config.yml | 56 +++++++++---------- Makefile | 2 +- package.json | 2 +- .../investments/project-add-evidence-spec.js | 29 +++++----- 4 files changed, 46 insertions(+), 43 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 29da0eb3da7..5c286a2d5f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -225,32 +225,32 @@ workflows: version: 2 datahub: jobs: - - lint: *ignore_ghpages - - unit_tests: *ignore_ghpages - - unit_client_tests: *ignore_ghpages + # - lint: *ignore_ghpages + # - unit_tests: *ignore_ghpages + # - unit_client_tests: *ignore_ghpages - functional_tests: *ignore_ghpages - - a11y_tests: *ignore_ghpages - - component_tests: *ignore_ghpages - - e2e_tests: - <<: *ignore_ghpages - name: e2e_tests_<< matrix.staff >> - matrix: - parameters: - staff: [da, lep] - - e2e_tests_dit: - <<: *ignore_ghpages - name: e2e_tests_dit - matrix: - parameters: - staff: [dit] - - release-storybook: - <<: *ignore_ghpages - filters: - branches: - only: - - main - - merge-and-publish-coverage: - <<: *ignore_ghpages - requires: - - functional_tests - - unit_tests + # - a11y_tests: *ignore_ghpages + # - component_tests: *ignore_ghpages + # - e2e_tests: + # <<: *ignore_ghpages + # name: e2e_tests_<< matrix.staff >> + # matrix: + # parameters: + # staff: [da, lep] + # - e2e_tests_dit: + # <<: *ignore_ghpages + # name: e2e_tests_dit + # matrix: + # parameters: + # staff: [dit] + # - release-storybook: + # <<: *ignore_ghpages + # filters: + # branches: + # only: + # - main + # - merge-and-publish-coverage: + # <<: *ignore_ghpages + # requires: + # - functional_tests + # - unit_tests diff --git a/Makefile b/Makefile index a029e1793dc..18ce8835450 100644 --- a/Makefile +++ b/Makefile @@ -104,7 +104,7 @@ endif functional-tests: @echo "*** Requires the mock stack, it can be started with 'make start-mock' ***" - $(docker-mock) exec frontend bash -c '$(wait-for-frontend) && npm run test:functional $(cypress-spec-args)' + $(docker-mock) exec frontend bash -c '$(wait-for-frontend) && npm run test:functional' a11y-tests: @echo "*** Requires the mock stack, it can be started with 'make start-mock' ***" diff --git a/package.json b/package.json index de6b38d36ef..ea456fbefe0 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test": "run-s test:*", "test:unit:files": "f() { NODE_ENV=test API_ROOT=http://test LOG_LEVEL=info MOCHA_FILE=junit/test-results.xml npx mocha \"${@:-./src/**/*.test.js}\"; }; f", "test:unit": "NODE_ENV=test API_ROOT=http://test LOG_LEVEL=info MOCHA_FILE=junit/test-results.xml npx mocha ./src/**/*.test.js --exit", - "test:functional": "CYPRESS_retries=3 nyc cypress run --browser chrome", + "test:functional": "cypress run --browser chrome --spec test/functional/cypress/specs/investments/project-add-evidence-spec.js", "test:a11y": "CYPRESS_coverage=false cypress run --config-file cypress.a11y.config.js --browser chrome", "test:a11y:watch": "CYPRESS_coverage=false cypress open --config-file cypress.a11y.config.js --e2e --browser chrome", "test:unit-client": "NODE_ENV=test WEBPACK_ENV=develop MOCHA_FILE=junit/test-results.xml npx mochapack --webpack-config webpack.node.config.js --opts ./test/unit-client/mocha.opts ./test/unit-client/assets/javascripts/**/*.test.{js,jsx}", diff --git a/test/functional/cypress/specs/investments/project-add-evidence-spec.js b/test/functional/cypress/specs/investments/project-add-evidence-spec.js index bb7a08b303e..b9e47968b7a 100644 --- a/test/functional/cypress/specs/investments/project-add-evidence-spec.js +++ b/test/functional/cypress/specs/investments/project-add-evidence-spec.js @@ -151,21 +151,24 @@ describe('Investment project add evidence', () => { }) }) - it('should show an error if the file uploaded is greater than the max file size', () => { - const moreThanFiftyMb = 50 * 1024 * 1024 + 1 - const bigFile = Cypress.Buffer.alloc(moreThanFiftyMb) - bigFile.write('X', moreThanFiftyMb) - cy.get('input[type=file]').selectFile({ - contents: bigFile, - fileName: 'more-than50mb.txt', - mimeType: 'text/plain', + Cypress._.range(10).forEach(() => { + it.only('should show an error if the file uploaded is greater than the max file size', () => { + const moreThanFiftyMb = 50 * 1024 * 1024 + 1 + const bigFile = Cypress.Buffer.alloc(moreThanFiftyMb) + bigFile.write('X', moreThanFiftyMb) + cy.get('input[type=file]').selectFile({ + contents: bigFile, + fileName: 'more-than50mb.txt', + mimeType: 'text/plain', + }) + + cy.get('[data-test="criteria_field_0"]').find('select').select(1) + cy.get('[data-test="submit-button"').click() + cy.get('[data-test="error-dialog') + .should('exist') + .and('contain', 'File must be no larger than 50Mb') }) - cy.get('[data-test="criteria_field_0"]').find('select').select(1) - cy.get('[data-test="submit-button"').click() - cy.get('[data-test="error-dialog') - .should('exist') - .and('contain', 'File must be no larger than 50Mb') }) }) })