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()
예제 #2
0
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 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_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()
예제 #6
0
    def __init__(
        self, client=None, name=None, image=None, vnc_port=None, webdriver_port=None, network=None
    ):
        default_conf = conf.get_config("selenium")
        self.client = client or default_conf.client
        self.name = name or default_conf.name
        self.image = image or default_conf.image
        self.vnc_port = vnc_port or default_conf.vnc_port
        self.webdriver_port = webdriver_port or default_conf.webdriver_port
        self.network = network or default_conf.network

        assert shutil.which(self.client)
 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()
예제 #8
0
def viewer():
    viewer = conf.get_config("selenium").vncviewer
    sel = SeleniumContainer()

    if not viewer:
        click.echo("No VNC viewer found in config file")
        exit(1)

    if not sel.is_running:
        click.echo(f"{sel.name} not in running state")
        exit(1)

    assert shutil.which(viewer)
    subprocess.run([viewer, f"localhost:{sel.vnc_port}"])
예제 #9
0
 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
예제 #10
0
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
예제 #11
0
    def __init__(
        self,
        hostname=None,
        user=None,
        *,
        config=None,
    ):
        self.config = config or conf.get_config("env")
        # Set up hostnames/paths
        self.hostname = hostname or self.config.application.hostname
        self.user = user or self.config.application.user
        self.web_ui = ViaWebUI(owner=self)

        from mta.base.application.implementations import MTAImplementationContext

        # TODO: include other context in future
        self.context = MTAImplementationContext.from_instances([self.web_ui])
예제 #12
0
    def __init__(self, entity_path=None, entrypoint=None, host=None, login=None, password=None):
        env = conf.get_config("env")
        host = host or env.ftpserver.host
        login = login or env.ftpserver.credentials.username
        password = password or env.ftpserver.credentials.password

        self.entrypoint = entrypoint or env.ftpserver.entrypoint
        self.entity_path = entity_path

        super(FTPClientWrapper, self).__init__(
            host=host, login=login, password=password, time_diff=False
        )

        # Change working directory as per entity_path if provided
        entity_path = self.entity_path if entity_path else ""
        path = PurePosixPath(self.entrypoint, entity_path)
        self.cwd(path)
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()
예제 #14
0
def pytest_configure(config):
    """Hook to get app and conf"""
    config._mta_conf = conf
    app = Application(config=conf.get_config("env"))
    plugin = ApplicationHolderPlugin(app)
    config.pluginmanager.register(plugin)