qe-fe-automation
Version:
FE test automation framework using cypress
72 lines (55 loc) • 3.94 kB
text/typescript
import { Logs } from '@utility-lib/log';
import { AmplitudeEvents } from './amplitude-events';
export class GrowthInterceptApis {
static interceptApis(): void {
cy.intercept('GET', new RegExp('/api/selfSetup/tasks')).as('waitForGetTasks');
cy.intercept('GET', new RegExp('/api/lookup/v1/uaa/emailinfo')).as('waitForEmail');
cy.intercept('POST', new RegExp('/api/selfSetup/task/update')).as('waitForTaskUpdate');
cy.intercept('GET', new RegExp('/api/adminpolicyengine/v1/rules/flight')).as('waitForFlightRule');
cy.intercept('GET', new RegExp('/api/adminpolicyengine/v1/rules/hotel')).as('waitForHotelRule');
cy.intercept('GET', new RegExp('/api/adminpolicyengine/v1/rules/car')).as('waitForCarRule');
cy.intercept('GET', new RegExp('/api/adminpolicyengine/v1/rules/train')).as('waitForTrainRule');
cy.intercept('GET', new RegExp('/api/selfSetup/company/usersSetup/wizard/overview')).as(
'usersLandingPageWizardOverview'
);
cy.intercept('GET', new RegExp('/api/uaa/userPlatformPermissions')).as('userPlatformPermissions');
cy.intercept('POST', new RegExp('/api/v2/admin/user/import/async')).as('usersWizardWaitForFileUpload');
cy.intercept('POST', new RegExp('/api/admin/users/bulk/enhanced')).as('usersWizardBulkUsersInvitation');
cy.intercept(
'GET',
new RegExp('/api/admin/users?page=0&size=10&includeRolesForDisplay=true&includeExpenseRole=true')
).as('apiAdminUsersWithRoles');
cy.intercept('GET', new RegExp('/api/admin/users')).as('apiAdminUsers');
cy.intercept('PATCH', new RegExp('/api/admin/users/.*')).as('apiUsersPatch');
cy.intercept('GET', new RegExp('/api/admin/userAccessControl/.*?component=DASHBOARD')).as('apiUserAccessControl');
cy.intercept('GET', new RegExp('/api/admin/users/.*/permissions')).as('apiUsersPermissions');
cy.intercept('POST', new RegExp('/api/admin/users/.*/permissions')).as('apiUsersPostPermissions');
cy.intercept(
'GET',
new RegExp('/api/admin/company/teamEvent/settings/isUserAllowedToAccessTeamEventByCompanySettings')
).as('apiIsUserAllowed');
cy.intercept('GET', new RegExp('/api/selfSell/user/readInfo\\?token=.+')).as('waitForReadInfo');
cy.intercept('GET', new RegExp('/api/v1/user/travel-events/.+/invitations\\?size=20$')).as('waitForAddInviters');
cy.intercept('POST', new RegExp('/api/selfSell/onboard\\?token=.+')).as('waitForOnboard');
cy.intercept('POST', new RegExp('/api/selfSell/company/onboard')).as('waitForCompanyOnboard');
cy.intercept('PUT', new RegExp('/api/admin/self-setup/policies/1\\?company-uuid=.+')).as('waitForSetupPolicy');
cy.intercept('PATCH', new RegExp('/api/admin/company/self-setup')).as('waitForSelfSetup');
cy.intercept('PUT', new RegExp('/api/admin/company/selfonboarding/v2/finish')).as('waitForSelfSetupFinish');
cy.intercept('GET', new RegExp('/api/admin/policies')).as('waitForAdminPolicies');
cy.intercept('POST', new RegExp('/api/selfSell/admin/companyOnboard\\?token=.*')).as('waitForCreateCompanyAccount');
cy.intercept('PUT', new RegExp('/api/admin/self-setup/policies/\\d\\?company-uuid=.*')).as('waitForApplyPolicy');
cy.intercept('POST', new RegExp('/api/admin/paymentMethods')).as('waitForAddPaymentMethods');
cy.intercept('POST', new RegExp('/api/selfSell/bulkSignup')).as('waitForAddTravelers');
cy.intercept('PATCH', new RegExp('/api/admin/company/finish-policy-setup')).as('waitForAdminCompleted');
cy.intercept('GET', new RegExp('api/selfSell/pricing/metaData')).as('waitForPricing');
cy.intercept('**/bam.nr-data.net/**', {
log: false
});
cy.readFile('cypress/fixtures/growth/chilipiper-marketing.js', 'utf8').then((stubResponse) => {
cy.intercept('https://js.chilipiper.com/marketing.js', (req) => {
req.reply(stubResponse);
}).as('chilipiperSDK');
});
AmplitudeEvents.interceptAmplitudeAPI();
}
}