Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport main] Update workspace description usecase tests #1380

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading