Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update e2e tests for actor model #918

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/k6/common/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defaultEndUserSsn, defaultServiceOwnerOrgNo } from "./config.js";

let defaultTokenOptions = {
scopes: "digdir:dialogporten digdir:dialogporten.serviceprovider digdir:dialogporten.serviceprovider.search",
orgName: "ttd",
orgName: "digdir",
orgNo: defaultServiceOwnerOrgNo,
ssn: defaultEndUserSsn
};
Expand Down
2 changes: 1 addition & 1 deletion tests/k6/tests/enduser/dialogDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function () {
describe('Check that seen log has been populated', () => {
if (dialog == null) return;
expect(dialog.seenSinceLastUpdate, 'seenSinceLastUpdate').to.have.lengthOf(1);
expect(dialog.seenSinceLastUpdate[0].endUserIdHash, 'endUserIdHash').to.have.lengthOf(10);
expect(dialog.seenSinceLastUpdate[0].seenBy.actorId, 'actorId').to.match(/urn:altinn:person:identifier-ephemeral/);
expect(dialog.seenSinceLastUpdate[0].isCurrentEndUser, 'isCurrentEndUser').to.equal(true);
});

Expand Down
11 changes: 8 additions & 3 deletions tests/k6/tests/enduser/dialogSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function () {
let idForCustomOrg = uuidv4();
let createdAfter = (new Date()).toISOString(); // We use this on all tests to hopefully avoid clashing with unrelated dialogs
let defaultFilter = "?CreatedAfter=" + createdAfter + "&Party=" + defaultParty;
let auxOrg = "digdir";
let auxOrg = "ttd";

describe('Arrange: Create some dialogs to test against', () => {

Expand Down Expand Up @@ -100,12 +100,12 @@ export default function () {

let d1 = r.json().items.find((d) => d.id == dialogIds[0]);
expect(d1.seenSinceLastUpdate, 'seenSinceLastUpdate').to.have.lengthOf(1);
expect(d1.seenSinceLastUpdate[0].endUserIdHash, 'endUserIdHash').to.have.lengthOf(10);
expect(d1.seenSinceLastUpdate[0].seenBy.actorId, 'actorId').to.match(/urn:altinn:person:identifier-ephemeral/);
expect(d1.seenSinceLastUpdate[0].isCurrentEndUser, 'isCurrentEndUser').to.equal(true);

let d2 = r.json().items.find((d) => d.id == dialogIds[1]);
expect(d2.seenSinceLastUpdate, 'seenSinceLastUpdate').to.have.lengthOf(1);
expect(d2.seenSinceLastUpdate[0].endUserIdHash, 'endUserIdHash').to.have.lengthOf(10);
expect(d1.seenSinceLastUpdate[0].seenBy.actorId, 'actorId').to.match(/urn:altinn:person:identifier-ephemeral/);
expect(d2.seenSinceLastUpdate[0].isCurrentEndUser, 'isCurrentEndUser').to.equal(true);
});

Expand Down Expand Up @@ -188,13 +188,18 @@ export default function () {
expect(r.json().items[0], 'party').to.have.property("serviceResource").that.equals(auxResource);
});

/*
Disabled for now. Dialogporten doesn't have proper TTD handling as of yet.

describe('List with org filter', () => {
console.log('dialogs/' + defaultFilter + '&Org=' + auxOrg);
let r = getEU('dialogs/' + defaultFilter + '&Org=' + auxOrg);
expectStatusFor(r).to.equal(200);
expect(r, 'response').to.have.validJsonBody();
expect(r.json(), 'response json').to.have.property("items").with.lengthOf(1);
expect(r.json().items[0], 'org').to.have.property("org").that.equals(auxOrg);
});
*/

describe("Cleanup", () => {
dialogIds.forEach((d) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/k6/tests/serviceowner/concurrency.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function () {
let promises = [];

for (let i=0; i<10; i++) {
let activity = { type: "Information", description: [ { value: i.toString(), languageCode: "nb"}]};
let activity = { type: "Information", performedBy: { actorType: "serviceOwner" }, description: [ { value: i.toString(), languageCode: "nb"}]};
promises.push(postSOAsync('dialogs/' + dialogId + '/activities?' + i, activity))
}

Expand Down
9 changes: 4 additions & 5 deletions tests/k6/tests/serviceowner/testdata/01-create-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ export default function () {
{
"type": "Error",
"performedBy": {
"actorType": "partyRepresentative",
"actorName": "Politiet"
"actorType": "serviceOwner"
},
"description": [
{
Expand All @@ -131,8 +130,8 @@ export default function () {
{
"type": "Submission",
"performedBy": {
"actorType": "partyRepresentative",
"actorName": "NAV"
"actorType": "partyRepresentative",
"actorName": "Some custom name"
},
"description": [
{
Expand All @@ -145,7 +144,7 @@ export default function () {
"type": "Submission",
"performedBy": {
"actorType": "partyRepresentative",
"actorName": "Skatteetaten"
"actorId": "urn:altinn:organization:identifier-no:991825827"
},
"description": [
{
Expand Down