Skip to content

Commit 0c5aad7

Browse files
committed
Change CSS a bit
1 parent 1d673d6 commit 0c5aad7

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/test/java/com/browserstack/test/suites/login/LoginVisualTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,39 @@
22

33
import com.browserstack.test.suites.TestBase;
44
import org.openqa.selenium.By;
5+
import org.openqa.selenium.JavascriptExecutor;
56
import org.openqa.selenium.Keys;
7+
import org.openqa.selenium.support.ui.ExpectedConditions;
68
import org.testng.Assert;
79
import org.testng.annotations.Test;
810

911
public class LoginVisualTest extends TestBase {
1012

13+
private boolean changeCSS = true;
14+
1115
@Test
1216
public void loginLockedUser() {
17+
JavascriptExecutor ex = ((JavascriptExecutor) getDriver());
1318

1419
percy.snapshot("Check Homepage");
1520
getDriver().findElement(By.id("signin")).click();
21+
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#username input")));
22+
23+
if (changeCSS) {
24+
ex.executeScript("document.getElementById('login-btn').style.backgroundColor = '#FFA500';");
25+
ex.executeScript("document.getElementById('login-btn').style.width = '60%';");
26+
}
1627
percy.snapshot("Check Signin page");
1728
getDriver().findElement(By.cssSelector("#username input")).sendKeys("locked_user" + Keys.ENTER);
1829
getDriver().findElement(By.cssSelector("#password input")).sendKeys("testingisfun99" + Keys.ENTER);
1930
getDriver().findElement(By.id("login-btn")).click();
20-
percy.snapshot("Check Login result");
2131

32+
wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("api-error")));
33+
if (changeCSS) {
34+
ex.executeScript("document.getElementsByClassName('api-error')[0].style.fontSize = '200%';");
35+
}
36+
percy.snapshot("Check Login result");
2237
Assert.assertEquals(getDriver().findElement(By.className("api-error")).getText(), "Your account has been locked.");
2338
}
39+
2440
}

0 commit comments

Comments
 (0)