Skip to content

Commit

Permalink
Adding Flow Framework Dashboards integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <saimedhi@amazon.com>
  • Loading branch information
saimedhi committed Oct 21, 2024
1 parent 1e14320 commit 2f4b6ff
Show file tree
Hide file tree
Showing 6 changed files with 2,971 additions and 2 deletions.
Binary file added .yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ import {
} from '../../../utils/constants';
import createConnectorBody from '../../../fixtures/plugins/dashboards-flow-framework/create_connector.json';
import registerModelBody from '../../../fixtures/plugins/dashboards-flow-framework/register_model.json';
import { getLastPathSegment } from '../../../utils/plugins/dashboards-flow-framework/helpers';
import {
getLastPathSegment,
setStorageItem,
} from '../../../utils/plugins/dashboards-flow-framework/helpers';

describe('Creating Workflows Using Various Methods', () => {
let restoreTenantSwitchModal;
var modelId = '';

before(() => {
Expand All @@ -34,6 +38,11 @@ describe('Creating Workflows Using Various Methods', () => {
});

beforeEach(() => {
restoreTenantSwitchModal = setStorageItem(
sessionStorage,
'opendistro::security::tenant::show_popup',
'false'
);
cy.visit(FF_URL.WORKFLOWS_NEW);
cy.url().should('include', getLastPathSegment(FF_URL.WORKFLOWS_NEW));
});
Expand Down Expand Up @@ -252,5 +261,8 @@ describe('Creating Workflows Using Various Methods', () => {
cy.undeployMLCommonsModel(modelId);
cy.deleteMLCommonsModel(modelId);
}
if (restoreTenantSwitchModal) {
restoreTenantSwitchModal();
}
});
});
12 changes: 12 additions & 0 deletions cypress/utils/plugins/dashboards-flow-framework/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@
export function getLastPathSegment(url) {
return url.split('/').pop();
}

export const setStorageItem = (storage, key, value) => {
const oldValue = storage.getItem(key);
storage.setItem(key, value);
return () => {
if (oldValue === null) {
storage.removeItem(key);
} else {
storage.setItem(key, oldValue);
}
};
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@
"overrides": {
"tough-cookie": "^4.1.3",
"optionator": "^0.9.3"
}
},
"packageManager": "yarn@4.3.1+sha512.af78262d7d125afbfeed740602ace8c5e4405cd7f4735c08feb327286b2fdb2390fbca01589bfd1f50b1240548b74806767f5a063c94b67e431aabd0d86f7774"
}
Loading

0 comments on commit 2f4b6ff

Please sign in to comment.