-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move building of locators to How enum
Signed-off-by: Simon Stewart <simon.m.stewart@gmail.com>
- Loading branch information
Showing
3 changed files
with
129 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
java/client/test/org/openqa/selenium/support/ui/HowTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package org.openqa.selenium.support.ui; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.support.ByIdOrName; | ||
import org.openqa.selenium.support.How; | ||
|
||
public class HowTest { | ||
|
||
private static final String VALUE = "value"; | ||
|
||
@Test | ||
public void testBuildByClassName(){ | ||
assertEquals(By.className(VALUE).toString(), How.CLASS_NAME.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByCss(){ | ||
assertEquals(By.cssSelector(VALUE).toString(), How.CSS.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildById(){ | ||
assertEquals(By.id(VALUE).toString(), How.ID.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByIdOrName(){ | ||
assertEquals(new ByIdOrName(VALUE).toString(), How.ID_OR_NAME.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByLinkText(){ | ||
assertEquals(By.linkText(VALUE).toString(), How.LINK_TEXT.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByName(){ | ||
assertEquals(By.name(VALUE).toString(), How.NAME.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByPartialLinkText(){ | ||
assertEquals(By.partialLinkText(VALUE).toString(), | ||
How.PARTIAL_LINK_TEXT.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByTagName(){ | ||
assertEquals(By.tagName(VALUE).toString(), How.TAG_NAME.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildByXpath(){ | ||
assertEquals(By.xpath(VALUE).toString(), How.XPATH.buildBy(VALUE).toString()); | ||
} | ||
|
||
@Test | ||
public void testBuildUnset(){ | ||
assertEquals(By.id(VALUE).toString(), How.UNSET.buildBy(VALUE).toString()); | ||
} | ||
} |