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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Web Automation Tests for Unlaunch (app.unlaunch.io)

Automation Testing Framework for Unlaunch Console using Selenium & Web Driver.

In order to run, make sure your installed Chrome browser version matches with chromedriver version in /src/main/resources folder.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.interactions.Actions;

/**
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/io/unlaunch/automation/pages/Registration.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
package io.unlaunch.automation.pages;

import io.unlaunch.automation.Browser;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

/**
*
* @author ghauri
Expand Down Expand Up @@ -52,23 +52,23 @@ public void register() {

public void otp() {
Browser.fluentWait((WebDriver d) -> d.findElement(By.cssSelector("input[type=tel]"))).sendKeys("455148");
/* Verify otp right away after code is entered
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because after code is entered, it verifies right away, there is no button to click.

WebElement button = Browser.driver.findElement(By.tagName("button"));
button.submit();
*/
}

public void company() {
Browser.fluentWait((WebDriver d) -> d.findElement(By.className("__at_btn_company"))).click();
}

public void createFirstProject() {
Browser.sleep(1);
webDriverWait.until(ExpectedConditions.urlContains("/project"));

WebElement nameElement = Browser.driver.findElement(By.cssSelector("input[name=name]"));
nameElement.sendKeys("Unlaunch automated test");

// WebElement keyElement = Browser.driver.findElement(By.cssSelector("input[name=key]"));
// keyElement.sendKeys("Unlaunch-automated-test");

WebElement descElement = Browser.driver.findElement(By.cssSelector("input[name=description]"));
descElement.sendKeys("Automated test selenium");

Expand All @@ -83,7 +83,7 @@ public void skipMembers() {
btn.click();
}

public void verifySuccessfullLogin() {
public void verifySuccessfulLogin() {
Browser.sleep(5);
webDriverWait.until(ExpectedConditions.urlContains("/features"));

Expand Down
35 changes: 35 additions & 0 deletions src/main/java/io/unlaunch/automation/pages/Tutorial.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.unlaunch.automation.pages;

import io.unlaunch.automation.Browser;
import io.unlaunch.automation.sdk.EvaluateFeatureFlag;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class Tutorial {

public void apiEventReceived() {
// Choose Java language
WebElement element = Browser.driver.findElement(By.cssSelector("div.__at_select_language div div div div input"));
Browser.fluentWait((WebDriver t) -> element);
element.sendKeys("Java");
element.sendKeys(Keys.ENTER);

// Get sdkKey
WebElement codeElement = Browser.driver.findElements(By.className("sdk_help_code")).get(1);
String code = codeElement.getText();
String sdkKey = code.substring(code.indexOf("prod-server"), code.indexOf("\")"));

// Send api event
EvaluateFeatureFlag evaluator = new EvaluateFeatureFlag();
evaluator.initializeClient(sdkKey);
evaluator.evalFlag("my-first-feature-flag", "identity");
evaluator.close();

// Make sure event is received
Browser.sleep(3);
WebElement successElement = Browser.driver.findElement(By.className("__at_p_tutorialsuccess"));
assert successElement.getText().contains("Congratulations");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public static void close() {
client.shutdown();
}

public String evalFlag(String flag, String identity) {
return client.getVariation(flag, identity);
}

public String evalInactiveFlagReturnsDefaultVariation() {

String variation = client.getVariation("test-archive-flag", "user-123");
Expand Down
Binary file modified src/main/resources/chromedriver
Binary file not shown.
Loading