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.
fix(export): export selenium-webdriver (#3433)
- rename to ProtractorBrowser to be able to export selenium-webdriver Browser as Browser - export all selenium-webdriver items and subfolders in ptor - update dependency tests for selenium - add tests when protractor is installed closes #3427 closes #2092
- Loading branch information
Showing
18 changed files
with
303 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
import { | ||
Browser, | ||
ProtractorBrowser, | ||
ElementArrayFinder, | ||
ElementFinder, | ||
ElementHelper, | ||
ProtractorBy, | ||
ProtractorExpectedConditions | ||
ProtractorExpectedConditions, | ||
Ptor | ||
} from 'protractor'; | ||
|
||
export interface Protractor { | ||
browser: Browser; | ||
element: ElementHelper; | ||
by: ProtractorBy; | ||
By: ProtractorBy; | ||
$: (search: string) => ElementFinder; | ||
$$: (search: string) => ElementArrayFinder; | ||
ExpectedConditions: ProtractorExpectedConditions; | ||
} | ||
interface global {}; | ||
export var protractor: Protractor = global['protractor']; | ||
export var browser: Browser = global['protractor']['browser']; | ||
export var element: ElementHelper = global['protractor']['element']; | ||
export var by: ProtractorBy = global['protractor']['by']; | ||
export var By: ProtractorBy = global['protractor']['By']; | ||
export var $: (search: string) => ElementFinder = global['protractor']['$']; | ||
export var $$: (search: string) => ElementArrayFinder = global['protractor']['$$']; | ||
export var ExpectedConditions: ProtractorExpectedConditions = | ||
global['protractor']['ExpectedConditions']; | ||
export let protractor: Ptor = global['protractor']; | ||
export let browser: ProtractorBrowser = protractor.browser; | ||
export let $: (search: string) => ElementFinder = protractor.$; | ||
export let $$: (search: string) => ElementArrayFinder = protractor.$$; | ||
export let element: ElementHelper = protractor.element; | ||
export let By: ProtractorBy = protractor.By; | ||
export let by: ProtractorBy = protractor.by; | ||
export let wrapDriver: | ||
(webdriver: any, baseUrl?: string, rootElement?: string, | ||
untrackOutstandingTimeouts?: boolean) => ProtractorBrowser = protractor.wrapDriver; | ||
export let ExpectedConditions: ProtractorExpectedConditions = protractor.ExpectedConditions; |
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 |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
* namespace. | ||
*/ | ||
|
||
export = require('./ptor').protractor | ||
export = require('./ptor').protractor; |
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 |
---|---|---|
@@ -1,36 +1,56 @@ | ||
import {Browser, ElementHelper} from './browser'; | ||
import {ElementHelper, ProtractorBrowser} from './browser'; | ||
import {ElementArrayFinder, ElementFinder} from './element'; | ||
import {ProtractorExpectedConditions} from './expectedConditions'; | ||
import {ProtractorBy} from './locators'; | ||
|
||
let webdriver = require('selenium-webdriver'); | ||
|
||
export namespace protractor { | ||
export class Ptor { | ||
// Variables tied to the global namespace. | ||
export let browser: Browser; | ||
export let $ = function(search: string): ElementFinder { return null;}; | ||
export let $$ = function(search: string): ElementArrayFinder { return null;}; | ||
export let element: ElementHelper; | ||
export let By: ProtractorBy; | ||
export let by: ProtractorBy; | ||
export let wrapDriver: | ||
browser: ProtractorBrowser; | ||
$ = function(search: string): ElementFinder { return null; }; | ||
$$ = function(search: string): ElementArrayFinder { return null; }; | ||
element: ElementHelper; | ||
By: ProtractorBy; | ||
by: ProtractorBy; | ||
wrapDriver: | ||
(webdriver: webdriver.WebDriver, baseUrl?: string, rootElement?: string, | ||
untrackOutstandingTimeouts?: boolean) => Browser; | ||
export let ExpectedConditions: ProtractorExpectedConditions; | ||
untrackOutstandingTimeouts?: boolean) => ProtractorBrowser; | ||
ExpectedConditions: ProtractorExpectedConditions; | ||
|
||
// Export protractor classes. | ||
export let Browser = require('./browser').Browser; | ||
export let ElementFinder = require('./element').ElementFinder; | ||
export let ElementArrayFinder = require('./element').ElementArrayFinder; | ||
export let ProtractorBy = require('./locators').ProtractorBy; | ||
export let ProtractorExpectedConditions = | ||
ProtractorBrowser = require('./browser').ProtractorBrowser; | ||
ElementFinder = require('./element').ElementFinder; | ||
ElementArrayFinder = require('./element').ElementArrayFinder; | ||
ProtractorBy = require('./locators').ProtractorBy; | ||
ProtractorExpectedConditions = | ||
require('./expectedConditions').ProtractorExpectedConditions; | ||
|
||
// Export selenium webdriver. | ||
export let promise = webdriver.promise; | ||
export let WebElement = webdriver.WebElement; | ||
export let ActionSequence = webdriver.ActionSequence; | ||
export let Key = webdriver.Key; | ||
export let Command = require('selenium-webdriver/lib/command').Command; | ||
export let CommandName = require('selenium-webdriver/lib/command').Name; | ||
ActionSequence = webdriver.ActionSequence; | ||
Browser = webdriver.Browser; | ||
Builder = webdriver.Builder; | ||
Button = webdriver.Button; | ||
Capabilities = webdriver.Capabilities; | ||
Capability = webdriver.Capability; | ||
EventEmitter = webdriver.EventEmitter; | ||
FileDetector = webdriver.FileDetector; | ||
Key = webdriver.Key; | ||
Session = webdriver.Session; | ||
WebDriver = webdriver.WebDriver; | ||
WebElement = webdriver.WebElement; | ||
WebElementPromise = webdriver.WebElementPromise; | ||
error = webdriver.error; | ||
logging = webdriver.logging; | ||
promise = webdriver.promise; | ||
until = webdriver.until; | ||
Command = require('selenium-webdriver/lib/command').Command; | ||
CommandName = require('selenium-webdriver/lib/command').Name; | ||
utils = { | ||
firefox: require('selenium-webdriver/firefox'), | ||
http: require('selenium-webdriver/http'), | ||
remote: require('selenium-webdriver/remote') | ||
} | ||
} | ||
|
||
export var protractor = new Ptor(); |
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,4 @@ | ||
node_modules | ||
typings | ||
conf.js | ||
typescript_spec.js |
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,7 @@ | ||
import {Config} from 'protractor'; | ||
|
||
export let config: Config = { | ||
mockSelenium: true, | ||
specs: ['*_spec.js'], | ||
framework: 'jasmine' | ||
} |
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,43 @@ | ||
describe('javascript', function () { | ||
it('should have global objects that match the protractor namespace', function () { | ||
expect(protractor.browser === browser).toBeTruthy(); | ||
expect(protractor.by === by).toBeTruthy(); | ||
expect(protractor.By === By).toBeTruthy(); | ||
expect(protractor.$ === $).toBeTruthy(); | ||
expect(protractor.$$ === $$).toBeTruthy(); | ||
expect(protractor.ExpectedConditions === ExpectedConditions).toBeTruthy(); | ||
}); | ||
it('should have selenium-webdriver components for the protractor namespace', function () { | ||
expect(typeof protractor.promise.all).toEqual('function'); | ||
expect(typeof protractor.promise.defer).toEqual('function'); | ||
expect(typeof protractor.promise.Promise).toEqual('function'); | ||
expect(typeof protractor.ActionSequence).toEqual('function'); | ||
expect(typeof protractor.Browser).toEqual('object'); | ||
expect(typeof protractor.Builder).toEqual('function'); | ||
expect(typeof protractor.Capabilities).toEqual('function'); | ||
expect(typeof protractor.Capability).toEqual('object'); | ||
expect(typeof protractor.EventEmitter).toEqual('function'); | ||
expect(typeof protractor.FileDetector).toEqual('function'); | ||
expect(typeof protractor.Key).toEqual('object'); | ||
expect(typeof protractor.Session).toEqual('function'); | ||
expect(typeof protractor.WebDriver).toEqual('function'); | ||
expect(typeof protractor.WebElement).toEqual('function'); | ||
expect(typeof protractor.WebElementPromise).toEqual('function'); | ||
expect(typeof protractor.error).toEqual('object'); | ||
expect(typeof protractor.logging).toEqual('object'); | ||
expect(typeof protractor.promise).toEqual('object'); | ||
expect(typeof protractor.until).toEqual('object'); | ||
expect(typeof protractor.Command).toEqual('function'); | ||
expect(typeof protractor.CommandName).toEqual('object'); | ||
expect(typeof protractor.utils.firefox).toEqual('object'); | ||
expect(typeof protractor.utils.http).toEqual('object'); | ||
expect(typeof protractor.utils.remote).toEqual('object'); | ||
}); | ||
it('should have protractor class definitions', function () { | ||
expect(typeof protractor.ProtractorBrowser).toBe('function'); | ||
expect(typeof protractor.ElementFinder).toBe('function'); | ||
expect(typeof protractor.ElementArrayFinder).toBe('function'); | ||
expect(typeof protractor.ProtractorBy).toBe('function'); | ||
expect(typeof protractor.ProtractorExpectedConditions).toBe('function'); | ||
}); | ||
}); |
Oops, something went wrong.