Пример #1
0
        private void btnExecuteTest_Click(object sender, EventArgs e)
        {
            var projectFolder    = Global.GetProjectsPath() + "\\" + projectManager.Project.Id;
            var testImagesFolder = projectFolder + "\\Tests\\" + test.Id + "\\Images";
            var dziFolder        = projectFolder + "\\Tests\\" + test.Id + "\\dzi";

            DeleteAllInDirectory(testImagesFolder);
            DeleteAllInDirectory(dziFolder);
            logger.LogInformation("Execute Test started. Project folder:" + projectFolder
                                  + "\nTestImagesFolder:" + testImagesFolder
                                  + "\nDziFolder:" + dziFolder);


            var    executor = DependencyInjector.Resolve <TestExecutor>(new { test = test });
            string res      = executor.Start(null, null);

            richTextBox1.Text = res;


            if (Directory.Exists(testImagesFolder) && Directory.Exists(dziFolder))
            {
                var dz = DependencyInjector.Retrieve <DeepZoomManager>();
                dz.GetImages(testImagesFolder, dziFolder);
            }
            else
            {
                MessageBox.Show("Images or dzi directory in Test folder does not exist");
            }

            projectManager.SaveProject();
            RefreshCommands();
        }
Пример #2
0
        private void btnNewTest_Click(object sender, EventArgs e)
        {
            var et = DependencyInjector.Resolve <EditTest>(new { parentForm = this });

            splitContainer1.Panel2.Controls.Clear();
            splitContainer1.Panel2.Controls.Add(et);
            et.Dock = DockStyle.Fill;
        }
Пример #3
0
        private void btnCreateCommand_Click(object sender, EventArgs e)
        {
            if (test.OrderIndex < 1)
            {
                Save();
            }
            var editCmd = DependencyInjector.Resolve <EditCommand>(new { test = test, parentForm = this, projectManager });

            if (editCmd != null)
            {
                editCmd.ShowDialog();
            }
        }
Пример #4
0
 private void dgrTests_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgrTests.SelectedRows.Count > 0)
     {
         var test = dgrTests.SelectedRows[0].DataBoundItem as Test;
         if (test != null)
         {
             var et = DependencyInjector.Resolve <EditTest>(new { test = test });
             splitContainer1.Panel2.Controls.Clear();
             splitContainer1.Panel2.Controls.Add(et);
             et.Dock = DockStyle.Fill;
         }
     }
 }
Пример #5
0
 private void dgrCommands_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgrCommands.SelectedRows.Count > 0)
     {
         Guid?id = dgrCommands.SelectedRows[0].Cells["Id"].Value as Guid?;
         if (id.HasValue)
         {
             var cmd = test.Commands.FirstOrDefault(i => i.Id == id);
             if (cmd != null)
             {
                 var editCmd = DependencyInjector.Resolve <EditCommand>(new { command = cmd, test = test, parentForm = this, projectManager });
                 if (editCmd != null)
                 {
                     editCmd.ShowDialog();
                 }
             }
         }
     }
 }
Пример #6
0
 private void cmbCommandType_SelectedIndexChanged(object sender, EventArgs e)
 {
     panel1.Controls.Clear();
     if (cmbCommandType.Text == "Take Screenshot")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new TakeScreenshotCommand();
         }
         var cmd = DependencyInjector.Resolve <TakeScreenshotCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "Navigate to URL")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new NavigateToUrlCommand();
         }
         var cmd = DependencyInjector.Resolve <NavigateToUrlCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "Fill Input")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new FillTextboxCommand();
         }
         var cmd = DependencyInjector.Resolve <FillTextboxCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "Click element")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new ClickButtonCommand();
         }
         var cmd = DependencyInjector.Resolve <ClickButtonCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "If contains string")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new IfContainsStringCommand();
         }
         var cmd = DependencyInjector.Resolve <IfContainsStringCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "Select option")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new SelectFromDropdownCommand();
         }
         var cmd = DependencyInjector.Resolve <SelectFromDropdownCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
     else if (cmbCommandType.Text == "Scroll to element")
     {
         if (command == null || command.OrderIndex == 0)
         {
             command = new ScrollToElementCommand();
         }
         var cmd = DependencyInjector.Resolve <ScrollToElementCommandUC>(new { command = command, test = test, parentForm = parentForm, mainCommandForm = this, projectManager = projectManager });
         if (cmd != null)
         {
             panel1.Controls.Add(cmd);
             cmd.Dock = DockStyle.Fill;
         }
     }
 }