19836: Test tweaking.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 20 Feb 2023 17:45:44 +0000 (14:45 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Mon, 20 Feb 2023 19:14:42 +0000 (16:14 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

cypress/integration/banner-tooltip.spec.js
cypress/support/commands.js

index 16235ccd5d0d2178f7577688dcc22394474ac36f..ccd4166a4155cd7e0969864b6cf66dcbe2aab9a6 100644 (file)
@@ -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)});
index e98000fc71403462a2f67ffbb0008c804da5c4b0..f09d959b8fe9ac6ec35b36f35bde9e7aa36799c2 100644 (file)
@@ -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', {