-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfb07f3
commit f259a48
Showing
27 changed files
with
1,834 additions
and
0 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
web/portal/brand/cypress/e2e/Corporation/Corporation.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,104 @@ | ||
import CorporationsCollection from '../../fixtures/Provider/Corporations/getCollection.json'; | ||
import CorporationItem from '../../fixtures/Provider/Corporations/getItem.json'; | ||
import newCorporation from '../../fixtures/Provider/Corporations/post.json'; | ||
import editCorporation from '../../fixtures/Provider/Corporations/put.json'; | ||
|
||
describe('in Corporations', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('Corporation'); | ||
cy.before(); | ||
|
||
cy.get('svg[data-testid="EngineeringIcon"]').first().click(); | ||
cy.contains('Corporations').click(); | ||
|
||
cy.get('header').should('contain', 'Corporations'); | ||
|
||
cy.get('table').should('contain', CorporationsCollection.body[0].name); | ||
}); | ||
|
||
/////////////////////// | ||
// POST | ||
/////////////////////// | ||
it('add Corporation', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'POST', | ||
url: '**/api/brand/corporations*', | ||
response: newCorporation.response, | ||
matchingRules: newCorporation.matchingRules, | ||
}, | ||
'createCorporation' | ||
); | ||
|
||
cy.get('[aria-label=Add]').click(); | ||
|
||
const { ...rest } = newCorporation.request; | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Corporations'); | ||
|
||
cy.usePactWait(['createCorporation']) | ||
.its('response.statusCode') | ||
.should('eq', 201); | ||
}); | ||
|
||
/////////////////////////////// | ||
// PUT | ||
/////////////////////////////// | ||
it('edit a Corporation', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'GET', | ||
url: '**/api/brand/corporations/1', | ||
response: { ...CorporationItem }, | ||
}, | ||
'getCorporation-1' | ||
); | ||
|
||
cy.usePactIntercept( | ||
{ | ||
method: 'PUT', | ||
url: `**/api/brand/corporations/${editCorporation.response.body.id}`, | ||
response: editCorporation.response, | ||
}, | ||
'editCorporation' | ||
); | ||
|
||
cy.get('svg[data-testid="EditIcon"]').first().click(); | ||
|
||
const { ...rest } = editCorporation.request; | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Corporations'); | ||
|
||
cy.usePactWait(['editCorporation']) | ||
.its('response.statusCode') | ||
.should('eq', 200); | ||
}); | ||
|
||
/////////////////////// | ||
// DELETE | ||
/////////////////////// | ||
it('delete Corporation', () => { | ||
cy.intercept('DELETE', '**/api/brand/corporations/1', { | ||
statusCode: 204, | ||
}).as('deleteCorporation'); | ||
|
||
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', 'Corporations'); | ||
|
||
cy.usePactWait(['deleteCorporation']) | ||
.its('response.statusCode') | ||
.should('eq', 204); | ||
}); | ||
}); |
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,124 @@ | ||
import FriendsCollection from '../../fixtures/Provider/Friends/getCollection.json'; | ||
import FriendItem from '../../fixtures/Provider/Friends/getItem.json'; | ||
import newFriend from '../../fixtures/Provider/Friends/post.json'; | ||
import editFriend from '../../fixtures/Provider/Friends/put.json'; | ||
|
||
describe('in Friends', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('Friend'); | ||
cy.before(); | ||
|
||
cy.get('svg[data-testid="EngineeringIcon"]').first().click(); | ||
cy.contains('Friends').click(); | ||
|
||
cy.get('header').should('contain', 'Friends'); | ||
|
||
cy.get('table').should('contain', FriendsCollection.body[0].name); | ||
}); | ||
|
||
/////////////////////// | ||
// POST | ||
/////////////////////// | ||
it('add Friend', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'POST', | ||
url: '**/api/brand/friends*', | ||
response: newFriend.response, | ||
matchingRules: newFriend.matchingRules, | ||
}, | ||
'createFriend' | ||
); | ||
|
||
cy.get('[aria-label=Add]').click(); | ||
|
||
const { ...rest } = newFriend.request; | ||
|
||
delete rest.allow; | ||
delete rest.fromDomain; | ||
delete rest.ddiIn; | ||
delete rest.t38Passthrough; | ||
|
||
if (rest.directConnectivity === 'intervpbx') { | ||
delete rest.ip; | ||
delete rest.port; | ||
delete rest.transport; | ||
delete rest.ruriDomain; | ||
delete rest.proxyUser; | ||
delete rest.multiContact; | ||
delete rest.name; | ||
delete rest.priority; | ||
delete rest.password; | ||
} | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Friends'); | ||
|
||
cy.usePactWait(['createFriend']) | ||
.its('response.statusCode') | ||
.should('eq', 201); | ||
}); | ||
|
||
/////////////////////////////// | ||
// PUT | ||
/////////////////////////////// | ||
it('edit a Friend', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'GET', | ||
url: '**/api/brand/friends/1', | ||
response: { ...FriendItem }, | ||
}, | ||
'getFriend-1' | ||
); | ||
|
||
cy.usePactIntercept( | ||
{ | ||
method: 'PUT', | ||
url: `**/api/brand/friends/${editFriend.response.body.id}`, | ||
response: editFriend.response, | ||
}, | ||
'editFriend' | ||
); | ||
|
||
cy.get('svg[data-testid="EditIcon"]').eq(1).click(); | ||
|
||
const { ...rest } = editFriend.request; | ||
delete rest.allow; | ||
delete rest.fromDomain; | ||
delete rest.ddiIn; | ||
delete rest.t38Passthrough; | ||
delete rest.maxCalls; | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Friends'); | ||
|
||
cy.usePactWait(['editFriend']).its('response.statusCode').should('eq', 200); | ||
}); | ||
|
||
/////////////////////// | ||
// DELETE | ||
/////////////////////// | ||
it('delete Friend', () => { | ||
cy.intercept('DELETE', '**/api/brand/friends/1', { | ||
statusCode: 204, | ||
}).as('deleteFriend'); | ||
|
||
cy.get('td button > svg[data-testid="DeleteIcon"]').eq(1).click(); | ||
|
||
cy.contains('Remove element'); | ||
|
||
cy.get('div.MuiDialog-container button') | ||
.filter(':visible') | ||
.contains('Yes, delete it') | ||
.click(); | ||
|
||
cy.get('header').should('contain', 'Friends'); | ||
|
||
cy.usePactWait(['deleteFriend']) | ||
.its('response.statusCode') | ||
.should('eq', 204); | ||
}); | ||
}); |
117 changes: 117 additions & 0 deletions
117
web/portal/brand/cypress/e2e/ResidentialDevice/ResidentialDevice.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,117 @@ | ||
import ResidentialDevicesCollection from '../../fixtures/Provider/ResidentialDevices/getCollection.json'; | ||
import ResidentialDeviceItem from '../../fixtures/Provider/ResidentialDevices/getItem.json'; | ||
import newResidentialDevice from '../../fixtures/Provider/ResidentialDevices/post.json'; | ||
import editResidentialDevice from '../../fixtures/Provider/ResidentialDevices/put.json'; | ||
|
||
describe('in ResidentialDevices', () => { | ||
beforeEach(() => { | ||
cy.prepareGenericPactInterceptors('ResidentialDevice'); | ||
cy.before(); | ||
|
||
cy.get('svg[data-testid="EngineeringIcon"]').first().click(); | ||
cy.contains('Residential Devices').click(); | ||
|
||
cy.get('header').should('contain', 'Residential Devices'); | ||
|
||
cy.get('table').should( | ||
'contain', | ||
ResidentialDevicesCollection.body[0].name | ||
); | ||
}); | ||
|
||
/////////////////////// | ||
// POST | ||
/////////////////////// | ||
it('add ResidentialDevice', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'POST', | ||
url: '**/api/brand/residential_devices*', | ||
response: newResidentialDevice.response, | ||
matchingRules: newResidentialDevice.matchingRules, | ||
}, | ||
'createResidentialDevice' | ||
); | ||
|
||
cy.get('[aria-label=Add]').click(); | ||
|
||
const { ...rest } = newResidentialDevice.request; | ||
|
||
delete rest.t38Passthrough; | ||
delete rest.allow; | ||
delete rest.ddiIn; | ||
delete rest.maxCalls; | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Residential Devices'); | ||
|
||
cy.usePactWait(['createResidentialDevice']) | ||
.its('response.statusCode') | ||
.should('eq', 201); | ||
}); | ||
|
||
/////////////////////////////// | ||
// PUT | ||
/////////////////////////////// | ||
it('edit a ResidentialDevice', () => { | ||
cy.usePactIntercept( | ||
{ | ||
method: 'GET', | ||
url: '**/api/brand/residential_devices/1', | ||
response: { ...ResidentialDeviceItem }, | ||
}, | ||
'getResidentialDevice-1' | ||
); | ||
|
||
cy.usePactIntercept( | ||
{ | ||
method: 'PUT', | ||
url: `**/api/brand/residential_devices/${editResidentialDevice.response.body.id}`, | ||
response: editResidentialDevice.response, | ||
}, | ||
'editResidentialDevice' | ||
); | ||
|
||
cy.get('svg[data-testid="EditIcon"]').eq(4).click(); | ||
|
||
const { ...rest } = editResidentialDevice.request; | ||
|
||
delete rest.t38Passthrough; | ||
delete rest.allow; | ||
delete rest.ddiIn; | ||
delete rest.maxCalls; | ||
|
||
cy.fillTheForm(rest); | ||
|
||
cy.get('header').should('contain', 'Residential Devices'); | ||
|
||
cy.usePactWait(['editResidentialDevice']) | ||
.its('response.statusCode') | ||
.should('eq', 200); | ||
}); | ||
|
||
/////////////////////// | ||
// DELETE | ||
/////////////////////// | ||
it('delete ResidentialDevice', () => { | ||
cy.intercept('DELETE', '**/api/brand/residential_devices/1', { | ||
statusCode: 204, | ||
}).as('deleteResidentialDevice'); | ||
|
||
cy.get('td button > svg[data-testid="DeleteIcon"]').eq(4).click(); | ||
|
||
cy.contains('Remove element'); | ||
|
||
cy.get('div.MuiDialog-container button') | ||
.filter(':visible') | ||
.contains('Yes, delete it') | ||
.click(); | ||
|
||
cy.get('header').should('contain', 'Residential Devices'); | ||
|
||
cy.usePactWait(['deleteResidentialDevice']) | ||
.its('response.statusCode') | ||
.should('eq', 204); | ||
}); | ||
}); |
Oops, something went wrong.