2017-02-24 08:22:38 +00:00
|
|
|
window.onload = function() {
|
|
|
|
|
|
|
|
var ticketData = {
|
|
|
|
"number": "72008",
|
|
|
|
"title": "asdfasdf",
|
|
|
|
"group_id": 1,
|
|
|
|
"owner_id": 6,
|
|
|
|
"updated_by_id": 6,
|
|
|
|
"created_by_id": 6,
|
|
|
|
"customer_id": 6,
|
|
|
|
"state_id": 4,
|
|
|
|
"priority_id": 2,
|
|
|
|
"created_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"updated_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"pending_time": "2017-02-09T09:16:56.192Z",
|
|
|
|
"aaaaa": "1234568791",
|
|
|
|
"anrede": "Herr",
|
|
|
|
"asdf": "",
|
|
|
|
"organization_id": 6,
|
|
|
|
"organization": {
|
|
|
|
"name": "harald test gmbh",
|
|
|
|
"domain": "www.harald-ist-cool.de",
|
|
|
|
"shared": true,
|
|
|
|
"note": "<div>harald test gmbh</div>",
|
|
|
|
"member_ids": [
|
|
|
|
6,
|
|
|
|
2
|
|
|
|
],
|
|
|
|
"active": true,
|
|
|
|
"created_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"updated_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"domain_assignment": false,
|
|
|
|
"updated_by_id": 6,
|
|
|
|
"created_by_id": 6,
|
|
|
|
"id": 6
|
|
|
|
},
|
|
|
|
"group": {
|
|
|
|
"name": "Users",
|
|
|
|
"assignment_timeout": null,
|
|
|
|
"follow_up_possible": "reject",
|
|
|
|
"follow_up_assignment": true,
|
|
|
|
"email_address_id": 1,
|
|
|
|
"signature_id": 1,
|
|
|
|
"note": "Standard Group/Pool for Tickets.",
|
|
|
|
"active": true,
|
|
|
|
"updated_at": "2017-01-18T13:45:30.528Z",
|
|
|
|
"id": 1
|
|
|
|
},
|
|
|
|
"owner": {
|
|
|
|
"login": "-",
|
|
|
|
"firstname": "-",
|
|
|
|
"lastname": "",
|
|
|
|
"email": "",
|
|
|
|
"web": "",
|
|
|
|
"password": "",
|
|
|
|
"phone": "",
|
|
|
|
"fax": "",
|
|
|
|
"mobile": "",
|
|
|
|
"street": "",
|
|
|
|
"zip": "",
|
|
|
|
"city": "",
|
|
|
|
"country": "",
|
|
|
|
"organization_id": null,
|
|
|
|
"department": "",
|
|
|
|
"note": "",
|
|
|
|
"role_ids": [],
|
|
|
|
"group_ids": [],
|
|
|
|
"active": false,
|
|
|
|
"updated_at": "2016-08-02T14:25:24.053Z",
|
|
|
|
"address": "",
|
|
|
|
"vip": false,
|
|
|
|
"anrede": null,
|
|
|
|
"asdf": null,
|
|
|
|
"id": 1
|
|
|
|
},
|
|
|
|
"state": {
|
|
|
|
"name": "closed",
|
|
|
|
"note": null,
|
|
|
|
"active": true,
|
|
|
|
"id": 4
|
|
|
|
},
|
|
|
|
"priority": {
|
|
|
|
"name": "2 normal",
|
|
|
|
"note": null,
|
|
|
|
"active": true,
|
|
|
|
"updated_at": "2016-08-02T14:25:24.677Z",
|
|
|
|
"id": 2
|
|
|
|
},
|
|
|
|
"article": {
|
2021-08-20 08:56:23 +00:00
|
|
|
"from": "Test Admin Agent",
|
2017-02-24 08:22:38 +00:00
|
|
|
"to": "agent1@example.com",
|
|
|
|
"cc": "agent1+cc@example.com",
|
2021-08-20 08:56:23 +00:00
|
|
|
"body": "asdfasdfasdf<br><br><div data-signature=\"true\" data-signature-id=\"1\"> Test Admin Agent<br><br>--<br> Super Support - Waterford Business Park<br> 5201 Blue Lagoon Drive - 8th Floor & 9th Floor - Miami, 33126 USA<br> Email: hot@example.com - Web: http://www.example.com/<br>--</div>",
|
2017-02-24 08:22:38 +00:00
|
|
|
"content_type": "text/html",
|
|
|
|
"ticket_id": "2",
|
|
|
|
"type_id": 1,
|
|
|
|
"sender_id": 1,
|
|
|
|
"internal": false,
|
|
|
|
"in_reply_to": "<20170217100622.2.152971@zammad.example.com>",
|
|
|
|
"form_id": "326044216"
|
|
|
|
},
|
|
|
|
"customer": {
|
|
|
|
"login": "hc@zammad.com",
|
|
|
|
"firstname": "Harald",
|
|
|
|
"lastname": "Customer",
|
|
|
|
"email": "hc@zammad.com",
|
|
|
|
"web": "zammad.com",
|
|
|
|
"password": "",
|
|
|
|
"phone": "1234567894",
|
|
|
|
"fax": "",
|
|
|
|
"mobile": "",
|
|
|
|
"street": "",
|
|
|
|
"zip": "",
|
|
|
|
"city": "",
|
|
|
|
"country": "",
|
|
|
|
"organization_id": 6,
|
|
|
|
"created_by_id": 6,
|
|
|
|
"updated_by_id": 6,
|
|
|
|
"department": "",
|
|
|
|
"note": "",
|
|
|
|
"role_ids": [
|
|
|
|
3
|
|
|
|
],
|
|
|
|
"group_ids": [],
|
|
|
|
"active": true,
|
|
|
|
"created_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"updated_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"address": "Walter-Gropius-Straße 17, 80807 München, Germany",
|
|
|
|
"web": "www.harald-ist-cool.de",
|
|
|
|
"vip": false,
|
|
|
|
"id": 434
|
|
|
|
},
|
2017-11-30 08:29:18 +00:00
|
|
|
"tags": ["tag a", "tag b"],
|
2021-03-16 08:59:32 +00:00
|
|
|
"mention_user_ids": [1,3,5,6],
|
2017-02-24 08:22:38 +00:00
|
|
|
"escalation_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"last_contact_agent_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"last_contact_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"last_contact_customer_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"first_response_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"close_at": "2017-02-09T09:16:56.192Z",
|
|
|
|
"id": 8
|
|
|
|
};
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
App.User.refresh([{
|
2017-02-24 08:22:38 +00:00
|
|
|
"login": "hh@zammad.com",
|
|
|
|
"firstname": "Harald",
|
|
|
|
"lastname": "Habebe",
|
|
|
|
"email": "hh@zammad.com",
|
|
|
|
"web": "",
|
|
|
|
"password": "",
|
|
|
|
"phone": "",
|
|
|
|
"fax": "",
|
|
|
|
"mobile": "",
|
|
|
|
"street": "",
|
|
|
|
"zip": "",
|
|
|
|
"city": "",
|
|
|
|
"country": "",
|
|
|
|
"organization_id": 6,
|
|
|
|
"department": "",
|
|
|
|
"note": "",
|
|
|
|
"role_ids": [
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
4
|
|
|
|
],
|
|
|
|
"group_ids": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"active": true,
|
|
|
|
"updated_at": "2017-02-09T09:17:04.770Z",
|
|
|
|
"address": "",
|
|
|
|
"vip": false,
|
|
|
|
"anrede": "",
|
|
|
|
"asdf": "",
|
|
|
|
"id": 6
|
2019-02-28 08:04:56 +00:00
|
|
|
}]);
|
|
|
|
|
|
|
|
var sessionData = App.User.find(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Test functions
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testContains = function (assert, key, value, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "contains",
|
|
|
|
"value": value
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "contains not",
|
|
|
|
"value": value
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testIs = function (assert, key, value, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"value": value
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"value": value
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testPreConditionUser = function (assert, key, specificValue, ticket, session) {
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "current_user.id",
|
|
|
|
"value": "",
|
|
|
|
"value_completion": ""
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "current_user.id",
|
|
|
|
"value": "",
|
|
|
|
"value_completion": ""
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "not_set",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "not_set",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testPreConditionOrganization = function (assert, key, specificValue, ticket, session) {
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "current_user.organization_id",
|
|
|
|
"value": "",
|
|
|
|
"value_completion": ""
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "current_user.organization_id",
|
|
|
|
"value": "",
|
|
|
|
"value_completion": ""
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "specific",
|
|
|
|
"value": specificValue,
|
|
|
|
"value_completion": "Nicole Braun <nicole.braun@zammad.org>"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is",
|
|
|
|
"pre_condition": "not_set",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "is not",
|
|
|
|
"pre_condition": "not_set",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testPreConditionTags = function (assert, key, ticket) {
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one",
|
|
|
|
"value": "tag a",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one",
|
|
|
|
"value": "tag aa",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all",
|
|
|
|
"value": "tag a",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag a, not existing",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all not",
|
|
|
|
"value": "tag a",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag a, tag b",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag a, tag b, tag c",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains all not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag c, tag d",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one not",
|
|
|
|
"value": "tag a",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag a, tag b",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag a, tag c",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
"ticket.tags": {
|
|
|
|
"operator": "contains one not",
|
2020-11-06 09:49:32 +00:00
|
|
|
"value": "tag c",
|
2017-11-30 08:29:18 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-11-30 08:29:18 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testTime = function (assert, key, value, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
valueDate = new Date(value);
|
|
|
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() - 1 ) ).toISOString();
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "after (absolute)",
|
|
|
|
"value": compareDate
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
valueDate = new Date(value);
|
|
|
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() + 1 ) ).toISOString();
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "after (absolute)",
|
|
|
|
"value": compareDate
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
valueDate = new Date(value);
|
|
|
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() - 1 ) ).toISOString();
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "before (absolute)",
|
|
|
|
"value": compareDate
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, false, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
valueDate = new Date(value);
|
|
|
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() + 1 ) ).toISOString();
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "before (absolute)",
|
|
|
|
"value": compareDate
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
valueDate = new Date(value);
|
|
|
|
compareDate = new Date( valueDate.setHours( valueDate.getHours() + 2 ) ).toISOString();
|
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "before (relative)",
|
|
|
|
"value": 1,
|
|
|
|
"range": "hour"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, true, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testTimeBeforeRelative = function (assert, key, value, range, expectedResult, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "before (relative)",
|
|
|
|
"value": value,
|
|
|
|
"range": range
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, expectedResult, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testTimeAfterRelative = function (assert, key, value, range, expectedResult, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "after (relative)",
|
|
|
|
"value": value,
|
|
|
|
"range": range
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, expectedResult, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testTimeWithinNextRelative = function (assert, key, value, range, expectedResult, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "within next (relative)",
|
|
|
|
"value": value,
|
|
|
|
"range": range
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, expectedResult, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
var testTimeWithinLastRelative = function (assert, key, value, range, expectedResult, ticket) {
|
2017-02-24 08:22:38 +00:00
|
|
|
setting = {
|
|
|
|
"condition": {
|
|
|
|
[key]: {
|
|
|
|
"operator": "within last (relative)",
|
|
|
|
"value": value,
|
|
|
|
"range": range
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2017-11-30 08:29:18 +00:00
|
|
|
result = App.Ticket.selector(ticket, setting['condition']);
|
2021-10-14 14:35:12 +00:00
|
|
|
assert.equal(result, expectedResult, result);
|
2017-02-24 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
* Field tests
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket number", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'ticket.number', '72', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket title", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'ticket.title', 'asd', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket customer_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.customer_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket organization_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.organization_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket group_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'ticket.group_id', ['1'], ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket owner_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.owner_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket state_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'ticket.state_id', ['4'], ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket pending_time", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.pending_time', ticket.pending_time, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
// BEFORE TIME
|
|
|
|
// -------------------------
|
|
|
|
|
|
|
|
// hour
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'hour', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() - 60 * 60 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'hour', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// day
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'day', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() - 60 * 60 * 48 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'day', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// year
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'year', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() - 60 * 60 * 365 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeBeforeRelative(assert, 'ticket.pending_time', 1, 'year', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
// AFTER TIME
|
|
|
|
// -------------------------
|
|
|
|
|
|
|
|
// hour
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'hour', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() + 60 * 60 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'hour', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// day
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'day', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() + 60 * 60 * 48 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'day', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// year
|
|
|
|
ticket.pending_time = new Date().toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'year', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() + 60 * 60 * 365 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeAfterRelative(assert, 'ticket.pending_time', 1, 'year', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
// WITHIN LAST TIME
|
|
|
|
// -------------------------
|
|
|
|
|
|
|
|
// hour
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() - 60 * 60 * 0.5 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeWithinLastRelative(assert, 'ticket.pending_time', 1, 'hour', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() - 60 * 60 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeWithinLastRelative(assert, 'ticket.pending_time', 1, 'hour', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
// -------------------------
|
|
|
|
// WITHIN NEXT TIME
|
|
|
|
// -------------------------
|
|
|
|
|
|
|
|
// hour
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() + 60 * 60 * 0.5 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeWithinNextRelative(assert, 'ticket.pending_time', 1, 'hour', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
|
|
|
compareDate = new Date();
|
2017-11-30 08:29:18 +00:00
|
|
|
compareDate.setTime( compareDate.getTime() + 60 * 60 * 2 * 1000);
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket.pending_time = compareDate.toISOString();
|
2021-10-14 14:35:12 +00:00
|
|
|
testTimeWithinNextRelative(assert, 'ticket.pending_time', 1, 'hour', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket priority_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'ticket.priority_id', ['2'], ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket escalation_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.escalation_at', ticket.escalation_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket last_contact_agent_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.last_contact_agent_at', ticket.last_contact_agent_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket last_contact_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.last_contact_at', ticket.last_contact_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket last_contact_customer_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.last_contact_customer_at', ticket.last_contact_customer_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket first_response_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.first_response_at', ticket.first_response_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket close_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.close_at', ticket.close_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket created_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.created_by_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket created_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.created_at', ticket.created_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket updated_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'ticket.updated_at', ticket.updated_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket updated_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
App.Session.set(6);
|
2017-02-24 08:22:38 +00:00
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.updated_by_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket tags", assert => {
|
2017-11-30 08:29:18 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionTags(assert, 'ticket.tags', ticket);
|
2017-11-30 08:29:18 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article from", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'article.from', 'Admin', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article to", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'article.to', 'agent1', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article cc", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'article.cc', 'agent1+cc', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article subject", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'article.subject', 'asdf', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article type_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'article.type_id', ['1'], ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article sender_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'article.sender_id', ['1'], ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article internal", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'article.internal', ['false'], ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("article created_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'article.created_by_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer login", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.login', 'hc', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer firstname", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.firstname', 'Harald', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer lastname", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.lastname', 'Customer', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer email", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.email', 'hc', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer organization_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionOrganization(assert, 'customer.organization_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer created_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'customer.created_by_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer created_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'customer.created_at', ticket.customer.created_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer updated_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'customer.updated_by_id', '6', ticket, sessionData);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer missing_field", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.missing_field', '', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("customer web", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'customer.web', 'cool', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization name", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'organization.name', 'gmbh', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization shared", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'organization.shared', true, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization created_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'organization.created_by_id', 6, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization updated_by_id", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'organization.updated_by_id', 6, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization created_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'organization.created_at', ticket.organization.created_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization updated_at", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testTime(assert, 'organization.updated_at', ticket.organization.updated_at, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization domain_assignment", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testIs(assert, 'organization.domain_assignment', false, ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("organization domain", assert => {
|
2017-02-24 08:22:38 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testContains(assert, 'organization.domain', 'cool', ticket);
|
2017-02-24 08:22:38 +00:00
|
|
|
});
|
2021-03-16 08:59:32 +00:00
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
QUnit.test("ticket mention user_id", assert => {
|
2021-03-16 08:59:32 +00:00
|
|
|
ticket = new App.Ticket();
|
|
|
|
ticket.load(ticketData);
|
|
|
|
|
2021-10-14 14:35:12 +00:00
|
|
|
testPreConditionUser(assert, 'ticket.mention_user_ids', '6', ticket, sessionData);
|
2021-03-16 08:59:32 +00:00
|
|
|
});
|
|
|
|
|
2019-02-28 08:04:56 +00:00
|
|
|
}
|