Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pages;
- import io.qameta.allure.Step;
- import org.openqa.selenium.Keys;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.support.FindBy;
- import pages.edg.EdgLandingPage;
- import pages.landing.LandingsPage;
- import pages.payments.ChildPaymentsPage;
- import pages.personal.PersonalAreaLoginPage;
- import pages.personal.PersonalAreaPage;
- import pages.personal.documents.personnal.AllEventsPage;
- import pages.portal.criminal.CriminalCertificateStartPage;
- import pages.portal.kindergarten.BookKindergartenStartPage;
- import pages.portal.passport.ForeignPassportStartPage;
- import pages.portal.registration.RegistrationStartPage;
- import pages.services.AboutRegistrationСitizenPlaceStayPage;
- import pages.services.ServicesCategoryPage;
- import pages.services.ServicesMarriageRegistrationPage;
- import pages.services.ServicesPassportRFPage;
- import pages.services.ServicesDrugsCertificationPage;
- public class HomePage extends BasePage {
- @FindBy(xpath = "//a[@class='lk-enter']")
- private WebElement personalAreaButton;
- @FindBy(xpath = "//a[text()='Все уведомления']")
- private WebElement allNotificationButton;
- @FindBy(xpath = "//div[contains(text(),'портал Госуслуг')]")
- private WebElement navigateToPortalButton;
- @FindBy(xpath = "//a[@class='main-app-logo']")
- private WebElement mainLogo;
- @FindBy(xpath = "//p[@class='plain-text ng-scope']//a[contains(text(),'Запись ребенка в детский сад')]")
- private WebElement pushChildrenIntoTheKinderGardenLink;
- @FindBy(xpath = "//a[contains(.,'Запись в детский сад')]")
- private WebElement recordIntoTheKinderGardenLink;
- @FindBy(xpath = "//div[contains(@class, 'main-navigation__item')]/a[text()='Услуги']")
- private WebElement servicesLink;
- @FindBy(xpath = "//div[@class='search-ico']")
- private WebElement searchIcon;
- @FindBy(xpath = "//input[@placeholder='что вы ищете?']")
- private WebElement searchForm;
- @FindBy(xpath = "//div[text()='Регистрация гражданина по месту жительства']")
- private WebElement registrationAtResidenceResultLabel;
- @FindBy(xpath = "//div[text()='Регистрация гражданина по месту пребывания']")
- private WebElement RegistrationPlaceStay;
- @FindBy(xpath = "//div[text()='Справка об отсутствии судимости']")
- private WebElement criminalCertificateResultLabel;
- @FindBy(xpath = "//div[@class='icon services' and text()='Регистрация брака']")
- private WebElement marriageRegistrationResultLabel;
- @FindBy(xpath = "//div[text()='Выдача или замена паспорта гражданина РФ']")
- private WebElement obtainingPassportRFLabel;
- @FindBy(xpath = "//div[text()='Заграничный паспорт']")
- private WebElement internationalPassportLabel;
- @FindBy(xpath = "//div[text()='Справка об отсутствии наказания за употребление наркотиков']")
- private WebElement drugsCertificationPunishmentLabel;
- @FindBy(xpath = "//*[contains(.,'Укажите ваше местоположение')]")
- private WebElement userLocationPopup;
- @FindBy(xpath = "//span[@class='search-label']")
- private WebElement searchButton;
- public HomePage() {
- waitForPageVisible();
- }
- private WebElement divLabel(String text) {
- return xpathElement("//div[text()='%s']", text);
- }
- @Step("Переход к услуге записи в детский сад")
- public PersonalAreaPage navigateToChildrenIntoTheKinderGardenForm() {
- clickElement(pushChildrenIntoTheKinderGardenLink);
- clickElement(recordIntoTheKinderGardenLink);
- return new PersonalAreaPage();
- }
- @Step("Вернуть состояние лого 'Госуслуги' на главной странице портала")
- public boolean isMainLogoPresent() {
- return isElementExist(mainLogo);
- }
- @Step("Вернуться на портал госулуг")
- public PortalMainPage navigateToPortal() {
- clickElement(navigateToPortalButton);
- return new PortalMainPage("/");
- }
- @Step("Кликнуть на 'Услуги'")
- public ServicesCategoryPage clickToServices() {
- clickElement(servicesLink);
- return new ServicesCategoryPage();
- }
- @Step("Нажать на 'Личный кабинет' и перейти на PersonalAreaLoginPage")
- public PersonalAreaLoginPage navigateToPersonalAreaLoginPage() {
- closeUserLocationPopup();
- clickElement(personalAreaButton);
- return new PersonalAreaLoginPage();
- }
- @Step("Кликнуть на кнопку 'Все уведомления'")
- public AllEventsPage clickOnAllNotificationButton() {
- clickElement(allNotificationButton);
- return new AllEventsPage();
- }
- @Step("Перейти на Страницу входа в ЛК(PersonalAreaLoginPage)")
- public PersonalAreaLoginPage openPersonalAreaLoginPage() {
- return new PersonalAreaLoginPage();
- }
- @Step("Перейти на основную страницу портала и закрыть попап")
- public PersonalAreaPage navigateToPersonalAreaPageAndClosePopup() {
- closeUserLocationPopup();
- return new PersonalAreaPage();
- }
- @Step("Перейти на основную страницу портала ")
- public PersonalAreaPage navigateToPersonalAreaPage() {
- return new PersonalAreaPage();
- }
- private void closeUserLocationPopup() {
- if (isElementExist(userLocationPopup)) {
- userLocationPopup.sendKeys(Keys.ESCAPE);
- }
- }
- @Step("Перейти на Страницу лендинга(ElectionLandingPage)")
- public EdgLandingPage openEdgLandingPage() {
- return new EdgLandingPage();
- }
- @Step("Перейти на Страницу лендинга 'Пособие 2020'(ChildPaymentsPage)")
- public ChildPaymentsPage openChildPaymentsPage() {
- return new ChildPaymentsPage();
- }
- @Step("Перейти на Страницу лендингов(LandingsPage)")
- public LandingsPage openLandingsPage() {
- if (isElementExist(userLocationPopup)) {
- userLocationPopup.sendKeys(Keys.ESCAPE);
- }
- return new LandingsPage();
- }
- @Step("Перейти на страницу 'Запись ребёнка в детский сад' (BookKindergartenStartPage)")
- public BookKindergartenStartPage navigateToBookKindergartenStartPage() {
- return new BookKindergartenStartPage();
- }
- @Step("Клик на иконку поиска")
- public HomePage clickToSearchIcon() {
- clickElement(searchIcon);
- return this;
- }
- @Step("Заполнить поисковую строку {0}")
- public HomePage setSearchQuery(String query) {
- searchForm.clear();
- searchForm.sendKeys(query);
- return this;
- }
- @Step("Кликаем в поисковой выдачи на: 'Регистрация гражданина по месту жительства'")
- public RegistrationStartPage clickSearchResultRegistrationResidence() {
- clickElement(registrationAtResidenceResultLabel);
- return new RegistrationStartPage();
- }
- @Step("Кликаем в поисковой выдачи на: 'Регистрация по месту пребывания'")
- public AboutRegistrationСitizenPlaceStayPage clickSearchResultRegistrationPlaceStay() {
- clickElement(RegistrationPlaceStay);
- return new AboutRegistrationСitizenPlaceStayPage();
- }
- @Step("Кликаем в поисковой выдачи на: 'Справка об отсутствии судимости'")
- public CriminalCertificateStartPage clickSearchResultCriminalCertificate() {
- clickElement(criminalCertificateResultLabel);
- return new CriminalCertificateStartPage();
- }
- @Step("Кликаем в поисковой выдачи на: 'Регистрация брака'")
- public ServicesMarriageRegistrationPage clickSearchResultMarrigeRegistration() {
- clickElement(marriageRegistrationResultLabel);
- return new ServicesMarriageRegistrationPage();
- }
- @Step("Кликаем в поисковой выдачи на: 'Выдача или замена паспорта гражданина РФ'")
- public ServicesPassportRFPage clickSerchResultObtainingPassportRF() {
- clickElement(obtainingPassportRFLabel);
- return new ServicesPassportRFPage();
- }
- @Step("Кликам в поисковой выдачи на: 'Заграничный паспорт'")
- public ForeignPassportStartPage clickSerchResultatInternationalPassport() {
- clickElement(internationalPassportLabel);
- return new ForeignPassportStartPage();
- }
- @Step("Кликам в поисковой выдачи на: 'Справка об отсутствии наказания за употребление наркотиков'")
- public ServicesDrugsCertificationPage clickSerchResultatDrugsCertificationPunishment() {
- clickElement(drugsCertificationPunishmentLabel);
- return new ServicesDrugsCertificationPage();
- }
- }
Add Comment
Please, Sign In to add comment