Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

AAE-771 Modify test to check taskDefinitionKey #706

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void startSignalCatchProcess() {
assertThat(processInstanceCatchSignal).isNotNull();
}

@Then("the task is created with a name $taskName")
@Then("the task with a name '$taskName' is created")
public void checkTaskIsCreated(String taskName) {
List<Task> tasks = new ArrayList<>(
runtimeBundleSteps.getTaskByProcessInstanceId(processInstanceBoundarySignal.getId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.serenitybdd.core.Serenity;
import net.thucydides.core.annotations.Steps;
import org.activiti.api.model.shared.event.VariableEvent;
Expand All @@ -42,13 +49,6 @@
import org.jbehave.core.annotations.When;
import org.springframework.hateoas.PagedResources;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Tasks {

public static final String STAND_ALONE_TASK_ID = "standAloneTaskId";
Expand Down Expand Up @@ -104,7 +104,7 @@ public void createUnassignedTask() throws Exception {
Serenity.setSessionVariable(STAND_ALONE_TASK_ID).to(newTask.getId());
}

@Then("the task is created and the status is assigned")
@Then("the task with a status assigned is created")
public void taskIsCreatedAndAssigned() throws Exception {
final CloudTask assignedTask = taskRuntimeBundleSteps.getTaskById(newTask.getId());
assertThat(assignedTask).isNotNull();
Expand Down Expand Up @@ -252,6 +252,8 @@ public void adminUpdateTaskFields(){
Collection <CloudTask> tasksCollection = taskQuerySteps.getTasksByProcessInstance(processInstanceId).getContent();
List <CloudTask> tasksList = new ArrayList<>(tasksCollection);
newTask = tasksList.get(0);

assertThat(newTask.getTaskDefinitionKey()).isEqualTo("Task_03l0zc2");

Date tomorrow = new Date(System.currentTimeMillis() + 86400000);
Serenity.setSessionVariable("tomorrow").to(tomorrow);
Expand All @@ -270,33 +272,31 @@ public void adminUpdateTaskFields(){
public void checkUpdatedTaskFields (){
Date tomorrow = Serenity.sessionVariableCalled("tomorrow");

//name
assertThat(taskRuntimeBundleSteps.getTaskById(newTask.getId()).getName())
.isEqualTo("new-task-name");
assertThat(taskQuerySteps.getTaskById(newTask.getId()).getName())
.isEqualTo("new-task-name");
//priority
assertThat(taskRuntimeBundleSteps.getTaskById(newTask.getId()).getPriority())
.isEqualTo(3);
assertThat(taskQuerySteps.getTaskById(newTask.getId()).getPriority())
.isEqualTo(3);
//dueDate
assertThat(taskRuntimeBundleSteps.getTaskById(newTask.getId()).getDueDate())
.isEqualTo(tomorrow);
assertThat(taskQuerySteps.getTaskById(newTask.getId()).getDueDate())
.isEqualTo(tomorrow);
//formKey
assertThat(taskRuntimeBundleSteps.getTaskById(newTask.getId()).getFormKey())
.isEqualTo("new-task-form-key");
//assertThat(taskQuerySteps.getTaskById(newTask.getId()).getFormKey()).isEqualTo("new-task-form-key");
CloudTask checkTask = taskRuntimeBundleSteps.getTaskById(newTask.getId());

assertThat(checkTask).isNotNull();
assertThat(checkTask.getTaskDefinitionKey()).isEqualTo("Task_03l0zc2");
assertThat(checkTask.getName()).isEqualTo("new-task-name");
assertThat(checkTask.getPriority()).isEqualTo(3);
assertThat(checkTask.getDueDate()).isEqualTo(tomorrow);
assertThat(checkTask.getFormKey()).isEqualTo("new-task-form-key");

checkTask = taskQuerySteps.getTaskById(newTask.getId());

assertThat(checkTask).isNotNull();
assertThat(checkTask.getTaskDefinitionKey()).isEqualTo("Task_03l0zc2");
assertThat(checkTask.getName()).isEqualTo("new-task-name");
assertThat(checkTask.getPriority()).isEqualTo(3);
assertThat(checkTask.getDueDate()).isEqualTo(tomorrow);
assertThat(checkTask.getFormKey()).isEqualTo("new-task-form-key");
}

@Then("the task is updated")
public void checkIfTaskUpdated (){
auditSteps.checkTaskUpdatedEvent(newTask.getId());
}

@Then("the user will see only root tasks when quering for root tasks")
@Then("the user can see only root tasks when quering for root tasks")
public void checkRootTasks(){
String processInstanceId = Serenity.sessionVariableCalled("processInstanceId");
Collection <CloudTask> rootTasksCollection = taskQuerySteps.getRootTasksByProcessInstance(processInstanceId).getContent();
Expand All @@ -309,7 +309,7 @@ public void checkRootTasks(){
);
}

@Then("the user will see only standalone tasks when quering for standalone tasks")
@Then("the user can see only standalone tasks when quering for standalone tasks")
public void checkStandaloneTasks(){
Collection <CloudTask> standaloneTasksCollection = taskQuerySteps.getStandaloneTasks().getContent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Given the user is authenticated as hruser
Then check number of processes with processDefinitionKey SignalStartEventProcess
When the user starts a process with intermediate catch signal
And the user starts a process with a boundary signal
Then the task is created with a name Boundary container
Then the task with a name 'Boundary container' is created
When the user starts a process with intermediate throw signal
Then the process throwing a signal is completed
And the process catching a signal is completed
And check number of processes with processDefinitionKey SignalStartEventProcess increased
And the SIGNAL_RECEIVED event was catched up by intermediateCatchEvent process
And the task is created with a name Boundary target
And the task with a name 'Boundary target' is created
And the SIGNAL_RECEIVED event was catched up by boundary signal process
When another user is authenticated as testadmin
And the admin deletes boundary signal process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Then the status of the process and the task is changed to completed
Scenario: create a standalone task
Given the user is authenticated as testuser
When the user creates a standalone task
Then the task is created and the status is assigned
Then the task with a status assigned is created

Scenario: delete a standalone task
Given the user is authenticated as testuser
Expand Down Expand Up @@ -124,7 +124,7 @@ And the task has the updated fields
Scenario: check root tasks for the process TWO_TASK_PROCESS
Given the user is authenticated as testuser
When the user starts an instance of the process called TWO_TASK_PROCESS
Then the user will see only root tasks when quering for root tasks
Then the user can see only root tasks when quering for root tasks

Scenario: check the task has completion fields
Given the user is authenticated as testuser
Expand All @@ -137,7 +137,7 @@ Given the user is authenticated as testuser
When the user starts an instance of the process called PROCESS_INSTANCE_WITH_VARIABLES
And the user claims the task
And the user creates a standalone task
Then the user will see only standalone tasks when quering for standalone tasks
Then the user can see only standalone tasks when quering for standalone tasks

Scenario: admin completes tasks in a running process
Given the user is authenticated as testadmin
Expand Down