예제 #1
0
    def test_create_material_multi_over(self):
        """ Tests that multiple materials can be created in bulk edit, but no more than 13
        """
        expected_materials_01 = [
            ['cotton'],
            ['cotton'],
            ['wool', 'AAA', 'BBB', 'CCC'],
        ]

        expected_materials_02 = [
            [
                'cotton', '00', '01', '02', '03', '04', '05', '06', '07', '08',
                '09', '10', '11'
            ],
            [
                'cotton', '00', '01', '02', '03', '04', '05', '06', '07', '08',
                '09', '10', '11'
            ],
            [
                'wool', 'AAA', 'BBB', 'CCC', '00', '01', '02', '03', '04',
                '05', '06', '07', '08'
            ],
        ]

        select_listings_to_edit(self.driver)
        d = self.driver
        bp = BulkPage(d)

        # deselect 2, 3
        bp.click_on_listings(
            ['Second something 1235 (2)', 'Third something LG-512a (3)'])

        # append AAA BBB CCC materials to the 1st listing
        send_keys(bp.operation_input(), 'AAA,BBB   ,CCC')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials_01

        # append 00, 01, 02... to all listings
        bp.click_on_listings(
            ['Second something 1235 (2)', 'Third something LG-512a (3)'])
        send_keys(
            bp.operation_input(),
            '00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials_02
예제 #2
0
    def test_delete_single_material(self):
        """ Tests that single material can be deleted
        """
        select_listings_to_edit(self.driver)
        d = self.driver
        bp = BulkPage(d)

        row = bp.listing_row('First something 1234 (1)')
        material_names = bp.material_names(row)
        assert material_names == ['wool']

        materials = bp.material_elements(row)
        close_icon = materials[0].find_element_by_css_selector('span.close')
        click(close_icon)
        sleep(1)

        material_names = bp.material_names(
            bp.listing_row('First something 1234 (1)'))
        assert material_names == []

        titles = bp.listing_rows_texts_sorted()
        assert titles[0] == "First something 1234 (1)\n13 remaining"
예제 #3
0
    def test_delete_material(self):
        """ Tests that materials can be deleted in bulk
        """
        expected_materials = [
            [],
            ['cotton'],
            ['cotton'],
        ]

        select_listings_to_edit(self.driver, 'Delete')
        d = self.driver
        bp = BulkPage(d)

        send_keys(bp.operation_input(), 'wool')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials
예제 #4
0
    def test_create_material_multi_basic(self):
        """ Tests that multiple materials can be created in bulk edit
        """
        expected_materials = [
            ['cotton', 'AAA', 'BBB', 'CCC'],
            ['cotton', 'AAA', 'BBB', 'CCC'],
            ['wool', 'AAA', 'BBB', 'CCC'],
        ]

        select_listings_to_edit(self.driver)
        d = self.driver
        bp = BulkPage(d)

        send_keys(bp.operation_input(), 'AAA,BBB   ,CCC')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials
예제 #5
0
    def test_create_material(self):
        """ Tests that a material can be created in bulk edit
        """
        expected_materials = [
            ['cotton', 'AAA'],
            ['cotton', 'AAA'],
            ['wool', 'AAA'],
        ]

        select_listings_to_edit(self.driver)
        d = self.driver
        bp = BulkPage(d)

        send_keys(bp.operation_input(), 'AAA')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials

        apply_class = bp.operation_apply().get_attribute('class')
        assert 'inactive' in apply_class.split(' ')
예제 #6
0
    def test_create_material_special_chars(self):
        """ Tests that a material can be created in bulk edit with czech chars, but not special chars
        """
        expected_materials = [
            ['cotton', 'žvýkačky'],
            ['cotton', 'žvýkačky'],
            ['wool', 'žvýkačky'],
        ]

        select_listings_to_edit(self.driver)
        d = self.driver
        bp = BulkPage(d)

        send_keys(bp.operation_input(), 'žvýkačky')
        click(bp.operation_apply())

        material_names = bp.material_names()
        assert material_names == expected_materials

        send_keys(bp.operation_input(), 'me@site')
        err = bp.error_baloon()
        assert err == "Materials can only include spaces, letters, and numbers."