-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
524 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> | ||
<!-- | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Infostretch Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
--> | ||
|
||
<suite name="QAF selenium Tests" verbose="0"> | ||
|
||
<parameter name="driver.name" value="firefoxDriver" /> | ||
<test name="Test-UI"> | ||
<packages> | ||
<package name="com.qmetry.qaf.automation.ui.*" /> | ||
</packages> | ||
</test> | ||
<!-- --> | ||
</suite> |
96 changes: 96 additions & 0 deletions
96
qaf-selenium/src/it/java/com/qmetry/qaf/automation/ui/element/ElementTest.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,96 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Infostretch Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
package com.qmetry.qaf.automation.ui.element; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.openqa.selenium.By; | ||
import org.testng.annotations.Test; | ||
|
||
import static com.qmetry.qaf.automation.core.ConfigurationManager.getBundle; | ||
import com.qmetry.qaf.automation.ui.WebDriverTestBase; | ||
import com.qmetry.qaf.automation.ui.webdriver.ElementFactory; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFWebElement; | ||
import com.qmetry.qaf.automation.util.Validator; | ||
|
||
/** | ||
* | ||
* @author chirag jayswal | ||
* | ||
*/ | ||
public class ElementTest{ | ||
|
||
@Test(groups="ui-driver") | ||
public void defaultElemetnTest() { | ||
getBundle().setProperty("default.element.impl", UiElement.class.getCanonicalName()); | ||
getBundle().setProperty("system.webdriver.gecko.driver", "C:/Users/chirag/Downloads/geckodriver-v0.18.0-win64/geckodriver.exe"); | ||
getBundle().setProperty("system.webdriver.chrome.driver", "C:/Users/chirag/Downloads/chromedriver_win32/chromedriver.exe"); | ||
|
||
getBundle().setProperty("driver.name", "chromeDriver"); | ||
|
||
System.out.println(UiElement.class.getCanonicalName()); | ||
|
||
new WebDriverTestBase().getDriver().get("http://www.google.com"); | ||
QAFExtendedWebElement ele = new WebDriverTestBase().getDriver().findElement(By.name("q")); | ||
ele.verifyPresent(); | ||
|
||
SearchPage spPage = new SearchPage(); | ||
System.out.println(spPage.isPageActive(null)); | ||
|
||
spPage.waitForPageToLoad(); | ||
Validator.verifyThat(ele, Matchers.instanceOf(UiElement.class)); | ||
System.out.println("element is implementation of" + ele.getClass()); | ||
|
||
QAFExtendedWebElement eleFromList = (QAFExtendedWebElement) new WebDriverTestBase().getDriver().findElements(By.name("q")).get(0); | ||
eleFromList.verifyPresent(); | ||
Validator.verifyThat(eleFromList, Matchers.instanceOf(UiElement.class)); | ||
|
||
System.out.println("element From List is implementation of" + eleFromList.getClass()); | ||
|
||
QAFExtendedWebElement childEleFromList = (QAFExtendedWebElement) new WebDriverTestBase().getDriver().findElement("tagName=body").findElements(By.name("q")).get(0); | ||
childEleFromList.verifyPresent(); | ||
Validator.verifyThat(childEleFromList, Matchers.instanceOf(UiElement.class)); | ||
childEleFromList.verifyVisible(); | ||
|
||
|
||
System.out.println("child element From List is implementation of" + childEleFromList.getClass()); | ||
QAFWebElement ele1 = ElementFactory.$("name=q"); | ||
Validator.verifyThat(ele1, Matchers.instanceOf(UiElement.class)); | ||
|
||
System.out.println("element is implementation of " + ele1.getClass()); | ||
ele1.verifyPresent(); | ||
new WebDriverTestBase().getDriver().waitForAnyElementVisible(childEleFromList,ele,ele1); | ||
|
||
new WebDriverTestBase().getDriver().waitForAllElementVisible(childEleFromList,ele,ele1); | ||
|
||
SearchPage searchPage = new SearchPage(); | ||
System.out.println("element is implementation of " + searchPage.getSearchInput().getClass()); | ||
Validator.verifyThat(searchPage.getSearchInput(), Matchers.instanceOf(UiElement.class)); | ||
|
||
searchPage.getSearchInput().verifyPresent(); | ||
|
||
System.out.println("element From page List is implementation of " + searchPage.getSearchInputList().get(0).getClass()); | ||
Validator.verifyThat(searchPage.getSearchInputList(), Matchers.instanceOf(UiElement.class)); | ||
|
||
} | ||
|
||
} |
68 changes: 68 additions & 0 deletions
68
qaf-selenium/src/it/java/com/qmetry/qaf/automation/ui/element/SearchPage.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,68 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Infostretch Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
package com.qmetry.qaf.automation.ui.element; | ||
|
||
import java.util.List; | ||
|
||
import com.qmetry.qaf.automation.ui.WebDriverBaseTestPage; | ||
import com.qmetry.qaf.automation.ui.annotations.FindBy; | ||
import com.qmetry.qaf.automation.ui.annotations.PageIdentifier; | ||
import com.qmetry.qaf.automation.ui.api.PageLocator; | ||
import com.qmetry.qaf.automation.ui.api.WebDriverTestPage; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFWebElement; | ||
|
||
/** | ||
* @author chirag | ||
* | ||
*/ | ||
public class SearchPage extends WebDriverBaseTestPage<WebDriverTestPage>{ | ||
|
||
@PageIdentifier | ||
@FindBy(locator="name=q") | ||
private QAFWebElement searchInput; | ||
|
||
@PageIdentifier//will not considered as page identifier as it is list. | ||
@FindBy(locator="name=q") | ||
private List<QAFWebElement> searchInputList; | ||
|
||
@PageIdentifier//will not considered as page identifier as it is list. | ||
@FindBy(locator="name=btnG") | ||
private QAFWebElement searchBtn; | ||
|
||
public QAFWebElement getSearchInput() { | ||
return searchInput; | ||
} | ||
|
||
public List<QAFWebElement> getSearchInputList() { | ||
return searchInputList; | ||
} | ||
|
||
|
||
|
||
@Override | ||
protected void openPage(PageLocator locator, Object... args) { | ||
// TODO Auto-generated method stub | ||
} | ||
|
||
|
||
|
||
} |
44 changes: 44 additions & 0 deletions
44
qaf-selenium/src/it/java/com/qmetry/qaf/automation/ui/element/UiElement.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,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Infostretch Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
package com.qmetry.qaf.automation.ui.element; | ||
|
||
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFWebComponent; | ||
|
||
/** | ||
* @author chirag jayswal | ||
* | ||
*/ | ||
public class UiElement extends QAFWebComponent { | ||
|
||
UiElement(QAFExtendedWebDriver driver) { | ||
super(driver); | ||
} | ||
public UiElement(String locator) { | ||
super(locator); | ||
} | ||
public UiElement(QAFExtendedWebElement parent, String locator) { | ||
super(parent, locator); | ||
} | ||
|
||
} |
99 changes: 99 additions & 0 deletions
99
qaf-selenium/src/it/java/com/qmetry/qaf/automation/ui/locator/DescriptiveLocatorsTest.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,99 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Infostretch Corporation | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
******************************************************************************/ | ||
package com.qmetry.qaf.automation.ui.locator; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import com.qmetry.qaf.automation.ui.WebDriverTestBase; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebDriver; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFExtendedWebElement; | ||
import com.qmetry.qaf.automation.ui.webdriver.QAFWebElement; | ||
|
||
@Test(groups="UI") | ||
public class DescriptiveLocatorsTest { | ||
|
||
String searchbox = "{'locator' : 'css=#q'; 'desc' : 'search box'}"; | ||
String servicesTab = "{'locator' : 'css=#services'; 'desc' : 'services tab'}"; | ||
String productsTab = "{'locator' : 'css=#products'; 'desc' : 'products tab'}"; | ||
|
||
QAFWebElement services = new QAFExtendedWebElement(servicesTab); | ||
QAFWebElement searchBox = new QAFExtendedWebElement(searchbox); | ||
QAFWebElement products = new QAFExtendedWebElement(productsTab); | ||
|
||
String searchboxN = "{'locator' : 'css=#qa'; 'desc' : 'search box'}"; | ||
String servicesTabN = "{'locator' : 'css=#servicesa'; 'desc' : 'services tab'}"; | ||
String productsTabN = "{'locator' : 'css=#productsa'; 'desc' : 'products tab'}"; | ||
|
||
QAFWebElement servicesN = new QAFExtendedWebElement(servicesTabN); | ||
QAFWebElement searchBoxN = new QAFExtendedWebElement(searchboxN); | ||
QAFWebElement productsN = new QAFExtendedWebElement(productsTabN); | ||
|
||
@BeforeClass | ||
// @BeforeMethod(groups = {"waitservice", "assertions", | ||
// "descriptiveLocators", | ||
// "verifications"}) | ||
public void start() { | ||
// getDriver().get("/"); | ||
getDriver().get("http://www.infostretch.com"); | ||
|
||
} | ||
|
||
@Test(description = "test descriptive locators", groups = {"descriptiveLocators",""}) | ||
public void DescLocators() { | ||
getDriver().get("http://www.infostretch.com"); | ||
|
||
searchBox.verifyPresent(); | ||
services.verifyPresent(); | ||
products.verifyPresent(); | ||
} | ||
|
||
@Test(description = "test descriptive locators", groups = "descriptiveLocators") | ||
public void DescLocatorsNegative() { | ||
servicesN.verifyNotPresent(); | ||
searchBoxN.verifyNotPresent(); | ||
productsN.verifyNotPresent(); | ||
} | ||
|
||
@Test(description = "test assertions", groups = "assertions") | ||
public void AssertionsTC() { | ||
services.assertPresent(); | ||
searchBox.assertPresent(); | ||
products.assertPresent(); | ||
} | ||
|
||
@Test(description = "test verifications", groups = "verifications") | ||
public void VerificationsTC() { | ||
searchBox.verifyPresent(); | ||
services.verifyPresent(); | ||
products.verifyPresent(); | ||
} | ||
|
||
@Test(description = "test verifications", groups = "waitservice") | ||
public void WaitServiceTC() { | ||
services.waitForPresent(); | ||
} | ||
|
||
private QAFExtendedWebDriver getDriver() { | ||
return new WebDriverTestBase().getDriver(); | ||
} | ||
} |
Oops, something went wrong.