Stone, Avi (as206k) | 9b2ceb3 | 2018-04-12 16:36:39 +0300 | [diff] [blame] | 1 | declare namespace Cypress { |
| 2 | interface Chainable { |
| 3 | homePage: typeof homePage; |
| 4 | homePageCertified: typeof homePageCertified; |
| 5 | sdcIsOwnerFalse: typeof sdcIsOwnerFalse; |
| 6 | sdcUserNotCheckout: typeof sdcUserNotCheckout; |
| 7 | getMCList: typeof getMCList; |
| 8 | getMCListEmpty: typeof getMCListEmpty; |
| 9 | deleteMonitoringComponent: typeof deleteMonitoringComponent; |
| 10 | deleteMonitoringComponentWithBlueprint: typeof deleteMonitoringComponentWithBlueprint; |
| 11 | submitMonitoringComponent: typeof submitMonitoringComponent; |
| 12 | saveMonitoringComponent: typeof saveMonitoringComponent; |
| 13 | getMC: typeof getMC; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | // functionality |
| 18 | function sdcIsOwnerFalse(): void { |
| 19 | cy.visit( |
| 20 | 'home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICE&uuid=b1645734-b812-4cd7-a0cc-5b5843940ad6&lifecycleState=NOT_CERTIFIED_CHECKOUT&isOwner=false' |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | function sdcUserNotCheckout(): void { |
| 25 | cy.visit( |
| 26 | 'home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICE&uuid=b1645734-b812-4cd7-a0cc-5b5843940ad6&lifecycleState=READY_FOR_CERTIFICATION&isOwner=true' |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | function homePage(): void { |
| 31 | cy.visit( |
| 32 | 'home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uuid=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=NOT_CERTIFIED_CHECKOUT&isOwner=true&version=0.1' |
| 33 | ); |
| 34 | } |
| 35 | |
| 36 | function homePageCertified(): void { |
| 37 | cy.visit( |
| 38 | 'home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uuid=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=CERTIFIED_CHECKOUT&isOwner=true&version=0.1' |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | function deleteMonitoringComponent(): void { |
| 43 | cy |
| 44 | .server() |
| 45 | .route({ |
| 46 | method: 'DELETE', |
| 47 | url: |
| 48 | Cypress.env('backendUrl') + |
| 49 | '/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9b0/cba37ed8-94e1-406f-b4f5-b5edbc31ac85/deleteVfcmtReference', |
| 50 | response: '{}' |
| 51 | }) |
| 52 | .as('deleteMonitoringComponent'); |
| 53 | } |
| 54 | |
| 55 | function saveMonitoringComponent(): void { |
| 56 | cy |
| 57 | .server() |
| 58 | .route({ |
| 59 | method: 'POST', |
| 60 | url: |
| 61 | Cypress.env('backendUrl') + |
| 62 | '/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9b0/saveComposition/cba37ed8-94e1-406f-b4f5-b5edbc31ac85', |
| 63 | response: '{}' |
| 64 | }) |
| 65 | .as('saveMonitoringComponent'); |
| 66 | } |
| 67 | |
| 68 | function submitMonitoringComponent(): void { |
| 69 | cy |
| 70 | .server() |
| 71 | .route({ |
| 72 | method: 'POST', |
| 73 | url: |
| 74 | Cypress.env('backendUrl') + |
| 75 | '/SERVICES/createBluePrint/cba37ed8-94e1-406f-b4f5-b5edbc31ac85/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9b0/', |
| 76 | response: '{}' |
| 77 | }) |
| 78 | .as('submitMonitoringComponent'); |
| 79 | } |
| 80 | |
| 81 | function deleteMonitoringComponentWithBlueprint(): void { |
| 82 | cy |
| 83 | .server() |
| 84 | .route({ |
| 85 | method: 'DELETE', |
| 86 | url: |
| 87 | Cypress.env('backendUrl') + |
| 88 | '/SERVICES/teSt.__.monitoring---TempLATE.6hnc/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/dump0/64471437-8feb-40d9-a8b0-9407a81dd5c0/deleteVfcmtReference', |
| 89 | response: '{}' |
| 90 | }) |
| 91 | .as('deleteMonitoringComponentWithBlueprint'); |
| 92 | } |
| 93 | |
| 94 | function getMCList(): void { |
| 95 | cy |
| 96 | .server() |
| 97 | .route({ |
| 98 | method: 'GET', |
| 99 | url: |
| 100 | Cypress.env('backendUrl') + |
| 101 | '/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/monitoringComponents', |
| 102 | response: 'fixture:monitoringComponentsMock' |
| 103 | }) |
| 104 | .as('mcList'); |
| 105 | } |
| 106 | |
| 107 | function getMC(): void { |
| 108 | cy |
| 109 | .server() |
| 110 | .route({ |
| 111 | method: 'GET', |
| 112 | url: |
| 113 | Cypress.env('backendUrl') + |
| 114 | '/getMC/cba37ed8-94e1-406f-b4f5-b5edbc31ac85', |
| 115 | response: 'fixture:getMCMock' |
| 116 | }) |
| 117 | .as('getMC'); |
| 118 | } |
| 119 | |
| 120 | function getMCListEmpty(): void { |
| 121 | cy |
| 122 | .server() |
| 123 | .route({ |
| 124 | method: 'GET', |
| 125 | url: |
| 126 | Cypress.env('backendUrl') + |
| 127 | '/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/monitoringComponents', |
| 128 | response: '{}' |
| 129 | }) |
| 130 | .as('mcListEmpty'); |
| 131 | } |
| 132 | |
| 133 | // Add cypress commands |
| 134 | Cypress.Commands.add('homePage', homePage); |
| 135 | Cypress.Commands.add('homePageCertified', homePageCertified); |
| 136 | Cypress.Commands.add('sdcIsOwnerFalse', sdcIsOwnerFalse); |
| 137 | Cypress.Commands.add('sdcUserNotCheckout', sdcUserNotCheckout); |
| 138 | Cypress.Commands.add('getMCList', getMCList); |
| 139 | Cypress.Commands.add('getMCListEmpty', getMCListEmpty); |
| 140 | Cypress.Commands.add('deleteMonitoringComponent', deleteMonitoringComponent); |
| 141 | Cypress.Commands.add( |
| 142 | 'deleteMonitoringComponentWithBlueprint', |
| 143 | deleteMonitoringComponentWithBlueprint |
| 144 | ); |
| 145 | Cypress.Commands.add('submitMonitoringComponent', submitMonitoringComponent); |
| 146 | Cypress.Commands.add('saveMonitoringComponent', saveMonitoringComponent); |
| 147 | Cypress.Commands.add('getMC', getMC); |