Skip to content

Commit

Permalink
Merge branch 'main' into observability-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ritvibhatt authored Jan 14, 2025
2 parents cc605e6 + c4dd875 commit 9f9c124
Show file tree
Hide file tree
Showing 5 changed files with 558 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { WorkspaceCopyTestCases } from '../../../../utils/dashboards/workspace-plugin/test-cases/mds_workspace_copy.cases';

WorkspaceCopyTestCases();
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@

import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';

const updatePrivacySetting = (settingId) => {
cy.getElementByTestId('workspaceCollaborators-privacySetting-edit').click();
cy.getElementByTestId('workspacePrivacySettingSelector').click({
force: true,
});
cy.get(`#${settingId}`).click({ force: true });
cy.getElementByTestId('workspaceCollaborators-privacySetting-save').click({
force: true,
});

cy.getElementByTestId('workspaceCollaborators-privacySetting-save').should(
'not.exist'
);
};

export const WorkspaceCollaboratorsTestCases = () => {
const miscUtils = new MiscUtils(cy);
const workspaceName = 'test_workspace_collaborators';
Expand Down Expand Up @@ -209,6 +224,108 @@ export const WorkspaceCollaboratorsTestCases = () => {
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
});

it('should change to "anyone can read" successfully', () => {
updatePrivacySetting('anyone-can-view');

const expectedWorkspace = {
name: workspaceName,
features: ['use-case-observability'],
description: 'test_description',
permissions: {
library_write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
library_read: {
users: ['read_user', '*'],
},
read: {
users: ['read_user', '*'],
},
},
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
});

it('should change to "anyone can edit" successfully', () => {
updatePrivacySetting('anyone-can-edit');

const expectedWorkspace = {
name: workspaceName,
features: ['use-case-observability'],
description: 'test_description',
permissions: {
library_write: {
users: [`${Cypress.env('username')}`, '*'],
groups: ['admin_group'],
},
write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
library_read: {
users: ['read_user'],
},
read: {
users: ['read_user', '*'],
},
},
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
});

it('should change back to "private to collaborators" successfully', () => {
updatePrivacySetting('anyone-can-view');
cy.checkWorkspace(workspaceId, {
name: workspaceName,
features: ['use-case-observability'],
description: 'test_description',
permissions: {
library_write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
library_read: {
users: ['read_user', '*'],
},
read: {
users: ['read_user', '*'],
},
},
});

updatePrivacySetting('private-to-collaborators');
cy.checkWorkspace(workspaceId, {
name: workspaceName,
features: ['use-case-observability'],
description: 'test_description',
permissions: {
library_write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
write: {
users: [`${Cypress.env('username')}`],
groups: ['admin_group'],
},
library_read: {
users: ['read_user'],
},
read: {
users: ['read_user'],
},
},
});
});
});
}
};
Loading

0 comments on commit 9f9c124

Please sign in to comment.