Skip to content

Commit 6a5bd64

Browse files
committed
[js] Add commands
1 parent c4f228b commit 6a5bd64

File tree

5 files changed

+157
-1
lines changed

5 files changed

+157
-1
lines changed

java/src/org/openqa/selenium/grid/distributor/GridModel.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static org.openqa.selenium.grid.data.Availability.DRAINING;
2222
import static org.openqa.selenium.grid.data.Availability.UP;
2323

24-
import com.google.common.collect.ImmutableSet;
2524
import java.time.Instant;
2625
import java.util.Collections;
2726
import java.util.HashMap;

javascript/node/selenium-webdriver/lib/command.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ const Name = {
185185
GET_DOWNLOADABLE_FILES: 'getDownloadableFiles',
186186
DOWNLOAD_FILE: 'downloadFile',
187187
DELETE_DOWNLOADABLE_FILES: 'deleteDownloadableFiles',
188+
189+
// Federated Credential Management API
190+
// https://www.w3.org/TR/fedcm/#automation
191+
CANCEL_DIALOG : 'cancelDialog',
192+
SELECT_ACCOUNT : 'selectAccount',
193+
GET_ACCOUNTS : 'getAccounts',
194+
GET_FEDCM_TITLE : 'getFedCmTitle',
195+
GET_FEDCM_DIALOG_TYPE : 'getFedCmDialogType',
196+
SET_DELAY_ENABLED : 'setDelayEnabled',
197+
RESET_COOLDOWN : 'resetCooldown',
198+
CLICK_DIALOG_BUTTON: 'clickdialogbutton'
188199
}
189200

190201
/**
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
const LoginState = {
19+
SIGN_IN: 'SignIn',
20+
SIGN_UP: 'SignUp',
21+
}
22+
23+
class Account {
24+
25+
constructor(accountId,
26+
email,
27+
name,
28+
givenName,
29+
pictureUrl,
30+
idpConfigUrl,
31+
loginState,
32+
termsOfServiceUrl,
33+
privacyPolicyUrl ) {
34+
this._accountId = accountId
35+
this._email = email
36+
this._name = name
37+
this._pictureUrl = pictureUrl
38+
this._idpConfigUrl = idpConfigUrl
39+
this._loginState = loginState
40+
this._termsOfServiceUrl = termsOfServiceUrl
41+
this._privacyPolicyUrl = privacyPolicyUrl
42+
}
43+
44+
get accountId() {
45+
return this._accountId
46+
}
47+
48+
get email() {
49+
return this._email
50+
}
51+
52+
get name() {
53+
return this._name
54+
}
55+
56+
get pictureUrl() {
57+
return this._pictureUrl
58+
}
59+
60+
get idpConfigUrl() {
61+
return this._idpConfigUrl
62+
}
63+
64+
get loginState() {
65+
return this._loginState
66+
}
67+
68+
get termsOfServiceUrl() {
69+
return this._termsOfServiceUrl
70+
}
71+
72+
get privacyPolicyUrl() {
73+
return this._privacyPolicyUrl
74+
}
75+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Licensed to the Software Freedom Conservancy (SFC) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The SFC licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
const command = require('../command')
19+
20+
const LoginState = {
21+
DIALOG_TYPE_ACCOUNT_LIST: 'DIALOG_TYPE_ACCOUNT_LIST',
22+
DIALOG_TYPE_AUTO_REAUTH: 'AutoReauthn',
23+
}
24+
25+
class Dialog {
26+
27+
constructor(driver) {
28+
this._driver = driver
29+
}
30+
31+
title() {
32+
return this._driver.execute(new command.Command(command.Name.GET_FEDCM_TITLE))
33+
}
34+
35+
subtitle() {
36+
return this._driver.execute(new command.Command(command.Name.GET_FEDCM_TITLE))
37+
}
38+
39+
type() {
40+
return this._driver.execute(new command.Command(command.Name.GET_FEDCM_DIALOG_TYPE))
41+
}
42+
43+
accounts() {
44+
return this._driver.execute(new command.Command(command.Name.GET_ACCOUNTS))
45+
}
46+
47+
selectAccount(index) {
48+
return this._driver.execute(new command.Command(command.Name.SELECT_ACCOUNT).setParameter('accountIndex', index))
49+
}
50+
51+
accept() {
52+
return this._driver.execute(new command.Command(command.Name.CLICK_DIALOG_BUTTON))
53+
}
54+
55+
dismiss() {
56+
return this._driver.execute(new command.Command(command.Name.CANCEL_DIALOG))
57+
}
58+
}

javascript/node/selenium-webdriver/lib/webdriver.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,19 @@ class WebDriver {
11061106
return this.execute(new command.Command(command.Name.SCREENSHOT))
11071107
}
11081108

1109+
setDelayEnabled(enabled) {
1110+
return this.execute(new command.Command(command.Name.SET_DELAY_ENABLED).setParameter('enabled', enabled))
1111+
}
1112+
1113+
resetCooldown() {
1114+
return this.execute(new command.Command(command.Name.RESET_COOLDOWN))
1115+
}
1116+
1117+
getFederalCredentialManagementDialog() {
1118+
return new FederalCredentialManagementDialog()
1119+
}
1120+
1121+
11091122
/** @override */
11101123
manage() {
11111124
return new Options(this)

0 commit comments

Comments
 (0)