Ejemplo n.º 1
0
 def get_last(self):
     id_img: str = ''
     if self.driver.name.lower() == 'firefox':
         id_img = id_from_web_element(self.images[0])
     else:
         id_img = id_from_web_element(self.images[-1])
     return ImageCard(self.driver, id_img)
Ejemplo n.º 2
0
    def request_main_photo(self, new_main_photo: ImageCard) -> ConfirmMakeMainModal:
        modal: ConfirmMakeMainModal = new_main_photo.make_main()

        main_photo_change = self.create_main_photo_change_waiter(new_main_photo.id)

        modal.on_confirm = lambda: waits.wait(self.driver).until(main_photo_change)
        return modal
Ejemplo n.º 3
0
    def bulk_upload(self, images: List[str]) -> List[ImageCard]:
        if self.driver.name.lower() == 'firefox':
            uploading = 0
            uploaded = []
            for path in images:
                uploaded.append(self.upload(os.path.abspath(path), uploading))
                uploading = uploading + 1
            return uploaded

        paths: str = '\n'.join([os.path.abspath(path) for path in images])
        self.upload_input.send_keys(paths)
        self.wait_uploading(len(images))
        return [ImageCard(self.driver, id_from_web_element(img)) for img in self.images]
Ejemplo n.º 4
0
 def drag_and_drop(self, lhs: ImageCard, rhs: ImageCard):
     lhs.take_position(rhs)
     waits.wait(self.driver).until_not(
         expected_conditions.presence_of_element_located((By.CSS_SELECTOR, self.DRAG_AND_DROP_TRACKER))
     )
Ejemplo n.º 5
0
 def image_cards(self) -> List[ImageCard]:
     return [ImageCard(self.driver, id_from_web_element(img)) for img in self.images]
Ejemplo n.º 6
0
 def main_photo(self) -> ImageCard:
     img_id: str = id_from_src(self.main_img_raw.get_attribute('src'))
     return ImageCard(self.driver, img_id)