Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions GettingStarted/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
<include>**/newtestcases/**/*.java</include>
<include>**/newtestcases/*.java</include>
</includes>
<parallel>classes</parallel>
<!--parallel>classes</parallel>
<threadCount>2</threadCount>
<forkCount>2C</forkCount>
<forkCount>2C</forkCount-->
</configuration>
<executions>
<execution>
Expand Down
4 changes: 2 additions & 2 deletions GettingStarted/serenity.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ serenity.project.name = Serenity Inspify Practice
webdriver.base.url=https://nikhilp-prod3.inspify.com/hub
webdriver.driver=chrome
webdriver.chrome.driver = src/test/resources/drivers/chromedriver.exe
webdriver.wait.for.timeout = 15000
webdriver.timeouts.implicitlywait = 20000
webdriver.wait.for.timeout = 20000
webdriver.timeouts.implicitlywait = 25000
serenity.browser.maximized=true
#serenity.take.screenshots=FOR_EACH_ACTION
#chrome_preferences.profile.default_content_setting_values.notifications=2
Expand Down
24 changes: 19 additions & 5 deletions GettingStarted/src/test/java/base/BasePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import net.serenitybdd.core.pages.PageObject;
import net.serenitybdd.core.pages.WebElementFacade;
Expand Down Expand Up @@ -86,15 +88,15 @@ private By getBy(String locator) {

}

public void click(String locator) {

waitFor(getElement(locator)).click();
}

public void type(String locator, String value) {

waitFor(getElement(locator)).sendKeys(value);
}

public void click(String locator) {

waitFor(getElement(locator)).click();
}

public String getText(String locator) {

Expand Down Expand Up @@ -128,4 +130,16 @@ public String getElementText(String locator) {
String text = waitFor(getElement(locator)).getText();
return text;
}

public void scrollDown() {
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("window.scrollTo(0, document.body.scrollHeight);");
}

// public void click(String locator) {
// By byLocator = By.cssSelector(locator);
// WebDriverWait wait = new WebDriverWait(getDriver(), 10);
// WebElement element = wait.until(ExpectedConditions.elementToBeClickable(byLocator));
// element.click();
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class CreateStorybook {

@Title("Login to inspify site")
@Before
public void login() {
public void login() throws InterruptedException {
username = environmentVariables.getProperty("username");
password = environmentVariables.getProperty("password");
sessionTitle = faker.company().name();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static void beforeClass() {

@Title("Login to inspify")
@Before
public void doLogin() {
public void doLogin() throws InterruptedException {
username = testDataLoader.getUsername();
password = testDataLoader.getPassword();

Expand All @@ -57,9 +57,8 @@ public void verifyLogin() {
@Title("Logout from inspify")
@Test
// @Pending
public void doLogut() {
public void doLogut() throws InterruptedException {
inspify.logout();

}

@Title("Verify logout")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class SessionCreationTest {

@Title("Login to inspify site")
@Before
public void login() {
public void login() throws InterruptedException {
username = environmentVariables.getProperty("username");
password = environmentVariables.getProperty("password");
sessionTitle = faker.company().name();
Expand All @@ -60,7 +60,7 @@ public void sessionCreationTest() throws InterruptedException {

@Title("Logout from inspify")
@After
public void logout() {
public void logout() throws InterruptedException {
inspify.logout();
inspify.verifyLogout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String qualifier() {

@Title("Login to inspify site")
@Before
public void login() {
public void login() throws InterruptedException {
inspify.launchURL();
inspify.login(username, password);
inspify.goToProfile();
Expand All @@ -48,17 +48,17 @@ public void login() {
public void startLiveSessionTest() throws InterruptedException {
inspify.goToCalendar();
inspify.startLiveSession();
inspify.acceptPermissions();
// inspify.verifyIsLiveSessionLoungeDisplayed();
// inspify.closeLiveSessionPopUp();
// inspify.acceptPermissions();
// inspify.startSession();
// inspify.verifyIsLiveSessionStarted();
}

@Title("Logout from inspify")
@After
public void logout() {
inspify.logout();
inspify.verifyLogout();
}

// @Title("Logout from inspify")
// @After
// public void logout() throws InterruptedException {
// inspify.logout();
// inspify.verifyLogout();
// }
}
21 changes: 19 additions & 2 deletions GettingStarted/src/test/java/pages/InspifyPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,23 @@ public class InspifyPage extends BasePage {
String Scene = "xpath=//div[contains(@class, 'actions')]";
String SBTitleText = "css=.title strong";
String SBSubTitleText = "css=.subtitle";
String closeLiveSsnPopUp = "css=.title-close .popup-close";

public void goToProfile() {
elementPresence(Menu);
click(Menu);
elementPresence(ProfileMenu);
click(ProfileMenu);
}

public void verifyLogin() {
elementPresence(AvatarSymbol);
}

public void logout() {
public void logout() throws InterruptedException {
Thread.sleep(5000);
click(Menu);
scrollDown();
click(LogoutMenu);
}

Expand All @@ -63,21 +68,33 @@ public void verifyLogout() {
}

public void startLiveSession() throws InterruptedException {

click(StartLiveSessionButton1);
Thread.sleep(5000);
elementPresence(PopupTitle);
Thread.sleep(5000);
scrollDown();
click(StartLiveSessionButton2);
Thread.sleep(5000);
}

public void verifyIsLiveSessionLoungeDisplayed() throws InterruptedException {
java.util.Set<String> windowHandles = getDriver().getWindowHandles();
String sideWindowHandle = windowHandles.stream().filter(handle -> !handle.equals(getDriver().getWindowHandle()))
.findFirst().orElseThrow(() -> new RuntimeException("Side window not found"));
getDriver().switchTo().window(sideWindowHandle);
elementPresence(Logo);
elementPresence(HostMessage);
elementPresence(LoungeVideo);
}

public void closeLiveSessionPopUp() {
java.util.Set<String> windowHandles = getDriver().getWindowHandles();
String sideWindowHandle = windowHandles.stream().filter(handle -> !handle.equals(getDriver().getWindowHandle()))
.findFirst().orElseThrow(() -> new RuntimeException("Side window not found"));
getDriver().switchTo().window(sideWindowHandle);
click(closeLiveSsnPopUp);
}

public void startSession() {
elementPresence(InputName);
type(InputName, "Host");
Expand Down
8 changes: 5 additions & 3 deletions GettingStarted/src/test/java/pages/LoginPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ public class LoginPage extends BasePage {
String Username = "id=username";
String Password = "id=password";
String SigninButton = "xpath=//button[text()='SIGN IN']";


public InspifyPage login(String username, String password) {
public InspifyPage login(String username, String password) throws InterruptedException {
type(Username, username);
type(Password, password);
click(SigninButton);

Thread.sleep(5000);
getDriver().navigate().refresh();
Thread.sleep(5000);

return this.switchToPage(InspifyPage.class);
}

Expand Down
19 changes: 19 additions & 0 deletions GettingStarted/src/test/java/pages/ScreenPlayPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package pages;

import org.openqa.selenium.WebDriver;

import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.abilities.BrowseTheWeb;
import net.serenitybdd.screenplay.actions.Open;
import net.thucydides.core.annotations.Step;

public abstract class ScreenPlayPage implements Task {
WebDriver driver;

@Step("Launches 'SiteURL'")
public <T extends Actor> void performAs(T actor, String SiteURL) {
actor.can(BrowseTheWeb.with(driver));
actor.attemptsTo(Open.url(SiteURL));
}
}
11 changes: 7 additions & 4 deletions GettingStarted/src/test/java/steps/InspifySteps.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import net.thucydides.core.annotations.Step;
import pages.InspifyPage;
import pages.LoginPage;
import pages.ScreenPlay;

public class InspifySteps {
LoginPage login;
Expand All @@ -26,7 +25,7 @@ public void launchURL() {
}

@Step
public void login(String username, String password) {
public void login(String username, String password) throws InterruptedException {
login.login(username, password);
}

Expand All @@ -41,7 +40,7 @@ public void verifyLogin() {
}

@Step
public void logout() {
public void logout() throws InterruptedException {
inspify.logout();
}

Expand All @@ -66,10 +65,14 @@ public void acceptPermissions() {
@Step

public void verifyIsLiveSessionLoungeDisplayed() throws InterruptedException {

inspify.verifyIsLiveSessionLoungeDisplayed();
}

@Step
public void closeLiveSessionPopUp() {
inspify.closeLiveSessionPopUp();
}

@Step

public void startSession() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class InspifyLoginTest {
@Title("Login to Inspify")
@Test

public void login() {
public void login() throws InterruptedException {
inspify.launchURL();
inspify.login(username, password);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public class InspifyPrcaticeTest {
@Title("Operations on inspify site")
@Test

public void verifyIsUserLoggedInSuccessfully() {
public void verifyIsUserLoggedInSuccessfully() throws InterruptedException {
inspify.launchURL();
inspify.login(username, password);
inspify.goToProfile();
inspify.verifyLogin();
}

@Test
public void verifyIsUserLoggedOutSuccessFully() {
public void verifyIsUserLoggedOutSuccessFully() throws InterruptedException {
inspify.launchURL();
inspify.login(username, password);
inspify.goToProfile();
Expand Down
38 changes: 21 additions & 17 deletions GettingStarted/src/test/java/utilities/TestDataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
import java.util.Properties;

public class TestDataLoader {
private Properties testDataProperties;
private Properties testDataProperties;

public TestDataLoader() {
testDataProperties = new Properties();
try {
FileInputStream fileInputStream = new FileInputStream("testData.properties");
testDataProperties.load(fileInputStream);
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public TestDataLoader() {
testDataProperties = new Properties();
try {
FileInputStream fileInputStream = new FileInputStream("testData.properties");
testDataProperties.load(fileInputStream);
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}

public String getUsername() {
return testDataProperties.getProperty("username");
}
public String getUsername() {
return testDataProperties.getProperty("username");
}

public String getPassword() {
return testDataProperties.getProperty("password");
}
public String getPassword() {
return testDataProperties.getProperty("password");
}

public String getSiteURL() {
return testDataProperties.getProperty("SiteURL");
}

}
Binary file modified GettingStarted/target/GettingStarted-0.0.1-SNAPSHOT.jar
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions GettingStarted/target/failsafe-reports/failsafe-summary.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<failsafe-summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd" result="255" timeout="false">
<completed>4</completed>
<errors>1</errors>
<failsafe-summary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/failsafe-summary.xsd" result="null" timeout="false">
<completed>5</completed>
<errors>0</errors>
<failures>0</failures>
<skipped>0</skipped>
<failureMessage xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: newtestcases.CreateStorybook
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 56.278 s - in newtestcases.CreateStorybook
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-------------------------------------------------------------------------------
Test set: newtestcases.InspifyLoginPageTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 60.362 s - in newtestcases.InspifyLoginPageTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 68.987 s - in newtestcases.InspifyLoginPageTest
Loading