Skip to content

Commit

Permalink
Update workspace description usecase tests (#1375)
Browse files Browse the repository at this point in the history
* Remove workspace invalid description cases

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add workspace use case test cases

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update create workspace page title

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update copy to Enter Details

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Add special characters and move use case out

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Remove user & permissions button

Signed-off-by: Lin Wang <wonglam@amazon.com>

* Update expected worksapce content

Signed-off-by: Lin Wang <wonglam@amazon.com>

---------

Signed-off-by: Lin Wang <wonglam@amazon.com>
(cherry picked from commit c5ae8b4)
  • Loading branch information
wanglam authored and github-actions[bot] committed Jun 12, 2024
1 parent b892624 commit 52f8e53
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
});

it('should successfully load the page', () => {
cy.contains('Create Workspace', { timeout: 60000 });
cy.contains('Create a workspace', { timeout: 60000 });
});

describe('Create a workspace successfully', () => {
Expand All @@ -34,14 +34,13 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
).type(workspaceName);
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('test_workspace_description');
).type('test_workspace_description.+~!');
cy.getElementByTestId(
'euiColorPickerAnchor workspaceForm-workspaceDetails-colorPicker'
).type('#000000');
cy.getElementByTestId(
'workspaceForm-workspaceFeatureVisibility-OpenSearch Dashboards'
).check({ force: true });
cy.get('[id$="discover"]').uncheck({ force: true });
cy.getElementByTestId('workspaceUseCase-observability').check({
force: true,
});
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});
Expand All @@ -58,12 +57,11 @@ if (Cypress.env('WORKSPACE_ENABLED')) {

const expectedWorkspace = {
name: workspaceName,
description: 'test_workspace_description',
description: 'test_workspace_description.+~!',
features: [
'dashboards',
'visualize',
'workspace_update',
'workspace_overview',
'use-case-observability',
],
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
Expand Down Expand Up @@ -102,24 +100,24 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('test_workspace_description');
cy.getElementByTestId('workspaceUseCase-observability').check({
force: true,
});
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});
cy.contains('workspace name has already been used').should('exist');
});
});

it('workspace description is not valid', () => {
cy.getElementByTestId(
'workspaceForm-workspaceDetails-nameInputText'
).type(workspaceName);
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('./+');
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});
cy.contains('Invalid workspace description').should('exist');
it('workspace use case is required', () => {
cy.getElementByTestId(
'workspaceForm-workspaceDetails-nameInputText'
).type(workspaceName);
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});
cy.contains('Use case is required. Select a use case.').should('exist');
});

if (
Expand All @@ -141,11 +139,9 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.getElementByTestId(
'euiColorPickerAnchor workspaceForm-workspaceDetails-colorPicker'
).type('#000000');
cy.getElementByTestId(
'workspaceForm-workspaceFeatureVisibility-OpenSearch Dashboards'
).check({ force: true });
cy.get('[id$="discover"]').uncheck({ force: true });
cy.get('button').contains('Users & Permissions').click();
cy.getElementByTestId('workspaceUseCase-observability').check({
force: true,
});
cy.getElementByTestId(
'workspaceForm-permissionSettingPanel-user-addNew'
).click();
Expand All @@ -168,10 +164,9 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
name: workspaceName,
description: 'test_workspace_description',
features: [
'dashboards',
'visualize',
'workspace_update',
'workspace_overview',
'use-case-observability',
],
permissions: {
read: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.deleteAllWorkspaces();

for (const workspaceName of workspaceNames) {
cy.createWorkspace({ name: workspaceName }).then((workspaceId) => {
cy.createWorkspace({
name: workspaceName,
features: [
'workspace_overview',
'workspace_update',
'use-case-observability',
],
}).then((workspaceId) => {
workspaceNameIdMapping[workspaceName] = workspaceId;
});
}
Expand Down Expand Up @@ -98,7 +105,14 @@ if (Cypress.env('WORKSPACE_ENABLED')) {

// Create 3 more workspaces so that there are more than 5 workspaces in the system
for (const workspaceName of newWorkspaceNames) {
cy.createWorkspace({ name: workspaceName });
cy.createWorkspace({
name: workspaceName,
features: [
'workspace_overview',
'workspace_update',
'use-case-observability',
],
});
}

cy.wait(1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
name: workspaceName,
description: workspaceDescription,
features: [
'management',
'discover',
'workspace_overview',
'workspace_update',
'dashboards',
'visualize',
'use-case-observability',
],
}).then((id) => {
workspaceId = id;
Expand Down Expand Up @@ -103,7 +100,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
it('should show wokrspace update when click on settings tab', () => {
// click on settings tab
cy.getElementByTestId('workspaceTabs').find('#settings').click();
cy.contains('Workspace Details').should('be.visible');
cy.contains('Enter Details').should('be.visible');

cy.getElementByTestId('workspaceForm-workspaceDetails-nameInputText')
.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
describe('Update workspace', () => {
before(() => {
cy.deleteWorkspaceByName(workspaceName);
cy.createWorkspace({ name: workspaceName }).then(
(value) => (workspaceId = value)
);
cy.createWorkspace({
name: workspaceName,
features: [
'workspace_overview',
'workspace_update',
'use-case-observability',
],
}).then((value) => (workspaceId = value));
});

beforeEach(() => {
Expand Down Expand Up @@ -77,21 +82,16 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
});
cy.contains('Invalid workspace name').should('exist');
});
});

it('workspace description is not valid', () => {
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).clear({
force: true,
});
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('./+');
cy.getElementByTestId('workspaceForm-bottomBar-updateButton').click({
force: true,
});
cy.contains('Invalid workspace description').should('exist');
it('workspace use case is required', () => {
cy.getElementByTestId('workspaceUseCase-observability').uncheck({
force: true,
});
cy.getElementByTestId('workspaceForm-bottomBar-updateButton').click({
force: true,
});
cy.contains('Use case is required. Select a use case.').should('exist');
});

describe('Update a workspace successfully', () => {
Expand All @@ -111,13 +111,13 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
).type(workspaceName);
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('test_workspace_description');
).type('test_workspace_description.+~!');
cy.getElementByTestId(
'euiColorPickerAnchor workspaceForm-workspaceDetails-colorPicker'
).type('#D36086');
cy.getElementByTestId(
'workspaceForm-workspaceFeatureVisibility-OpenSearch Dashboards'
).check({ force: true });
cy.getElementByTestId('workspaceUseCase-observability').check({
force: true,
});
cy.getElementByTestId('workspaceForm-bottomBar-updateButton').click({
force: true,
});
Expand All @@ -130,13 +130,11 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
);
const expectedWorkspace = {
name: workspaceName,
description: 'test_workspace_description',
description: 'test_workspace_description.+~!',
features: [
'dashboards',
'visualize',
'discover',
'workspace_update',
'workspace_overview',
'use-case-observability',
],
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
Expand All @@ -148,7 +146,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
Cypress.env('SECURITY_ENABLED')
) {
describe('Update a workspace with permissions successfully', () => {
it.only('should successfully update a workspace with permissions', () => {
it('should successfully update a workspace with permissions', () => {
cy.getElementByTestId(
'workspaceForm-workspaceDetails-nameInputText'
).clear({
Expand All @@ -168,11 +166,9 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.getElementByTestId(
'euiColorPickerAnchor workspaceForm-workspaceDetails-colorPicker'
).type('#000000');
cy.getElementByTestId(
'workspaceForm-workspaceFeatureVisibility-OpenSearch Dashboards'
).check({ force: true });
cy.get('[id$="discover"]').uncheck({ force: true });
cy.get('button').contains('Users & Permissions').click();
cy.getElementByTestId('workspaceUseCase-observability').check({
force: true,
});
cy.getElementByTestId(
'workspaceForm-permissionSettingPanel-user-addNew'
).click();
Expand All @@ -193,10 +189,9 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
name: workspaceName,
description: 'test_workspace_description',
features: [
'dashboards',
'visualize',
'workspace_update',
'workspace_overview',
'use-case-observability',
],
permissions: {
read: {
Expand Down

0 comments on commit 52f8e53

Please sign in to comment.