Skip to content

Commit

Permalink
schrodinger: more coverage for task page and task tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Nov 10, 2020
1 parent a07f72b commit dab96a0
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 7 deletions.
Expand Up @@ -11,6 +11,7 @@
import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab;
import com.evolveum.midpoint.schrodinger.component.common.PrismForm;
import com.evolveum.midpoint.schrodinger.component.task.OperationStatisticsTab;
import com.evolveum.midpoint.schrodinger.page.task.ListTasksPage;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;
import com.evolveum.midpoint.testing.schrodinger.AbstractSchrodingerTest;
Expand Down Expand Up @@ -72,6 +73,22 @@ public void test001createNewTask() {

@Test
public void test002cleanupOperationStatistics() {
TaskPage taskPage = basicPage.listTasks()
.table()
.search()
.byName()
.inputValue("operation statistics clean up test")
.updateSearch()
.and()
.clickByName("operation statistics clean up test");
OperationStatisticsTab operationStatisticsTab = taskPage
.selectTabOperationStatistics();
Assert.assertEquals(operationStatisticsTab.getSuccessfullyProcessed(), Integer.getInteger("30"),
"The count of successfully processed objects doesn't match");
Assert.assertEquals(operationStatisticsTab.getObjectsFailedToBeProcessed(), Integer.getInteger("3"),
"The count of failed objects doesn't match");
Assert.assertEquals(operationStatisticsTab.getObjectsTotalCount(), Integer.getInteger("33"),
"The total count of processed objects doesn't match");
Assert.assertTrue(basicPage.listTasks()
.table()
.search()
Expand All @@ -84,5 +101,12 @@ public void test002cleanupOperationStatistics() {
.clickYes()
.feedback()
.isSuccess());
Assert.assertNull(operationStatisticsTab.getSuccessfullyProcessed(),
"The count of successfully processed objects after cleanup is not null");
Assert.assertNull(operationStatisticsTab.getObjectsFailedToBeProcessed(),
"The count of failed objects after cleanup is not null");
Assert.assertNull(operationStatisticsTab.getObjectsTotalCount(),
"The total count of processed objects after cleanup is not null");

}
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.component.task;

import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;

/**
* @author honchar
*/
public class EnvironmentalPerformanceTab extends Component<TaskPage> {

public EnvironmentalPerformanceTab(TaskPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.component.task;

import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;

/**
* @author honchar
*/
public class ErrorsTab extends Component<TaskPage> {

public ErrorsTab(TaskPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.component.task;

import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;

/**
* @author honchar
*/
public class InternalPerformanceTab extends Component<TaskPage> {

public InternalPerformanceTab(TaskPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}
}
Expand Up @@ -9,19 +9,36 @@
import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;
import com.evolveum.midpoint.schrodinger.util.Schrodinger;

/**
* @author skublik
*/

public class OperationStatisticsTab<T> extends Component<T> {
public class OperationStatisticsTab extends Component<TaskPage> {

public OperationStatisticsTab(T parent, SelenideElement parentElement) {
public OperationStatisticsTab(TaskPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}

public int getSuccessfullyProcessed() {
return Integer.valueOf(getParentElement().$(Schrodinger.byDataId("span", "objectsProcessedSuccess")).getText());
public Integer getSuccessfullyProcessed() {
return getIntegerValueForTextField("objectsProcessedSuccess");
}

public Integer getObjectsFailedToBeProcessed() {
return getIntegerValueForTextField("objectsProcessedFailure");
}

public Integer getObjectsTotalCount() {
return getIntegerValueForTextField("objectsTotal");
}

private Integer getIntegerValueForTextField(String fieldName) {
String textValue = getParentElement().$(Schrodinger.byDataId("span", fieldName)).getText();
if (textValue == null || textValue.trim().equals("")) {
return null;
}
return Integer.valueOf(textValue);
}
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2010-2020 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.schrodinger.component.task;

import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.Component;
import com.evolveum.midpoint.schrodinger.page.task.TaskPage;

/**
* @author honchar
*/
public class ResultTab extends Component<TaskPage> {

public ResultTab(TaskPage parent, SelenideElement parentElement) {
super(parent, parentElement);
}
}
Expand Up @@ -12,15 +12,16 @@

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;

import com.evolveum.midpoint.schrodinger.component.task.*;

import org.openqa.selenium.By;

import com.evolveum.midpoint.schrodinger.MidPoint;
import com.evolveum.midpoint.schrodinger.component.AssignmentHolderBasicTab;
import com.evolveum.midpoint.schrodinger.component.AssignmentsTab;
import com.evolveum.midpoint.schrodinger.component.common.SummaryPanel;
import com.evolveum.midpoint.schrodinger.component.modal.ConfirmationModal;
import com.evolveum.midpoint.schrodinger.component.task.OperationStatisticsTab;
import com.evolveum.midpoint.schrodinger.component.task.TaskBasicTab;
import com.evolveum.midpoint.schrodinger.page.AssignmentHolderDetailsPage;
import com.evolveum.midpoint.schrodinger.page.PreviewPage;
import com.evolveum.midpoint.schrodinger.page.user.ProgressPage;
Expand Down Expand Up @@ -127,13 +128,41 @@ public AssignmentHolderBasicTab<TaskPage> selectScheduleTab(){
return new AssignmentHolderBasicTab<TaskPage>(this, element);
}

public OperationStatisticsTab<TaskPage> selectTabOperationStatistics() {
public OperationStatisticsTab selectTabOperationStatistics() {
SelenideElement element = getTabPanel().clickTab("pageTask.operationStats.title")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new OperationStatisticsTab(this, element);
}

public EnvironmentalPerformanceTab selectTabEnvironmentalPerformance() {
SelenideElement element = getTabPanel().clickTab("pageTask.environmentalPerformance.title")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new EnvironmentalPerformanceTab(this, element);
}

public InternalPerformanceTab selectTabInternalPerformance() {
SelenideElement element = getTabPanel().clickTab("pageTask.internalPerformance.title")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new InternalPerformanceTab(this, element);
}

public ResultTab selectTabResult() {
SelenideElement element = getTabPanel().clickTab("pageTask.result.title")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new ResultTab(this, element);
}

public ErrorsTab selectTabErrors() {
SelenideElement element = getTabPanel().clickTab("pageTask.errors.title")
.waitUntil(Condition.appear, MidPoint.TIMEOUT_DEFAULT_2_S);

return new ErrorsTab(this, element);
}

public TaskPage setHandlerUriForNewTask(String handler) {
SelenideElement handlerElement = $(Schrodinger.byDataResourceKey("a", "TaskHandlerSelectorPanel.selector.header"));
selectTabBasic().form().addAttributeValue("handlerUri", handler.substring(0, (handler.length() - 1)));
Expand Down

0 comments on commit dab96a0

Please sign in to comment.