Skip to content

Commit 9bf3047

Browse files
committed
More functional tests.
1 parent 94fcb62 commit 9bf3047

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/functional/libraries.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,31 @@ describe('Libraries', function() {
104104

105105
it('Sets the right classes when the vulnerability is and ' +
106106
'is not displayed ', async function() {
107+
expect(await this.page.$$eval('.panel-wrap', elements => {
108+
function getLibraryName(panelWrapElement) {
109+
return panelWrapElement.parentNode
110+
.querySelector('h3')
111+
.firstChild
112+
.textContent;
113+
}
107114

115+
const result = [];
116+
117+
Array.prototype.forEach.call(elements, el => {
118+
const versionPresent = !!el.querySelector('.version');
119+
const panelBodyElement = el.querySelector('.panel-body');
120+
const mversionPresent = panelBodyElement.classList.contains('mversion');
121+
122+
if((versionPresent && mversionPresent) ||
123+
(!versionPresent && !mversionPresent)) {
124+
// All good
125+
return;
126+
}
127+
128+
result.push(getLibraryName(el));
129+
});
130+
131+
return result;
132+
})).to.be.empty;
108133
});
109134
});

0 commit comments

Comments
 (0)