0.0.72 • Published 2 months ago

@spartez-software/azure-test v0.0.72

Weekly downloads
-
License
MIT
Repository
bitbucket
Last release
2 months ago

azure-tests (Beta)

Helper lib - azure integration tests

prerequisites

  • ability to run tests using jest

installation

npm install @spartez-software/azure-test --save-dev

setup

  • go get yourself an Azure devOps instance
  • setup .env
TEST_AZURE_URL=https://dev.azure.com/your-azure-site-name
TEST_AZURE_USER_TOKEN=pst! it is a secret pat, it belongs to the user that we use to make changes in Azure!

usage (jest/typescript example)

import { step } from '@spartez-software/test-utils';
import { TeamProjectReference } from 'azure-devops-node-api/interfaces/CoreInterfaces';
import { WorkItem } from 'azure-devops-node-api/interfaces/WorkItemTrackingInterfaces';
import { AzureDevOps } from '@spartez-software/azure-test/AzureDevOps';

describe('azure tests', () => {
    const azureDevOps = AzureDevOps.fromEnv();
    let teamProjectReference: TeamProjectReference;

    jest.retryTimes(5);
    jest.setTimeout(240000);

    beforeEach(async () => {
        await step('Create azure Project', async () => {
            teamProjectReference = await azureDevOps.createProject();
            expect(teamProjectReference).toBeDefined();
        });
    });

    it('should create and destroy project', async () => {
        const projectId = String(teamProjectReference.id);
        const workItemTrackingApi = await azureDevOps.connection.getWorkItemTrackingApi();
        const json = [{
            op: 'add',
            path: '/fields/System.Title',
            from: null,
            value: 'Sample task',
        }];

        let wi: WorkItem;
        await step('Create work item', async () => {
            wi = await workItemTrackingApi.createWorkItem({}, json, projectId, 'Task');
            expect(wi).toBeDefined();
        });

        await step('Verify workitem exists', async () => {
            const workItem = await workItemTrackingApi.getWorkItem(wi.id as number);
            expect(workItem).toBeDefined();
        });
    });

    afterEach(async () => {
        await step('Delete azure project', async () => {
            if (teamProjectReference.id) {
                await azureDevOps.deleteProject(teamProjectReference.id);
            }
        });
    });
});

pitfalls

  • Azure DevOps can take a long time to create a project, set up timeouts accordingly.
  • Large number of project, even deleted ones, make the create project time even longer.
0.0.72

2 months ago

0.0.71

4 months ago

0.0.70

11 months ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.67

2 years ago

0.0.66

2 years ago

0.0.64

2 years ago

0.0.65

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.61

2 years ago

0.0.60

3 years ago

0.0.59

3 years ago

0.0.57

3 years ago

0.0.58

3 years ago

0.0.56

3 years ago

0.0.55

3 years ago

0.0.53

3 years ago

0.0.54

3 years ago

0.0.52

3 years ago

0.0.51

3 years ago

0.0.50

3 years ago

0.0.49

3 years ago

0.0.48

3 years ago

0.0.47

3 years ago

0.0.46

3 years ago

0.0.45

3 years ago

0.0.44

3 years ago

0.0.43

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.40

3 years ago

0.0.39

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.36

3 years ago

0.0.35

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.24

3 years ago

0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago