From db4a44827d8e58913bae985e77a251f72efe5a5e Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 20 Feb 2023 14:45:44 -0300 Subject: [PATCH] 19836: Test tweaking. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- cypress/integration/banner-tooltip.spec.js | 21 +++++++++++++-------- cypress/support/commands.js | 6 ++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/cypress/integration/banner-tooltip.spec.js b/cypress/integration/banner-tooltip.spec.js index 16235ccd..ccd4166a 100644 --- a/cypress/integration/banner-tooltip.spec.js +++ b/cypress/integration/banner-tooltip.spec.js @@ -34,24 +34,29 @@ describe('Collection panel tests', function () { .then(function ([bannerCollection]) { collectionUUID=bannerCollection.uuid; - + cy.loginAs(adminUser); - + cy.goToPath(`/collections/${bannerCollection.uuid}`); - + cy.get('[data-cy=upload-button]').click(); - + cy.fixture('files/banner.html').as('banner'); cy.fixture('files/tooltips.txt').as('tooltips'); - + cy.getAll('@banner', '@tooltips') .then(([banner, tooltips]) => { console.log(tooltips) - cy.get('[data-cy=drag-and-drop]').upload(btoa(banner), 'banner.html'); - cy.get('[data-cy=drag-and-drop]').upload(btoa(tooltips), 'tooltips.json'); + cy.get('[data-cy=drag-and-drop]').upload(banner, 'banner.html', false); + cy.get('[data-cy=drag-and-drop]').upload(tooltips, 'tooltips.json', false); }); - + cy.get('[data-cy=form-submit-btn]').click(); + cy.get('[data-cy=form-submit-btn]').should('not.exist'); + cy.get('[data-cy=collection-files-right-panel]') + .contains('banner.html').should('exist'); + cy.get('[data-cy=collection-files-right-panel]') + .contains('tooltips.json').should('exist'); }); }); cy.on('uncaught:exception', (err, runnable) => {console.error(err)}); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index e98000fc..f09d959b 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -387,9 +387,11 @@ Cypress.Commands.add( { prevSubject: 'element', }, - (subject, file, fileName) => { + (subject, file, fileName, binaryMode = true) => { cy.window().then(window => { - const blob = b64toBlob(file, '', 512); + const blob = binaryMode + ? b64toBlob(file, '', 512) + : new Blob([file], {type: 'text/plain'}); const testFile = new window.File([blob], fileName); cy.wrap(subject).trigger('drop', { -- 2.30.2