I have racked my brain and scoured the internet for a way to make a protractor e2e test code synchronous to no avail! What I wish to achieve is to repeat the same protractor test indefinitely until I close the browser or end the tests or to end it via ^(control)c on the command line. Here is an example of what I am trying to do:
import { AppPage } from './app.po';
import { browser } from 'protractor';
import { interval } from 'rxjs';
import { takeWhile, switchMap } from 'rxjs/operators';
describe('workspace-project App', () => {
let page: AppPage;
let testComplete = false;
beforeEach(() => {
page = new AppPage();
});
while (true) { // Doesn't work
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to testAngular6!');
console.log('Executing tests');
browser.wait(function () { return true; }, 5000);
});
}
});
but the while loop around the 'it' test does not work and keeps looping around. I realise that I cannot use any of the protractor/ web-driver wait commands or even the rjx interval APIs to achieve this because this is purely a JavaScript problem. Since JavaScript is single threaded. How could I possibly achieve this please? There are a lot of questions on the internet about this but some have no answers and others are at best similar but not quite the same! Thanks very much in advance for your help.