Skip to content

Commit a7a91f7

Browse files
Fix tests
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
1 parent cb6d600 commit a7a91f7

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

public/apps/resource-sharing/test/resource-sharing-panel.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const toasts = {
3636
const typesPayload = [
3737
{
3838
type: 'anomaly-detector',
39-
access_levels: ['READ', 'WRITE'],
39+
action_groups: ['READ', 'WRITE'],
4040
},
4141
{
4242
type: 'forecaster',
43-
access_levels: ['READ_ONLY'],
43+
action_groups: ['READ_ONLY'],
4444
},
4545
];
4646

test/cypress/e2e/resource-sharing/resource_access_management.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ function closeAnyOpenPopover() {
2525
cy.get('body').type('{esc}', { force: true });
2626
}
2727

28-
function pickFirstType() {
28+
function pickSampleResourceType() {
2929
// Click the SuperSelect trigger (shows either selected text or "Select a type…")
3030
cy.contains('button.euiSuperSelectControl', /Select a type|.+/).click();
3131

32-
// Choose the first real item in the dropdown (ignore placeholder)
33-
// EUI renders items as listbox > button; pick the first enabled option
34-
cy.get('[role="listbox"] button:enabled').first().click();
32+
// Click the "Sample Resource" option in the dropdown
33+
cy.get('[role="listbox"]').within(() => {
34+
cy.contains('button:enabled', /^Sample Resource$/).click();
35+
});
3536

3637
// Close dropdown
3738
closeAnyOpenPopover();
@@ -85,11 +86,11 @@ function openFirstRowModal() {
8586
}
8687

8788
function addRecipientAndSubmit(expectLabel: 'Share' | 'Update Access') {
88-
// Ensure there is at least one action-group panel (create one if missing)
89+
// Ensure there is at least one access-levels panel (create one if missing)
8990
cy.get('@overlay').then(($ov) => {
90-
if ($ov.text().includes('No action-groups added yet.')) {
91+
if ($ov.text().includes('No access-levels added yet.')) {
9192
cy.wrap($ov)
92-
.contains('button', /Add action-group/i)
93+
.contains('button', /Add access-level/i)
9394
.click();
9495
}
9596
});
@@ -164,14 +165,14 @@ describe('Resource Access Management Dashboard', () => {
164165

165166
it('selects the first available type and loads the table (rows may be empty)', () => {
166167
cy.visit(BASE + ROUTE);
167-
pickFirstType();
168+
pickSampleResourceType();
168169
// Table exists whether or not there are rows
169170
findTable();
170171
});
171172

172173
it('opens Share/Update modal on first row (if rows exist), adds a recipient, and submits', () => {
173174
cy.visit(BASE + ROUTE);
174-
pickFirstType();
175+
pickSampleResourceType();
175176
findTable();
176177

177178
// If there are zero rows, gracefully skip the modal flow

0 commit comments

Comments
 (0)