Created
May 10, 2020 16:35
-
-
Save haigopi/85ef528dc7587b39f679f55a261c0602 to your computer and use it in GitHub Desktop.
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
package com.generic.functional.automation.ui.tests.login; | |
import com.generic.framework.ui.functional.ExtentManager; | |
import com.generic.framework.ui.functional.Login; | |
import com.generic.functional.automation.ui.tests.common.TestConfig; | |
import com.generic.framework.ui.functional.AppConstants; | |
import org.openqa.selenium.*; | |
import org.openqa.selenium.chrome.ChromeDriver; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.Test; | |
import java.util.concurrent.TimeUnit; | |
public class LoginLogoutAutomation extends TestConfig { | |
@Test | |
public void btnShadowTest() throws Exception { | |
test = extent.createTest("Login Page Button Shadow", | |
"Verifying Login Shadow Button"); | |
test.createNode("Looking for button"); | |
WebElement btn = driver.findElement(By.xpath("//div[@id='gatsby-focus-wrapper']/div/main/div/main/div/form/button")); | |
// 1. Button style | |
String style = btn.getAttribute("style"); | |
test.createNode("Style retrieved"); | |
if (style.contains("box-shadow: rgba(255, 105, 135, 0.3)")) { | |
// Fail it because the style is not valid. | |
System.out.println("==> " + style); | |
System.err.println("Style is not what we desired."); | |
} | |
test.createNode("Style Cross Checked."); | |
} | |
@Test | |
public void testLogin() throws Exception { | |
test = extent.createTest("Login Button Click", | |
"Verifying Login Functionalities"); | |
test.createNode("Click Login Test"); | |
login.doLogin(test); | |
} | |
@Test | |
public void testLoginElementsAndLogout() throws Exception { | |
test = extent.createTest("Logout Button Click", | |
"Verifying Logout Functionalities"); | |
test.createNode("Looking for Articulator Button"); | |
driver.findElement(By.xpath("//*[text()='Articulator']")); | |
test.createNode("Looking for Cluster Studio Button"); | |
driver.findElement(By.xpath("//*[text()='Cluster Studio']")); | |
test.createNode("Looking for Entitles Button"); | |
driver.findElement(By.xpath("//*[text()='Entitles']")); | |
test.createNode("Looking for Logout Button & clicking on it"); | |
driver.findElement(By.xpath("//*[text()='Logout']")).click(); | |
// 2. How do I know I actually Logged In? | |
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); | |
test.createNode("Looking for SignIn Button"); | |
driver.findElement(By.xpath("//*[text()='Sign in']")); | |
test.createNode("SignIn Found"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment