Beispiel #1
0
    def add_item_to_basket(self, selenium, sku, is_new_payment_page):
        """
        Arguments:
            is_new_payment_page (bool): True to test the new payment page, False to test the older basket page.
        """
        if is_new_payment_page:
            microfrontend_waffle_flag_enabled = 1
            page_css_selector = ".page__payment"
        else:
            microfrontend_waffle_flag_enabled = 0
            page_css_selector = ".basket-client-side"

        # Note: although not intuitive, the waffle flag `force_microfrontend_bucket` must be enabled to allow the
        #   waffle flag `enable_microfrontend_for_basket_page` to function.
        force_microfrontend_bucket_flag_enabled = 1

        # Add the item to the basket and start the checkout process
        selenium.get(
            EcommerceHelpers.build_url(
                '/basket/add/?sku={}'
                '&dwft_enable_microfrontend_for_basket_page={}'
                '&dwft_force_microfrontend_bucket={}'.format(
                    sku,
                    microfrontend_waffle_flag_enabled,
                    force_microfrontend_bucket_flag_enabled,
                )))

        # Wait till the selector is visible
        WebDriverWait(selenium, 20).until(
            EC.visibility_of_element_located(
                (By.CSS_SELECTOR, page_css_selector)))
    def add_item_to_basket(self, selenium, sku):
        # Add the item to the basket and start the checkout process
        selenium.get(EcommerceHelpers.build_url('/basket/add/?sku=' + sku))

        # Wait till the selector is visible
        WebDriverWait(selenium, 20).until(
            EC.visibility_of_element_located(
                (By.CSS_SELECTOR, ".basket-client-side")))
Beispiel #3
0
def test_login_redirection(selenium):
    """ If the login process is initiated at the E-Commerce Service, a successful login should return the user to
    the service. """
    # Visit LMS once to perform basic authentication
    selenium.get(LmsHelpers.build_url(''))

    selenium.get(EcommerceHelpers.build_url('dashboard'))
    LmsHelpers.submit_login_form(selenium)
    EcommerceHelpers.assert_on_dashboard(selenium)
Beispiel #4
0
    def add_item_to_basket(self, selenium, sku):
        page_css_selector = ".page__payment"

        # Add the item to the basket and start the checkout process
        selenium.get(
            EcommerceHelpers.build_url('/basket/add/?sku={}'.format(sku, )))

        # Wait till the selector is visible
        WebDriverWait(selenium, 20).until(
            EC.visibility_of_element_located(
                (By.CSS_SELECTOR, page_css_selector)))
Beispiel #5
0
def test_login_redirection(selenium):
    """ If the login process is initiated at the E-Commerce Service, a successful login should return the user to
    the service. """
    # Visit LMS login with next query param once to perform basic authentication
    selenium.get(
        LmsHelpers.build_url(
            'login?next={}&skip_authn_mfe=true'.format(EcommerceHelpers.build_url('dashboard'))
        )
    )

    LmsHelpers.submit_login_form(selenium)
    EcommerceHelpers.assert_on_dashboard(selenium)
Beispiel #6
0
 def add_item_to_basket(self, selenium, sku):
     # Add the item to the basket and start the checkout process
     selenium.get(EcommerceHelpers.build_url('/basket/add/?sku=' + sku))
     assert selenium.find_element_by_css_selector('.basket-client-side').is_displayed()
Beispiel #7
0
 def setup_method(self):
     # The specific URL doesn't matter. We just want something that doesn't 404 on us
     self.url = EcommerceHelpers.build_url('dashboard/')  # pylint: disable=attribute-defined-outside-init