Skip to content

Commit

Permalink
portal/brand: cypress ddiProviders block
Browse files Browse the repository at this point in the history
  • Loading branch information
R0MANDEV committed Dec 3, 2024
1 parent eb81488 commit 82345b5
Show file tree
Hide file tree
Showing 26 changed files with 1,199 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import BillableCallsCollection from '../../../../fixtures/Provider/BillableCalls/getCollection.json';
import BillableCallItem from '../../../../fixtures/Provider/BillableCalls/getItem.json';
import DdisCollection from '../../../../fixtures/Provider/Ddis/getCollection.json';

describe('in Carriers BillableCalls', () => {
beforeEach(() => {
cy.prepareGenericPactInterceptors('ddis-billable_calls');

cy.intercept('GET', '**/api/brand/ddis/1', {
...DdisCollection,
body: DdisCollection.body.find((row) => row.id === 3),
}).as('getDdis1');

cy.before('ddis');

cy.get('svg[data-testid="PrecisionManufacturingIcon"]').first().click();
cy.contains('Carriers').click();
cy.get('td button svg[data-testid="MoreHorizIcon"]').first().click();
cy.get('li.MuiMenuItem-root')
.contains('External calls')
.click({ force: true });
cy.get('header').should('contain', 'Carriers');
cy.get('table').should('contain', DdisCollection.body[0].id);
});

it('contains Billable Calls', () => {
cy.get('table').should('contain', BillableCallsCollection.body[0].caller);
});

it('View details', () => {
cy.intercept('GET', '**/api/brand/billable_calls/*', {
...BillableCallItem,
}).as('getBillableCall-1');

cy.get('svg[data-testid="PanoramaIcon"]').first().click();

cy.usePactWait(['getBillableCall-1'])
.its('response.statusCode')
.should('eq', 200);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import BillableCallsCollection from '../../../../fixtures/Provider/BillableCalls/getCollection.json';
import DdisCollection from '../../../../fixtures/Provider/Ddis/getCollection.json';

describe('in BillableCalls', () => {
beforeEach(() => {
cy.prepareGenericPactInterceptors('ddis-billable_calls');

cy.intercept('GET', '**/api/brand/ddis/1', {
...DdisCollection,
body: DdisCollection.body.find((row) => row.id === 3),
}).as('getDdis1');

cy.before('ddis');

cy.get('svg[data-testid="PrecisionManufacturingIcon"]').first().click();
cy.contains('DDIs').click();

cy.get(`svg[data-testid="ChatBubbleIcon"]`).eq(1).click();

cy.get('header li.MuiBreadcrumbs-li:last').should(
'contain',
'External calls'
);
});

it('contains Billable Calls', () => {
cy.get('table').should('contain', BillableCallsCollection.body[0].caller);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import DdisProvidersAddressesCollection from '../../../../fixtures/Provider/DdiProviders/getProviderAddressesCollection.json';
import {
deleteDdiProviders,
postDdiProvidersAddresses,
putDdiProvidersAddresses,
} from './DDIProviderAddresses.tests';

describe('in Ddis Provider Addresses', () => {
beforeEach(() => {
cy.prepareGenericPactInterceptors('DDIs-Providers-Addresses');
cy.before();

cy.get('svg[data-testid="PrecisionManufacturingIcon"]').first().click();
cy.contains('DDI Providers').click();

cy.get('svg[data-testid="DnsIcon"]').first().click();
cy.get('header').should('contain', 'DDI Providers');

cy.get('table').should(
'contain',
DdisProvidersAddressesCollection.body[0].id
);
});

///////////////////////
// POST
///////////////////////
it('add Ddi Providers Addresses', postDdiProvidersAddresses);

///////////////////////////////
// PUT
///////////////////////////////
it('edit Ddi Providers', putDdiProvidersAddresses);

///////////////////////
// DELETE
///////////////////////
it('delete Ddi Providers', deleteDdiProviders);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import DdiProvidersAddressesItem from '../../../../fixtures/Provider/DdiProviders/getProviderAddressesItem.json';
import newDdiProvidersAddresses from '../../../../fixtures/Provider/DdiProviders/postProviderAddresses.json';
import editDdisProvidersAddresses from '../../../../fixtures/Provider/DdiProviders/putProviderAddresses.json';

export const postDdiProvidersAddresses = () => {
cy.usePactIntercept(
{
method: 'POST',
url: '**/api/brand/ddi_provider_addresses*',
response: newDdiProvidersAddresses.response,
matchingRules: newDdiProvidersAddresses.matchingRules,
},
'createDdiProvidersAddresses'
);

cy.get('[aria-label=Add]').click();
cy.get('header').should('contain', 'DDI Provider Addresses');

const { ip, description } = newDdiProvidersAddresses.request;
cy.fillTheForm({ ip, description });

cy.usePactWait(['createDdiProvidersAddresses'])
.its('response.statusCode')
.should('eq', 201);
};

export const putDdiProvidersAddresses = () => {
cy.usePactIntercept(
{
method: 'GET',
url: '**/api/brand/ddi_provider_addresses/1',
response: { ...DdiProvidersAddressesItem },
},
'getDdisProvidersAddresses-1'
);

cy.usePactIntercept(
{
method: 'PUT',
url: `**/api/brand/ddi_provider_addresses/${editDdisProvidersAddresses.response.body.id}`,
response: editDdisProvidersAddresses.response,
},
'editDdisProvidersAddresses'
);

cy.get('svg[data-testid="EditIcon"]').click();

const { description, ip } = editDdisProvidersAddresses.request;
cy.fillTheForm({ description, ip });

cy.get('header').should('contain', 'DDI Provider Addresses');

cy.usePactWait(['editDdisProvidersAddresses'])
.its('response.statusCode')
.should('eq', 200);
};

export const deleteDdiProviders = () => {
cy.intercept('DELETE', '**/api/brand/ddi_provider_addresses/*', {
statusCode: 204,
}).as('deleteDdiProvidersAddresses');
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', 'DDI Provider Addresses');

cy.usePactWait(['deleteDdiProvidersAddresses'])
.its('response.statusCode')
.should('eq', 204);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import DdisProvidersRegistrationsCollection from '../../../../fixtures/Provider/DdiProviders/getProviderRegistrationsCollection.json';
import {
deleteDdiProvidersRegistrations,
postDdiProvidersRegistrations,
putDdiProvidersRegistrations,
} from './DDIProviderRegistrations.tests';

describe('in Ddis Provider Registrations', () => {
beforeEach(() => {
cy.prepareGenericPactInterceptors('DDIs-Providers-Registrations');
cy.before();

cy.get('svg[data-testid="PrecisionManufacturingIcon"]').first().click();
cy.contains('DDI Providers').click();

cy.get('td button svg[data-testid="MoreHorizIcon"]').first().click();
cy.get('li.MuiMenuItem-root')
.contains('DDI Provider Registrations')
.click();
cy.get('header').should('contain', 'DDI Provider Registrations');

cy.get('table').should(
'contain',
DdisProvidersRegistrationsCollection.body[0].username
);
});

///////////////////////
// POST
///////////////////////
it('add Ddi Providers Registrations', postDdiProvidersRegistrations);

///////////////////////////////
// PUT
///////////////////////////////
it('edit Ddi Providers Registrations', putDdiProvidersRegistrations);

///////////////////////
// DELETE
///////////////////////
it('delete Ddi Providers Registrations', deleteDdiProvidersRegistrations);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import DdiProvidersRegistrationsItem from '../../../../fixtures/Provider/DdiProviders/getProviderRegistrationsItem.json';
import newDdiProvidersRegistrations from '../../../../fixtures/Provider/DdiProviders/postProviderRegistrations.json';
import editDdisProvidersRegistrations from '../../../../fixtures/Provider/DdiProviders/putProviderRegistrations.json';

export const postDdiProvidersRegistrations = () => {
cy.usePactIntercept(
{
method: 'POST',
url: '**/api/brand/ddi_provider_registrations*',
response: newDdiProvidersRegistrations.response,
matchingRules: newDdiProvidersRegistrations.matchingRules,
},
'createDdiProvidersRegistrations'
);

cy.get('[aria-label=Add]').click();
cy.get('header').should('contain', 'DDI Provider Registrations');

const {
username,
domain,
realm,
authUsername,
authPassword,
authProxy,
expires,
multiDdi,
} = newDdiProvidersRegistrations.request;
cy.fillTheForm({
username,
domain,
realm,
authUsername,
authPassword,
authProxy,
expires,
multiDdi,
});

cy.usePactWait(['createDdiProvidersRegistrations'])
.its('response.statusCode')
.should('eq', 201);
};

export const putDdiProvidersRegistrations = () => {
cy.usePactIntercept(
{
method: 'GET',
url: '**/api/brand/ddi_provider_registrations/1',
response: { ...DdiProvidersRegistrationsItem },
},
'getDdisProvidersRegistrations-1'
);

cy.usePactIntercept(
{
method: 'PUT',
url: `**/api/brand/ddi_provider_registrations/${editDdisProvidersRegistrations.response.body.id}`,
response: editDdisProvidersRegistrations.response,
},
'editDdisProvidersRegistrations'
);

cy.get('svg[data-testid="EditIcon"]').click();

const {
username,
realm,
authUsername,
authPassword,
authProxy,
expires,
multiDdi,
} = editDdisProvidersRegistrations.request;
cy.fillTheForm({
username,
realm,
authUsername,
authPassword,
authProxy,
expires,
multiDdi,
});

cy.get('header').should('contain', 'DDI Provider Registrations');

cy.usePactWait(['editDdisProvidersRegistrations'])
.its('response.statusCode')
.should('eq', 200);
};

export const deleteDdiProvidersRegistrations = () => {
cy.intercept('DELETE', '**/api/brand/ddi_provider_registrations/*', {
statusCode: 204,
}).as('deleteDdiProvidersRegistrations');

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', 'DDI Provider Registrations');

cy.usePactWait(['deleteDdiProvidersRegistrations'])
.its('response.statusCode')
.should('eq', 204);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import DdisCollection from '../../../../fixtures/Provider/Ddis/getCollection.json';
import { deleteDdi, postDdi, putDdi } from './Ddis.tests';

describe('in Ddi Providers DDIs', () => {
beforeEach(() => {
cy.prepareGenericPactInterceptors('DDIs');
cy.before();

cy.get('svg[data-testid="PrecisionManufacturingIcon"]').first().click();
cy.contains('DDI Providers').click();

cy.get('td button svg[data-testid="MoreHorizIcon"]').first().click();
cy.get('li.MuiMenuItem-root').contains('DDIs').click();
cy.get('header').should('contain', 'DDIs');

cy.get('table').should('contain', DdisCollection.body[0].id);
});

///////////////////////
// POST
///////////////////////
it('add Ddi', postDdi);

///////////////////////////////
// PUT
///////////////////////////////
it('edit Ddi', putDdi);

///////////////////////
// DELETE
///////////////////////
it('delete Ddi', deleteDdi);
});
Loading

0 comments on commit 82345b5

Please sign in to comment.