Merge branch 'TAS-777' into 'master'

This commit is contained in:
Iulia Nechita
2016-10-20 17:27:33 +03:00
2 changed files with 123 additions and 0 deletions
@@ -0,0 +1,68 @@
package org.alfresco.rest.workflow.processes;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.model.RestProcessModel;
import org.alfresco.rest.requests.RestProcessesApi;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.TestGroup;
import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/19/2016.
*/
@Test(groups = { TestGroup.REST_API, TestGroup.PROCESSES, TestGroup.SANITY })
public class GetProcessSanityTests extends RestWorkflowTest
{
@Autowired
private DataUser dataUser;
@Autowired
private RestProcessesApi processesApi;
private UserModel userWhoStartsProcess, assignee;
private RestProcessModel addedProcess;
@BeforeClass(alwaysRun = true)
public void dataPreparation() throws Exception
{
processesApi.useRestClient(restClient);
userWhoStartsProcess = dataUser.createRandomTestUser();
assignee = dataUser.createRandomTestUser();
restClient.authenticateUser(userWhoStartsProcess);
addedProcess = processesApi.addProcess("activitiAdhoc", assignee, false, CMISUtil.Priority.High);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user is able to get the process started by him using REST API and status code is OK (200)")
public void getProcessByOwner() throws Exception
{
restClient.authenticateUser(userWhoStartsProcess);
processesApi.getProcess(addedProcess);
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify user is able to get the process assigned to him using REST API and status code is OK (200)")
public void getProcessByAssignee() throws Exception
{
restClient.authenticateUser(assignee);
processesApi.getProcess(addedProcess);
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API,
TestGroup.PROCESSES }, executionType = ExecutionType.SANITY, description = "Verify admin is able to get any process using REST API and status code is OK (200)")
public void getProcessByAdmin() throws Exception
{
restClient.authenticateUser(dataUser.getAdminUser());
processesApi.getProcess(addedProcess);
processesApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
}
@@ -0,0 +1,55 @@
package org.alfresco.rest.workflow.tasks;
import org.alfresco.dataprep.CMISUtil;
import org.alfresco.rest.RestWorkflowTest;
import org.alfresco.rest.requests.RestTasksApi;
import org.alfresco.utility.model.*;
import org.alfresco.utility.testrail.ExecutionType;
import org.alfresco.utility.testrail.annotation.TestRail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Created by Claudia Agache on 10/20/2016.
*/
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.SANITY })
public class GetTaskFormModelSanityTests extends RestWorkflowTest
{
@Autowired RestTasksApi tasksApi;
UserModel userModel;
SiteModel siteModel;
FileModel fileModel;
TaskModel taskModel;
@BeforeClass(alwaysRun=true)
public void dataPreparation() throws Exception
{
userModel = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(userModel).createPublicRandomSite();
fileModel = dataContent.usingSite(siteModel).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
taskModel = dataWorkflow.usingUser(userModel).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(userModel);
tasksApi.useRestClient(restClient);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
executionType = ExecutionType.SANITY, description = "Verify admin user gets all task form models with Rest API and response is successful (200)")
public void adminGetsTaskFormModels() throws Exception
{
restClient.authenticateUser(dataUser.getAdminUser());
tasksApi.getTaskFormModel(taskModel).assertEntriesListIsNotEmpty();
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS },
executionType = ExecutionType.SANITY, description = "Verify user involved in task gets all the task form models with Rest API and response is successful (200)")
public void involvedUserGetsTaskFormModels() throws Exception
{
restClient.authenticateUser(userModel);
tasksApi.getTaskFormModel(taskModel).assertEntriesListIsNotEmpty();
tasksApi.usingRestWrapper().assertStatusCodeIs(HttpStatus.OK);
}
}