def testCreateOrder(self):
        status = self.configuration['order_tests']['status']
        customer_name = self.configuration['order_tests']['customer_name']
        product_id = self.configuration['order_tests']['product_id']
        product_name = self.configuration['order_tests']['product_name']
        quantity = self.configuration['order_tests']['quantity']

        # Count the number of orders before order creation
        target_url = self.configuration['base_url'] + "/admin/order_manager/order/"
        index_page = OrderIndex(self.browser, target_url)
        num_orders_before_creation = index_page.count_orders()

        # Fill the form and submit it
        target_url = self.configuration['base_url'] + "/admin/order_manager/order/add/"
        create_page = OrderCreate(self.browser, target_url)
        create_page.fill_form(product_id, product_id, quantity, status)
        create_page.submit_form()

        # Verify that a new order was created
        orders_after_creation = index_page.get_order_elements()
        self.validate((len(orders_after_creation) == num_orders_before_creation + 1),
                      error_message="Could not find created order on index page.")
        self.validate((orders_after_creation[0].text == "%d %s for %s" % (quantity, product_name, customer_name)),
                      error_message="Could not find created order on index page.")

        self.order_id = index_page.id_for_order(quantity, product_name, customer_name)
    def testCreateOrder(self):
        status = self.configuration['order_tests']['status']
        customer_name = self.configuration['order_tests']['customer_name']
        product_id = self.configuration['order_tests']['product_id']
        product_name = self.configuration['order_tests']['product_name']
        quantity = self.configuration['order_tests']['quantity']

        # Count the number of orders before order creation
        target_url = self.configuration[
            'base_url'] + "/admin/order_manager/order/"
        index_page = OrderIndex(self.browser, target_url)
        num_orders_before_creation = index_page.count_orders()

        # Fill the form and submit it
        target_url = self.configuration[
            'base_url'] + "/admin/order_manager/order/add/"
        create_page = OrderCreate(self.browser, target_url)
        create_page.fill_form(product_id, product_id, quantity, status)
        create_page.submit_form()

        # Verify that a new order was created
        orders_after_creation = index_page.get_order_elements()
        self.validate(
            (len(orders_after_creation) == num_orders_before_creation + 1),
            error_message="Could not find created order on index page.")
        self.validate(
            (orders_after_creation[0].text == "%d %s for %s" %
             (quantity, product_name, customer_name)),
            error_message="Could not find created order on index page.")

        self.order_id = index_page.id_for_order(quantity, product_name,
                                                customer_name)