Skip to content

Commit

Permalink
Add FTs for data source association in workspace creator and detail
Browse files Browse the repository at this point in the history
Signed-off-by: Kapian1234 <[email protected]>
  • Loading branch information
Kapian1234 committed Sep 10, 2024
1 parent b243f17 commit 00829f3
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion cypress/utils/dashboards/workspace-plugin/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Cypress.Commands.add('deleteWorkspaceByName', (workspaceName) => {
headers: {
'osd-xsrf': true,
},
body: {},
body: {
perPage: 9999,
},
}).then((resp) => {
if (resp && resp.body && resp.body.success) {
resp.body.result.workspaces.map(({ name, id }) => {
Expand Down Expand Up @@ -51,6 +53,7 @@ Cypress.Commands.add('createWorkspace', ({ settings, ...workspace } = {}) => {
body: {
attributes: {
...workspace,
features: workspace.features || ['use-case-observability'],
description: workspace.description || 'test_description',
},
settings,
Expand Down Expand Up @@ -153,6 +156,25 @@ Cypress.Commands.add('checkWorkspace', (workspaceId, expected) => {
});
});

Cypress.Commands.add('checkAssignedDatasource', (id, workspaceId) => {
cy.request({
method: 'GET',
headers: {
'osd-xsrf': true,
},
url: `/api/saved_objects/data-source/${id}`,
}).then((resp) => {
if (resp.body) {
const { workspaces } = resp.body;
if (!workspaces.includes(workspaceId)) {
throw new Error(
`data source ${id} is not assigned to workspace ${workspaceId}`
);
}
}
});
});

function checkPrincipalArrayEquals(expectedPrincipals, actualPrincipals) {
if (expectedPrincipals.length !== actualPrincipals.length) {
return false;
Expand Down

0 comments on commit 00829f3

Please sign in to comment.