Skip to content

Commit

Permalink
Merge pull request telekom#463 from telekom/feature/update-gradle-8
Browse files Browse the repository at this point in the history
Feature/update gradle 8
  • Loading branch information
martingrossmann authored Dec 6, 2024
2 parents 63099ea + 88903d0 commit c3e24e1
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 106 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ Every module contains tests that can be run like
gradle test
```

The following optional properties can be set.
Additional test properties are listed in the module's README.

| Property | Description |
|--------------|---------------------------------------|
| `withJacoco` | Enables Jacoco code coverage analysis |
Activate Jacoco code coverage analysis by
```shell
gradle testCodeCoverageReport
```
instead of ``gradle test``

### License report

Expand Down
40 changes: 1 addition & 39 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ plugins {
import com.github.jk1.license.filter.*
import com.github.jk1.license.render.*

def jacocoVersion = "0.8.6"

apply plugin: 'io.codearte.nexus-staging'

ext {
Expand Down Expand Up @@ -50,7 +48,7 @@ subprojects {
archivesBaseName = "testerra"

apply plugin: 'maven-publish' // tasks publish and publishToMavenLocal
apply plugin: 'jacoco'
apply plugin: 'jacoco-report-aggregation'
apply plugin: 'signing'

apply plugin: 'com.github.jk1.dependency-license-report'
Expand All @@ -63,10 +61,6 @@ subprojects {
mavenCentral()
}

jacoco {
toolVersion = jacocoVersion
}

test {

ignoreFailures = true
Expand All @@ -78,11 +72,6 @@ subprojects {
options {
systemProperties(System.getProperties())
}

jacoco {
enabled = System.properties.containsKey("withJacoco")
//excludes = ['jdk.internal.*']
}
}

task cleanDist {
Expand Down Expand Up @@ -122,30 +111,3 @@ subprojects {

// Do not move this integration because `group` and `version` is needed for publishing
apply from: rootProject.file('publish.gradle')

task jacocoAggregateReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {

additionalSourceDirs(files(subprojects.sourceSets.main.allSource.srcDirs))

def srcdirs = files(subprojects.sourceSets.main.allSource.srcDirs)
def classdirs = files(subprojects.sourceSets.main.output)
sourceDirectories.setFrom(srcdirs)
classDirectories.setFrom(classdirs)

executionData(project.fileTree(dir: '.', include: '**/build/jacoco/test.exec'))

reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
onlyIf = {
true
}

doFirst {
executionData(files(executionData.findAll {
it.exists()
}))
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,16 @@ private void testElementIntersectsParent(boolean test) {
element.expect().bounds().intersects(parent).is(test);
}

// Window size of all tests is set to 1024x768
// Viewport size is smaller then window size
@Test
public void test_viewport() {
WebTestPage page = getPage();
page.expect().viewport().left().is(0);
page.expect().viewport().top().is(0);

page.expect().viewport().contains(page.getOpenAgainLink()).is(true);
page.expect().viewport().width().is(1024);
page.expect().viewport().height().is(768);
page.expect().viewport().width().isBetween(1000, 1024);
page.expect().viewport().height().isBetween(570, 768);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions report-ng-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test {

def preTest = findProperty("pretestRNG")
def preTestExtended = findProperty("pretestRNGExtended")
def playground = findProperty("playground")

if (preTest) {
s = ['src/test/resources/testng/GenerateReport.xml']
Expand All @@ -36,6 +37,10 @@ test {
System.setProperty("tt.report.name", "Generated Report for Additional UI-Test")
}

if (playground) {
s = ['src/test/resources/testng/Playground.xml']
}

useTestNG() {
suites s
// configFailurePolicy "continue"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.testerra.report.test.pages.report.methodReport;

import eu.tsystems.mms.tic.testframework.pageobjects.AbstractComponent;
import eu.tsystems.mms.tic.testframework.pageobjects.Check;
import eu.tsystems.mms.tic.testframework.pageobjects.Page;
import eu.tsystems.mms.tic.testframework.pageobjects.PreparedLocator;
Expand All @@ -10,59 +11,72 @@

import java.util.HashMap;

public class ComparisonDialogOverlay extends Page implements AssertProvider {
public class ComparisonDialogOverlay extends AbstractComponent<ComparisonDialogOverlay> implements AssertProvider {
@Check
private final UiElement contrastIcon = findIconInDialog("compare");
private final UiElement contrastIcon = find(By.xpath("//mdc-icon[text() = 'compare']"));
@Check
private final UiElement switchIcon = findIconInDialog("compare_arrows");
private final UiElement switchIcon = find(By.xpath("//mdc-icon[text() = 'compare_arrows']"));
@Check
private final UiElement leftSelection = find(By.xpath("//mdc-select[@label='Left']"));
@Check
private final UiElement rightSelection = find(By.xpath("//mdc-select[@label='Right']"));
@Check
private final UiElement slider= find(By.xpath("//div[contains(@class,'slider')]"));
private final UiElement selectedItemLeft = leftSelection.find(By.xpath("//span[contains(@class,'selected-text')]"));
private final UiElement selectedItemRight = rightSelection.find(By.xpath("//span[contains(@class,'selected-text')]"));
PreparedLocator itemLocator = LOCATE.prepare("//span[text()='%s']");
// private final UiElement selectedItemLeft = leftSelection.find(By.xpath("//span[contains(@class,'selected-text')]"));
// private final UiElement selectedItemRight = rightSelection.find(By.xpath("//span[contains(@class,'selected-text')]"));
// PreparedLocator itemLocator = LOCATE.prepare("//span[text()='%s']");

public ComparisonDialogOverlay(WebDriver webDriver) {
super(webDriver);
}
private final UiElement content = find(By.xpath("//div[contains(@class,'img-comp-container')]"));

PreparedLocator selectedScreenshotOption = LOCATE.prepare("//mdc-select[@label='%s']//span[contains(@class,'selected-text')]//span[text()='%s']");

private final UiElement closeIcon = find(By.xpath("//button//span[text()='clear']"));

private UiElement findIconInDialog(String icon){
return find(By.xpath(String.format("//mdc-icon[text()='%s']",icon)));
public ComparisonDialogOverlay(UiElement rootElement) {
super(rootElement);
}

public ReportDetailsTab closeDialog() {
UiElement closeBtn = find(By.xpath("//button//span[text()='clear']"));
closeBtn.click();
this.closeIcon.click();
return createPage(ReportDetailsTab.class);
}

public void checkSelectedAndContentFromStartingMatched(String state) {
HashMap<String, String> stateMapping = new HashMap<String, String>();
stateMapping.put("Actual", "Difference");
stateMapping.put("Difference", "Expected");
stateMapping.put("Expected", "Difference");
public void checkContent(final ReportDetailsTab.ScreenshotType leftType, final ReportDetailsTab.ScreenshotType rightType, final String imageName) {
UiElement leftSelectedOption = find(selectedScreenshotOption.with("Left", leftType.toString()));
UiElement rightSelectedOption = find(selectedScreenshotOption.with("Right", rightType.toString()));

HashMap<String, String> screenshotMapping = new HashMap<String, String>();
screenshotMapping.put("Actual", "actual_difference_referenceImage");
screenshotMapping.put("Difference", "difference_expected_referenceImage");
screenshotMapping.put("Expected", "expected_difference_referenceImage");
leftSelectedOption.assertThat().displayed(true);
rightSelectedOption.assertThat().displayed(true);

CONTROL.collectAssertions(()->{
UiElement defaultSelectedItemLeft = selectedItemLeft.find(itemLocator.with(state));
UiElement imgContent = find(By.xpath("//div[contains(@class,'img-comp-container')]"));
defaultSelectedItemLeft.expect().displayed(true);
String expectedRightState = stateMapping.get(state);
String screenshotReference = screenshotMapping.get(state);
ASSERT.assertNotNull(expectedRightState);

UiElement defaultSelectedItemRight = selectedItemRight.find(itemLocator.with(expectedRightState));
defaultSelectedItemRight.expect().displayed(true);
imgContent.expect().screenshot().pixelDistance(screenshotReference).isLowerThan(10);
final String referenceImageName = String.format("%s_%s_%s", imageName, leftType, rightType);
this.content.assertThat().screenshot().pixelDistance(referenceImageName).isLowerThan(1);
}

});
// public void checkSelectedAndContentFromStartingMatched(String state) {
// HashMap<String, String> stateMapping = new HashMap<String, String>();
// stateMapping.put("Actual", "Difference");
// stateMapping.put("Difference", "Expected");
// stateMapping.put("Expected", "Difference");
//
// HashMap<String, String> screenshotMapping = new HashMap<String, String>();
// screenshotMapping.put("Actual", "actual_difference_referenceImage");
// screenshotMapping.put("Difference", "difference_expected_referenceImage");
// screenshotMapping.put("Expected", "expected_difference_referenceImage");
//
// CONTROL.collectAssertions(()->{
// UiElement defaultSelectedItemLeft = selectedItemLeft.find(itemLocator.with(state));
// UiElement imgContent = find(By.xpath("//div[contains(@class,'img-comp-container')]"));
// defaultSelectedItemLeft.expect().displayed(true);
// String expectedRightState = stateMapping.get(state);
// String screenshotReference = screenshotMapping.get(state);
// ASSERT.assertNotNull(expectedRightState);
//
// UiElement defaultSelectedItemRight = selectedItemRight.find(itemLocator.with(expectedRightState));
// defaultSelectedItemRight.expect().displayed(true);
// imgContent.expect().screenshot().pixelDistance(screenshotReference).isLowerThan(10);
//
// });
//
// }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class ReportDetailsTab extends AbstractReportMethodPage {
private final UiElement layoutComparison = find(By.xpath("//layout-comparison"));
PreparedLocator imgTitleLocator = LOCATE.prepare("//img[contains(@title,'%s')]");

// Root element of every overly component
private final UiElement dialogRoot = find(By.xpath("//div[@class = 'mdc-dialog__container']"));

public ReportDetailsTab(WebDriver driver) {
super(driver);
}
Expand Down Expand Up @@ -211,9 +214,15 @@ public boolean hasFailureAspectAScreenshotComparison(String failureMessage) {
return this.getFailureAspectElement(failureMessage).find(By.xpath("//layout-comparison")).waitFor().present(true);
}

public ComparisonDialogOverlay openComparisonDialogByClickingOnScreenShot(String imageTitle) {
UiElement image = layoutComparison.find(imgTitleLocator.with(imageTitle));
public ComparisonDialogOverlay openComparisonDialogByClickingOnScreenShot(final ScreenshotType screenshotType) {
UiElement image = layoutComparison.find(imgTitleLocator.with(screenshotType.toString()));
image.click();
return createPage(ComparisonDialogOverlay.class);
return createComponent(ComparisonDialogOverlay.class, this.dialogRoot);
}

public enum ScreenshotType {
Actual,
Difference,
Expected;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.testerra.report.test.pages.report.sideBarPages.ReportDashBoardPage;
import io.testerra.report.test.pages.report.sideBarPages.ReportTestsPage;
import org.testng.annotations.Test;
import io.testerra.report.test.pages.report.methodReport.ReportDetailsTab.ScreenshotType;

public class LayoutTest extends AbstractReportTest {

Expand Down Expand Up @@ -153,27 +154,31 @@ public void testT05_checkPassedLayoutTestAndFailedAssertion() {
}

@Test
public void testT06_checkLayoutDialog(){
public void testT06_checkLayoutDialog() {
String methodName = "layoutTest01_layoutTestFailing";
String className = "GenerateLayoutTestsTTReportTest";

String[] imageTitles = new String[]{
"Actual",
"Difference",
"Expected"
};

TestStep.begin("Navigate to details page");
ReportDashBoardPage reportDashBoardPage = this.gotoDashBoardOnAdditionalReport(WEB_DRIVER_MANAGER.getWebDriver());
ReportTestsPage reportTestsPage = reportDashBoardPage.gotoToReportPage(ReportSidebarPageType.TESTS, ReportTestsPage.class);
reportTestsPage.selectClassName(className);
ReportDetailsTab reportDetailsTab = reportTestsPage.navigateToDetailsTab(methodName);
TestStep.begin("Open Layout Dialog");
for(String title: imageTitles){
ComparisonDialogOverlay comparisonDialogOverlay = reportDetailsTab.openComparisonDialogByClickingOnScreenShot(title);
comparisonDialogOverlay.checkSelectedAndContentFromStartingMatched(title);
reportDetailsTab = comparisonDialogOverlay.closeDialog();
}

TestStep.begin("Open Layout Dialog from actual image");
ComparisonDialogOverlay comparisonDialogOverlay = reportDetailsTab.openComparisonDialogByClickingOnScreenShot(ScreenshotType.Actual);
comparisonDialogOverlay.checkContent(ScreenshotType.Actual, ScreenshotType.Difference, "layout_compare_dialog");
reportDetailsTab = comparisonDialogOverlay.closeDialog();

TestStep.begin("Open Layout Dialog from difference image");
comparisonDialogOverlay = reportDetailsTab.openComparisonDialogByClickingOnScreenShot(ScreenshotType.Difference);
comparisonDialogOverlay.checkContent(ScreenshotType.Difference, ScreenshotType.Expected, "layout_compare_dialog");
reportDetailsTab = comparisonDialogOverlay.closeDialog();

TestStep.begin("Open Layout Dialog from expected image");
comparisonDialogOverlay = reportDetailsTab.openComparisonDialogByClickingOnScreenShot(ScreenshotType.Expected);
comparisonDialogOverlay.checkContent(ScreenshotType.Expected, ScreenshotType.Difference, "layout_compare_dialog");
reportDetailsTab = comparisonDialogOverlay.closeDialog();

}

}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions report-ng-tests/src/test/resources/test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ tt.browser.maximize=false
tt.display.resolution=1600x1024

#tt.element.timeout.seconds=3
tt.screencaster.active=false

#tt.selenium.server.host=localhost

#tt.layoutcheck.takereference=true
tt.layoutcheck.reference.path=src/test/resources/layout-references/{tt.browser}
Expand Down
17 changes: 11 additions & 6 deletions report-ng-tests/src/test/resources/testng/Playground.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
<suite name="Report - Playground suite" verbose="1" parallel="methods" configfailurepolicy="continue" thread-count="10" data-provider-thread-count="10">

<test name="Test1" parallel="methods">
<groups>
<run>
<include name="extended"/>
<!-- <groups>-->
<!-- <run>-->
<!-- <include name="extended"/>-->
<!-- <include name="extended2"/>-->
</run>
</groups>
<!-- </run>-->
<!-- </groups>-->
<classes>
<class name="io.testerra.report.test.pretest_status.dependency.DependencySetup1Tests"/>
<!-- <class name="io.testerra.report.test.pretest_status.dependency.DependencySetup1Tests"/>-->
<!-- <class name="io.testerra.report.test.pretest_status.dependency.DependencySetup3Tests"/>-->
<class name="io.testerra.report.test.report_test.common.LayoutTest">
<methods>
<include name="testT06_checkLayoutDialog"/>
</methods>
</class>
</classes>
</test>

Expand Down

0 comments on commit c3e24e1

Please sign in to comment.