aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/jsonBuilders/mocks/permission.mock.ts
blob: a69d725660621de38d22c8bcf97c4165d326bfe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
declare namespace Cypress {
  interface Chainable {
    permissionVidMock: typeof permissionVidMock;
    initDrawingBoardUserPermission : typeof  initDrawingBoardUserPermission;
  }
}



function initDrawingBoardUserPermission( response?: any , delay?: number, status?: number) : void {
    cy.server()
      .route({
        method: 'GET',
        delay : delay ? delay : 0,
        status : status ? status : 200,
        url : Cypress.config('baseUrl') + "/roles/service_permissions?**",
        response : response ? response : {
          isEditPermitted : true
        }
      }).as('isEditPermitted');
}

function permissionVidMock(): void {
  initDrawingBoardUserPermission();
}


Cypress.Commands.add('permissionVidMock', permissionVidMock);
Cypress.Commands.add('initDrawingBoardUserPermission', initDrawingBoardUserPermission);