I have done a lot of unit tests using Karma, but my office would like to have some integration tests, especially testing cross browser capabilities. For this, it seemed Protractor was my best option, and I have started get get some basic dashboard tests going, but am stuck with safari.
My Config:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['scenarios/*Scenario.js'],
framework: 'jasmine',
baseUrl: 'https://www-dev.remeeting.com/',
multiCapabilities: [{
browserName: 'firefox'
}, {
browserName: 'chrome'
}, {
browserName: 'safari'
}],
onPrepare: function() {
browser.driver.get('https://www-dev.remeeting.com/');
browser.driver.findElement(by.id('email')).sendKeys('[email protected]');
browser.driver.findElement(by.id('password')).sendKeys('abc123');
browser.driver.findElement(by.id('submit_btn')).click();
// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// app/#/d.
return browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return /app\/#\/d/.test(url);
});
}, 10000);
}
};
My only spec
describe('Dashboard', function() {
it('should login to the dashboard', function() {
expect(element(by.css('.dashboard')).getText()).toMatch(/Upload Meeting/);
expect(element(by.id('refreshButton')));
expect(element(by.css('.dashboard div.btn-group')))
});
});
And the error
[safari #21] PID: 79079
[safari #21] Specs: /Users/adam/git/mrp- www/e2e/scenarios/dashboardScenario.js
[safari #21]
[safari #21] Using the selenium server at http://localhost:4444/wd/hub
[safari #21] ERROR - Unable to start a WebDriver session.
[safari #21] Unknown command: setTimeout (WARNING: The server did not provide any stacktrace information)
...
[safari #21] Driver info: org.openqa.selenium.safari.SafariDriver
[safari #21] Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.1, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}]
[safari #21] Session ID: null
[launcher] Runner process exited unexpectedly with error code: 1
[launcher] 2 instance(s) of WebDriver still running
Anybody know how to configure protractor for safari?
Here is what I did to successfully set up Safari + Protractor:
SafariDriver.safariextz
file into the extension list:protractor
to the latest version (3.2.2 at the moment)Note that, as an alternative, you can always run Safari remotely on BrowserStack
or SauceLabs
.
See also the list of Safari+Protractor issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With