-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(task-details): show notification selected task is deleted
Related to CAM-7058
- Loading branch information
Showing
4 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
'use strict'; | ||
|
||
var factory = require('../../../common/tests/setup-factory.js'), | ||
readResource = factory.readResource, | ||
combine = factory.combine, | ||
operation = factory.operation; | ||
|
||
var setup1 = combine( | ||
operation('filter', 'create', [{ | ||
name: 'All', | ||
query: {}, | ||
resourceType: 'Task', | ||
properties: { | ||
variables: [{ | ||
name: 'testVar', | ||
label: 'Test Variable' | ||
}, | ||
{ | ||
name: 'testString', | ||
label:'String Variable' | ||
}] | ||
} | ||
}]), | ||
|
||
operation('user', 'create', [{ | ||
id: 'test', | ||
firstName: 'Montgomery', | ||
lastName: 'QA', | ||
password: 'test' | ||
}, | ||
{ | ||
id: 'otheruser', | ||
firstName: 'Other', | ||
lastName: 'User', | ||
password: 'otheruser' | ||
}]), | ||
|
||
operation('authorization', 'create', [{ | ||
type : 1, | ||
permissions: ['ALL'], | ||
userId: 'test', | ||
groupId: null, | ||
resourceType: 0, | ||
resourceId: 'tasklist' | ||
}, | ||
{ | ||
type : 1, | ||
permissions: ['ALL'], | ||
userId: 'test', | ||
groupId: null, | ||
resourceType: 5, | ||
resourceId: '*' | ||
}, | ||
{ | ||
type : 1, | ||
permissions: ['READ'], | ||
userId: 'test', | ||
groupId: null, | ||
resourceType: 7, | ||
resourceId: '*' | ||
}, | ||
|
||
{ | ||
type : 1, | ||
permissions: ['ALL'], | ||
userId: 'otheruser', | ||
groupId: null, | ||
resourceType: 0, | ||
resourceId: 'tasklist' | ||
}, | ||
{ | ||
type : 1, | ||
permissions: ['ALL'], | ||
userId: 'otheruser', | ||
groupId: null, | ||
resourceType: 5, | ||
resourceId: '*' | ||
}, | ||
{ | ||
type : 1, | ||
permissions: ['READ'], | ||
userId: 'otheruser', | ||
groupId: null, | ||
resourceType: 7, | ||
resourceId: '*' | ||
}]), | ||
|
||
operation('task', 'create', [{ | ||
id: '1', | ||
name: 'Task 1' | ||
}]), | ||
|
||
operation('task', 'assignee', [{ | ||
taskId: '1', | ||
userId: 'test' | ||
}]) | ||
); | ||
|
||
|
||
module.exports = { | ||
setup1: setup1 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
var testHelper = require('../../../common/tests/test-helper'); | ||
var setupFile = require('./task-vanishing-setup'); | ||
var dashboardPage = require('../pages/dashboard'); | ||
|
||
describe('Task Vanishing Spec', function() { | ||
describe('a task that has been removed or completed', function() { | ||
var tasklistItems; | ||
|
||
before(function() { | ||
return testHelper(setupFile.setup1, function() { | ||
dashboardPage.navigateToWebapp('Tasklist'); | ||
dashboardPage.authentication.userLogin('test', 'test'); | ||
|
||
tasklistItems = element.all(by.css('.tasks-list > li')); | ||
tasklistItems.first().element(by.css('.clickable')).click(); | ||
}); | ||
}); | ||
|
||
|
||
it('disapears from list and shows a notification', function() { | ||
expect(tasklistItems.count()).to.eventually.eql(1); | ||
expect(element(by.css('.task-details .names > h2')).getText()).to.eventually.eql('Task 1'); | ||
|
||
// simulates a background resolution | ||
browser.executeAsyncScript(function() { | ||
var callback = arguments[arguments.length - 1]; | ||
var xhr = new XMLHttpRequest(); | ||
xhr.onreadystatechange = function() { | ||
if (xhr.readyState == 4) { | ||
callback(); | ||
} | ||
}; | ||
xhr.open('POST', '/camunda/api/engine/engine/default/task/1/submit-form', true); | ||
xhr.setRequestHeader('Content-Type', 'application/json'); | ||
xhr.send('{"variables":{}}'); | ||
}) | ||
.then(function() { | ||
browser.sleep(2500); | ||
|
||
// refresh! | ||
tasklistItems = element.all(by.css('.tasks-list > li')); | ||
expect(tasklistItems.count()).to.eventually.eql(1); | ||
|
||
expect(element(by.css('.task-details .names > h2')).isPresent()).to.eventually.eql(true); | ||
|
||
var status = element(by.css('.page-notifications .status')); | ||
expect(status.isPresent()).to.eventually.eql(true); | ||
expect(status.getText()).to.eventually.eql('The task does not exist anymore'); | ||
|
||
var dismissButton = element(by.css('.page-notifications a.dismiss')); | ||
dismissButton.click(); | ||
|
||
// refresh! | ||
tasklistItems = element.all(by.css('.tasks-list > li')); | ||
expect(tasklistItems.count()).to.eventually.eql(0); | ||
|
||
expect(element(by.css('.task-details .names > h2')).isPresent()).to.eventually.eql(false); | ||
}); | ||
}); | ||
}); | ||
}); |