diff options
author | 2019-12-01 19:38:32 +0200 | |
---|---|---|
committer | 2019-12-01 19:51:25 +0200 | |
commit | e8887222c45e7d1849cb8098997c8fb7c149ebd7 (patch) | |
tree | 3d6d61e509f07c6202d924c8b5735a68fcfa1451 /vid-webpack-master/cypress/integration/iFrames | |
parent | d8a9536b717d0ff48f25deee301f033eceb6e100 (diff) |
Cypress to drive recreation from templates
A new route "RECREATE" allows the half-way between RETRY and CREATE: It
is "retry" because historic topology is loaded. It is "create" because
a new instance is created upon "Deploy".
Following commits should modify business-code, so that:
- The expectedPostAsyncInstantiation assertion pass;
- User is navigated the Instantiation-Status page;
- The template topology will be from a designated endpoint
"templateTopology", instead of "bulkForRetry";
- Consider the hack in `templates__instance_template.json`, where action
is "None_Create" instead of "Create" to workaround a state-oriented
problem in the method `extractServiceFields()`.
Issue-ID: VID-724
Change-Id: I0fc282b506a05b8161f3b3f96959493d3843c7f9
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/cypress/integration/iFrames')
-rw-r--r-- | vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts new file mode 100644 index 000000000..be029a1fc --- /dev/null +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -0,0 +1,69 @@ +describe('Drawing Board: Instantiation Templates', function () { + + describe('Load Page and Deploy', () => { + + beforeEach(() => { + cy.clearSessionStorage(); + cy.setTestApiParamToVNF(); + cy.initVidMock(); + cy.initDrawingBoardUserPermission(); + cy.login(); + + mockAsyncBulkResponse(); + }); + + afterEach(() => { + cy.screenshot(); + }); + + it(`Given a stored template - when click "deploy" - then a coherent request should be sent upon deploy`, function () { + const serviceModelId = '6cfeeb18-c2b0-49df-987a-da47493c8e38'; + const templateUuid = "46390edd-7100-46b2-9f18-419bd24fb60b"; + + const drawingBoardAction = `RECREATE`; + const templateTopologyEndpoint = "bulkForRetry"; // will be: "templateTopology" + + // Given... + + cy.route(`**/rest/models/services/${serviceModelId}`, + 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__service_model.json') + .as('serviceModel'); + + cy.route(`**/asyncInstantiation/${templateTopologyEndpoint}/${templateUuid}`, + 'fixture:../support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json') + .as('templateTopology'); + + // When... + + cy.openIframe(`app/ui/#/servicePlanning/${drawingBoardAction}` + + `?jobId=${templateUuid}` + + `&serviceModelId=${serviceModelId}`); + + cy.wait('@serviceModel'); + cy.wait('@templateTopology'); + + cy.getDrawingBoardDeployBtn().click(); + + // Then... + + cy.wait('@expectedPostAsyncInstantiation').then(xhr => { + // cy.readFile('cypress/support/jsonBuilders/mocks/jsons/instantiationTemplates/templates__instance_template.json').then((expectedResult) => { + // cy.deepCompare(xhr.request.body, expectedResult); + // }); + }); + + }); + + }); + + + function mockAsyncBulkResponse() { + cy.server().route({ + url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', + method: 'POST', + status: 200, + response: "[]", + }).as("expectedPostAsyncInstantiation"); + } + +}); |