private void AddTruncatedPrecursorsView(DocumentGridForm documentGrid, bool initialTestExecution)
        {
            RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Precursors));
            WaitForCondition(() => (documentGrid.RowCount > 0)); // Let it initialize

            var viewEditor = ShowDialog<ViewEditor>(documentGrid.NavBar.CustomizeView);
            RunUI(() =>
            {
                viewEditor.ViewName = TRUNCATED_PRECURSORS_VIEW_NAME;
                viewEditor.ChooseColumnsTab.RemoveColumns(2, viewEditor.ChooseColumnsTab.ColumnCount);
                Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Parse("Replicates!*")));
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
                viewEditor.ChooseColumnsTab.ExpandPropertyPath(
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*"), true);
                // Make the view editor bigger so that these expanded nodes can be seen in the next screenshot
                viewEditor.Height = Math.Max(viewEditor.Height, 529);
                Assert.IsTrue(
                    viewEditor.ChooseColumnsTab.TrySelect(
                        PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*.Value.CountTruncated")));
                viewEditor.ChooseColumnsTab.AddSelectedColumn();
            });

            if (initialTestExecution)
                PauseForScreenShot<ViewEditor.ChooseColumnsView>("Customize View form", 17);

            RunUI(() =>
            {
                viewEditor.ActivatePropertyPath(
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.Results!*.Value.CountTruncated"));
                viewEditor.TabControl.SelectTab(1);
                int iFilter = viewEditor.ViewInfo.Filters.Count;
                viewEditor.FilterTab.AddSelectedColumn();
                viewEditor.FilterTab.SetFilterOperation(iFilter, FilterOperations.OP_IS_GREATER_THAN);
                viewEditor.FilterTab.SetFilterOperand(iFilter, 0.ToString());
            });

            if (initialTestExecution)
                PauseForScreenShot<ViewEditor.ChooseColumnsView>("Customize View - Filter tab", 18);

            OkDialog(viewEditor, viewEditor.OkDialog);

            var pathTruncated = PropertyPath.Parse("Results!*.Value.CountTruncated");
            int expectedItems = 148;
            if (IsFullData)
                expectedItems = initialTestExecution ? 222 : 221;
            try
            {
                WaitForConditionUI(1000, () => documentGrid.RowCount == expectedItems &&
                                         documentGrid.FindColumn(pathTruncated) != null);
            }
            catch (AssertFailedException)
            {
                RunUI(() => Assert.AreEqual(expectedItems, documentGrid.RowCount));
            }

            RunUI(() =>
            {
                var columnTruncated = documentGrid.FindColumn(pathTruncated);
                documentGrid.DataGridView.Sort(columnTruncated, ListSortDirection.Descending);

                FormEx.GetParentForm(documentGrid).Size = new Size(514, 315);
            });

            if (initialTestExecution)
                PauseForScreenShot<DocumentGridForm>("Document Grid", 19);
        }
 public void EnableDocumentGridColumns(DocumentGridForm documentGrid, string viewName, int expectedRows, string[] colNames)
 {
     RunUI(() => documentGrid.ChooseView(viewName));
     WaitForCondition(() => (documentGrid.RowCount == expectedRows)); // Let it initialize
     RunDlg<ViewEditor>(documentGrid.NavBar.CustomizeView,
         viewEditor =>
         {
             foreach (var colName in colNames)
             {
                 Assert.IsTrue(viewEditor.ChooseColumnsTab.TrySelect(PropertyPath.Parse(colName)));
                 viewEditor.ChooseColumnsTab.AddSelectedColumn();
             }
             viewEditor.ViewName = viewName;
             viewEditor.OkDialog();
         });
 }