Exemple #1
0
        /// <summary>
        /// Verifies that the 'View' menu works as expected.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The test result for the current test case.</returns>
        public TestResult VerifyViewMenu(Application application, Log log)
        {
            const string prefix = "View menu";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage != null)
                {
                    log.Info(prefix, "Closing start page.");
                    TabProxies.CloseStartPageTab(application, log);
                }

                // Make sure we don't close the welcome tab upon opening the project page
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage != null)
                {
                    log.Info(prefix, "Closing project page.");
                    TabProxies.CloseProjectPageTab(application, log);
                }

                // Open start page via view menu
                MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);

                startPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNotNull(startPage, prefix + " - Check start page exists after clicking start page menu item");
                assert.IsTrue(startPage.IsSelected, prefix + " - Check start page is focussed after clicking start page menu item");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Verifies that the 'File' menu works as expected.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="log">The log object.</param>
        /// <returns>The test result for the current test case.</returns>
        public TestResult VerifyFileMenu(Application application, Log log)
        {
            const string prefix = "File menu";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage != null)
                {
                    TabProxies.CloseProjectPageTab(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNull(projectPage, prefix + " - The project page was not closed.");

                MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - A new project was not created.");

                var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log);
                assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled");

                MenuProxies.CloseProjectViaFileCloseMenuItem(application, log);

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNull(projectPage, prefix + " - The project page was not closed.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #3
0
        public TestResult VerifyCloseOnProjectOpenCheckbox(Application application, Log log)
        {
            const string prefix = "Close welcome tab on project open";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to get the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return(result);
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return(result);
                }

                // Check 'keep open' flag
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                var newProjectSearchCriteria = SearchCriteria
                                               .ByAutomationId(WelcomeViewAutomationIds.NewProject);
                var newProjectButton = (Button)startPage.Get(newProjectSearchCriteria);
                if (newProjectButton == null)
                {
                    var message = "Failed to get the 'New Project' button.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return(result);
                }

                newProjectButton.Click();

                // Check that the start page hasn't been closed
                var currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNotNull(currentStartPage, prefix + " - Start page does not exist after opening project");
                assert.IsFalse(currentStartPage.IsSelected, prefix + " - Start page is selected after opening project");

                var currentProjectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(currentProjectPage, prefix + " - Project page does not exist after opening project");
                assert.IsTrue(currentProjectPage.IsSelected, prefix + " - Project page is not selected after opening project");

                // Check that File - close has been enabled
                var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log);
                assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled");

                // HACK: It seems that the File menu stays open when we check the File - close menu item
                var fileMenu = MenuProxies.GetFileMenuItem(application, log);
                if (fileMenu == null)
                {
                    var message = "Failed to get the file menu.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return(result);
                }

                if (fileMenu.IsFocussed)
                {
                    fileMenu.Click();
                }

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);

                WelcomePageControlProxies.CheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                newProjectButton.Click();

                // Check that the start page has been closed
                currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNull(currentStartPage, prefix + " - Start page exists after opening project");

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #4
0
        private TestResult VerifyTabBehaviour(Application application, Log log)
        {
            const string prefix = "Tabs";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                // Make sure we don't close the welcome tab upon opening the project page
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    log.Info(prefix, "Opening project page.");
                    WelcomePageControlProxies.OpenProjectPageViaWelcomePageButton(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to open the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return(result);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    var message = "Failed to open the project page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return(result);
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return(result);
                }

                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                MenuProxies.SwitchToProjectPageViaViewStartPageMenuItem(application, log);
                assert.IsFalse(startPage.IsSelected, prefix + " - Start is not selected");
                assert.IsTrue(projectPage.IsSelected, prefix + " - Project is selected");

                MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                TabProxies.CloseProjectPageTab(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #5
0
        private TestResult VerifyProjectInformation(Application application, Log log)
        {
            const string prefix = "Project information";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                // Start new project via File menu
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                // Set a name
                var name = "Project-Test-Name";
                ProjectPageControlProxies.ProjectName(application, log, name);

                var storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The written project name does not match the stored project name.");

                // Set a summary
                var summary = "Project-Test-Summary";
                ProjectPageControlProxies.ProjectSummary(application, log, summary);

                var storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.AreEqual(summary, storedSummary, prefix + " - The written project summary does not match the stored project summary.");

                // Set focus away from the text control so that the changes 'stick' by clicking somewhere, in this case the project tab item.
                projectPage.Click();

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The project name change was undone too early.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);

                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedName), prefix + " - The change to the project name was not undone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was not undone.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.IsTrue(string.IsNullOrEmpty(storedSummary), prefix + " - The change to the project summary was redone too early.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                storedName = ProjectPageControlProxies.ProjectName(application, log);
                assert.AreEqual(name, storedName, prefix + " - The change to the project name was not redone.");

                storedSummary = ProjectPageControlProxies.ProjectSummary(application, log);
                assert.AreEqual(summary, storedSummary, prefix + " - The change to the project summary was not redone.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #6
0
        private TestResult VerifyActivateDataset(Application application, Log log)
        {
            const string prefix = "Dataset activation";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                // Start new project via File menu
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);
                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                // Wait for datasets to be created
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3);

                var datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log);
                var ids        = new List <int>(datasetIds);
                ids.Sort();

                ProjectPageControlProxies.ActivateDataset(application, log, ids[1]);

                var isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Failed to activate the first dataset.");

                var isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Activated the second dataset while it should not have been.");

                ProjectPageControlProxies.ActivateDataset(application, log, ids[2]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsTrue(isDataset2Activated, prefix + " - Failed to activate the second dataset.");

                /*
                 * // Undo
                 * MenuProxies.UndoViaEditMenu(application, log);
                 *
                 * isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                 * assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been.");
                 *
                 * isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                 * assert.IsFalse(isDataset2Activated, prefix + " - Did not undo the activation state of the second dataset.");
                 *
                 * // Undo
                 * MenuProxies.UndoViaEditMenu(application, log);
                 *
                 * isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                 * assert.IsFalse(isDataset1Activated, prefix + " - Did not undo the activation state of the first dataset.");
                 *
                 * isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                 * assert.IsFalse(isDataset2Activated, prefix + " - Still did not undo the activation state of the second dataset.");
                 *
                 * // Redo
                 * MenuProxies.RedoViaEditMenu(application, log);
                 *
                 * isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                 * assert.IsTrue(isDataset1Activated, prefix + " - Did not redo the undone activation state of the first dataset.");
                 *
                 * isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                 * assert.IsFalse(isDataset2Activated, prefix + " - Redid the activation state of the second dataset when it should not have been.");
                 *
                 * // Redo
                 * MenuProxies.RedoViaEditMenu(application, log);
                 *
                 * isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                 * assert.IsTrue(isDataset1Activated, prefix + " - Changed the activation state of the first dataset when it should not have been.");
                 *
                 * isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                 * assert.IsTrue(isDataset2Activated, prefix + " - Did not redo the undone activation state of the second dataset.");
                 * */

                ProjectPageControlProxies.DeactivateDataset(application, log, ids[1]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsTrue(isDataset2Activated, prefix + " - Deactivated the second dataset when it should not have been.");

                ProjectPageControlProxies.DeactivateDataset(application, log, ids[2]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Failed to deactivate the second dataset.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }
Exemple #7
0
        private TestResult VerifyDatasetCreation(Application application, Log log)
        {
            const string prefix = "Dataset information";
            var          result = new TestResult();
            var          assert = new Assert(result, log);

            try
            {
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                var datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                var datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs before creating sub-datasets.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after creating 1 sub-dataset.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after creating 2 sub-datasets.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the second dataset.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after undoing the creation of the first dataset.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the first dataset.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after redoing the creation of the second dataset.");

                // Delete first child
                var ids = new List <int>(datasetIds);
                ids.Sort();
                ProjectPageControlProxies.DeleteDataset(application, log, ids[1]);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 2);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the first dataset.");
                assert.IsTrue(datasetIds.Contains(ids[2]), prefix + " - The second dataset was deleted but should not have been.");

                // Delete second child
                ProjectPageControlProxies.DeleteDataset(application, log, ids[2]);
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 1);

                datasetCount = ProjectPageControlProxies.GetNumberOfDatasetsViaProjectControl(application, log);
                datasetIds   = ProjectPageControlProxies.GetDatasetIds(application, log);
                assert.AreEqual(
                    datasetIds.Count(),
                    datasetCount,
                    prefix + " - The number of datasets does not match the number of dataset IDs after the deletion of the second dataset.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(CultureInfo.InvariantCulture, "Failed with exception. Error: {0}", e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return(result);
        }