-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathselectors.js
More file actions
65 lines (57 loc) · 2.99 KB
/
selectors.js
File metadata and controls
65 lines (57 loc) · 2.99 KB
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
64
65
/**
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
export const NEW_ROLE_BTN = '[data-test-new-role-button]';
export const MANAGE_DROPDOWN_ROLES = '[data-test-manage-roles-dropdown] button';
export const MANAGE_DROPDOWN_ROLES_PRINCIPALS =
'[data-test-manage-dropdown-principals]';
export const MANAGE_DROPDOWN_ROLES_SCOPES =
'[data-test-manage-dropdown-scopes]';
export const MANAGE_DROPDOWN_ROLES_REMOVE =
'[data-test-manage-roles-dropdown] div:last-child button';
export const MANAGE_DROPDOWN_ADD_PRINCIPALS =
'[data-test-manage-role-principals]';
export const MANAGE_DROPDOWN_ADD_GRANT_TEMPLATES =
'[data-test-manage-role-grant-templates]';
export const MANAGE_DROPDOWN_EDIT_GRANTS = '[data-test-manage-dropdown-grants]';
export const ROLE_BADGE = (id) =>
`tbody [data-test-role-row="${id}"] td:nth-child(2) .hds-badge__text`;
export const ROLE_TOOLTIP_BTN = (id) =>
`tbody [data-test-role-row="${id}"] td:nth-child(2) .hds-tooltip-button`;
export const ROLE_TOOLTIP_CONTENT = (id) =>
`tbody [data-test-role-row="${id}"] td:nth-child(2) [data-tippy-root]`;
export const GRANT_SCOPE_ROW = (id) =>
`tbody [data-test-grant-scope-row="${id}"]`;
export const GRANT_SCOPE_PARENT_SCOPE =
'tbody tr:nth-child(2) td:nth-child(3) a';
export const TABLE_ALL_CHECKBOX = 'thead input[type="checkbox"]';
export const NO_RESULTS_MSG = '[data-test-no-role-results]';
export const NO_RESULTS_GRANT_SCOPE_MSG = '[data-test-no-grant-scope-results]';
export const NO_SCOPES_MSG = '.role-grant-scopes div';
export const NO_SCOPES_MSG_LINK = '.role-grant-scopes div div:nth-child(3) a';
export const NO_GRANT_TEMPLATES_MSG = '[data-test-no-grant-template-results]';
// Manage scopes selectors
export const SCOPE_TOGGLE = (name) => `.hds-form-toggle input[name="${name}"]`;
export const SCOPE_CHECKBOX = (type, id) =>
`tbody [data-test-${type}-scopes-table-row="${id}"] input`;
export const MANAGE_CUSTOM_SCOPES_BUTTON_ICON =
'[data-test-manage-custom-scopes-button] [data-test-icon="check-circle"]';
export const MANAGE_CUSTOM_SCOPES_BUTTON =
'[data-test-manage-custom-scopes-button]';
export const REMOVE_ORG_MODAL = (name) =>
`[data-test-manage-scopes-remove-${name}-modal]`;
export const REMOVE_ORG_ONLY_BTN = (name) =>
`[data-test-manage-scopes-remove-${name}-modal] div:nth-child(3) button:last-of-type`;
export const REMOVE_ORG_PROJECTS_BTN = (name) =>
`[data-test-manage-scopes-remove-${name}-modal] div:nth-child(3) button`;
// Role grants
export const FIELD_NEW_GRANT = 'form:nth-child(1) [name="grant"]';
export const FIELD_NEW_GRANT_ADD_BTN = 'form:nth-child(1) [type="submit"]';
export const FIELD_GRANT = 'form:nth-child(2) [name="grant"]';
export const FIELD_GRANT_VALUE = 'ids=123,action=delete';
export const FIELD_GRANT_REMOVE_BTN = 'form:nth-child(2) button[type="button"]';
export const GRANTS_FORM = 'form:nth-child(2)';
// We need to use a different selector for the grants form because the
// grants form has multiple submit buttons
export const SAVE_BTN = '.rose-form-actions [type=submit]';