From 16e41f91cddf09c3453683776e9455303402114d Mon Sep 17 00:00:00 2001 From: Arnab Sen Date: Tue, 19 Apr 2022 12:41:41 +0530 Subject: [PATCH] test for JS library selector --- cypress/integration/interface.test.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cypress/integration/interface.test.js b/cypress/integration/interface.test.js index 81b09ec..70e6ae9 100644 --- a/cypress/integration/interface.test.js +++ b/cypress/integration/interface.test.js @@ -141,6 +141,7 @@ describe('Testing interfaces', () => { // check for the saved projects cy.get('#openItemsBtn').click(); + cy.get('#js-saved-items-wrap').should('be.visible'); messages.forEach((m, index) => { cy.get('#js-saved-items-wrap') .children() @@ -148,4 +149,29 @@ describe('Testing interfaces', () => { .contains(m); }); }); + + it('Selecting a library from dropdown should change URL in textarea', () => { + cy.get('[data-testid=addLibraryButton]').click(); + + cy.get('#externalJsTextarea').should('exist'); + cy.get('#externalCssTextarea').should('exist'); + + const checkLibrary = (label, url, type) => { + cy.get('#js-add-library-select').select(label); + + cy.get(`#external${type}Textarea`).should('contain.value', '\n' + url); // \n because every url should be in a new line + }; + + cy.fixture('libraries').then(data => { + data['jsLibs'].forEach(lib => + checkLibrary(lib['label'], lib['urlPref'], 'Js') + ); + }); + + cy.fixture('libraries').then(data => { + data['csLibs'].forEach(lib => + checkLibrary(lib['label'], lib['urlPref'], 'Css') + ); + }); + }); });