Skip to content

Commit

Permalink
test for JS library selector
Browse files Browse the repository at this point in the history
  • Loading branch information
arnabsen1729 committed Apr 19, 2022
1 parent f6f3b5e commit 16e41f9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions cypress/integration/interface.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 141,37 @@ 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()
.eq(messages.length - index - 1)
.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')
);
});
});
});

0 comments on commit 16e41f9

Please sign in to comment.