From 93f8bd75f3096b9f59e721c0f298445dfa88fd95 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Sun, 8 Dec 2019 10:12:01 +0200 Subject: fix cypress test: should enable correct menu items Issue-ID: VID-724 The cypress test not handling well scroll bar so decrease data Change-Id: I7541b7127866bb0cc8651d80ab2721846eafabde Signed-off-by: Eylon Malin --- .../integration/iFrames/instantiationStatus.e2e.ts | 66 +++++++++++-------- .../mocks/jsons/asyncInstantiation.json | 76 ---------------------- 2 files changed, 39 insertions(+), 103 deletions(-) (limited to 'vid-webpack-master/cypress') diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts index 054f7858b..9a0c1aa36 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiationStatus.e2e.ts @@ -70,34 +70,46 @@ describe('Instantiation status', function () { cy.get('table#instantiation-status tbody tr').should('have.length', 3); }); + function getDropDownMenuByDataTestId(testId:String) { + return cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='${testId}']`); + } + + function clickOnTitleAndThenOnMenuWithJobId(jobId: string) { + cy.getElementByDataTestsId("instantiation-status-title").click(); + cy.get('#' + jobId).find('.menu-div').click(); + } + it('should enable correct menu items', function () { - cy.openIframe('app/ui/#/instantiationStatus'); - - // Instantiate action with Job status FAILED - isRetry = true - cy.get( '#5c2cd8e5-27d0-42e3-85a1-85db5eaba459').find('.menu-div').click(); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-retry']`).should('not.exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-remove']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-open']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-hide']`).should('not.exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-audit-info']`).should('not.exist'); - - // Instantiate action with Job status FAILED - isRetry = false - cy.get( '#e1db03c3-6274-4ff7-84cf-7bd3a3946de7').find('.menu-div').click(); - cy.get('.dropdown-menu').find(`[data-tests-id='context-menu-retry']`).should('not.be.visible'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-open']`).should('exist'); - - //Delete action with Job status IN_PROGRESS - cy.get( '#850dc7d2-5240-437f-9bcd-b1ed7dc339c2').find('.menu-div').click(); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-remove']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-open']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-hide']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-audit-info']`).should('not.exist'); - //Update action with Job status COMPLETED - cy.get( '#850dc7d2-5240-437f-9bcd-b1ed7dc339c1').find('.menu-div').click(); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-remove']`).should('exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-open']`).should('not.exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-hide']`).should('not.exist'); - cy.get('.dropdown-menu').find('.disabled').find(`[data-tests-id='context-menu-audit-info']`).should('not.exist'); + + cy.openIframe('app/ui/#/instantiationStatus'); + + // Instantiate action with Job status FAILED - isRetry = true + + clickOnTitleAndThenOnMenuWithJobId('5c2cd8e5-27d0-42e3-85a1-85db5eaba459'); + getDropDownMenuByDataTestId('context-menu-retry').should('not.exist'); + getDropDownMenuByDataTestId('context-menu-remove').should('exist'); + getDropDownMenuByDataTestId('context-menu-open').should('exist'); + getDropDownMenuByDataTestId('context-menu-hide').should('not.exist'); + getDropDownMenuByDataTestId('context-menu-audit-info').should('not.exist'); + + // Instantiate action with Job status FAILED - isRetry = false + clickOnTitleAndThenOnMenuWithJobId('e1db03c3-6274-4ff7-84cf-7bd3a3946de7'); + getDropDownMenuByDataTestId('context-menu-retry').should('not.be.visible'); + getDropDownMenuByDataTestId('context-menu-open').should('exist'); + + //Delete action with Job status IN_PROGRESS + clickOnTitleAndThenOnMenuWithJobId('850dc7d2-5240-437f-9bcd-b1ed7dc339c2'); + getDropDownMenuByDataTestId('context-menu-remove').should('exist'); + getDropDownMenuByDataTestId('context-menu-open').should('exist'); + getDropDownMenuByDataTestId('context-menu-hide').should('exist'); + getDropDownMenuByDataTestId('context-menu-audit-info').should('not.exist'); + + //Update action with Job status COMPLETED + clickOnTitleAndThenOnMenuWithJobId('850dc7d2-5240-437f-9bcd-b1ed7dc339c1'); + getDropDownMenuByDataTestId('context-menu-remove').should('exist'); + getDropDownMenuByDataTestId('context-menu-open').should('not.exist'); + getDropDownMenuByDataTestId('context-menu-hide').should('not.exist'); + getDropDownMenuByDataTestId('context-menu-audit-info').should('not.exist'); }); }); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json index 01eda9551..c6fc4ebc0 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json @@ -267,82 +267,6 @@ "createdBulkDate": 1524991828000, "isRetryEnabled": false }, - { - "id": 2, - "created": 1524663233000, - "modified": 1524663236000, - "action": "INSTANTIATE", - "createdId": null, - "modifiedId": null, - "rowNum": null, - "auditUserId": null, - "auditTrail": null, - "jobId": "b1ff271b-829a-43f9-a2e3-23987a34f261", - "templateId": "262fccc5-cae9-4258-b522-540c4010e0a9", - "userId": "16807000", - "aLaCarte": true, - "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d98", - "jobStatus": "FAILED", - "statusModifiedDate": 1524663233000, - "hidden": false, - "pause": false, - "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", - "owningEntityName": "WayneHolland", - "project": "WATKINS", - "aicZoneId": "NFT1", - "aicZoneName": "NFTJSSSS-NFT1", - "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", - "tenantName": "AIN Web Tool-15-D-testalexandria", - "regionId": "hvf6", - "regionName": null, - "serviceType": "TYLER SILVIA", - "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", - "serviceInstanceId": null, - "serviceInstanceName": "sPenLiZXXpqzsVck instance name_02", - "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", - "serviceModelName": "action-data", - "serviceModelVersion": "1.0", - "createdBulkDate": 1524663233000, - "isRetryEnabled": true - }, - { - "id": 1, - "created": 1524663233000, - "modified": 1524663236000, - "action": "INSTANTIATE", - "createdId": null, - "modifiedId": null, - "rowNum": null, - "auditUserId": null, - "auditTrail": null, - "jobId": "850dc7d2-5240-437f-9bcd-b1ed7dc339ca", - "templateId": "262fccc5-cae9-4258-b522-540c4010e0a9", - "userId": "16807000", - "aLaCarte": true, - "msoRequestId": "c0011670-0e1a-4b74-945d-8bf5aede1d45", - "jobStatus": "IN_PROGRESS", - "statusModifiedDate": 1524663233000, - "hidden": false, - "pause": false, - "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", - "owningEntityName": "WayneHolland", - "project": "WATKINS", - "aicZoneId": "NFT1", - "aicZoneName": "NFTJSSSS-NFT1", - "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", - "tenantName": "AIN Web Tool-15-D-testalexandria", - "regionId": "hvf6", - "regionName": null, - "serviceType": "TYLER SILVIA", - "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", - "serviceInstanceId": null, - "serviceInstanceName": "sPenLiZXXpqzsVck instance name_01", - "serviceModelId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", - "serviceModelName": "action-data", - "serviceModelVersion": "1.0", - "createdBulkDate": 1524663233000, - "isRetryEnabled": false - }, { "id": 9, "created": 1524663233000, -- cgit 1.2.3-korg