-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathedgeSpecificCaps.spec.js
63 lines (50 loc) · 2 KB
/
edgeSpecificCaps.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const {Browser, By, Builder } = require('selenium-webdriver');
const edge = require('selenium-webdriver/edge');
const options = new edge.Options();
const assert = require("assert");
describe('Should be able to Test Command line arguments', function () {
it('headless', async function () {
let driver = new Builder()
.forBrowser(Browser.EDGE)
.setEdgeOptions(options.addArguments('--headless=new'))
.build();
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
await driver.quit();
});
it('exclude switches', async function () {
let driver = new Builder()
.forBrowser(Browser.EDGE)
.setEdgeOptions(options.excludeSwitches('enable-automation'))
.build();
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
await driver.quit();
});
it('Keep browser open - set detach to true ', async function () {
let driver = new Builder()
.forBrowser(Browser.EDGE)
.setEdgeOptions(options.detachDriver(true))
.build();
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
// As tests runs in ci, quitting the driver instance to avoid any failures
await driver.quit();
});
it('Basic edge test', async function () {
const Options = new edge.Options();
let driver = new Builder()
.forBrowser(Browser.EDGE)
.setEdgeOptions(Options)
.build();
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
await driver.quit();
});
it('Add Extension', async function () {
let driver = new Builder()
.forBrowser(Browser.EDGE)
.setEdgeOptions(options.addExtensions(['./test/resources/extensions/webextensions-selenium-example.crx']))
.build();
await driver.get('https://www.selenium.dev/selenium/web/blank.html');
let injected = await driver.findElement(By.id('webextensions-selenium-example'));
assert.equal(await injected.getText(), `Content injected by webextensions-selenium-example`)
await driver.quit();
});
});