def add_application(self, app): """ Add application Args: app: name of app """ view = navigate_to(self, "ApplicationsPage") view.add_application_button.click() env = conf.get_config("env") fs = FTPClientWrapper(env.ftpserver.entities.mta) # Download application file to analyze file_path = fs.download(app) view.upload_file.fill(file_path) view.done_button.click() # Save Configuration view = navigate_to(self, "AllProject") analysis_configuration = AnalysisConfiguration(self.application, self.project_name) # Bug WINDUP-2995 analysis_configuration.save_and_run_configuration() # wait for analysis to finish view = self.create_view(AnalysisResultsView) view.wait_displayed("60s") assert view.is_displayed wait_for(lambda: view.analysis_results.in_progress(), delay=0.2, timeout=450) wait_for(lambda: view.analysis_results.is_analysis_complete(), delay=0.2, timeout=450) assert view.analysis_results.is_analysis_complete()
def test_default_transformation_path(mta_app, request): """Test default transformation path for Projects Polarion: assignee: ghubale initialEstimate: 1/12h caseimportance: medium testSteps: 1. Create project 2. Go to transformation path page expectedResults: 1. Default value should be eap7 """ project_name = fauxfactory.gen_alphanumeric(12, start="project_") project_collection = mta_app.collections.projects view = navigate_to(project_collection, "Add") view.create_project.fill({"name": project_name, "description": "desc"}) view.add_applications.wait_displayed("20s") env = conf.get_config("env") fs = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs.download("arit-ear-0.8.1-SNAPSHOT.ear") view.add_applications.upload_file.fill(file_path) view.add_applications.next_button.wait_displayed() wait_for(lambda: view.add_applications.next_button.is_enabled, delay=0.2, timeout=60) view.add_applications.next_button.click() view.configure_analysis.set_transformation_target.wait_displayed() default_value = view.configure_analysis.set_transformation_target.transformation_path.read_card( card_name="Application server migration to" ) @request.addfinalizer def _finalize(): view.configure_analysis.set_transformation_target.cancel_button.click() assert default_value == "eap7"
def test_delete_application(application): """ Test01 -08 Delete uploaded application file and check if next button gets disabled """ project_name = fauxfactory.gen_alphanumeric(12, start="project_") project_collection = application.collections.projects view = navigate_to(project_collection, "Add") view.create_project.fill({"name": project_name, "description": "desc"}) env = conf.get_config("env") fs = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs.download("acmeair-webapp-1.0-SNAPSHOT.war") view.add_applications.upload_file.fill(file_path) view.add_applications.next_button.wait_displayed() view.add_applications.delete_application.click() view.add_applications.confirm_delete.wait_displayed() view.add_applications.confirm_delete.click() view.add_applications.next_button.wait_displayed() assert not view.add_applications.next_button.is_enabled view.add_applications.back_button.wait_displayed() view.add_applications.back_button.click() view.add_applications.cancel_button.wait_displayed() view.add_applications.cancel_button.click()
def upload_custom_label_file(self): """Method for uploading custom label file """ view = navigate_to(self, "Add") view.wait_displayed() # upload custom labels env = conf.get_config("env") fs1 = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs1.download(self.file_name) view.upload_label.fill(file_path) view.close_button.click()
def upload_custom_label_file(self): """Method for uploading custom label file""" view = navigate_to(self, "Add") view.wait_displayed("20s") # upload custom labels env = conf.get_config("env") fs1 = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs1.download(self.file_name) view.upload_label.fill(file_path) wait_for(lambda: view.browser.is_displayed(view.file_uploaded), delay=10, timeout=30) view.close_button.click()
def fill(self, values): app_list = values.get("app_list") env = conf.get_config("env") fs = FTPClientWrapper(env.ftpserver.entities.mta) for app in app_list: # Download application file to analyze # This part has to be here as file is downloaded temporarily file_path = fs.download(app) self.upload_file.fill(file_path) wait_for(lambda: self.next_button.is_enabled, delay=0.2, timeout=60) was_change = True self.after_fill(was_change) return was_change
def test_add_folder_of_rules(mta_app, request): """Test adding a folder containing both valid and invalid rules Polarion: assignee: ghubale initialEstimate: 1/12h caseimportance: medium testSteps: 1. Login to MTA web console 2. Navigate to Global > Rules configuration > Custom rules 3. Click on Add rule button and got to server path tab and browse rules folder 4. Click on Close button expectedResults: 1. Error should be handled and it should only upload valid rules files from folder """ rule_files = [ "customWebLogic.windup.label.xml", "empty_rule_file.xml", "custom.Test1rules.rhamt.xml", ] server_path = "/tmp" @request.addfinalizer def _finalize(): rules = CustomRulesConfiguration(mta_app, server_path) rules.delete_custom_rule() rules_configurations = CustomRulesConfiguration(mta_app, server_path) view = navigate_to(rules_configurations, "Add") view.wait_displayed("20s") for file_name in rule_files: env = conf.get_config("env") fs1 = FTPClientWrapper(env.ftpserver.entities.mta) fs1.download(file_name) view.server_path.click() view.server_path.rules_path.fill(server_path) view.server_path.scan_recursive.click() view.server_path.save_button.click() view = rules_configurations.create_view(CustomRulesView) view.wait_displayed("50s") all_rules = view.table.read() for rule in all_rules: if rule["Short path"] == "/tmp": # There will be older files downloaded in /tmp directory. Hence asserting number of # rules equal to and greater than 1 only assert int(rule["Number of rules"]) >= 1
def test_delete_application(mta_app): """Delete uploaded application file and check if next button gets disabled Polarion: assignee: ghubale initialEstimate: 1/12h caseimportance: medium testSteps: 1. Go to project all page and click on `Create project` button 2. Add name and description and click on `Next` button 3. Browse and add application file 4. Click on delete button expectedResults: 1. Next button should be disabled before uploading application file 1. Next button should be enabled after uploading application file 2. Next button should be disabled after deleting application file """ application = mta_app project_collection = application.collections.projects view = navigate_to(project_collection, "Add") view.wait_displayed("20s") view.create_project.fill({ "name": fauxfactory.gen_alphanumeric(12, start="project_"), "description": "desc" }) view.add_applications.wait_displayed() env = conf.get_config("env") fs = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs.download("acmeair-webapp-1.0-SNAPSHOT.war") view.add_applications.upload_file.fill(file_path) wait_for(lambda: view.add_applications.next_button.is_enabled, delay=0.2, timeout=60) assert view.add_applications.next_button.is_enabled view.add_applications.delete_application.click() view.add_applications.next_button.wait_displayed() assert not view.add_applications.next_button.is_enabled view.add_applications.back_button.wait_displayed() view.add_applications.back_button.click() view.add_applications.cancel_button.wait_displayed() view.add_applications.cancel_button.click() view.create_project.yes_button.click()
def upload_custom_rule_file(self, server_path=False, scan_recursive=False): """Method for uploading custom rule file server_path: if True then upload rule file by server path scan_recursive: If True and the given path is a directory, the subdirectories will also be scanned for rule sets """ view = navigate_to(self, "Add") if server_path: # upload custom rules by providing server path to folder of rule files env = conf.get_config("env") fs1 = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs1.download(self.file_name) rules_path = file_path.split(self.file_name)[0] view.server_path.click() view.server_path.rules_path.fill(rules_path) if scan_recursive: view.server_path.scan_recursive.click() view.server_path.save_button.click() else: # upload custom rules by browsing rule files env = conf.get_config("env") fs1 = FTPClientWrapper(env.ftpserver.entities.mta) file_path = fs1.download(self.file_name) view.upload_rule.fill(file_path) wait_for(lambda: view.browser.is_displayed(view.file_uploaded), delay=10, timeout=60) view.close_button.click()