|
| 1 | +""" |
| 2 | +Module for testing CFA asset issuance. |
| 3 | +""" |
| 4 | +from __future__ import annotations |
| 5 | + |
| 6 | +import os |
| 7 | + |
| 8 | +from e2e_tests.test.pageobjects.main_page_objects import MainPageObjects |
| 9 | +from e2e_tests.test.utilities.asset_copy import copy_cfa_image_to_home_directory |
| 10 | +from e2e_tests.test.utilities.base_operation import BaseOperations |
| 11 | + |
| 12 | + |
| 13 | +class IssueCfa(MainPageObjects, BaseOperations): |
| 14 | + """ |
| 15 | + Class for testing CFA asset issuance. |
| 16 | + """ |
| 17 | + |
| 18 | + def __init__(self, application): |
| 19 | + """ |
| 20 | + Initialize the IssueCfa class. |
| 21 | + """ |
| 22 | + super().__init__(application) |
| 23 | + |
| 24 | + def issue_cfa_with_sufficient_sats_and_utxo(self, application, asset_name, asset_description, asset_amount, is_native_auth_enabled: bool = False): |
| 25 | + """ |
| 26 | + Issue CFA asset with sufficient sats and utxo. |
| 27 | + """ |
| 28 | + self.do_focus_on_application(application) |
| 29 | + copy_cfa_image_to_home_directory(os.getcwd()) |
| 30 | + |
| 31 | + if self.do_is_displayed(self.sidebar_page_objects.collectibles_button()): |
| 32 | + self.sidebar_page_objects.click_collectibles_button() |
| 33 | + |
| 34 | + if self.do_is_displayed(self.collectible_page_objects.issue_cfa_button()): |
| 35 | + self.collectible_page_objects.click_issue_cfa_button() |
| 36 | + |
| 37 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_name()): |
| 38 | + self.issue_cfa_page_objects.enter_asset_name(asset_name) |
| 39 | + |
| 40 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_description()): |
| 41 | + self.issue_cfa_page_objects.enter_asset_description( |
| 42 | + asset_description, |
| 43 | + ) |
| 44 | + |
| 45 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_amount()): |
| 46 | + self.issue_cfa_page_objects.enter_asset_amount(asset_amount) |
| 47 | + |
| 48 | + if self.do_is_displayed(self.issue_cfa_page_objects.upload_file_button()): |
| 49 | + self.issue_cfa_page_objects.click_upload_file_button() |
| 50 | + |
| 51 | + if self.do_is_displayed(self.issue_cfa_page_objects.cfa_asset_media()): |
| 52 | + self.issue_cfa_page_objects.click_cfa_asset_media() |
| 53 | + |
| 54 | + if self.do_is_displayed(self.issue_cfa_page_objects.issue_cfa_button()): |
| 55 | + self.issue_cfa_page_objects.click_issue_cfa_button() |
| 56 | + |
| 57 | + if is_native_auth_enabled is True: |
| 58 | + self.enter_native_password() |
| 59 | + |
| 60 | + if self.do_is_displayed(self.success_page_objects.home_button()): |
| 61 | + self.success_page_objects.click_home_button() |
| 62 | + |
| 63 | + def issue_cfa_asset_without_sat(self, application, asset_name, asset_description, asset_amount): |
| 64 | + """ |
| 65 | + Issue CFA asset without sat. |
| 66 | + """ |
| 67 | + description = None |
| 68 | + self.do_focus_on_application(application) |
| 69 | + copy_cfa_image_to_home_directory(os.getcwd()) |
| 70 | + |
| 71 | + if self.do_is_displayed(self.sidebar_page_objects.collectibles_button()): |
| 72 | + self.sidebar_page_objects.click_collectibles_button() |
| 73 | + |
| 74 | + if self.do_is_displayed(self.collectible_page_objects.issue_cfa_button()): |
| 75 | + self.collectible_page_objects.click_issue_cfa_button() |
| 76 | + |
| 77 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_name()): |
| 78 | + self.issue_cfa_page_objects.enter_asset_name(asset_name) |
| 79 | + |
| 80 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_description()): |
| 81 | + self.issue_cfa_page_objects.enter_asset_description( |
| 82 | + asset_description, |
| 83 | + ) |
| 84 | + |
| 85 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_amount()): |
| 86 | + self.issue_cfa_page_objects.enter_asset_amount(asset_amount) |
| 87 | + |
| 88 | + if self.do_is_displayed(self.issue_cfa_page_objects.upload_file_button()): |
| 89 | + self.issue_cfa_page_objects.click_upload_file_button() |
| 90 | + |
| 91 | + if self.do_is_displayed(self.issue_cfa_page_objects.cfa_asset_media()): |
| 92 | + self.issue_cfa_page_objects.click_cfa_asset_media() |
| 93 | + |
| 94 | + if self.do_is_displayed(self.issue_cfa_page_objects.issue_cfa_button()): |
| 95 | + self.issue_cfa_page_objects.click_issue_cfa_button() |
| 96 | + |
| 97 | + if self.do_is_displayed(self.toaster_page_objects.toaster_frame()): |
| 98 | + description = self.toaster_page_objects.click_and_get_description() |
| 99 | + |
| 100 | + if self.do_is_displayed(self.issue_cfa_page_objects.close_button()): |
| 101 | + self.issue_cfa_page_objects.click_close_button() |
| 102 | + |
| 103 | + if self.do_is_displayed(self.sidebar_page_objects.fungibles_button()): |
| 104 | + self.sidebar_page_objects.click_fungibles_button() |
| 105 | + |
| 106 | + return description |
| 107 | + |
| 108 | + def issue_cfa_with_sufficient_sats_and_no_utxo(self, application, asset_name, asset_description, asset_amount): |
| 109 | + """ |
| 110 | + Issue CFA asset with sufficient sats and no utxo. |
| 111 | + """ |
| 112 | + self.do_focus_on_application(application) |
| 113 | + copy_cfa_image_to_home_directory(os.getcwd()) |
| 114 | + |
| 115 | + if self.do_is_displayed(self.sidebar_page_objects.view_unspents_button()): |
| 116 | + self.sidebar_page_objects.click_view_unspents_button() |
| 117 | + |
| 118 | + if self.do_is_displayed(self.sidebar_page_objects.collectibles_button()): |
| 119 | + self.sidebar_page_objects.click_collectibles_button() |
| 120 | + |
| 121 | + if self.do_is_displayed(self.collectible_page_objects.issue_cfa_button()): |
| 122 | + self.collectible_page_objects.click_issue_cfa_button() |
| 123 | + |
| 124 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_name()): |
| 125 | + self.issue_cfa_page_objects.enter_asset_name(asset_name) |
| 126 | + |
| 127 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_description()): |
| 128 | + self.issue_cfa_page_objects.enter_asset_description( |
| 129 | + asset_description, |
| 130 | + ) |
| 131 | + |
| 132 | + if self.do_is_displayed(self.issue_cfa_page_objects.asset_amount()): |
| 133 | + self.issue_cfa_page_objects.enter_asset_amount(asset_amount) |
| 134 | + |
| 135 | + if self.do_is_displayed(self.issue_cfa_page_objects.upload_file_button()): |
| 136 | + self.issue_cfa_page_objects.click_upload_file_button() |
| 137 | + |
| 138 | + if self.do_is_displayed(self.issue_cfa_page_objects.cfa_asset_media()): |
| 139 | + self.issue_cfa_page_objects.click_cfa_asset_media() |
| 140 | + |
| 141 | + if self.do_is_displayed(self.issue_cfa_page_objects.issue_cfa_button()): |
| 142 | + self.issue_cfa_page_objects.click_issue_cfa_button() |
| 143 | + |
| 144 | + if self.do_is_displayed(self.success_page_objects.home_button()): |
| 145 | + self.success_page_objects.click_home_button() |
0 commit comments