diff --git a/README.md b/README.md index 57d217b..afe302e 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ The project aims to provide a simple light weight object (Creative Element) to compare the layout of one Web Element with respect to the Other. The relation between web elements (two web elements) is expressed in the following terms: -* On -* Near -* Inside -* Aligned +* creative.layout.On +* creative.layout.Near +* creative.layout.Inside +* creative.layout.Aligned The project is inspired by Galen Framework and has been produced so that relevant functions can be utilized by other frameworks. @@ -15,7 +15,7 @@ The project is inspired by Galen Framework and has been produced so that relevan Creative Element is created using a WebElement. ```java -CreativeElment element = new CreativeElement(driver.findElement(By.cssSelector(...))); +CreativeElment element = new creative.layout.CreativeElement(driver.findElement(By.cssSelector(...))); ``` Creative Element also returns back the Selenium WebElement so as the tester can continue with their regular selenium operations @@ -26,14 +26,14 @@ WebElement element = creativeElement.getElement(); Relation between one Creative Element with respect to other can be asserted in the following way: ```java -CreativeElment elementOne = new CreativeElement(driver.findElement(By.cssSelector(...))); -CreativeElment elementTwo = new CreativeElement(driver.findElement(By.cssSelector(...))); +CreativeElment elementOne = new creative.layout.CreativeElement(driver.findElement(By.cssSelector(...))); +CreativeElment elementTwo = new creative.layout.CreativeElement(driver.findElement(By.cssSelector(...))); Assert.assertTrue(elementOne.isInside().isInside(elementTwo)); ``` -#### On: +#### creative.layout.On: -On is used to evaluate if a WebElement overlaps the other WebElement. If the respective edges or even points of 2 WebElements will overlap each other they are considered overlapping. +creative.layout.On is used to evaluate if a WebElement overlaps the other WebElement. If the respective edges or even points of 2 WebElements will overlap each other they are considered overlapping. ```java //Overlaps @@ -42,71 +42,71 @@ elementOne.on().overlaps(elementTwo); //Get Distance //Returns the distance (integer) between Top edge of ElementOne and Top Edge of ElementTwo -elementOne.on().getDistance(elementTwo, Direction.TOP); +elementOne.on().getDistance(elementTwo, creative.layout.Direction.TOP); ``` -#### Inside +#### creative.layout.Inside -Inside is used to evaluate if a WebElement is inside other WebElement. Completely inside no edges or points overlap. +creative.layout.Inside is used to evaluate if a WebElement is inside other WebElement. Completely inside no edges or points overlap. ```java -//Is Inside +//Is creative.layout.Inside //Returns true in case the WebElement is inside other WebElement elementOne.isInside().isInside(elementTwo); //Simple check //Returns true in case the WebElement is inside other WebElement, and the distance between the Top Edge of Element 1, and Top Edge of //Element 2 is exactly 16 pixels (calculated using integers) -elementOne.isInside().isInside(elementTwo, Direction.Top, 16); +elementOne.isInside().isInside(elementTwo, creative.layout.Direction.Top, 16); //Returns true in case the WebElement is inside other WebElement, and the distance between the Top Edge of Element 1, and Top Edge of //Element 2 is between 16 - 20 pixels (calculated using integers) -elementOne.isInside().isInside(elementTwo, Direction.Top, 16, 20); +elementOne.isInside().isInside(elementTwo, creative.layout.Direction.Top, 16, 20); ``` -#### Near +#### creative.layout.Near -Near is used to evaluate that a WebElement is not on, or inside another WebElement. Relevant functions for near are: -* On Top Of => isNear().onTopOf(...) -* On Bottom Of => isNear().onBottomOf(...) -* Is Near => isNear().isNear(...) -* On Right Of => isNear().onRightOf(...) -* On Left Of => isNear().onLeftOf(...) +creative.layout.Near is used to evaluate that a WebElement is not on, or inside another WebElement. Relevant functions for near are: +* creative.layout.On Top Of => isNear().onTopOf(...) +* creative.layout.On Bottom Of => isNear().onBottomOf(...) +* Is creative.layout.Near => isNear().isNear(...) +* creative.layout.On Right Of => isNear().onRightOf(...) +* creative.layout.On Left Of => isNear().onLeftOf(...) ```java -//Is Near +//Is creative.layout.Near //Returns true in case the WebElement is neither inside other WebElement, nor on the other WebElement elementOne.isNear().isNear(elementTwo); -//On Top Of +//creative.layout.On Top Of //Returns true in case the WebElement is near and on right of other WebElement elementOne.isNear().onRightOf(elementTwo); -//On Top Of +//creative.layout.On Top Of //Returns true in case the WebElement is near other WebElement, and the distance between the Top Edge of Element 1, and Top Edge of //Element 2 is exactly 16 pixels (calculated using integers) -elementOne.isInside().isInside(elementTwo, Direction.Top, 16); +elementOne.isInside().isInside(elementTwo, creative.layout.Direction.Top, 16); -//On Top Of +//creative.layout.On Top Of //Returns true in case the WebElement is near other WebElement, and the distance between the Top Edge of Element 1, and Top Edge of //Element 2 is between 16 - 20 pixels (calculated using integers) -elementOne.isInside().isInside(elementTwo, Direction.Top, 16, 20); +elementOne.isInside().isInside(elementTwo, creative.layout.Direction.Top, 16, 20); ``` -#### Aligned +#### creative.layout.Aligned -Aligned evaluates if the two WebElemnts are aligned. Aligned is validated on the edges, or inside another Web Element. Functions: +creative.layout.Aligned evaluates if the two WebElemnts are aligned. creative.layout.Aligned is validated on the edges, or inside another Web Element. Functions: * Top => isAligned().top(...); * Bottom => isAligned().bottom(...); * Left => isAligned().left(...); * Right => isAligned().right(...); -* Inside Centrally => isAligned().insideCentrally(...); -* Inside Horizontally => isAligned().insideHorizontally(...); -* Inside Vertically => isAligned().insideVertically(...); +* creative.layout.Inside Centrally => isAligned().insideCentrally(...); +* creative.layout.Inside Horizontally => isAligned().insideHorizontally(...); +* creative.layout.Inside Vertically => isAligned().insideVertically(...); ```java -//Inside Top +//creative.layout.Inside Top //Returns true in case the WebElement 1 is top aligned with WebElement 2 elementOne.isAligned().top(elementTwo); ``` diff --git a/pom.xml b/pom.xml index 51caae5..a943aa6 100644 --- a/pom.xml +++ b/pom.xml @@ -26,24 +26,4 @@ - - - - org.apache.maven.plugins - maven-jar-plugin - - - package - - jar - - - true - - - - - - - \ No newline at end of file diff --git a/src/main/java/Aligned.java b/src/main/java/creative/layout/Aligned.java similarity index 98% rename from src/main/java/Aligned.java rename to src/main/java/creative/layout/Aligned.java index 00ed0ba..514c67d 100644 --- a/src/main/java/Aligned.java +++ b/src/main/java/creative/layout/Aligned.java @@ -1,3 +1,5 @@ +package creative.layout; + public class Aligned { diff --git a/src/main/java/CreativeElement.java b/src/main/java/creative/layout/CreativeElement.java similarity index 97% rename from src/main/java/CreativeElement.java rename to src/main/java/creative/layout/CreativeElement.java index 29a79dd..764cb98 100644 --- a/src/main/java/CreativeElement.java +++ b/src/main/java/creative/layout/CreativeElement.java @@ -1,3 +1,5 @@ +package creative.layout; + import org.openqa.selenium.WebElement; public class CreativeElement { diff --git a/src/main/java/CyclicQuad.java b/src/main/java/creative/layout/CyclicQuad.java similarity index 97% rename from src/main/java/CyclicQuad.java rename to src/main/java/creative/layout/CyclicQuad.java index 8566aa2..2ff8044 100644 --- a/src/main/java/CyclicQuad.java +++ b/src/main/java/creative/layout/CyclicQuad.java @@ -1,5 +1,6 @@ -import org.openqa.selenium.Point; +package creative.layout; +import org.openqa.selenium.Point; import java.awt.*; class CyclicQuad { diff --git a/src/main/java/Direction.java b/src/main/java/creative/layout/Direction.java similarity index 72% rename from src/main/java/Direction.java rename to src/main/java/creative/layout/Direction.java index e577e0b..7b39bf9 100644 --- a/src/main/java/Direction.java +++ b/src/main/java/creative/layout/Direction.java @@ -1,3 +1,5 @@ +package creative.layout; + public enum Direction { TOP, BOTTOM, diff --git a/src/main/java/Inside.java b/src/main/java/creative/layout/Inside.java similarity index 99% rename from src/main/java/Inside.java rename to src/main/java/creative/layout/Inside.java index 33b25c2..cfd319f 100644 --- a/src/main/java/Inside.java +++ b/src/main/java/creative/layout/Inside.java @@ -1,3 +1,5 @@ +package creative.layout; + public class Inside { private CyclicQuad quad; diff --git a/src/main/java/Near.java b/src/main/java/creative/layout/Near.java similarity index 99% rename from src/main/java/Near.java rename to src/main/java/creative/layout/Near.java index bd44459..33caf8a 100644 --- a/src/main/java/Near.java +++ b/src/main/java/creative/layout/Near.java @@ -1,3 +1,5 @@ +package creative.layout; + public class Near { private CyclicQuad quad; diff --git a/src/main/java/On.java b/src/main/java/creative/layout/On.java similarity index 98% rename from src/main/java/On.java rename to src/main/java/creative/layout/On.java index b25e3a9..533ceea 100644 --- a/src/main/java/On.java +++ b/src/main/java/creative/layout/On.java @@ -1,3 +1,5 @@ +package creative.layout; + public class On { private CyclicQuad quad;