Я новичок в автоматизации испытаний.Я пытаюсь создать тестовый сценарий со стандартом шаблона объекта страницы.Ниже я размещаю свой код в данный момент:
BaseTest.java
package tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
public class BaseTest {
public WebDriver driver;
public WebDriverWait wait;
@BeforeClass
public void setUp() {
driver = new ChromeDriver();
wait = new WebDriverWait(driver, 15);
driver.manage().window().maximize();
}
@AfterClass
public void tearDown() {
driver.quit();
}
}
BasePage.java
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
public class BasePage {
public WebDriver driver;
public WebDriverWait wait;
public BasePage(WebDriver driver, WebDriverWait wait) {
this.driver = driver;
this.wait = wait;
}
public void click (By elementLocation) {
driver.findElement(elementLocation).click();
}
public void SendKeys (By elementLocation) {
driver.findElement(elementLocation).sendKeys();
}
}
HomePaga.java
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
public class HomePage extends BasePage {
public HomePage (WebDriver driver, WebDriverWait wait) {
super(driver, wait);
}
String baseURL = "http://localhost:4200/dashboard";
String BigFamilyCard = "client-individualPerson-bigFamilyCard-details-bttn";
public void OpenUFE() {
driver.get(baseURL);
}
public void OpenBigFamilyCard() {
click(By.className(BigFamilyCard));
}
}
BigFamilyCard.java
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.WebDriverWait;
import pages.BasePage;
public class BigFamilyCard extends BasePage {
public BigFamilyCard(WebDriver driver, WebDriverWait wait) {
super(driver, wait);
}
By DetailsButton = By.id("client-individualPerson-bigFamilyCard-details-bttn");
By EditionButton = By.id("client-insdividualPerson-bigfamilyCard-edit-bttn");
By BigFamilyCardNumber = By.id("cardNumber-inputText");
By ReleaseDate = By.id("releaseDate-calendar");
By ExpirationDate = By.id("expirationDate-calendar");
By NextButton = By.id("next-bttn");
By SignedCheckbox = By.id("signed-checkbox");
By SaveButton = By.id("save-bigFamilyCard-bttn");
public void OpenBigFamilyCard() {
driver.findElement(DetailsButton).click();
driver.findElement(EditionButton).click();
driver.findElement(BigFamilyCardNumber).click();
driver.findElement(ReleaseDate).click();
driver.findElement(ExpirationDate).click();
driver.findElement(NextButton).click();
driver.findElement(SignedCheckbox).click();
driver.findElement(SaveButton).click();
}
}
TestBigFamilyCard.java
package tests;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import pages.BasePage;
import pages.BigFamilyCard;
import pages.HomePage;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TestBigFamilyCard extends BasePage {
public TestBigFamilyCard(WebDriver driver, WebDriverWait wait) {
super(driver, wait);
}
@Test
public void BigFamilyCardEdition() {
// Page Instantiations - instancje stron
HomePage homePage = new HomePage(driver, wait);
BigFamilyCard bigFamilyCard = new BigFamilyCard(driver, wait);
// Page Methods
homePage.OpenUFE();
homePage.OpenBigFamilyCard();
bigFamilyCard.OpenBigFamilyCard();
}
}
Во время выполнения теста я получил сообщение - тесты не найдены и "Произошла ошибка при создании экземпляров тестов класса.TestBigFamilyCard. Проверьте, чтобы убедиться, что он может быть создан "Может кто-нибудь помочь Ми с этой проблемой?