Skip to content

Commit

Permalink
[1.4.1] - added fix for HTML reporting. Extended verification for ins…
Browse files Browse the repository at this point in the history
…ideIn() method
  • Loading branch information
dzaiats committed Dec 4, 2016
1 parent 900d23f commit 4becfcd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 61 deletions.
50 changes: 2 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,50 +1,4 @@
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries
target
*.iml
.idea
drivers

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Created by .ignore support plugin (hsz.mobi)
drivers
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
mvn clean deploy -DperformRelease=true -DconnectionUrl=scm:git:https://github.com/dzaiats/java.automation.library.git
mvn clean deploy -DperformRelease=true -DconnectionUrl=scm:git:https://github.com/ITArray/Automotion.git
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<licenses>
<license>
<name>Apache-2.0</name>
<url>https://github.com/dzaiats/Automotion/blob/master/LICENSE</url>
<url>https://github.com/ITArray/Automotion/blob/master/LICENSE-2.0</url>
</license>
</licenses>

Expand All @@ -28,9 +28,9 @@
</developers>

<scm>
<connection>scm:git:[email protected]:dzaiats/java.automation.library.git</connection>
<developerConnection>scm:git:[email protected]:dzaiats/java.automation.library.git</developerConnection>
<url>[email protected]:dzaiats/java.automation.library.git</url>
<connection>scm:git:[email protected]:ITArray/Automotion.git</connection>
<developerConnection>scm:git:[email protected]:ITArray/Automotion.git</developerConnection>
<url>[email protected]:ITArray/Automotion.git</url>
</scm>

<properties>
Expand Down
27 changes: 19 additions & 8 deletions src/main/java/util/validator/ResponsiveUIValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,21 +736,32 @@ private void validateSameSize(List<WebElement> elements) {
int h2 = el2.getSize().getHeight();
int w2 = el2.getSize().getWidth();
if (h1 != h2 || w1 != w2) {
putJsonDetailsWithoutElement("Elements in a gird have different size.");
putJsonDetailsWithElement("Elements in a grid have different size.", el1);
}
}
}
}
}

private void validateInsideOfContainer(WebElement element, String readableContainerName) {
float xContainer = element.getLocation().getX();
float yContainer = element.getLocation().getY();
float widthContainer = element.getSize().getWidth();
float heightContainer = element.getSize().getHeight();

if (xRoot < xContainer || yRoot < yContainer || (xRoot + widthRoot) > (xContainer + widthContainer) || (yRoot + heightRoot) > (yContainer + heightContainer)) {
putJsonDetailsWithElement(String.format("Element '%s' is not inside of '%s'", rootElementReadableName, readableContainerName), element);
float xContainer = element.getLocation().x;
float yContainer = element.getLocation().y;
float widthContainer = element.getSize().width;
float heightContainer = element.getSize().height;
if (rootElements == null || rootElements.isEmpty()) {
if (xRoot < xContainer || yRoot < yContainer || (xRoot + widthRoot) > (xContainer + widthContainer) || (yRoot + heightRoot) > (yContainer + heightContainer)) {
putJsonDetailsWithElement(String.format("Element '%s' is not inside of '%s'", rootElementReadableName, readableContainerName), element);
}
}else{
for (WebElement el: rootElements){
float xRoot = el.getLocation().x;
float yRoot = el.getLocation().y;
float widthRoot = el.getSize().width;
float heightRoot = el.getSize().height;
if (xRoot < xContainer || yRoot < yContainer || (xRoot + widthRoot) > (xContainer + widthContainer) || (yRoot + heightRoot) > (yContainer + heightContainer)) {
putJsonDetailsWithElement(String.format("Element is not inside of '%s'", readableContainerName), element);
}
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test/java/ResponsiveValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void testThatResponsiveValidatorWorks() {
.alignedAsGrid(1, 3)
.areNotOverlappedWithEachOther()
.withSameSize()
.insideOf(page.container(), "List View container")
.drawMap()
.validate();

Expand Down
4 changes: 4 additions & 0 deletions src/test/java/TestPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public WebElement myPhotos() {
return getWebElement(By.id("my-photos"));
}

public WebElement container(){
return getWebElement(By.className("gallery"));
}

public WebElement footer() {
return getWebElement(ExpectedConditions.elementToBeClickable(By.id("footer")));
}
Expand Down

0 comments on commit 4becfcd

Please sign in to comment.