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

Add test cases for workspace creation #1635

Merged
merged 5 commits into from
Nov 20, 2024
Merged
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 @@ -91,6 +91,103 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
cy.checkWorkspace(workspaceId, expectedWorkspace);
});
});

it('should successfully create a workspace from home page', () => {
cy.deleteWorkspaceByName(workspaceName);
miscUtils.visitPage('app/workspace_initial');
cy.getElementByTestId(
'workspace-initial-card-createWorkspace-button'
).click({
force: true,
});
cy.getElementByTestId(
'workspace-initial-button-create-observability-workspace'
).click({
force: true,
});
cy.contains('Observability')
.first()
.closest('.euiCheckableCard-isChecked')
.should('exist');

miscUtils.visitPage('app/workspace_initial');
wanglam marked this conversation as resolved.
Show resolved Hide resolved
cy.getElementByTestId(
'workspace-initial-useCaseCard-security-analytics-button-createWorkspace'
).click({
force: true,
});
cy.contains('Security Analytics')
.first()
.closest('.euiCheckableCard-isChecked')
.should('exist');

inputWorkspaceName(workspaceName);
inputDataSourceWhenMDSEnabled(dataSourceTitle);
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});

let workspaceId;
cy.wait('@createWorkspaceRequest').then((interception) => {
expect(interception.response.statusCode).to.equal(200);
workspaceId = interception.response.body.result.id;

cy.location('pathname', { timeout: 6000 }).should(
'include',
`w/${workspaceId}/app`
);

const expectedWorkspace = {
name: workspaceName,
features: ['use-case-security-analytics'],
};
cy.checkWorkspace(workspaceId, expectedWorkspace);
});
});

if (
Cypress.env('SAVED_OBJECTS_PERMISSION_ENABLED') &&
Cypress.env('SECURITY_ENABLED')
) {
it('should successfully jump to collaborators page after creating a workspace', () => {
cy.deleteWorkspaceByName(workspaceName);
inputWorkspaceName(workspaceName);
inputDataSourceWhenMDSEnabled(dataSourceTitle);
cy.getElementByTestId('workspaceForm-bottomBar-createButton').click({
force: true,
});

let workspaceId;
cy.wait('@createWorkspaceRequest').then((interception) => {
expect(interception.response.statusCode).to.equal(200);
workspaceId = interception.response.body.result.id;

cy.location('pathname', { timeout: 6000 }).should(
'include',
`w/${workspaceId}/app/workspace_collaborators`
);
});
});
}

it('should correctly display the summary card', () => {
inputWorkspaceName(workspaceName);
cy.getElementByTestId(
'workspaceForm-workspaceDetails-descriptionInputText'
).type('test_workspace_description.+~!');
cy.getElementByTestId('workspaceUseCase-essentials').click({
force: true,
});
inputDataSourceWhenMDSEnabled(dataSourceTitle);
cy.get('.workspaceCreateRightSidebar').within(() => {
cy.contains(workspaceName).should('exist');
cy.contains('test_workspace_description.+~!').should('exist');
cy.contains('Essentials').should('exist');
if (MDSEnabled) {
cy.contains(dataSourceTitle).should('exist');
}
});
});
});

describe('Validate workspace name and description', () => {
Expand Down
Loading