diff --git a/.gitignore b/.gitignore index 3d76778..855ad10 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index ee2a89c..5f3820a 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -mvn clean deploy -DperformRelease=true -DconnectionUrl=scm:git:https://github.com/dzaiats/java.automation.library.git \ No newline at end of file +mvn clean deploy -DperformRelease=true -DconnectionUrl=scm:git:https://github.com/ITArray/Automotion.git \ No newline at end of file diff --git a/pom.xml b/pom.xml index 98226d7..a74caa1 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ Apache-2.0 - https://github.com/dzaiats/Automotion/blob/master/LICENSE + https://github.com/ITArray/Automotion/blob/master/LICENSE-2.0 @@ -28,9 +28,9 @@ - scm:git:git@github.com:dzaiats/java.automation.library.git - scm:git:git@github.com:dzaiats/java.automation.library.git - git@github.com:dzaiats/java.automation.library.git + scm:git:git@github.com:ITArray/Automotion.git + scm:git:git@github.com:ITArray/Automotion.git + git@github.com:ITArray/Automotion.git diff --git a/src/main/java/util/validator/ResponsiveUIValidator.java b/src/main/java/util/validator/ResponsiveUIValidator.java index 7e907f3..992221e 100644 --- a/src/main/java/util/validator/ResponsiveUIValidator.java +++ b/src/main/java/util/validator/ResponsiveUIValidator.java @@ -736,7 +736,7 @@ private void validateSameSize(List 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); } } } @@ -744,13 +744,24 @@ private void validateSameSize(List elements) { } 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); + } + } } } diff --git a/src/test/java/ResponsiveValidatorTest.java b/src/test/java/ResponsiveValidatorTest.java index f6a965d..859f592 100644 --- a/src/test/java/ResponsiveValidatorTest.java +++ b/src/test/java/ResponsiveValidatorTest.java @@ -34,6 +34,7 @@ public void testThatResponsiveValidatorWorks() { .alignedAsGrid(1, 3) .areNotOverlappedWithEachOther() .withSameSize() + .insideOf(page.container(), "List View container") .drawMap() .validate(); diff --git a/src/test/java/TestPage.java b/src/test/java/TestPage.java index 5456999..978e7bc 100644 --- a/src/test/java/TestPage.java +++ b/src/test/java/TestPage.java @@ -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"))); }