Skip to content

Commit

Permalink
repo-editor as plug-in
Browse files Browse the repository at this point in the history
  • Loading branch information
cjayswal committed Nov 23, 2024
1 parent 2c4f053 commit aa617bc
Show file tree
Hide file tree
Showing 14 changed files with 524 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@
</properties>

<modules>
<module>qaf</module>
<module>qaf-core</module>
<module>qaf-testng</module>
<module>qaf-ws</module>
<module>qaf-selenium</module>
<module>qaf-playwright</module>
<module>qaf-tools</module>
<module>qaf</module>
</modules>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ private static Collection<PlaywrightCommandListener> getDriverListeners() {

@Override
public void loadDriverResouces(String name) {
// TODO Auto-generated method stub
Browsers browser = Browsers.getBrowser(name);
loadDriverResouces(browser);

}

Expand Down
1 change: 1 addition & 0 deletions qaf-selenium/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<artifactId>qaf-selenium</artifactId>
<properties>
<qaf.type>plugin</qaf.type>
<skip.it>false</skip.it>
</properties>
<dependencies>
<dependency>
Expand Down
35 changes: 35 additions & 0 deletions qaf-selenium/src/it/config/testrun_config.xml
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>
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));

}

}
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
}



}
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);
}

}
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();
}
}
Loading

0 comments on commit aa617bc

Please sign in to comment.