@@ -188,9 +188,9 @@ describe('WebDriver', function () {
188
188
let executor = new FakeExecutor()
189
189
.expect(CName.NEW_SESSION)
190
190
.withParameters({
191
-
desiredCapabilities: { browserName: 'firefox' },
192
191
capabilities: {
193
192
alwaysMatch: { browserName: 'firefox' },
193
+
firstMatch: [{}],
194
194
},
195
195
})
196
196
.andReturnSuccess(aSession)
@@ -207,15 +207,12 @@ describe('WebDriver', function () {
207
207
let executor = new FakeExecutor()
208
208
.expect(CName.NEW_SESSION)
209
209
.withParameters({
210
-
desiredCapabilities: {
211
-
'moz:debuggerAddress': true,
212
-
browserName: 'firefox',
213
-
},
214
210
capabilities: {
215
211
alwaysMatch: {
216
212
'moz:debuggerAddress': true,
217
213
browserName: 'firefox',
218
214
},
215
+
firstMatch: [{}],
219
216
},
220
217
})
221
218
.andReturnSuccess(aSession)
@@ -230,9 +227,9 @@ describe('WebDriver', function () {
230
227
let executor = new FakeExecutor()
231
228
.expect(CName.NEW_SESSION)
232
229
.withParameters({
233
-
desiredCapabilities: { browserName: 'firefox', foo: 'bar' },
234
230
capabilities: {
235
-
alwaysMatch: { browserName: 'firefox' },
231
+
alwaysMatch: { browserName: 'firefox'},
232
+
firstMatch: [{}],
236
233
},
237
234
})
238
235
.andReturnSuccess(aSession)
@@ -249,9 +246,9 @@ describe('WebDriver', function () {
249
246
let executor = new FakeExecutor()
250
247
.expect(CName.NEW_SESSION)
251
248
.withParameters({
252
-
desiredCapabilities: { browserName: 'firefox' },
253
249
capabilities: {
254
250
alwaysMatch: { browserName: 'firefox' },
251
+
firstMatch: [{}],
255
252
},
256
253
})
257
254
.andReturnError(new StubError())
@@ -268,9 +265,9 @@ describe('WebDriver', function () {
268
265
let executor = new FakeExecutor()
269
266
.expect(CName.NEW_SESSION)
270
267
.withParameters({
271
-
desiredCapabilities: { browserName: 'firefox' },
272
268
capabilities: {
273
269
alwaysMatch: { browserName: 'firefox' },
270
+
firstMatch: [{}],
274
271
},
275
272
})
276
273
.andReturnError(new StubError())
@@ -1728,227 +1725,4 @@ describe('WebDriver', function () {
1728
1725
})
1729
1726
})
1730
1727
})
1731
-
1732
-
describe('wire format', function () {
1733
-
const FAKE_DRIVER = new FakeExecutor().createDriver()
1734
-
1735
-
describe('can serialize', function () {
1736
-
function runSerializeTest(input, want) {
1737
-
let executor = new FakeExecutor()
1738
-
.expect(CName.NEW_SESSION)
1739
-
.withParameters({
1740
-
desiredCapabilities: { 'serialize-test': want },
1741
-
capabilities: { alwaysMatch: {} },
1742
-
})
1743
-
.andReturnSuccess({ browserName: 'firefox' })
1744
-
.end()
1745
-
// We stuff the value to be serialized inside of a capabilities object,
1746
-
// using a non-W3C key so that the value gets dropped from the W3C
1747
-
// capabilities object.
1748
-
return WebDriver.createSession(executor, {
1749
-
'serialize-test': input,
1750
-
}).getSession()
1751
-
}
1752
-
1753
-
it('function as a string', function () {
1754
-
function foo() {
1755
-
return 'foo'
1756
-
}
1757
-
return runSerializeTest(foo, '' + foo)
1758
-
})
1759
-
1760
-
it('object with toJSON()', function () {
1761
-
return runSerializeTest(
1762
-
new Date(605728511546),
1763
-
'1989-03-12T17:55:11.546Z'
1764
-
)
1765
-
})
1766
-
1767
-
it('Session', function () {
1768
-
return runSerializeTest(new Session('foo', {}), 'foo')
1769
-
})
1770
-
1771
-
it('Capabilities', function () {
1772
-
const prefs = new logging.Preferences()
1773
-
prefs.setLevel(logging.Type.BROWSER, logging.Level.DEBUG)
1774
-
1775
-
const caps = Capabilities.chrome()
1776
-
caps.setLoggingPrefs(prefs)
1777
-
1778
-
return runSerializeTest(caps, {
1779
-
browserName: 'chrome',
1780
-
'goog:loggingPrefs': { browser: 'DEBUG' },
1781
-
})
1782
-
})
1783
-
1784
-
it('WebElement', function () {
1785
-
return runSerializeTest(
1786
-
new WebElement(FAKE_DRIVER, 'fefifofum'),
1787
-
WebElement.buildId('fefifofum')
1788
-
)
1789
-
})
1790
-
1791
-
it('WebElementPromise', function () {
1792
-
return runSerializeTest(
1793
-
new WebElementPromise(
1794
-
FAKE_DRIVER,
1795
-
Promise.resolve(new WebElement(FAKE_DRIVER, 'fefifofum'))
1796
-
),
1797
-
WebElement.buildId('fefifofum')
1798
-
)
1799
-
})
1800
-
1801
-
describe('an array', function () {
1802
-
it('with Serializable', function () {
1803
-
return runSerializeTest([new Session('foo', {})], ['foo'])
1804
-
})
1805
-
1806
-
it('with WebElement', function () {
1807
-
return runSerializeTest(
1808
-
[new WebElement(FAKE_DRIVER, 'fefifofum')],
1809
-
[WebElement.buildId('fefifofum')]
1810
-
)
1811
-
})
1812
-
1813
-
it('with WebElementPromise', function () {
1814
-
return runSerializeTest(
1815
-
[
1816
-
new WebElementPromise(
1817
-
FAKE_DRIVER,
1818
-
Promise.resolve(new WebElement(FAKE_DRIVER, 'fefifofum'))
1819
-
),
1820
-
],
1821
-
[WebElement.buildId('fefifofum')]
1822
-
)
1823
-
})
1824
-
1825
-
it('complex array', function () {
1826
-
const expected = [
1827
-
'abc',
1828
-
123,
1829
-
true,
1830
-
WebElement.buildId('fefifofum'),
1831
-
[123, { foo: 'bar' }],
1832
-
]
1833
-
1834
-
const element = new WebElement(FAKE_DRIVER, 'fefifofum')
1835
-
const input = ['abc', 123, true, element, [123, { foo: 'bar' }]]
1836
-
return runSerializeTest(input, expected)
1837
-
})
1838
-
1839
-
it('nested promises', function () {
1840
-
return runSerializeTest(
1841
-
['abc', Promise.resolve([123, Promise.resolve(true)])],
1842
-
['abc', [123, true]]
1843
-
)
1844
-
})
1845
-
})
1846
-
1847
-
describe('an object', function () {
1848
-
it('literal', function () {
1849
-
const expected = { sessionId: 'foo' }
1850
-
return runSerializeTest({ sessionId: 'foo' }, expected)
1851
-
})
1852
-
1853
-
it('with sub-objects', function () {
1854
-
const expected = { sessionId: { value: 'foo' } }
1855
-
return runSerializeTest({ sessionId: { value: 'foo' } }, expected)
1856
-
})
1857
-
1858
-
it('with values that have toJSON', function () {
1859
-
return runSerializeTest(
1860
-
{ a: { b: new Date(605728511546) } },
1861
-
{ a: { b: '1989-03-12T17:55:11.546Z' } }
1862
-
)
1863
-
})
1864
-
1865
-
it('with a Session', function () {
1866
-
return runSerializeTest({ a: new Session('foo', {}) }, { a: 'foo' })
1867
-
})
1868
-
1869
-
it('nested', function () {
1870
-
const elementJson = WebElement.buildId('fefifofum')
1871
-
const expected = {
1872
-
script: 'return 1',
1873
-
args: ['abc', 123, true, elementJson, [123, { foo: 'bar' }]],
1874
-
sessionId: 'foo',
1875
-
}
1876
-
1877
-
const element = new WebElement(FAKE_DRIVER, 'fefifofum')
1878
-
const parameters = {
1879
-
script: 'return 1',
1880
-
args: ['abc', 123, true, element, [123, { foo: 'bar' }]],
1881
-
sessionId: new Session('foo', {}),
1882
-
}
1883
-
1884
-
return runSerializeTest(parameters, expected)
1885
-
})
1886
-
1887
-
it('nested promises', function () {
1888
-
const input = {
1889
-
struct: Promise.resolve({
1890
-
element: new WebElementPromise(
1891
-
FAKE_DRIVER,
1892
-
Promise.resolve(new WebElement(FAKE_DRIVER, 'fefifofum'))
1893
-
),
1894
-
}),
1895
-
}
1896
-
1897
-
const want = {
1898
-
struct: {
1899
-
element: WebElement.buildId('fefifofum'),
1900
-
},
1901
-
}
1902
-
1903
-
return runSerializeTest(input, want)
1904
-
})
1905
-
})
1906
-
})
1907
-
1908
-
describe('can deserialize', function () {
1909
-
function runDeserializeTest(original, want) {
1910
-
let executor = new FakeExecutor()
1911
-
.expect(CName.GET_CURRENT_URL)
1912
-
.andReturnSuccess(original)
1913
-
.end()
1914
-
let driver = executor.createDriver()
1915
-
return driver.getCurrentUrl().then(function (got) {
1916
-
assert.deepStrictEqual(got, want)
1917
-
})
1918
-
}
1919
-
1920
-
it('primitives', function () {
1921
-
return Promise.all([
1922
-
runDeserializeTest(1, 1),
1923
-
runDeserializeTest('', ''),
1924
-
runDeserializeTest(true, true),
1925
-
runDeserializeTest(undefined, null),
1926
-
runDeserializeTest(null, null),
1927
-
])
1928
-
})
1929
-
1930
-
it('simple object', function () {
1931
-
return runDeserializeTest({ sessionId: 'foo' }, { sessionId: 'foo' })
1932
-
})
1933
-
1934
-
it('nested object', function () {
1935
-
return runDeserializeTest({ foo: { bar: 123 } }, { foo: { bar: 123 } })
1936
-
})
1937
-
1938
-
it('array', function () {
1939
-
return runDeserializeTest(
1940
-
[{ foo: { bar: 123 } }],
1941
-
[{ foo: { bar: 123 } }]
1942
-
)
1943
-
})
1944
-
1945
-
it('passes through function properties', function () {
1946
-
function bar() {}
1947
-
return runDeserializeTest(
1948
-
[{ foo: { bar: 123 }, func: bar }],
1949
-
[{ foo: { bar: 123 }, func: bar }]
1950
-
)
1951
-
})
1952
-
})
1953
-
})
1954
1728
})
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4