cypress -> tests for /libraries

This commit is contained in:
jhouse
2020-02-07 16:27:01 +09:00
parent b793151ca5
commit c8cc0d4a7d
5 changed files with 39 additions and 4 deletions

View File

@@ -53,10 +53,7 @@
<div class="dropdown show">
<a aria-expanded="false" aria-haspopup="true" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"
href="#"
id="dropdownMenuLink" role="button">
Libraries
</a>
href="#" id="dropdownMenuLink" role="button">Libraries</a>
<div aria-labelledby="dropdownMenuLink" class="dropdown-menu">
<div th:each="instance : ${plexServers}" th:remove="tag">

View File

@@ -0,0 +1,38 @@
let appHasStarted;
function spyOnAddEventListener(win) {
// win = window object in our application
const addListener = win.EventTarget.prototype.addEventListener
win.EventTarget.prototype.addEventListener = function (name) {
if (name === 'change') {
// web app added an event listener to the input box -
// that means the web application has started
appHasStarted = true
// restore the original event listener
win.EventTarget.prototype.addEventListener = addListener
}
return addListener.apply(this, arguments)
}
}
describe('Not Searched Yet Library Tests', function () {
it('Clean configuration page load', () => {
cy.visit('/libraries', {onBeforeLoad: spyOnAddEventListener});
//Switch to contains
/*cy.get('#libraryTitle')
.should('have.text', 'KnoxServer - Movies');*/
cy.get('#dropdownMenuLink')
.should('have.text', 'Libraries');
cy.get('[data-key="1"]')
.should('have.text', 'KnoxServer - Movies');
cy.get('[data-key="2"]')
.should('have.text', 'KnoxServer - Disney Classic Movies');
cy.get('.card-img-top')
.should('be.visible');
});
});