Skip to content

Instantly share code, notes, and snippets.

@borodicht
Created December 16, 2024 18:01
Show Gist options
  • Save borodicht/7a9fc4b0ac29f1fdaf53cb403a71a8b0 to your computer and use it in GitHub Desktop.
Save borodicht/7a9fc4b0ac29f1fdaf53cb403a71a8b0 to your computer and use it in GitHub Desktop.
package tests;
import com.codeborne.selenide.Configuration;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testng.annotations.BeforeMethod;
import pages.LoginPage;
import static com.codeborne.selenide.WebDriverRunner.setWebDriver;
public class BaseTest {
LoginPage loginPage;
@BeforeMethod
public void setup() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
Configuration.browserCapabilities = options;
Configuration.browser = "chrome";
Configuration.headless = false;
Configuration.timeout = 10000;
Configuration.clickViaJs = true;
Configuration.baseUrl = "https://app.qase.io/";
// Configuration.assertionMode = AssertionMode.valueOf("SOFT");
// WebDriver driver = new ChromeDriver();
// setWebDriver(driver);
loginPage = new LoginPage();
}
}
package pages;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;
public class LoginPage {
private static final String USER = "[name=email]",
PASSWORD = "[name=password]",
BUTTON_SIGN_IN = "Sign in";
public void openPage() {
open("login");
}
public void login(String user, String password) {
$(USER).setValue("[email protected]");
$(PASSWORD).setValue("Kazantip_001");
$(byText(BUTTON_SIGN_IN)).click();
}
}
package tests;
import org.testng.annotations.Test;
public class ProjectTest extends BaseTest {
@Test
public void checkCreateProject() {
loginPage.openPage();
loginPage.login("[email protected]", "Kazantip_001");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment