Reputation: 51
My system under test is a website, that dynamically creates pages from a config file and an index page with clickable icons to these pages. So far I could not find a way to iterate through the icons on the index page and test all the linked pages.
it('lets us test all the pages', () =>
actorCalled('Jasmine').attemptsTo(
Loop.over(EntryPage.SynthLinks).to(
Ensure.that(Loop.item<ElementFinder>(), isClickable()),
Click.on(Loop.item<ElementFinder>()),
Wait.for(Duration.ofSeconds(10)),
Log.the(Website.title()),
//Navigate.back(),
),
));
This loop works in so far, that it shows me all the pages in Chrome, but the logged website title is always the one from the index page, so I cannot do any testing on the clicked pages.(The commented Navigate.back()
also breaks the test.)
I tried to read the url of the clicked pages out of Loop.item<ElementFinder>()
, so I could use Navigate.To()
instead, but I could not find any method for this.
Upvotes: 0
Views: 214
Reputation: 51
Ok, I found it out. The culprit was the website under test, it did not use a href for the link, but a bit of js code:
[...]
var Subwindows = [];
function openSub(name) {
var neighbour = window.open(name);
Subwindows.push(neighbour);
}
[...]
<a onclick="openSub('../SynthPage.html?Mdl=access+virus+b')"><img src="../images/virus.jpg" class="icon" alt="access virus b"></a>
The idea is to remember the opened pages and close them, when done. So the good Chrome executed the js faithfully and showed me the opened page (in a separate tab), but the focus of the test was still the original page. I will have to figure out, how to test that one ||:-)
Upvotes: 0