aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-27 19:10:41 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-27 19:10:41 +0000
commitae5156453ebf0c8c81c5aa2f791bb527dbf344ad (patch)
tree595da72e11ad39a2fbea2e72a0abf16c9efd1b90 /vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
parent79a8f61035752620b50a0fb42d98361f21962cd9 (diff)
parent3f216a5ba38d70c193256f05c634093da9599984 (diff)
Merge "When feature toggle is active then SDNC preload files is enable."
Diffstat (limited to 'vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts')
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts92
1 files changed, 92 insertions, 0 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
new file mode 100644
index 000000000..877506cad
--- /dev/null
+++ b/vid-webpack-master/cypress/integration/iFrames/sdncPreload.e2e.ts
@@ -0,0 +1,92 @@
+describe('SDNC preload ', () => {
+
+ beforeEach(() => {
+ cy.clearSessionStorage();
+ cy.setTestApiParamToGR();
+ cy.initAAIMock();
+ cy.initGetAAISubDetails();
+ cy.initVidMock();
+ cy.initDrawingBoardUserPermission();
+ cy.login();
+ });
+
+ afterEach(() => {
+ cy.screenshot();
+ });
+
+ it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload success' , () => {
+ mockPreloadResult(true, 200);
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+ cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1");
+ checkUploadLinkLogic();
+
+ uploadFile().then(() => {
+ cy.get('.sdc-modal__content').should('contain', 'The pre-load file(s) have been uploaded successfully.');
+ cy.getElementByDataTestsId('button-ok').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload another')
+ });
+ });
+
+ it('feature toggle is on and SDNC is checked then SDNC preload file is enable : upload fail', () => {
+ mockPreloadResult(false, 200);
+ cy.loadDrawingBoardWithRecreateMode(templateWithVnfSetup);
+
+ cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1");
+ checkUploadLinkLogic();
+
+ uploadFile().then(() => {
+ cy.get('.sdc-modal__content').should('contain', 'Failed to upload one or more of the files, please retry.');
+ cy.getElementByDataTestsId('button-ok').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload')
+ });
+ });
+});
+
+
+let apiTestResources = '../vid-automation/src/test/resources/asyncInstantiation/';
+
+const templateWithVnfSetup = {
+ serviceModelId: '6cfeeb18-c2b0-49df-987a-da47493c8e38',
+ instanceTemplateFile: apiTestResources + 'templates__instance_template.json',
+ instanceTemplateSetWithoutModifyFile: apiTestResources + 'templates__instance_from_template__set_without_modify1.json',
+ serviceModelFile: '../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json',
+};
+
+function mockAsyncBulkResponse() {
+ cy.server().route({
+ url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk',
+ method: 'POST',
+ status: 200,
+ response: true,
+ }).as("expectedPostAsyncInstantiation");
+}
+
+function mockPreloadResult(response: boolean, status?: number) {
+ cy.server().route({
+ url: Cypress.config('baseUrl') + '/preload',
+ method: 'POST',
+ status: status ? status : 200,
+ response: response,
+ }).as("preload");
+}
+
+
+function uploadFile() {
+ // @ts-ignore
+ return new Promise((resolve) => {
+ const fileName = '../support/uploadFiles/sdncPreLoadFileExample.json';
+ cy.fixture(fileName).then(fileContent => {
+ // @ts-ignore
+ cy.get('input[type=file]').eq(0).upload({fileContent, fileName, mimeType: 'application/json'}).then(() => {
+ resolve();
+ });
+ })
+ });
+}
+
+function checkUploadLinkLogic() {
+ cy.getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('not.have.class', 'disabled')
+ .getElementByDataTestsId('sdncPreLoad').click()
+ .getElementByDataTestsId('sdnc_pereload_upload_link').should('contain', 'Upload').should('have.class', 'disabled')
+ .getElementByDataTestsId('sdncPreLoad').click()
+}