From 7183321dfe5eb59692ea9598eb58d4171d0c5094 Mon Sep 17 00:00:00 2001 From: rgomez Date: Thu, 19 Sep 2024 12:30:14 +0200 Subject: [PATCH] portal/client: retail sales tests for customers --- .../CallForwardSetting.cy.js | 120 +++++++++++++++ .../cypress/e2e/RetailAccount/Ddi/Ddi.cy.js | 75 ++++++++++ .../e2e/RetailAccount/RetailAccount.cy.js | 50 +++++++ .../fixtures/My/Profile/getProfileRetail.json | 23 +++ .../fixtures/RetailAccount/getItem.json | 35 +++++ .../cypress/fixtures/RetailAccount/post.json | 33 ++++ .../cypress/fixtures/RetailAccount/put.json | 23 +++ ...er-Retail-Accounts-CallForwardSetting.json | 141 ++++++++++++++++++ ...i-client-consumer-Retail-Accounts-Ddi.json | 67 +++++++++ ...ounts-client-consumer-Retail-Accounts.json | 70 +++++++++ .../prepareGenericPactInterceptors.js | 23 ++- 11 files changed, 654 insertions(+), 6 deletions(-) create mode 100644 web/portal/client/cypress/e2e/RetailAccount/CallForwardSetting/CallForwardSetting.cy.js create mode 100644 web/portal/client/cypress/e2e/RetailAccount/Ddi/Ddi.cy.js create mode 100644 web/portal/client/cypress/e2e/RetailAccount/RetailAccount.cy.js create mode 100644 web/portal/client/cypress/fixtures/My/Profile/getProfileRetail.json create mode 100644 web/portal/client/cypress/fixtures/RetailAccount/getItem.json create mode 100644 web/portal/client/cypress/fixtures/RetailAccount/post.json create mode 100644 web/portal/client/cypress/fixtures/RetailAccount/put.json create mode 100644 web/portal/client/cypress/pacts/client-provider-Retail-Accounts-CallForwardSetting-client-consumer-Retail-Accounts-CallForwardSetting.json create mode 100644 web/portal/client/cypress/pacts/client-provider-Retail-Accounts-Ddi-client-consumer-Retail-Accounts-Ddi.json create mode 100644 web/portal/client/cypress/pacts/client-provider-Retail-Accounts-client-consumer-Retail-Accounts.json diff --git a/web/portal/client/cypress/e2e/RetailAccount/CallForwardSetting/CallForwardSetting.cy.js b/web/portal/client/cypress/e2e/RetailAccount/CallForwardSetting/CallForwardSetting.cy.js new file mode 100644 index 00000000000..43706a5d372 --- /dev/null +++ b/web/portal/client/cypress/e2e/RetailAccount/CallForwardSetting/CallForwardSetting.cy.js @@ -0,0 +1,120 @@ +import CallForwardSettingCollection from '../../../fixtures/CallForwardSetting/getCollection.json'; +import CallForwardSettingItem from '../../../fixtures/CallForwardSetting/getItem.json'; +import newCallForwardSetting from '../../../fixtures/CallForwardSetting/post.json'; +import editCallForwardSetting from '../../../fixtures/CallForwardSetting/put.json'; + +describe('Retail Accounts CallForwardSetting', () => { + beforeEach(() => { + cy.prepareGenericPactInterceptors('Retail-Accounts-CallForwardSetting'); + cy.before(); + + cy.contains('Retail Accounts').click(); + + cy.get('header').should('contain', 'Retail Accounts'); + + cy.get('svg[data-testid="PhoneForwardedIcon"]').first().click(); + + cy.get('table').should( + 'contain', + CallForwardSettingCollection.body[0].numberValue + ); + }); + + /////////////////////// + // POST + /////////////////////// + it('add CallForwardSetting', () => { + cy.usePactIntercept( + { + method: 'POST', + url: '**/api/client/call_forward_settings*', + response: newCallForwardSetting.response, + matchingRules: newCallForwardSetting.matchingRules, + }, + 'createCallForwardSetting' + ); + + cy.get('[aria-label=Add]').click(); + + const { + targetType, + numberValue, + friend, + extension, + voicemail, + enabled, + ddi, + } = newCallForwardSetting.request; + cy.fillTheForm({ + targetType, + numberValue, + friend, + extension, + voicemail, + enabled, + ddi, + }); + + cy.get('header').should('contain', 'Call forward settings'); + + cy.usePactWait('createCallForwardSetting') + .its('response.statusCode') + .should('eq', 201); + }); + + /////////////////////////////// + // PUT + /////////////////////////////// + it('edit CallForwardSetting', () => { + cy.intercept('GET', '**/api/client/call_forward_settings/1', { + ...CallForwardSettingItem, + }).as('getCallForwardSetting-1'); + + cy.usePactIntercept( + { + method: 'PUT', + url: `**/api/client/call_forward_settings/${editCallForwardSetting.response.body.id}`, + response: editCallForwardSetting.response, + }, + 'editCallForwardSetting' + ); + + cy.get('svg[data-testid="EditIcon"]').first().click(); + + const { enabled, ddi, callForwardType } = editCallForwardSetting.request; + cy.fillTheForm({ + enabled, + ddi, + callForwardType, + }); + + cy.get('header').contains('Call forward settings'); + + cy.usePactWait(['editCallForwardSetting']) + .its('response.statusCode') + .should('eq', 200); + }); + + /////////////////////// + // DELETE + /////////////////////// + it('delete CallForwardSetting', () => { + cy.intercept('DELETE', '**/api/client/call_forward_settings/*', { + statusCode: 204, + }).as('deleteCallForwardSetting'); + + cy.get('td button > svg[data-testid="DeleteIcon"]').first().click(); + + cy.contains('Remove element'); + cy.get('div.MuiDialog-container button') + .filter(':visible') + .contains('Yes, delete it') + .click(); + + cy.get('header').should('contain', 'Call forward settings'); + + cy.usePactWait(['deleteCallForwardSetting']) + .its('response.statusCode') + .should('eq', 204); + }); +}); diff --git a/web/portal/client/cypress/e2e/RetailAccount/Ddi/Ddi.cy.js b/web/portal/client/cypress/e2e/RetailAccount/Ddi/Ddi.cy.js new file mode 100644 index 00000000000..b3fbf482802 --- /dev/null +++ b/web/portal/client/cypress/e2e/RetailAccount/Ddi/Ddi.cy.js @@ -0,0 +1,75 @@ +import DdiCollection from '../../../fixtures/Ddi/getCollection.json'; +import DdiItem from '../../../fixtures/Ddi/getItem.json'; +import editDdi from '../../../fixtures/Ddi/put.json'; + +describe('Retail Accounts Ddi', () => { + beforeEach(() => { + cy.prepareGenericPactInterceptors('Retail-Accounts-Ddi'); + cy.before(); + + cy.contains('Retail Accounts').click(); + + cy.get('header').should('contain', 'Retail Accounts'); + + cy.get('td button svg[data-testid="MoreHorizIcon"]').first().click(); + cy.get('li.MuiMenuItem-root').contains('DDIs').click(); + + cy.get('table').should('contain', DdiCollection.body[0].ddie164); + }); + + /////////////////////////////// + // PUT + /////////////////////////////// + it('edit Ddi', () => { + cy.intercept('GET', '**/api/client/ddis/1', { + ...DdiItem, + }).as('getDdi-1'); + + cy.usePactIntercept( + { + method: 'PUT', + url: `**/api/client/ddis/${editDdi.response.body.id}`, + response: editDdi.response, + }, + 'editDdi' + ); + + cy.get('svg[data-testid="EditIcon"]').first().click(); + + const { + conditionalRoute, + conferenceRoom, + description, + displayName, + externalCallFilter, + fax, + huntGroup, + ivr, + language, + queue, + residentialDevice, + routeType, + user, + } = editDdi.request; + + cy.fillTheForm({ + conditionalRoute, + conferenceRoom, + description, + displayName, + externalCallFilter, + fax, + huntGroup, + ivr, + language, + queue, + residentialDevice, + routeType, + user, + }); + + cy.contains('DDIs'); + + cy.usePactWait(['editDdi']).its('response.statusCode').should('eq', 200); + }); +}); diff --git a/web/portal/client/cypress/e2e/RetailAccount/RetailAccount.cy.js b/web/portal/client/cypress/e2e/RetailAccount/RetailAccount.cy.js new file mode 100644 index 00000000000..140c4c8c9a4 --- /dev/null +++ b/web/portal/client/cypress/e2e/RetailAccount/RetailAccount.cy.js @@ -0,0 +1,50 @@ +import RetailAccountCollection from '../../fixtures/RetailAccount/getCollection.json'; +import RetailAccountItem from '../../fixtures/RetailAccount/getItem.json'; +import editRetailAccount from '../../fixtures/RetailAccount/put.json'; + +describe('Retail Account', () => { + beforeEach(() => { + cy.prepareGenericPactInterceptors('Retail-Accounts'); + cy.before(); + + cy.contains('Retail Accounts').click(); + + cy.get('header').should('contain', 'Retail Accounts'); + + cy.get('table').should('contain', RetailAccountCollection.body[0].name); + }); + + /////////////////////////////// + // PUT + /////////////////////////////// + it('edit Retail Account', () => { + cy.intercept('GET', '**/api/client/retail_accounts/1', { + ...RetailAccountItem, + }).as('getRetailAccount-1'); + + cy.usePactIntercept( + { + method: 'PUT', + url: `**/api/client/retail_accounts/${editRetailAccount.response.body.id}`, + response: editRetailAccount.response, + }, + 'editRetailAccount' + ); + + cy.get('svg[data-testid="EditIcon"]').first().click(); + + const { description, transformationRuleSet, outgoingDdi } = + editRetailAccount.request; + cy.fillTheForm({ + description, + transformationRuleSet, + outgoingDdi, + }); + + cy.contains('Retail Accounts'); + + cy.usePactWait(['editRetailAccount']) + .its('response.statusCode') + .should('eq', 200); + }); +}); diff --git a/web/portal/client/cypress/fixtures/My/Profile/getProfileRetail.json b/web/portal/client/cypress/fixtures/My/Profile/getProfileRetail.json new file mode 100644 index 00000000000..6e6634320f2 --- /dev/null +++ b/web/portal/client/cypress/fixtures/My/Profile/getProfileRetail.json @@ -0,0 +1,23 @@ +{ + "body": { + "restricted": false, + "vpbx": false, + "residential": false, + "retail": true, + "wholesale": false, + "billingInfo": false, + "defaultCountryId": 68, + "acls": [], + "features": [ + "queues", + "recordings", + "faxes", + "friends", + "conferences" + ] + }, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "statusCode": 200 +} \ No newline at end of file diff --git a/web/portal/client/cypress/fixtures/RetailAccount/getItem.json b/web/portal/client/cypress/fixtures/RetailAccount/getItem.json new file mode 100644 index 00000000000..9495180e3f5 --- /dev/null +++ b/web/portal/client/cypress/fixtures/RetailAccount/getItem.json @@ -0,0 +1,35 @@ +{ + "body": { + "name": "testRetailAccount", + "description": "", + "transport": "udp", + "ip": null, + "port": null, + "password": "9rv6G3TVc-", + "fromDomain": null, + "directConnectivity": "no", + "ddiIn": "yes", + "t38Passthrough": "no", + "rtpEncryption": false, + "multiContact": true, + "ruriDomain": null, + "trustSDP": false, + "id": 1, + "transformationRuleSet": null, + "outgoingDdi": null, + "status": [ + { + "contact": "sip:yealinktest@10.10.1.109:5060", + "publicContact": false, + "received": "sip:212.64.172.26:5060", + "publicReceived": true, + "expires": "2031-01-01 00:59:59", + "userAgent": "Yealink SIP-T23G 44.80.0.130" + } + ] + }, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "statusCode": 200 +} diff --git a/web/portal/client/cypress/fixtures/RetailAccount/post.json b/web/portal/client/cypress/fixtures/RetailAccount/post.json new file mode 100644 index 00000000000..bf5038f7e37 --- /dev/null +++ b/web/portal/client/cypress/fixtures/RetailAccount/post.json @@ -0,0 +1,33 @@ +{ + "request": { + "name": "alice2", + "password": "ZGthe7E2+5", + "mac": null, + "terminalModel": 1 + }, + "response": { + "body": { + "name": "alice2", + "disallow": "all", + "allowAudio": "alaw", + "allowVideo": null, + "directMediaMethod": "invite", + "password": "ZGthe7E2+5", + "mac": null, + "lastProvisionDate": null, + "t38Passthrough": "no", + "rtpEncryption": false, + "id": 5, + "terminalModel": 1 + }, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "statusCode": 201 + }, + "matchingRules": { + "$.body.id": { + "match": "type" + } + } +} diff --git a/web/portal/client/cypress/fixtures/RetailAccount/put.json b/web/portal/client/cypress/fixtures/RetailAccount/put.json new file mode 100644 index 00000000000..6d693f6adad --- /dev/null +++ b/web/portal/client/cypress/fixtures/RetailAccount/put.json @@ -0,0 +1,23 @@ +{ + "request": { + "name": "readOnlyRetailAccount", + "description": "updated desc", + "transformationRuleSet": 1, + "outgoingDdi": 1 + }, + "response": { + "body": { + "name": "testRetailAccount", + "description": "updated desc", + "transport": "udp", + "password": "9rv6G1TVc-", + "id": 1, + "transformationRuleSet": 1, + "outgoingDdi": 1 + }, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "statusCode": 200 + } +} diff --git a/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-CallForwardSetting-client-consumer-Retail-Accounts-CallForwardSetting.json b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-CallForwardSetting-client-consumer-Retail-Accounts-CallForwardSetting.json new file mode 100644 index 00000000000..22d233cc600 --- /dev/null +++ b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-CallForwardSetting-client-consumer-Retail-Accounts-CallForwardSetting.json @@ -0,0 +1,141 @@ +{ + "consumer": { + "name": "client-consumer-Retail-Accounts-CallForwardSetting" + }, + "provider": { + "name": "client-provider-Retail-Accounts-CallForwardSetting" + }, + "interactions": [ + { + "description": "add CallForwardSetting", + "providerState": "", + "request": { + "method": "POST", + "path": "/api/client/call_forward_settings", + "headers": { + "accept": "application/json, text/plain, */*", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2Nzc4MzY2OTMsImV4cCI6MTY3Nzg0MDI5Mywicm9sZXMiOlsiUk9MRV9DT01QQU5ZX0FETUlOIl0sInVzZXJuYW1lIjoiY2xpZW50In0.eUZuqUVipx3O6OE9pd-TfjCdCIq3t0w8vZxky_eclCDng3GNf2dJjjdVcTv16BDswy355tixdqHhTx_X3sK6bMJoqD52eDshPL821sNHm2b38zbZl3bnf9MRRqY82eT88MZ_cWiJQ5_fm6PxMickC4FtJzXqAP-SBV7XswA-zB57TMKhdNYFsz41GI0szfmqRpm_-CYv3AfORKozFxWHtKJNd71r-Re1-BmSR0neatx9fr2eJOjAKoNGJkQmmx8c6nMcaeZBDIiglQJkDXk-A7eq6q1iF6vrqLq2ov27mFn4YmuLQkNCloZEoQDJNFR1CNZJRNqod4jC0N-y1FXFSBmbMH7_-F0XyUrbUx7DRzP-4ZK9LDxNTGZRvylDHXcTmJgmMEmPZ64DuTW4SozUjVxeVFv4OgveeLtexbLbmJ9qLoh0d8dtQSMvDOyr-t4zGw2zOUOdudXUp-t0S1oqDcEfEM-3dx2EW6SL11QoXWgVkIaN6eARiKMVnAWmUDAn7uT6TbKAZ4F8rEo5MmZMjDT_YuOF57DcGeDbC6035Kyd8SFgTcS6i3UqGf1Fp6U9nT1Snux8ATrt6cLJ644ZF2nkFb39EXlHHF03kzvVsw05nHHerLSVvdLgoSRVJSQufIF8JMK0MNMFGlBcUs3q4drqVGKiFcWQ-qXVV97IFpk", + "content-length": "168", + "content-type": "application/json" + }, + "body": { + "callTypeFilter": "both", + "callForwardType": "inconditional", + "targetType": "number", + "enabled": "1", + "ddi": null, + "retailAccount": 1, + "numberCountry": 3, + "numberValue": "946002020" + }, + "query": "" + }, + "response": { + "status": 201, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "body": { + "callTypeFilter": "internal", + "callForwardType": "inconditional", + "targetType": "number", + "numberValue": "946002020", + "noAnswerTimeout": 0, + "enabled": true, + "id": 5, + "user": 2, + "friend": null, + "extension": null, + "voicemail": null, + "numberCountry": 68, + "residentialDevice": null, + "retailAccount": null, + "cfwToRetailAccount": null, + "ddi": null + }, + "matchingRules": { + "$.body.id": { + "match": "type" + } + } + } + }, + { + "description": "edit CallForwardSetting", + "providerState": "", + "request": { + "method": "PUT", + "path": "/api/client/call_forward_settings/1", + "headers": { + "accept": "application/json, text/plain, */*", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2Nzc4MzY2OTMsImV4cCI6MTY3Nzg0MDI5Mywicm9sZXMiOlsiUk9MRV9DT01QQU5ZX0FETUlOIl0sInVzZXJuYW1lIjoiY2xpZW50In0.eUZuqUVipx3O6OE9pd-TfjCdCIq3t0w8vZxky_eclCDng3GNf2dJjjdVcTv16BDswy355tixdqHhTx_X3sK6bMJoqD52eDshPL821sNHm2b38zbZl3bnf9MRRqY82eT88MZ_cWiJQ5_fm6PxMickC4FtJzXqAP-SBV7XswA-zB57TMKhdNYFsz41GI0szfmqRpm_-CYv3AfORKozFxWHtKJNd71r-Re1-BmSR0neatx9fr2eJOjAKoNGJkQmmx8c6nMcaeZBDIiglQJkDXk-A7eq6q1iF6vrqLq2ov27mFn4YmuLQkNCloZEoQDJNFR1CNZJRNqod4jC0N-y1FXFSBmbMH7_-F0XyUrbUx7DRzP-4ZK9LDxNTGZRvylDHXcTmJgmMEmPZ64DuTW4SozUjVxeVFv4OgveeLtexbLbmJ9qLoh0d8dtQSMvDOyr-t4zGw2zOUOdudXUp-t0S1oqDcEfEM-3dx2EW6SL11QoXWgVkIaN6eARiKMVnAWmUDAn7uT6TbKAZ4F8rEo5MmZMjDT_YuOF57DcGeDbC6035Kyd8SFgTcS6i3UqGf1Fp6U9nT1Snux8ATrt6cLJ644ZF2nkFb39EXlHHF03kzvVsw05nHHerLSVvdLgoSRVJSQufIF8JMK0MNMFGlBcUs3q4drqVGKiFcWQ-qXVV97IFpk", + "content-length": "172", + "content-type": "application/json" + }, + "body": { + "callTypeFilter": "both", + "callForwardType": "inconditional", + "targetType": "number", + "enabled": "1", + "ddi": null, + "numberValue": "946002053", + "numberCountry": 68, + "retailAccount": null + }, + "query": "" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "body": { + "callTypeFilter": "internal", + "callForwardType": "inconditional", + "targetType": "number", + "numberValue": "946002021", + "noAnswerTimeout": 0, + "enabled": true, + "id": 1, + "user": 1, + "friend": null, + "extension": null, + "voicemail": null, + "numberCountry": 1, + "residentialDevice": null, + "retailAccount": null, + "cfwToRetailAccount": null, + "ddi": null + } + } + }, + { + "description": "delete CallForwardSetting", + "providerState": "", + "request": { + "method": "DELETE", + "path": "/api/client/call_forward_settings/1", + "headers": { + "accept": "application/json, text/plain, */*", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2Nzc4MzY2OTMsImV4cCI6MTY3Nzg0MDI5Mywicm9sZXMiOlsiUk9MRV9DT01QQU5ZX0FETUlOIl0sInVzZXJuYW1lIjoiY2xpZW50In0.eUZuqUVipx3O6OE9pd-TfjCdCIq3t0w8vZxky_eclCDng3GNf2dJjjdVcTv16BDswy355tixdqHhTx_X3sK6bMJoqD52eDshPL821sNHm2b38zbZl3bnf9MRRqY82eT88MZ_cWiJQ5_fm6PxMickC4FtJzXqAP-SBV7XswA-zB57TMKhdNYFsz41GI0szfmqRpm_-CYv3AfORKozFxWHtKJNd71r-Re1-BmSR0neatx9fr2eJOjAKoNGJkQmmx8c6nMcaeZBDIiglQJkDXk-A7eq6q1iF6vrqLq2ov27mFn4YmuLQkNCloZEoQDJNFR1CNZJRNqod4jC0N-y1FXFSBmbMH7_-F0XyUrbUx7DRzP-4ZK9LDxNTGZRvylDHXcTmJgmMEmPZ64DuTW4SozUjVxeVFv4OgveeLtexbLbmJ9qLoh0d8dtQSMvDOyr-t4zGw2zOUOdudXUp-t0S1oqDcEfEM-3dx2EW6SL11QoXWgVkIaN6eARiKMVnAWmUDAn7uT6TbKAZ4F8rEo5MmZMjDT_YuOF57DcGeDbC6035Kyd8SFgTcS6i3UqGf1Fp6U9nT1Snux8ATrt6cLJ644ZF2nkFb39EXlHHF03kzvVsw05nHHerLSVvdLgoSRVJSQufIF8JMK0MNMFGlBcUs3q4drqVGKiFcWQ-qXVV97IFpk" + }, + "body": "", + "query": "" + }, + "response": { + "status": 204, + "headers": {}, + "body": "" + } + } + ], + "metadata": { + "pactSpecification": { + "version": "2.0.0" + }, + "client": { + "name": "pact-cypress-adapter", + "version": "1.3.0" + } + } +} diff --git a/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-Ddi-client-consumer-Retail-Accounts-Ddi.json b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-Ddi-client-consumer-Retail-Accounts-Ddi.json new file mode 100644 index 00000000000..607f272911c --- /dev/null +++ b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-Ddi-client-consumer-Retail-Accounts-Ddi.json @@ -0,0 +1,67 @@ +{ + "consumer": { + "name": "client-consumer-Retail-Accounts-Ddi" + }, + "provider": { + "name": "client-provider-Retail-Accounts-Ddi" + }, + "interactions": [ + { + "description": "edit Ddi", + "providerState": "", + "request": { + "method": "PUT", + "path": "/api/client/ddis/1", + "headers": { + "accept": "application/json, text/plain, */*", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2Nzc4MzY2OTMsImV4cCI6MTY3Nzg0MDI5Mywicm9sZXMiOlsiUk9MRV9DT01QQU5ZX0FETUlOIl0sInVzZXJuYW1lIjoiY2xpZW50In0.eUZuqUVipx3O6OE9pd-TfjCdCIq3t0w8vZxky_eclCDng3GNf2dJjjdVcTv16BDswy355tixdqHhTx_X3sK6bMJoqD52eDshPL821sNHm2b38zbZl3bnf9MRRqY82eT88MZ_cWiJQ5_fm6PxMickC4FtJzXqAP-SBV7XswA-zB57TMKhdNYFsz41GI0szfmqRpm_-CYv3AfORKozFxWHtKJNd71r-Re1-BmSR0neatx9fr2eJOjAKoNGJkQmmx8c6nMcaeZBDIiglQJkDXk-A7eq6q1iF6vrqLq2ov27mFn4YmuLQkNCloZEoQDJNFR1CNZJRNqod4jC0N-y1FXFSBmbMH7_-F0XyUrbUx7DRzP-4ZK9LDxNTGZRvylDHXcTmJgmMEmPZ64DuTW4SozUjVxeVFv4OgveeLtexbLbmJ9qLoh0d8dtQSMvDOyr-t4zGw2zOUOdudXUp-t0S1oqDcEfEM-3dx2EW6SL11QoXWgVkIaN6eARiKMVnAWmUDAn7uT6TbKAZ4F8rEo5MmZMjDT_YuOF57DcGeDbC6035Kyd8SFgTcS6i3UqGf1Fp6U9nT1Snux8ATrt6cLJ644ZF2nkFb39EXlHHF03kzvVsw05nHHerLSVvdLgoSRVJSQufIF8JMK0MNMFGlBcUs3q4drqVGKiFcWQ-qXVV97IFpk", + "content-length": "94", + "content-type": "application/json" + }, + "body": { + "description": "New description for DDI 123", + "displayName": "new Display Name", + "language": null + }, + "query": "" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "body": { + "ddi": "123", + "ddie164": "+34123", + "description": "New description for DDI 123", + "recordCalls": "none", + "displayName": "new Display Name", + "routeType": null, + "friendValue": "", + "id": 1, + "conferenceRoom": null, + "language": null, + "queue": null, + "externalCallFilter": null, + "user": null, + "ivr": null, + "huntGroup": null, + "fax": null, + "country": 68, + "residentialDevice": null, + "conditionalRoute": null, + "retailAccount": null + } + } + } + ], + "metadata": { + "pactSpecification": { + "version": "2.0.0" + }, + "client": { + "name": "pact-cypress-adapter", + "version": "1.3.0" + } + } +} diff --git a/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-client-consumer-Retail-Accounts.json b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-client-consumer-Retail-Accounts.json new file mode 100644 index 00000000000..861741be67a --- /dev/null +++ b/web/portal/client/cypress/pacts/client-provider-Retail-Accounts-client-consumer-Retail-Accounts.json @@ -0,0 +1,70 @@ +{ + "consumer": { + "name": "client-consumer-Retail-Accounts" + }, + "provider": { + "name": "client-provider-Retail-Accounts" + }, + "interactions": [ + { + "description": "edit Retail Account", + "providerState": "", + "request": { + "method": "PUT", + "path": "/api/client/retail_accounts/1", + "headers": { + "accept": "application/json, text/plain, */*", + "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2Nzc4MzY2OTMsImV4cCI6MTY3Nzg0MDI5Mywicm9sZXMiOlsiUk9MRV9DT01QQU5ZX0FETUlOIl0sInVzZXJuYW1lIjoiY2xpZW50In0.eUZuqUVipx3O6OE9pd-TfjCdCIq3t0w8vZxky_eclCDng3GNf2dJjjdVcTv16BDswy355tixdqHhTx_X3sK6bMJoqD52eDshPL821sNHm2b38zbZl3bnf9MRRqY82eT88MZ_cWiJQ5_fm6PxMickC4FtJzXqAP-SBV7XswA-zB57TMKhdNYFsz41GI0szfmqRpm_-CYv3AfORKozFxWHtKJNd71r-Re1-BmSR0neatx9fr2eJOjAKoNGJkQmmx8c6nMcaeZBDIiglQJkDXk-A7eq6q1iF6vrqLq2ov27mFn4YmuLQkNCloZEoQDJNFR1CNZJRNqod4jC0N-y1FXFSBmbMH7_-F0XyUrbUx7DRzP-4ZK9LDxNTGZRvylDHXcTmJgmMEmPZ64DuTW4SozUjVxeVFv4OgveeLtexbLbmJ9qLoh0d8dtQSMvDOyr-t4zGw2zOUOdudXUp-t0S1oqDcEfEM-3dx2EW6SL11QoXWgVkIaN6eARiKMVnAWmUDAn7uT6TbKAZ4F8rEo5MmZMjDT_YuOF57DcGeDbC6035Kyd8SFgTcS6i3UqGf1Fp6U9nT1Snux8ATrt6cLJ644ZF2nkFb39EXlHHF03kzvVsw05nHHerLSVvdLgoSRVJSQufIF8JMK0MNMFGlBcUs3q4drqVGKiFcWQ-qXVV97IFpk", + "content-length": "407", + "content-type": "application/json" + }, + "body": { + "description": "updated desc", + "ddiIn": "yes", + "t38Passthrough": "no", + "rtpEncryption": false, + "multiContact": true, + "status": [ + { + "contact": "sip:yealinktest@10.10.1.109:5060", + "publicContact": false, + "received": "sip:212.64.172.26:5060", + "publicReceived": true, + "expires": "2031-01-01 00:59:59", + "userAgent": "Yealink SIP-T23G 44.80.0.130" + } + ], + "password": "9rv6G3TVc-", + "fromDomain": "", + "transformationRuleSet": "1", + "outgoingDdi": "1" + }, + "query": "" + }, + "response": { + "status": 200, + "headers": { + "content-type": "application/json; charset=utf-8" + }, + "body": { + "name": "testRetailAccount", + "description": "updated desc", + "transport": "udp", + "password": "9rv6G1TVc-", + "id": 1, + "transformationRuleSet": 1, + "outgoingDdi": 1 + } + } + } + ], + "metadata": { + "pactSpecification": { + "version": "2.0.0" + }, + "client": { + "name": "pact-cypress-adapter", + "version": "1.3.0" + } + } +} diff --git a/web/portal/client/cypress/support/commands/prepareGenericPactInterceptors.js b/web/portal/client/cypress/support/commands/prepareGenericPactInterceptors.js index daa6b053348..0e5f927df83 100644 --- a/web/portal/client/cypress/support/commands/prepareGenericPactInterceptors.js +++ b/web/portal/client/cypress/support/commands/prepareGenericPactInterceptors.js @@ -67,6 +67,7 @@ const CLIENT_TYPE = { Wholesale: 'wholesale', Vpbx: 'vpbx', }; +let profileItem; Cypress.Commands.add( 'prepareGenericPactInterceptors', @@ -266,17 +267,27 @@ Cypress.Commands.add( switch (clientType) { case CLIENT_TYPE.Retail: - cy.intercept('GET', '**/api/client/my/profile', { - ...RetailProfileItem, - }).as('getMyRetailProfile'); + profileItem = RetailProfileItem; break; default: - cy.intercept('GET', '**/api/client/my/profile', { ...ProfileItem }).as( - 'getMyProfile' - ); + profileItem = ProfileItem; break; } + switch (pactContextName) { + case 'Retail-Accounts': + case 'Retail-Accounts-CallForwardSetting': + case 'Retail-Accounts-Ddi': + profileItem = RetailProfileItem; + break; + default: + break; + } + + cy.intercept('GET', '**/api/client/my/profile', { ...profileItem }).as( + 'getMyProfile' + ); + cy.intercept('GET', '**/api/client/my/active_calls', { ...ActiveCallsCollection, }).as('getMyActiveCalls');