Skip to content

Commit

Permalink
updatd package
Browse files Browse the repository at this point in the history
  • Loading branch information
sethijatin committed Dec 18, 2017
1 parent 5abfe75 commit 7e599b1
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 55 deletions.
68 changes: 34 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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);
```
20 changes: 0 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<forceCreation>true</forceCreation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

public class Aligned {


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

import org.openqa.selenium.WebElement;

public class CreativeElement {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.openqa.selenium.Point;
package creative.layout;

import org.openqa.selenium.Point;
import java.awt.*;

class CyclicQuad {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

public enum Direction {
TOP,
BOTTOM,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

public class Inside {

private CyclicQuad quad;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

public class Near {

private CyclicQuad quad;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package creative.layout;

public class On {

private CyclicQuad quad;
Expand Down

0 comments on commit 7e599b1

Please sign in to comment.