コード例 #1
0
ファイル: frontendtests.py プロジェクト: dklan/frepple
    def test_table_multiple_rows_modification(self):

        table_page = TablePage(self.driver, SeleniumTest)
        table_page.login(self)

        # Open purchase order screen
        table_page.go_to_target_page_by_menu("Inventory", "distributionorder")

        distribution_order_table = table_page.get_table()

        rows = table_page.get_table_multiple_rows(rowNumber=2)

        table_page.multiline_checkboxes_check(targetrows=rows)

        references = []
        newStatus = "completed"
        q_objects = Q()

        table_page.select_action(newStatus)

        for row in rows:
            references.append(row.get_attribute("id"))

        table_page.click_save_button()

        time.sleep(2)
        for reference in references:

            q_objects |= Q(reference=reference)

        self.assertEqual(
            DistributionOrder.objects.all().filter(q_objects,
                                                   status=newStatus).count(),
            2,
        )
コード例 #2
0
ファイル: frontendtests.py プロジェクト: dklan/frepple
    def test_table_single_row_modification(self):

        newQuantity = 800
        newSupplier = "screw supplier"

        table_page = TablePage(self.driver, SeleniumTest)
        table_page.login(self)

        # Open purchase order screen
        table_page.go_to_target_page_by_menu("Purchasing", "purchaseorder")

        purchase_order_table = table_page.get_table()

        firstrow = table_page.get_table_row(rowNumber=1)
        reference = firstrow.get_attribute("id")

        supplier_content = table_page.get_content_of_row_column(
            firstrow, "supplier")
        supplier_inputfield = table_page.click_target_cell(
            supplier_content, "supplier")
        #only put existing supplier otherwise saving modification fails
        table_page.enter_text_in_inputfield(supplier_inputfield, newSupplier)

        quantity_content = table_page.get_content_of_row_column(
            firstrow, "quantity")
        quantity_inputfield = table_page.click_target_cell(
            quantity_content, "quantity")
        table_page.enter_text_in_inputfield(quantity_inputfield, newQuantity)
        self.assertEqual(quantity_content.text, "800",
                         "the input field of quantity hasn't been modified")

        enddate_content = table_page.get_content_of_row_column(
            firstrow, "enddate")
        enddate_inputdatefield = table_page.click_target_cell(
            enddate_content, "enddate")

        oldEndDate = datetime.strptime(
            enddate_inputdatefield.get_attribute("value"), "%Y-%m-%d 00:00:00")
        newEndDate = oldEndDate + mainDate.timedelta(days=9)
        newdatetext = table_page.enter_text_in_inputdatefield(
            enddate_inputdatefield, newEndDate)

        enddate_content = table_page.get_content_of_row_column(
            firstrow, "enddate")
        enddate_inputdatefield = table_page.click_target_cell(
            enddate_content, "enddate")
        self.assertEqual(
            enddate_inputdatefield.get_attribute("value"),
            newEndDate.strftime("%Y-%m-%d 00:00:00"),
            "the input field of Receipt Date hasn't been modified")

        #checking if data has been saved into database after saving data
        table_page.click_save_button()
        time.sleep(1)

        self.assertEqual(
            PurchaseOrder.objects.all().filter(reference=reference,
                                               enddate=newdatetext,
                                               supplier_id=newSupplier,
                                               quantity=newQuantity).count(),
            1,
        )