diff --git a/cypress/utils/dashboards/workspace-plugin/commands.js b/cypress/utils/dashboards/workspace-plugin/commands.js index 4ecf49df1..37bc7f2c1 100644 --- a/cypress/utils/dashboards/workspace-plugin/commands.js +++ b/cypress/utils/dashboards/workspace-plugin/commands.js @@ -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 }) => { @@ -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, @@ -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;