Closed rvenugopal closed 10 years ago
The following code worked for me. Please note the 'ptor.Sleep(500)'. The strange thing is that I need that only in Chrome. In other browsers and phantomjs, it runs fine without the sleep. Now I need to figure out how to get baseUrl instead of hardcoding it in the test
describe('Should be able to successfully login', function(){
var driver = ptor.driver;
beforeEach(function () {
ptor.findElement(protractor.By.model("login.email")).sendKeys('test@testrunner.com'); //Valid email format
ptor.findElement(protractor.By.model("login.password")).sendKeys('12345678'); //Valid email format
///Now click button and verify state afterwards
ptor.findElement(protractor.By.name("loginBtn")).click(); ///Action
});
it('Ensure that user is sent logged in when appropriate credentials are passed', function() {
ptor.sleep(500);
expect(ptor.getCurrentUrl()).toBe('http://localhost:9000/');
}, timeoutVal);
});
Hi
When I click a particular button, the button click takes me to a different html page. This new html page is not in the scope of my angular app.
How do I test this redirect? I am using window.location.replace("otherPage.html")
However, I get the following errors even though I see that the page transitions do occur in the browser.
-------------BEGIN ERROR MESSAGE------------------------------------------------
UnknownError: javascript error: document unloaded while waiting for result (Session info: chrome=31.0.1650.57) (Driver info: chromedriver=2.0,platform=Mac OS X 10.9.0 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 288 milliseconds Build info: version: '2.34.0', revision: '11cd0ef', time: '2013-08-06 17:10:22' System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9', java.version: '1.7.0_15' Session ID: e405483ecd5ab705412506a198cf8b53 Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=MAC, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={chromedriverVersion=2.0}, rotatable=false, locationContextEnabled=true, version=31.0.1650.57, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, applicationCacheEnabled=false, takesScreenshot=true}]
-------------END ERROR MESSAGE------------------------------------------------
I am trying to follow the advice for wrapping it in beforeach from https://github.com/angular/protractor/issues/89 and here is my code. However, I still get the same error