def test_calculate_parking_negative_flow(browser, form_data: FormData,
                                         expected_cost, expected_duration):
    calc_page = CalculatorPage(browser)
    calc_page.open()
    calc_page.fill_calculator(form_data)
    calc_page.calculate_button().click()

    assert expected_cost in calc_page.final_cost()
    assert expected_duration in calc_page.final_cost()
Exemple #2
0
def before_all(context):
    # Defining the test setup
    context.browser = Browser()
    context.calculator_page = CalculatorPage()
    context.calculator_page_locators = CalculatorPageLocator()
def test_calculate_parking_positive_flow(browser, form_data: FormData,
                                         expected_cost_method,
                                         expected_duration):
    calc_page = CalculatorPage(browser)
    calc_page.open()
    calc_page.fill_calculator(form_data)
    calc_page.calculate_button().click()

    if form_data.delay > 0:
        assert "0" in calc_page.final_cost()
        time.sleep(form_data.delay / 1000)

    assert expected_cost_method(form_data) in calc_page.final_cost()

    assert expected_duration in calc_page.final_cost()
def test_smoke_addition_operator(page, browser):
    calculator_page = CalculatorPage(page)
    calculator_page.navigate()
    calculator_page.fill_first_number("20")
    calculator_page.select_operator("ADDITION")
    calculator_page.fill_second_number("30")
    calculator_page.click_go()
    assert (calculator_page.result() == "50")
    browser.close
def test_smoke_modulo_operator(page, browser):
    calculator_page = CalculatorPage(page)
    calculator_page.navigate()
    calculator_page.fill_first_number("100")
    calculator_page.select_operator("MODULO")
    calculator_page.fill_second_number("30")
    calculator_page.click_go()
    assert (calculator_page.result() == "10")
    browser.close
def test_smoke_multiplication_operator(page, browser):
    calculator_page = CalculatorPage(page)
    calculator_page.navigate()
    calculator_page.fill_first_number("20")
    calculator_page.select_operator("MULTIPLICATION")
    calculator_page.fill_second_number("10")
    calculator_page.click_go()
    assert (calculator_page.result() == "200")
    browser.close
def test_smoke_division_operator(page, browser):
    calculator_page = CalculatorPage(page)
    calculator_page.navigate()
    calculator_page.fill_first_number("20")
    calculator_page.select_operator("DIVISION")
    calculator_page.fill_second_number("10")
    calculator_page.click_go()
    assert (calculator_page.result() == "2")
    browser.close