From e69bd4a6d47d7ffc06a9e99c6bfc6470ca064597 Mon Sep 17 00:00:00 2001 From: nd0ut Date: Mon, 26 Aug 2024 14:50:42 +0300 Subject: [PATCH] chore: fix e2e tests --- cypress/e2e/index.cy.js | 59 ++++++++++++++++++++++------------------- package-lock.json | 54 ++++++++++++++++--------------------- package.json | 2 +- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/cypress/e2e/index.cy.js b/cypress/e2e/index.cy.js index 4bf676db2..3a7d16354 100644 --- a/cypress/e2e/index.cy.js +++ b/cypress/e2e/index.cy.js @@ -1,6 +1,7 @@ /// /* eslint-env mocha */ /* global cy */ +/* global Cypress */ import { setup } from '../templates' @@ -26,44 +27,48 @@ describe('uploadcare widget', () => { const fileName = 'image.jpeg' setup() - cy.fixture(fileName).then((fileContent) => { - cy.get('.uploadcare--widget__button_type_open').click() + cy.fixture(fileName, 'binary') + .then(Cypress.Blob.binaryStringToBlob) + .then((fileContent) => { + cy.get('.uploadcare--widget__button_type_open').click() - cy.get('.uploadcare--draganddrop').attachFile( - { fileContent, fileName, mimeType: 'image/jpeg' }, - { subjectType: 'drag-n-drop', events: ['dragcenter', 'drop'] } - ) + cy.get('.uploadcare--draganddrop').attachFile( + { fileContent, fileName, mimeType: 'image/jpeg' }, + { subjectType: 'drag-n-drop', events: ['dragcenter', 'drop'] } + ) - cy.get('.uploadcare--progress').should('exist') + cy.get('.uploadcare--progress').should('exist') - cy.get('.uploadcare--link') - .should('exist') - .should('contain.text', fileName) - }) + cy.get('.uploadcare--link') + .should('exist') + .should('contain.text', fileName) + }) }) it('should upload images', () => { const fileName = 'image.jpeg' - cy.fixture(fileName).then((fileContent) => { - setup() + cy.fixture(fileName, 'binary') + .then(Cypress.Blob.binaryStringToBlob) + .then((fileContent) => { + setup() - cy.get('.uploadcare--widget__button_type_open').click() + cy.get('.uploadcare--widget__button_type_open').click() - cy.get( - '.uploadcare--tab_name_file .uploadcare--tab__action-button' - ).click() - cy.get('input[type="file"]').attachFile({ - fileContent, - fileName, - mimeType: 'image/jpeg' - }) + cy.get( + '.uploadcare--tab_name_file .uploadcare--tab__action-button' + ).click() + cy.get('input[type="file"]').attachFile({ + fileContent, + fileName, + mimeType: 'image/jpeg' + }) - cy.get('.uploadcare--progress').should('exist') + cy.get('.uploadcare--progress').should('exist') - cy.get('.uploadcare--link') - .should('exist') - .should('contain.text', fileName) - }) + cy.get('.uploadcare--link') + .should('exist') + .should('contain.text', fileName) + }) }) }) diff --git a/package-lock.json b/package-lock.json index 27a5101ca..5a151ac83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "cpy-cli": "5.0.0", "cross-env": "7.0.3", "cssnano": "6.0.2", - "cypress": "13.6.1", + "cypress": "13.13.3", "cypress-file-upload": "5.0.8", "dotenv": "8.6.0", "eslint": "8.56.0", @@ -5696,21 +5696,20 @@ "dev": true }, "node_modules/cypress": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.1.tgz", - "integrity": "sha512-k1Wl5PQcA/4UoTffYKKaxA0FJKwg8yenYNYRzLt11CUR0Kln+h7Udne6mdU1cUIdXBDTVZWtmiUjzqGs7/pEpw==", + "version": "13.13.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.3.tgz", + "integrity": "sha512-hUxPrdbJXhUOTzuML+y9Av7CKoYznbD83pt8g3klgpioEha0emfx4WNIuVRx0C76r0xV2MIwAW9WYiXfVJYFQw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^3.0.0", + "@cypress/request": "^3.0.1", "@cypress/xvfb": "^1.2.4", - "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", "bluebird": "^3.7.2", - "buffer": "^5.6.0", + "buffer": "^5.7.1", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -5728,7 +5727,7 @@ "figures": "^3.2.0", "fs-extra": "^9.1.0", "getos": "^3.2.1", - "is-ci": "^3.0.0", + "is-ci": "^3.0.1", "is-installed-globally": "~0.4.0", "lazy-ass": "^1.6.0", "listr2": "^3.8.3", @@ -5742,7 +5741,7 @@ "request-progress": "^3.0.0", "semver": "^7.5.3", "supports-color": "^8.1.1", - "tmp": "~0.2.1", + "tmp": "~0.2.3", "untildify": "^4.0.0", "yauzl": "^2.10.0" }, @@ -5969,15 +5968,12 @@ } }, "node_modules/cypress/node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", "dev": true, - "dependencies": { - "rimraf": "^3.0.0" - }, "engines": { - "node": ">=8.17.0" + "node": ">=14.14" } }, "node_modules/dargs": { @@ -19839,20 +19835,19 @@ "dev": true }, "cypress": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.1.tgz", - "integrity": "sha512-k1Wl5PQcA/4UoTffYKKaxA0FJKwg8yenYNYRzLt11CUR0Kln+h7Udne6mdU1cUIdXBDTVZWtmiUjzqGs7/pEpw==", + "version": "13.13.3", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.13.3.tgz", + "integrity": "sha512-hUxPrdbJXhUOTzuML+y9Av7CKoYznbD83pt8g3klgpioEha0emfx4WNIuVRx0C76r0xV2MIwAW9WYiXfVJYFQw==", "dev": true, "requires": { - "@cypress/request": "^3.0.0", + "@cypress/request": "^3.0.1", "@cypress/xvfb": "^1.2.4", - "@types/node": "^18.17.5", "@types/sinonjs__fake-timers": "8.1.1", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", "bluebird": "^3.7.2", - "buffer": "^5.6.0", + "buffer": "^5.7.1", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -19870,7 +19865,7 @@ "figures": "^3.2.0", "fs-extra": "^9.1.0", "getos": "^3.2.1", - "is-ci": "^3.0.0", + "is-ci": "^3.0.1", "is-installed-globally": "~0.4.0", "lazy-ass": "^1.6.0", "listr2": "^3.8.3", @@ -19884,7 +19879,7 @@ "request-progress": "^3.0.0", "semver": "^7.5.3", "supports-color": "^8.1.1", - "tmp": "~0.2.1", + "tmp": "~0.2.3", "untildify": "^4.0.0", "yauzl": "^2.10.0" }, @@ -20039,13 +20034,10 @@ } }, "tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", - "dev": true, - "requires": { - "rimraf": "^3.0.0" - } + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", + "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "dev": true } } }, diff --git a/package.json b/package.json index 65d3ca0e3..65deaad24 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "cpy-cli": "5.0.0", "cross-env": "7.0.3", "cssnano": "6.0.2", - "cypress": "13.6.1", + "cypress": "13.13.3", "cypress-file-upload": "5.0.8", "dotenv": "8.6.0", "eslint": "8.56.0",