Skip to content

Commit

Permalink
Created e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fargekritt committed Jan 9, 2025
1 parent 3c258bc commit a3759db
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/k6/tests/enduser/all-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
import { default as dialogDetails } from './dialogDetails.js';
import { default as dialogSearch } from './dialogSearch.js';
import { default as dialogSystemLabelLog } from './dialogSystemLabelLog.js';
import { default as enduserSearchWithThresholds } from './enduserSearchWithThresholds.js';
import { default as parties } from './parties.js';

export default function() {
dialogDetails();
dialogSearch();
dialogSystemLabelLog();
enduserSearchWithThresholds();
parties();
}
4 changes: 4 additions & 0 deletions tests/k6/tests/serviceowner/all-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { default as authentication } from './authentication.js';
import { default as authorization } from './authorization.js';
import { default as concurrency } from './concurrency.js';
import { default as createDialogWithThresholds } from './createDialogWithThresholds.js';
import { default as dialogCreateActivity } from './dialogCreateActivity.js';
import { default as dialogCreateExternalResource } from './dialogCreateExternalResource.js';
import { default as dialogCreateInvalidActionCount } from './dialogCreateInvalidActionCount.js';
Expand All @@ -11,11 +12,13 @@ import { default as dialogCreateUpdatePatchDeleteCorrespondenceResource } from '
import { default as dialogDetails } from './dialogDetails.js';
import { default as dialogSearch } from './dialogSearch.js';
import { default as dialogUpdateActivity } from './dialogUpdateActivity.js';
import { default as serviceOwnerSearchWithThresholds } from './serviceOwnerSearchWithThresholds.js';

export default function() {
authentication();
authorization();
concurrency();
createDialogWithThresholds();
dialogCreateActivity();
dialogCreateExternalResource();
dialogCreateInvalidActionCount();
Expand All @@ -25,4 +28,5 @@ export default function() {
dialogDetails();
dialogSearch();
dialogUpdateActivity();
serviceOwnerSearchWithThresholds();
}
30 changes: 30 additions & 0 deletions tests/k6/tests/serviceowner/dialogCreatePatchDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import {default as dialogToInsert} from './testdata/01-create-dialog.js';

export default function () {

let dialogIds = [];
let dialogId = null;
let attachmentId = null;
let eTag = null;
let newApiActionEndpointUrl = null;

Expand All @@ -28,6 +30,28 @@ export default function () {
dialogId = r.json();
});


describe('Perform dialog create with specifed attachmentId', () => {
let dialog = dialogToInsert();
attachmentId = uuidv7();
dialog.transmissions[0].attachments[0].id = attachmentId;
let r = postSO('dialogs', dialog);
expectStatusFor(r).to.equal(201);
expect(r, 'response').to.have.validJsonBody();
expect(r.json(), 'response json').to.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)

dialogIds.push(r.json());
});

describe('Perform dialog create with taken specifed attachmentId', () => {
let dialog = dialogToInsert();
dialog.transmissions[0].attachments[0].id = attachmentId;
let r = postSO('dialogs', dialog);
expectStatusFor(r).to.equal(422);
expect(r, 'response').to.have.validJsonBody();
expect(r.json(), 'response json').to.have.property('errors');

});
describe('Perform dialog get', () => {
let r = getSO('dialogs/' + dialogId);
expectStatusFor(r).to.equal(200);
Expand Down Expand Up @@ -190,4 +214,10 @@ export default function () {
expect(r.json(), 'response json').to.have.property('errors');
});

describe('Clean up', () => {
for (let i = 0; i < dialogIds.length; i++) {
let r = purgeSO('dialogs/' + dialogIds[i]);
expectStatusFor(r).to.equal(204);
}
});
}

0 comments on commit a3759db

Please sign in to comment.