I am new to writing test cases using protractor for non angular application. I wrote a sample test case.Here the browser closes automatically after running test case.How can I prevent this. Here is my code
var submitBtnElm = $('input[data-behavior=saveContribution]');
it('Should Search', function() {
browser.driver.get('http://localhost/enrollments/osda1.html');
browser.driver.findElement(by.id('contributePercentValue')).sendKeys(50);
submitBtnElm.click().then(function() {
});
});
I'm sure there is a change triggered on your page by the button click. It might be something as subtle as a class change on an element or as obvious as a
<p></p>
element with the text "Saved" displayed. What I would do is, after the test, explicitly wait for this change.You could add such a wait mechanism to the
afterEach()
method of your spec file, so that your tests are separated even without the Protractor Angular implicit waits.I found Gleeson's solution is working, and that really helped me. The solution was...
Restart your tests after that.
I am using node v8.12.0 npm v6.4.1 protractor v5.4.1
This solution will work, only if you installed npm or protractor globally; if you have installed your npm or protractor locally (in your folder) then, you have to go to your local protractor folder and do the same.