-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2814 from irontec/PROVIDER-2049-vpbx-client-billi…
…ng-block Add cypress tests for billing section
- Loading branch information
Showing
9 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import InvoiceCollection from '../../fixtures/Invoices/getCollection.json'; | ||
|
||
describe('Invoice', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('Invoices'); | ||
cy.before(); | ||
|
||
cy.contains('Billing').click(); | ||
cy.contains('Invoices').click(); | ||
|
||
cy.get('header').should('contain', 'Invoice'); | ||
|
||
cy.get('table').should('contain', InvoiceCollection.body[0].number); | ||
}); | ||
|
||
it('has disabled buttons', () => { | ||
cy.get('[data-testid="EditIcon"]').first().should('not.be.enabled'); | ||
cy.get('[data-testid="DeleteIcon"]').first().should('not.be.enabled'); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
web/portal/client/cypress/e2e/RatingProfile/RatingProfile.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import RatingProfileCollection from '../../fixtures/RatingProfiles/getCollection.json'; | ||
|
||
describe('RatingProfiles', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('RatingProfiles'); | ||
cy.before(); | ||
|
||
cy.contains('Billing').click(); | ||
cy.contains('Rating profiles').click(); | ||
|
||
cy.get('header').should('contain', 'Rating profiles'); | ||
|
||
cy.get('table').should( | ||
'contain', | ||
RatingProfileCollection.body[0].ratingPlanGroup | ||
); | ||
}); | ||
|
||
it('has disabled buttons', () => { | ||
cy.get('[data-testid="EditIcon"]').first().should('not.be.enabled'); | ||
cy.get('[data-testid="DeleteIcon"]').first().should('not.be.enabled'); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
web/portal/client/cypress/e2e/RatingProfile/SimulateCall/SimulateCall.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
describe('RatingProfiles', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('RatingProfiles'); | ||
cy.before(); | ||
|
||
cy.contains('Billing').click(); | ||
cy.contains('Rating profiles').click(); | ||
|
||
cy.get('header').should('contain', 'Rating profiles'); | ||
cy.get('[data-testid="CurrencyExchangeIcon"]').first().click(); | ||
|
||
cy.get('[role="dialog"]').contains('Simulate call'); | ||
}); | ||
|
||
it('has disabled buttons', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'POST', | ||
url: '**/api/client/rating_profiles/1/simulate_call', | ||
response: { | ||
body: { | ||
plan: 'Something', | ||
callDate: '2023-01-24 10:51:44', | ||
duration: 20, | ||
patternName: 'Dest3 (+346)', | ||
connectionCharge: 0, | ||
intervalStart: '0', | ||
rate: 0.0025, | ||
ratePeriod: 1, | ||
totalCost: 0.15, | ||
currencySymbol: '€', | ||
}, | ||
statusCode: 201, | ||
}, | ||
}, | ||
'postSimulateCall' | ||
); | ||
|
||
cy.get(`[role="dialog"] input`) | ||
.first() | ||
.clear() | ||
.type('+342654', { delay: 1 }); | ||
cy.get(`[role="dialog"] input`).eq(1).clear().type(20, { delay: 1 }); | ||
|
||
cy.get('[role="dialog"] button').contains('Accept').first().click(); | ||
|
||
cy.usePactWait('postSimulateCall'); | ||
|
||
cy.get('[role="dialog"] table').contains('Something'); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
web/portal/client/cypress/fixtures/Invoices/getCollection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"body": [ | ||
{ | ||
"number": "TEST025", | ||
"inDate": "2023-05-17 00:00:00", | ||
"outDate": "2023-05-18 21:29:59", | ||
"taxRate": 21, | ||
"totalWithTax": null, | ||
"id": 39, | ||
"pdf": { | ||
"fileSize": null, | ||
"mimeType": null, | ||
"baseName": null | ||
}, | ||
"currency": "€" | ||
} | ||
], | ||
"headers": { | ||
"x-first-page": "/api/client/invoices?_page=1", | ||
"x-next-page": "/api/client/invoices?_page=1", | ||
"x-last-page": "/api/client/invoices?_page=1", | ||
"x-total-items": "1", | ||
"x-total-pages": "1" | ||
}, | ||
"statusCode": 200 | ||
} |
30 changes: 30 additions & 0 deletions
30
web/portal/client/cypress/fixtures/RatingPlanGroup/getCollection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"body": [ | ||
{ | ||
"id": 1, | ||
"name": { | ||
"en": "Something", | ||
"es": "Algo", | ||
"ca": "Algo mes", | ||
"it": "Più" | ||
} | ||
}, | ||
{ | ||
"id": 2, | ||
"name": { | ||
"en": "Something more", | ||
"es": "Algo más", | ||
"ca": "Algo mes", | ||
"it": "Più" | ||
} | ||
} | ||
], | ||
"headers": { | ||
"x-first-page": "/api/client/rating_plan_groups?_page=1", | ||
"x-last-page": "/api/client/rating_plan_groups?_page=1", | ||
"x-next-page": "/api/client/rating_plan_groups?_page=1", | ||
"x-total-items": "1", | ||
"x-total-pages": "1" | ||
}, | ||
"statusCode": 200 | ||
} |
18 changes: 18 additions & 0 deletions
18
web/portal/client/cypress/fixtures/RatingProfiles/getCollection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"body": [ | ||
{ | ||
"activationTime": "2018-02-02 21:20:20", | ||
"id": 1, | ||
"ratingPlanGroup": 1, | ||
"routingTag": 1 | ||
} | ||
], | ||
"headers": { | ||
"x-first-page": "/api/client/rating_profiles?_page=1", | ||
"x-last-page": "/api/client/rating_profiles?_page=1", | ||
"x-next-page": "/api/client/rating_profiles?_page=1", | ||
"x-total-items": "1", | ||
"x-total-pages": "1" | ||
}, | ||
"statusCode": 200 | ||
} |
17 changes: 17 additions & 0 deletions
17
web/portal/client/cypress/fixtures/RoutingTag/getCollection.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"body": [ | ||
{ | ||
"name": "TagName", | ||
"tag": "123#", | ||
"id": 1 | ||
} | ||
], | ||
"headers": { | ||
"x-first-page": "/api/client/routing_tags?_page=1", | ||
"x-last-page": "/api/client/routing_tags?_page=1", | ||
"x-next-page": "/api/client/routing_tags?_page=1", | ||
"x-total-items": "1", | ||
"x-total-pages": "1" | ||
}, | ||
"statusCode": 200 | ||
} |
53 changes: 53 additions & 0 deletions
53
...l/client/cypress/pacts/client-provider-RatingProfiles-client-consumer-RatingProfiles.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"consumer": { | ||
"name": "client-consumer-RatingProfiles" | ||
}, | ||
"provider": { | ||
"name": "client-provider-RatingProfiles" | ||
}, | ||
"interactions": [ | ||
{ | ||
"description": "has disabled buttons", | ||
"providerState": "", | ||
"request": { | ||
"method": "POST", | ||
"path": "/api/client/rating_profiles/1/simulate_call", | ||
"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": "28", | ||
"content-type": "application/x-www-form-urlencoded" | ||
}, | ||
"body": "number=%2B342654&duration=20", | ||
"query": "" | ||
}, | ||
"response": { | ||
"status": 201, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"plan": "Something", | ||
"callDate": "2023-01-24 10:51:44", | ||
"duration": 20, | ||
"patternName": "Dest3 (+346)", | ||
"connectionCharge": 0, | ||
"intervalStart": "0", | ||
"rate": 0.0025, | ||
"ratePeriod": 1, | ||
"totalCost": 0.15, | ||
"currencySymbol": "€" | ||
} | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"pactSpecification": { | ||
"version": "2.0.0" | ||
}, | ||
"client": { | ||
"name": "pact-cypress-adapter", | ||
"version": "1.3.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters