This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(exitCodes): adding exit code for direct connect errors
- Loading branch information
Showing
6 changed files
with
194 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var env = require('../environment.js'); | ||
|
||
exports.config = { | ||
sauceUser: 'foo', | ||
sauceKey: process.env.SAUCE_ACCESS_KEY, | ||
|
||
framework: 'jasmine', | ||
|
||
specs: [ | ||
'../../example/example_spec.js' | ||
], | ||
|
||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
|
||
baseUrl: env.baseUrl + '/ng1/', | ||
|
||
jasmineNodeOpts: { | ||
defaultTimeoutInterval: 90000 | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
var fs = require('fs'), | ||
os = require('os'), | ||
path = require('path'); | ||
var BrowserError = require('../../../built/exitCodes').BrowserError, | ||
Logger = require('../../../built/logger2').Logger, | ||
WriteTo = require('../../../built/logger2').WriteTo; | ||
|
||
describe('direct connect', function() { | ||
beforeEach(function() { | ||
Logger.setWrite(WriteTo.NONE); | ||
}); | ||
|
||
afterEach(function() { | ||
Logger.setWrite(WriteTo.CONSOLE); | ||
}); | ||
|
||
describe('without the chrome driver', function() { | ||
it('should throw an error if no drivers are present', function() { | ||
var config = { | ||
directConnect: true, | ||
capabilities: { browserName: 'chrome' }, | ||
chromeDriver: '/foo/bar/chromedriver' | ||
}; | ||
var errorFound = false; | ||
try { | ||
webdriver = require('../../../built/driverProviders/direct')(config); | ||
webdriver.getNewDriver(); | ||
} catch(e) { | ||
errorFound = true; | ||
expect(e.code).toBe(BrowserError.CODE); | ||
} | ||
expect(errorFound).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('with chromedriver drivers', function() { | ||
var chromedriver = ''; | ||
beforeEach(function() { | ||
// add files to selenium folder | ||
file = 'chromedriver'; | ||
chromedriver = path.resolve(os.tmpdir(), file); | ||
fs.openSync(chromedriver, 'w'); | ||
}); | ||
|
||
afterEach(function() { | ||
try { | ||
fs.unlinkSync(chromedriver); | ||
} catch(e) { | ||
} | ||
}); | ||
it('should throw an error if the driver cannot be used', function() { | ||
var config = { | ||
directConnect: true, | ||
capabilities: { browserName: 'foobar explorer' }, | ||
chromeDriver: chromedriver | ||
}; | ||
var errorFound = false; | ||
try { | ||
webdriver = require('../../../built/driverProviders/direct')(config); | ||
webdriver.getNewDriver(); | ||
} catch(e) { | ||
errorFound = true; | ||
expect(e.code).toBe(BrowserError.CODE); | ||
} | ||
expect(errorFound).toBe(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
var fs = require('fs'), | ||
os = require('os'), | ||
path = require('path'); | ||
var BrowserError = require('../../../built/exitCodes').BrowserError, | ||
Logger = require('../../../built/logger2').Logger, | ||
WriteTo = require('../../../built/logger2').WriteTo; | ||
|
||
describe('local connect', function() { | ||
beforeEach(function() { | ||
Logger.setWrite(WriteTo.NONE); | ||
}); | ||
|
||
afterEach(function() { | ||
Logger.setWrite(WriteTo.CONSOLE); | ||
}); | ||
|
||
describe('without the selenium standalone jar', function() { | ||
it('should throw an error jar file is not present', function() { | ||
var config = { | ||
directConnect: true, | ||
capabilities: { browserName: 'chrome' }, | ||
seleniumServerJar: '/foo/bar/selenium.jar' | ||
}; | ||
var errorFound = false; | ||
try { | ||
webdriver = require('../../../built/driverProviders/local')(config); | ||
webdriver.setupEnv(); | ||
} catch(e) { | ||
errorFound = true; | ||
expect(e.code).toBe(BrowserError.CODE); | ||
} | ||
expect(errorFound).toBe(true); | ||
}); | ||
}); | ||
|
||
describe('with the selenium standalone jar', function() { | ||
it('should throw an error if the jar file does not work', function() { | ||
var jarFile = ''; | ||
beforeEach(function() { | ||
// add files to selenium folder | ||
file = 'selenium.jar'; | ||
jarFile = path.resolve(os.tmpdir(), file); | ||
fs.openSync(jarFile, 'w'); | ||
}); | ||
|
||
afterEach(function() { | ||
try { | ||
fs.unlinkSync(jarFile); | ||
} catch(e) { | ||
} | ||
}); | ||
|
||
it('should throw an error if the selenium sever jar cannot be used', function() { | ||
var config = { | ||
directConnect: true, | ||
capabilities: { browserName: 'foobar explorer' }, | ||
seleniumServerJar: jarFile | ||
}; | ||
var errorFound = false; | ||
try { | ||
webdriver = require('../../../built/driverProviders/local')(config); | ||
webdriver.getNewDriver(); | ||
} catch(e) { | ||
errorFound = true; | ||
expect(e.code).toBe(BrowserError.CODE); | ||
} | ||
expect(errorFound).toBe(true); | ||
}); | ||
}); | ||
}); | ||
}); |