def test_admin_user_login(browser):
    """
    GIVEN user is asked to login via dashbord
    WHEN user login as admin user
    THEN perx main page with all functions in side bar is displayed
    """
    login_page = LoginPage(browser)
    login_page.start()

    login_page.login(email="*****@*****.**", password="******")
    admin_page = AdminPage(browser)
    admin_page.start()

    # Check that admin has sufficient right to access all functionality
    assert admin_page.get_side_bar_menu_item(
        AdminPage.REPORTS_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.REWARDS_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.CAMPAIGNS_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.LOYALTIES_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.TRANSACTION_RULES_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.MERCHANTS_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.CUSTOMER_MANAGEMENT_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.SETTINGS_MENU_ITEM).size != 0
    assert admin_page.get_side_bar_menu_item(
        AdminPage.BUSINESS_INTELLIGENCE_MENU_ITEM).size != 0
Exemplo n.º 2
0
def login_to_jira(request, browser):
    from src.pages.login_page import LoginPage
    from src.pages.main_page import MainPage
    login_page = LoginPage(browser)
    main_page = MainPage(browser)

    with allure.step("Open login page"):
        login_page.open()
    with allure.step("Login to JIRA"):
        login_page.login(login, password)

    def take_screenshot():
        with allure.step("Taking screenshot"):
            browser.execute_script("document.body.bgColor = 'white';")
            allure.attach(browser.get_screenshot_as_png(),
                          name=request.function.__name__,
                          attachment_type=allure.attachment_type.PNG)

    request.addfinalizer(take_screenshot)

    with allure.step("Wait until main page is loaded"):
        main_page.wait_until_loaded()

    yield main_page

    with allure.step("Logout from JIRA"):
        main_page.logout()
def test_reward_user_login(browser):
    """
    GIVEN user is asked to login via dashbord
    WHEN user login as reward user
    THEN perx main page with ONLY reward priviledge is displayed
    """

    login_page = LoginPage(browser)
    login_page.start()

    login_page.login(email="*****@*****.**",
                     password="******")

    reward_admin_page = RewardAdminPage(browser)
    reward_admin_page.start()

    # Check that reward_admin has can only have priviledge to create reward
    assert reward_admin_page.get_side_bar_menu_item(
        RewardAdminPage.REWARDS_MENU_ITEM).size != 0

    # Check that rest of the menu_item element that can be found in admin page cannot be found in
    # reward admin page
    with pytest.raises(NoSuchElementException):
        reward_admin_page.get_side_bar_menu_item(AdminPage.REPORTS_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(AdminPage.CAMPAIGNS_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(AdminPage.LOYALTIES_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(
            AdminPage.TRANSACTION_RULES_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(AdminPage.MERCHANTS_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(
            AdminPage.CUSTOMER_MANAGEMENT_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(AdminPage.SETTINGS_MENU_ITEM)
        reward_admin_page.get_side_bar_menu_item(
            AdminPage.BUSINESS_INTELLIGENCE_MENU_ITEM)
Exemplo n.º 4
0
 def test_login_correct_creds(self, browser):
     login_page = LoginPage(browser)
     main_page = MainPage(browser)
     with allure.step("Open login page"):
         login_page.open()
     with allure.step("Check that login page opened"):
         assert login_page.at_page()
     with allure.step("Login to JIRA with correct credentials"):
         login_page.login(login, password)
         allure.attach(browser.get_screenshot_as_png(),
                       name="login_correct_creds1",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Check that main page opened"):
         assert main_page.at_page()
         allure.attach(browser.get_screenshot_as_png(),
                       name="test_login_correct_creds2",
                       attachment_type=allure.attachment_type.PNG)
     with allure.step("Logout from JIRA"):
         logout_page = main_page.logout()
     with allure.step("Cheсk that logout page appears"):
         assert logout_page.at_page()
     with allure.step("Open login page"):
         login_page.open()
     with allure.step("Check that login page opened"):
         assert login_page.at_page()
         allure.attach(browser.get_screenshot_as_png(),
                       name="test_logout",
                       attachment_type=allure.attachment_type.PNG)
Exemplo n.º 5
0
 def test_login_incorrect_password(self, browser):
     login_page = LoginPage(browser)
     with allure.step("Open login page"):
         login_page.open()
     with allure.step("Check that login page opened"):
         assert login_page.at_page()
     with allure.step("Call login method"):
         login_page.login(login, "wrong")
     with allure.step("Check that correct error is displayed"):
         assert login_page.username_error_text("Sorry, your username and password are incorrect")
         allure.attach(browser.get_screenshot_as_png(),
                       name="test_login_incorrect_password",
                       attachment_type=allure.attachment_type.PNG)
def test_create_reward(browser):
    """
    GIVEN user wants to login to reward page as reward admin
    WHEN user keys in correct email address and password 
    THEN user is logged in as reward admin
    AND reward admin can create reward
    """

    login_page = LoginPage(browser)
    login_page.login(email="*****@*****.**",
                     password="******")

    reward_admin_page = RewardAdminPage(browser)
    reward_admin_page.start()

    result = reward_admin_page.create_new_reward()
    assert reward_admin_page.get_xpath(
        RewardAdminPage.REWARD_FORM_STATUS).get_attribute(
            'textContent') == "ACTIVE"
Exemplo n.º 7
0
class AddGoods(Base):
    def __init__(self, driver1):
        self.driver = driver1

    def mulu_select(self):
        self.driver.find_element_by_xpath("//a[@descrip_value='休闲食品']").click()
        time.sleep(3)
        print("已点击休闲食品")
        self.driver.maximize_window()
        self.driver.find_element_by_xpath("//a[@descrip_value='二级02']").click()
        print("已点击二级")
        time.sleep(3)
        self.driver.find_element_by_id("next_one").click()
        time.sleep(3)


if __name__ == "__main__":
    driver2 = webdriver.Firefox()
    log = LoginPage(driver2)
    log.login("http://211.145.72.68:8080/forecom/login.shtml")
    time.sleep(3)
    driver2.get(
        "http://211.145.72.68:8080/foretrade/seller/addgoods_select.shtml?menu_no=51010101"
    )
    time.sleep(3)
    gs = AddGoodsSelect(driver2)
    gs.xian_huo()
    time.sleep(3)
    ad = AddGoods(driver2)
    ad.mulu_select()
Exemplo n.º 8
0
    def invoice_status2(self, text):
        invoicestatus2 = self.driver.find_element_by_id("invoice_status")
        Select(invoicestatus2).select_by_visible_text(text)
        invoicestatus2.click()

    def query_button(self):
        self.driver.find_element_by_id("query").click()

    def reset_button(self):
        self.driver.find_element_by_id("resetButton").click()


if __name__ == "__main__":
    driver = webdriver.Firefox()
    log1 = LoginPage(driver)
    log1.login(URL_68_FORWORD)
    time.sleep(3)
    driver.get("http://211.145.72.68:8080/foretrade/gxs/trade/invoice/invoice_buy.shtml")
    time.sleep(3)
    yemian = InvoiceBuy(driver)
    yemian.bill_status2("已完成")
    time.sleep(3)
    yemian.kaiPiaoFang("四")
    time.sleep(3)
    yemian.kaiPiaoMoney(1, 6)
    time.sleep(3)
    yemian.invoice_status2("运费")
    time.sleep(3)
    yemian.query_button()
    time.sleep(3)
    yemian.reset_button()