diff --git a/testing/PIMS.Tests.Automation/Classes/AcquisitionFile.cs b/testing/PIMS.Tests.Automation/Classes/AcquisitionFile.cs index 023266b8ea..3f67fce617 100644 --- a/testing/PIMS.Tests.Automation/Classes/AcquisitionFile.cs +++ b/testing/PIMS.Tests.Automation/Classes/AcquisitionFile.cs @@ -197,14 +197,15 @@ public class Take public string TakeStatus { get; set; } = null!; public string? SiteContamination { get; set; } = String.Empty; public string? TakeDescription { get; set; } = String.Empty; - public string? IsNewRightWay { get; set; } = String.Empty; - public string? IsNewRightWayArea { get; set; } = String.Empty; - public string? IsStatutoryRightWay { get; set; } = String.Empty; - public string? IsStatutoryRightWayArea { get; set; } = String.Empty; - public string? IsLandNotation { get; set; } = String.Empty; - public string? IsLandNotationDetail { get; set; } = String.Empty; - public string? IsLandNotationArea { get; set; } = String.Empty; - public string? IsLandNotationDate { get; set; } = String.Empty; + public string? IsNewHighwayDedication { get; set; } = String.Empty; + public string? IsNewHighwayDedicationArea { get; set; } = String.Empty; + public string? IsMotiInventory { get; set; } = String.Empty; + public string? IsNewInterestLand { get; set; } = String.Empty; + public string? IsNewInterestLandArea { get; set; } = String.Empty; + public string? IsLandActTenure { get; set; } = String.Empty; + public string? IsLandActTenureDetail { get; set; } = String.Empty; + public string? IsLandActTenureArea { get; set; } = String.Empty; + public string? IsLandActTenureDate { get; set; } = String.Empty; public string? IsLicenseConstruct { get; set; } = String.Empty; public string? IsLicenseConstructArea { get; set; } = String.Empty; public string IsLicenseConstructDate { get; set; } = String.Empty; diff --git a/testing/PIMS.Tests.Automation/Data/PIMS_Testing_Data.xlsx b/testing/PIMS.Tests.Automation/Data/PIMS_Testing_Data.xlsx index c752888540..303d99f764 100644 Binary files a/testing/PIMS.Tests.Automation/Data/PIMS_Testing_Data.xlsx and b/testing/PIMS.Tests.Automation/Data/PIMS_Testing_Data.xlsx differ diff --git a/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature b/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature index b3794928b9..05ad683e86 100644 --- a/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature +++ b/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature @@ -75,5 +75,5 @@ Scenario: 11. Acquisition File from Pin Then A new Acquisition file is created successfully Scenario: 12. Acquisition Files List View - Given I search for an existing Acquisition File from row number 1 + Given I search for an existing Acquisition File from row number 2 Then Expected Acquisition File Content is displayed on Acquisition File Table diff --git a/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature.cs b/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature.cs index 4e5037c0ac..3aa92bfcac 100644 --- a/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature.cs +++ b/testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature.cs @@ -490,7 +490,7 @@ public void _12_AcquisitionFilesListView() { this.ScenarioStart(); #line 78 - testRunner.Given("I search for an existing Acquisition File from row number 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); + testRunner.Given("I search for an existing Acquisition File from row number 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 79 testRunner.Then("Expected Acquisition File Content is displayed on Acquisition File Table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); diff --git a/testing/PIMS.Tests.Automation/Features/AdminTools.feature b/testing/PIMS.Tests.Automation/Features/AdminTools.feature index 23148711a4..248a1a778b 100644 --- a/testing/PIMS.Tests.Automation/Features/AdminTools.feature +++ b/testing/PIMS.Tests.Automation/Features/AdminTools.feature @@ -23,3 +23,7 @@ Scenario: 04. Financial Codes Scenario: 05. Duplicate existing Financial Code Given I attempt to duplicate a Financial Code from row number 1 Then Financial Code cannot be duplicated successfully + +Scenario: 06. Financial Codes List View + Given I search for an existing Financial Code from row number 1 + Then Financial Codes rendered successfully diff --git a/testing/PIMS.Tests.Automation/Features/AdminTools.feature.cs b/testing/PIMS.Tests.Automation/Features/AdminTools.feature.cs index a3b6e0f3e9..cb5fbe3c06 100644 --- a/testing/PIMS.Tests.Automation/Features/AdminTools.feature.cs +++ b/testing/PIMS.Tests.Automation/Features/AdminTools.feature.cs @@ -225,6 +225,34 @@ public void _05_DuplicateExistingFinancialCode() this.ScenarioCleanup(); } + [Xunit.SkippableFactAttribute(DisplayName="06. Financial Codes List View")] + [Xunit.TraitAttribute("FeatureTitle", "AdminTools")] + [Xunit.TraitAttribute("Description", "06. Financial Codes List View")] + public void _06_FinancialCodesListView() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("06. Financial Codes List View", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 27 +this.ScenarioInitialize(scenarioInfo); +#line hidden + if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 28 + testRunner.Given("I search for an existing Financial Code from row number 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 29 + testRunner.Then("Financial Codes rendered successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.9.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class FixtureData : System.IDisposable diff --git a/testing/PIMS.Tests.Automation/Features/Projects.feature b/testing/PIMS.Tests.Automation/Features/Projects.feature index 1bdf306dd3..3862728ab0 100644 --- a/testing/PIMS.Tests.Automation/Features/Projects.feature +++ b/testing/PIMS.Tests.Automation/Features/Projects.feature @@ -1,25 +1,36 @@ @Regression-Projects Feature: Projects -Scenario Outline: Create new Projects +Scenario Outline: Type of Projects Given I create a new Project from row number - When I verify The Project View Form - And I create Digital Documents for a "Project" row number - And I search for an existing project - Then Expected Content is displayed on Projects Table + Then A new Project is created successfully Examples: - | RowNumber | DocRowNumber | - | 1 | 8 | - | 2 | 9 | - | 3 | 10 | - | 4 | 11 | + | RowNumber | + | 1 | + | 2 | + | 3 | -Scenario: Update Project - Given I update an existing project from row number 5 - When I edit a Digital Document for a "Project" from row number 12 - And I navigate back to Project Details - Then The Project is updated successfully +Scenario: 01. Project Details + Given I create a new Project from row number 4 + When I update an existing project from row number 5 + Then A new Project is created successfully -Scenario: Duplicate Project - Given I create a new Project from row number 1 - Then Duplicate Project Alert is displayed +Scenario: 02. Project Documents + Given I create a new Project from row number 6 + When I create Digital Documents for a "Project" row number 8 + And I edit a Digital Document for a "Project" from row number 9 + Then A new Project is created successfully + +Scenario: 03. Project Notes + Given I create a new Project from row number 7 + When I create a new Note on the Notes Tab from row number 6 + And I edit a Note on the Notes Tab from row number 7 + Then A new Project is created successfully + +Scenario: 04. Project List View + Given I search for existing Projects from row number 2 + Then Expected Project Content is displayed on Projects Table + +#Scenario: Duplicate Project +# Given I create a new Project from row number 2 +# Then Duplicate Project Alert is displayed diff --git a/testing/PIMS.Tests.Automation/Features/Projects.feature.cs b/testing/PIMS.Tests.Automation/Features/Projects.feature.cs index eb792b06bd..d0d339e6b3 100644 --- a/testing/PIMS.Tests.Automation/Features/Projects.feature.cs +++ b/testing/PIMS.Tests.Automation/Features/Projects.feature.cs @@ -82,20 +82,18 @@ void System.IDisposable.Dispose() this.TestTearDown(); } - [Xunit.SkippableTheoryAttribute(DisplayName="Create new Projects")] + [Xunit.SkippableTheoryAttribute(DisplayName="Type of Projects")] [Xunit.TraitAttribute("FeatureTitle", "Projects")] - [Xunit.TraitAttribute("Description", "Create new Projects")] - [Xunit.InlineDataAttribute("1", "8", new string[0])] - [Xunit.InlineDataAttribute("2", "9", new string[0])] - [Xunit.InlineDataAttribute("3", "10", new string[0])] - [Xunit.InlineDataAttribute("4", "11", new string[0])] - public void CreateNewProjects(string rowNumber, string docRowNumber, string[] exampleTags) + [Xunit.TraitAttribute("Description", "Type of Projects")] + [Xunit.InlineDataAttribute("1", new string[0])] + [Xunit.InlineDataAttribute("2", new string[0])] + [Xunit.InlineDataAttribute("3", new string[0])] + public void TypeOfProjects(string rowNumber, string[] exampleTags) { string[] tagsOfScenario = exampleTags; System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); argumentsOfScenario.Add("RowNumber", rowNumber); - argumentsOfScenario.Add("DocRowNumber", docRowNumber); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Create new Projects", null, tagsOfScenario, argumentsOfScenario, featureTags); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Type of Projects", null, tagsOfScenario, argumentsOfScenario, featureTags); #line 4 this.ScenarioInitialize(scenarioInfo); #line hidden @@ -110,30 +108,52 @@ public void CreateNewProjects(string rowNumber, string docRowNumber, string[] ex testRunner.Given(string.Format("I create a new Project from row number {0}", rowNumber), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 6 - testRunner.When("I verify The Project View Form", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); + testRunner.Then("A new Project is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden -#line 7 - testRunner.And(string.Format("I create Digital Documents for a \"Project\" row number {0}", docRowNumber), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + } + this.ScenarioCleanup(); + } + + [Xunit.SkippableFactAttribute(DisplayName="01. Project Details")] + [Xunit.TraitAttribute("FeatureTitle", "Projects")] + [Xunit.TraitAttribute("Description", "01. Project Details")] + public void _01_ProjectDetails() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("01. Project Details", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 13 +this.ScenarioInitialize(scenarioInfo); #line hidden -#line 8 - testRunner.And("I search for an existing project", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 14 + testRunner.Given("I create a new Project from row number 4", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 15 + testRunner.When("I update an existing project from row number 5", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 9 - testRunner.Then("Expected Content is displayed on Projects Table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 16 + testRunner.Then("A new Project is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); } - [Xunit.SkippableFactAttribute(DisplayName="Update Project")] + [Xunit.SkippableFactAttribute(DisplayName="02. Project Documents")] [Xunit.TraitAttribute("FeatureTitle", "Projects")] - [Xunit.TraitAttribute("Description", "Update Project")] - public void UpdateProject() + [Xunit.TraitAttribute("Description", "02. Project Documents")] + public void _02_ProjectDocuments() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Update Project", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 17 + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("02. Project Documents", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 18 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -143,31 +163,31 @@ public void UpdateProject() else { this.ScenarioStart(); -#line 18 - testRunner.Given("I update an existing project from row number 5", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden #line 19 - testRunner.When("I edit a Digital Document for a \"Project\" from row number 12", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); + testRunner.Given("I create a new Project from row number 6", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 20 - testRunner.And("I navigate back to Project Details", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + testRunner.When("I create Digital Documents for a \"Project\" row number 8", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden #line 21 - testRunner.Then("The Project is updated successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); + testRunner.And("I edit a Digital Document for a \"Project\" from row number 9", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden +#line 22 + testRunner.Then("A new Project is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); } - [Xunit.SkippableFactAttribute(DisplayName="Duplicate Project")] + [Xunit.SkippableFactAttribute(DisplayName="03. Project Notes")] [Xunit.TraitAttribute("FeatureTitle", "Projects")] - [Xunit.TraitAttribute("Description", "Duplicate Project")] - public void DuplicateProject() + [Xunit.TraitAttribute("Description", "03. Project Notes")] + public void _03_ProjectNotes() { string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Duplicate Project", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 23 + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("03. Project Notes", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 24 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -177,11 +197,45 @@ public void DuplicateProject() else { this.ScenarioStart(); -#line 24 - testRunner.Given("I create a new Project from row number 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); -#line hidden #line 25 - testRunner.Then("Duplicate Project Alert is displayed", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); + testRunner.Given("I create a new Project from row number 7", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 26 + testRunner.When("I create a new Note on the Notes Tab from row number 6", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line hidden +#line 27 + testRunner.And("I edit a Note on the Notes Tab from row number 7", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden +#line 28 + testRunner.Then("A new Project is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line hidden + } + this.ScenarioCleanup(); + } + + [Xunit.SkippableFactAttribute(DisplayName="04. Project List View")] + [Xunit.TraitAttribute("FeatureTitle", "Projects")] + [Xunit.TraitAttribute("Description", "04. Project List View")] + public void _04_ProjectListView() + { + string[] tagsOfScenario = ((string[])(null)); + System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("04. Project List View", null, tagsOfScenario, argumentsOfScenario, featureTags); +#line 30 +this.ScenarioInitialize(scenarioInfo); +#line hidden + if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) + { + testRunner.SkipScenario(); + } + else + { + this.ScenarioStart(); +#line 31 + testRunner.Given("I search for existing Projects from row number 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); +#line hidden +#line 32 + testRunner.Then("Expected Project Content is displayed on Projects Table", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } this.ScenarioCleanup(); diff --git a/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature b/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature index ebcae9e062..12e0461795 100644 --- a/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature +++ b/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature @@ -17,7 +17,8 @@ Scenario: 02. Research File Properties Scenario: 03. Research File Documents Given I create a basic Research File from row number 3 - When I create Digital Documents for a "Research File" row number 3 + When I create Digital Documents for a "Research File" row number 3 + And I edit a Digital Document for a "Research File" from row number 6 Then A new Research File is created successfully Scenario: 04. Research File Notes diff --git a/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature.cs b/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature.cs index 332c2a2fa4..7d3eafd420 100644 --- a/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature.cs +++ b/testing/PIMS.Tests.Automation/Features/ResearchFiles.feature.cs @@ -175,6 +175,9 @@ public void _03_ResearchFileDocuments() testRunner.When("I create Digital Documents for a \"Research File\" row number 3", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden #line 21 + testRunner.And("I edit a Digital Document for a \"Research File\" from row number 6", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line hidden +#line 22 testRunner.Then("A new Research File is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } @@ -189,7 +192,7 @@ public void _04_ResearchFileNotes() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("04. Research File Notes", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 23 +#line 24 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -199,16 +202,16 @@ public void _04_ResearchFileNotes() else { this.ScenarioStart(); -#line 24 +#line 25 testRunner.Given("I create a basic Research File from row number 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden -#line 25 +#line 26 testRunner.When("I create a new Note on the Notes Tab from row number 1", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden -#line 26 +#line 27 testRunner.And("I edit a Note on the Notes Tab from row number 2", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden -#line 27 +#line 28 testRunner.Then("Notes update have been done successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } @@ -223,7 +226,7 @@ public void _05_ResearchFileFromPin() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("05. Research File from pin", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 29 +#line 30 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -233,10 +236,10 @@ public void _05_ResearchFileFromPin() else { this.ScenarioStart(); -#line 30 +#line 31 testRunner.Given("I create a Research File from a pin on map and from row number 6", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden -#line 31 +#line 32 testRunner.Then("A new Research File is created successfully", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } @@ -251,7 +254,7 @@ public void _06_ResearchFileListView() string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("06. Research File List View", null, tagsOfScenario, argumentsOfScenario, featureTags); -#line 33 +#line 34 this.ScenarioInitialize(scenarioInfo); #line hidden if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags))) @@ -261,10 +264,10 @@ public void _06_ResearchFileListView() else { this.ScenarioStart(); -#line 34 +#line 35 testRunner.Given("I search for Research Files from row number 8", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden -#line 35 +#line 36 testRunner.Then("Research File Properties remain unchanged", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden } diff --git a/testing/PIMS.Tests.Automation/PageObjects/AcquisitionFilesDetails.cs b/testing/PIMS.Tests.Automation/PageObjects/AcquisitionFilesDetails.cs index 5d5e4e1ae4..a8eb921edf 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/AcquisitionFilesDetails.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/AcquisitionFilesDetails.cs @@ -9,7 +9,7 @@ namespace PIMS.Tests.Automation.PageObjects public class AcquisitionFilesDetails : PageObjectBase { //Acquisition Files Menu Elements - private By menuAcquisitionButton = By.XPath("//a/label[contains(text(),'Acquisition')]/parent::a"); + private By menuAcquisitionButton = By.CssSelector("div[data-testid='nav-tooltip-acquisition'] a"); private By createAcquisitionFileButton = By.XPath("//a[contains(text(),'Create an Acquisition File')]"); private By acquisitionFileSummaryBttn = By.XPath("//div[contains(text(),'File Summary')]"); @@ -72,17 +72,19 @@ public class AcquisitionFilesDetails : PageObjectBase private By acquisitionFileOwnerSubtitle = By.XPath("//div[contains(text(),'Owner Information')]"); - //Acquisition File Main Form Input Elements private By acquisitionFileMainFormDiv = By.XPath("//h1[contains(text(),'Create Acquisition File')]/parent::div/parent::div/parent::div/parent::div"); private By acquisitionFileDeliveryDateInput = By.Id("datepicker-deliveryDate"); private By acquisitionFileCompletedDateInput = By.Id("datepicker-completionDate"); + private By acquisitionFileNameInput = By.Id("input-fileName"); + private By acquisitionFileNameInvalidMessage = By.XPath("//div[contains(text(),'Acquisition file name must be at most 500 characters')]"); + private By acquisitionFileHistoricalNumberLabel = By.XPath("//label[contains(text(),'Historical file number')]"); private By acquisitionFileHistoricalNumberInput = By.Id("input-legacyFileNumber"); + private By acquisitionFileHistoricalInvalidMessage = By.XPath("//div[contains(text(),'Legacy file number must be at most 18 characters')]"); private By acquisitionFileHistoricalNumberTooltip = By.XPath("//label[contains(text(),'Historical file number')]/span/span[@data-testid='tooltip-icon-section-field-tooltip']"); - private By acquisitionFileNameInput = By.Id("input-fileName"); private By acquisitionFilePhysicalStatusSelect = By.Id("input-acquisitionPhysFileStatusType"); private By acquisitionFileDetailsTypeSelect = By.Id("input-acquisitionType"); private By acquisitionFileDetailsRegionSelect = By.Id("input-region"); @@ -90,6 +92,8 @@ public class AcquisitionFilesDetails : PageObjectBase private By acquisitionFileAddAnotherMemberLink = By.CssSelector("button[data-testid='add-team-member']"); private By acquisitionFileTeamMembersGroup = By.XPath("//div[contains(text(),'Acquisition Team')]/parent::div/parent::h2/following-sibling::div/div[@class='py-3 row']"); private By acquisitionFileTeamFirstMemberDeleteBttn = By.XPath("//div[contains(text(),'Acquisition Team')]/parent::div/parent::h2/following-sibling::div/div[@class='py-3 row'][1]/div[3]/button"); + private By acquisitionFileTeamInvalidTeamMemberMessage = By.XPath("//div[contains(text(),'Select a team member')]"); + private By acquisitionFileTeamInvalidProfileMessage = By.XPath("//div[contains(text(),'Select a profile')]"); private By acquisitionFileCreateOwnerSubtitle = By.XPath("//div[contains(text(),'Owners')]"); private By acquisitionFileOwnerInfo = By.XPath("//p[contains(text(),'Each property in this file should be owned by the owner(s) in this section')]"); @@ -646,10 +650,15 @@ public void VerifyAcquisitionFileCreate() AssertTrueIsDisplayed(acquisitionFileDetailsMOTIRegionLabel); AssertTrueIsDisplayed(acquisitionFileDetailsRegionSelect); + VerifyMaximumFields(); + //Team members AssertTrueIsDisplayed(acquisitionFileTeamSubtitle); AssertTrueIsDisplayed(acquisitionFileAddAnotherMemberLink); + VerifyRequiredTeamMemberMessages(); + DeleteFirstStaffMember(); + //Owners AssertTrueIsDisplayed(acquisitionFileCreateOwnerSubtitle); AssertTrueIsDisplayed(acquisitionFileOwnerInfo); @@ -758,5 +767,37 @@ private void DeleteOwner() sharedModals.ModalClickOKBttn(); } + + private void VerifyRequiredTeamMemberMessages() + { + //Add a new Team member form + WaitUntilClickable(acquisitionFileAddAnotherMemberLink); + webDriver.FindElement(acquisitionFileAddAnotherMemberLink).Click(); + + //Verify that invalid team member message is displayed + ChooseSpecificSelectOption(By.Id("input-team.0.contactTypeCode"), "Expropriation agent"); + AssertTrueIsDisplayed(acquisitionFileTeamInvalidTeamMemberMessage); + + //verify that invalid profile message is displayed + ChooseSpecificSelectOption(By.Id("input-team.0.contactTypeCode"), "Select profile..."); + webDriver.FindElement(By.CssSelector("div[data-testid='contact-input'] button[title='Select Contact']")).Click(); + sharedSelectContact.SelectContact("Test", ""); + AssertTrueIsDisplayed(acquisitionFileTeamInvalidProfileMessage); + } + + private void VerifyMaximumFields() + { + //Verify File Name Input + webDriver.FindElement(acquisitionFileNameInput).SendKeys("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus"); + webDriver.FindElement(acquisitionFileDetailsNameLabel).Click(); + AssertTrueIsDisplayed(acquisitionFileNameInvalidMessage); + ClearInput(acquisitionFileNameInput); + + //Verify Historical File Number Input + webDriver.FindElement(acquisitionFileHistoricalNumberInput).SendKeys("Lorem ipsum dolor s"); + webDriver.FindElement(acquisitionFileHistoricalNumberLabel).Click(); + AssertTrueIsDisplayed(acquisitionFileHistoricalInvalidMessage); + ClearInput(acquisitionFileHistoricalNumberInput); + } } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/AcquisitionTakes.cs b/testing/PIMS.Tests.Automation/PageObjects/AcquisitionTakes.cs index 85b72c61c6..d2f5b300a2 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/AcquisitionTakes.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/AcquisitionTakes.cs @@ -29,17 +29,19 @@ public class AcquisitionTakes : PageObjectBase private By takeDescriptionLabel = By.XPath("//label[contains(text(),'Description of this Take')]"); private By take1DescriptionInput = By.Id("input-takes.0.description"); private By takeAreaSubtitle = By.XPath("//h2/div/div[contains(text(),'Area')]"); - private By takeRightOfWayLabel = By.XPath("//label[contains(text(),'Is there a new right of way?')]"); - private By takeRightOfWayRadioBttnGroup = By.CssSelector("input[name='takes.0.isNewRightOfWay']"); - private By takeSRWLabel = By.XPath("//label[contains(text(),'Is there a Statutory Right of Way: (SRW)?')]"); - private By takeSRWRadioBttnGroup = By.CssSelector("input[name='takes.0.isStatutoryRightOfWay']"); - private By takeLandActLabel = By.XPath("//label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]"); - private By takeLandActRadioBttnGroup = By.CssSelector("input[name='takes.0.isLandAct']"); - private By takeLicenseConstructLabel = By.XPath("//label[contains(text(),'Is there a License to Construct (LTC)?')]"); - private By takeLicenseConstructRadioBttnGroup = By.CssSelector("input[name='takes.0.isLicenseToConstruct']"); + private By takeRightOfWayLabel = By.XPath("//label[contains(text(),'Is there a new highway dedication?')]"); + private By takeRightOfWayRadioBttnGroup = By.CssSelector("input[name='takes.0.isNewHighwayDedication']"); + private By takeMOTIInventoryLabel = By.XPath("//label[contains(text(),'Is this being acquired for MoTI inventory? *')]"); + private By takeMOTIInventoryBttnGroup = By.CssSelector("input[name='takes.0.isAcquiredForInventory']"); + private By takeSRWLabel = By.XPath("//label[contains(text(),'Is there a new registered interest in land (SRW, Easement or Covenant)?')]"); + private By takeSRWRadioBttnGroup = By.CssSelector("input[name='takes.0.isNewInterestInSrw']"); + private By takeLandActLabel = By.XPath("//label[contains(text(),'Is a there a new Land Act tenure?')]"); + private By takeLandActRadioBttnGroup = By.CssSelector("input[name='takes.0.isNewLandAct']"); + private By takeLicenseConstructLabel = By.XPath("//label[contains(text(),'Is there a new License for Construction Access (TLCA/LTC)?')]"); + private By takeLicenseConstructRadioBttnGroup = By.CssSelector("input[name='takes.0.isNewLicenseToConstruct']"); private By takeSurplusSubtitle = By.XPath("//h2/div/div[contains(text(),'Surplus')]"); private By takeSurplusLabel = By.XPath("//label[contains(text(),'Is there a Surplus?')]"); - private By takeSurplusRadioBttnGroup = By.CssSelector("input[name='takes.0.isSurplus']"); + private By takeSurplusRadioBttnGroup = By.CssSelector("input[name='takes.0.isThereSurplus']"); private By createTakeBttn = By.XPath("//div/div/div[2]/div/div/div[3]/div/div/div/div/div/button"); @@ -105,8 +107,8 @@ public void InsertTake(Take take) } //Areas - //New Right of Way - ChooseSpecificRadioButton(By.Name("takes."+ index +".isNewRightOfWay"), take.IsNewRightWay); + //New Highway Dedication + ChooseSpecificRadioButton(By.Name("takes."+ index +".isNewHighwayDedication"), take.IsNewHighwayDedication); Wait(); if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0) @@ -117,18 +119,21 @@ public void InsertTake(Take take) sharedModals.ModalClickOKBttn(); } - if (take.IsNewRightWay.Equals("true") && take.IsNewRightWayArea != "") + if (take.IsNewHighwayDedication.Equals("true") && take.IsNewHighwayDedicationArea != "") { - ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); - webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsNewRightWayArea); + ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewhighwaydedication-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); + webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewhighwaydedication-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsNewHighwayDedicationArea); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsNewRightWayArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsNewRightWayArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsNewRightWayArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewhighwaydedication-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsNewHighwayDedicationArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewhighwaydedication-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsNewHighwayDedicationArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewhighwaydedication-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsNewHighwayDedicationArea)); } - //Statutory Right of Way - ChooseSpecificRadioButton(By.Name("takes."+ index +".isStatutoryRightOfWay"), take.IsStatutoryRightWay); + //MOTI Inventory + ChooseSpecificRadioButton(By.Name("takes."+ index +".isAcquiredForInventory"), take.IsMotiInventory); + + //New Registered Interest in Land + ChooseSpecificRadioButton(By.Name("takes."+ index +".isNewInterestInSrw"), take.IsNewInterestLand); Wait(); if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0) @@ -139,18 +144,18 @@ public void InsertTake(Take take) sharedModals.ModalClickOKBttn(); } - if (take.IsStatutoryRightWay.Equals("true") && take.IsStatutoryRightWayArea != "") + if (take.IsNewInterestLand.Equals("true") && take.IsNewInterestLandArea != "") { - ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isstatutoryrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); - webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isstatutoryrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsStatutoryRightWayArea); + ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewinterestinsrw-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); + webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewinterestinsrw-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsNewInterestLandArea); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isstatutoryrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsStatutoryRightWayArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isstatutoryrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsStatutoryRightWayArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isstatutoryrightofway-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsStatutoryRightWayArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewinterestinsrw-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsNewInterestLandArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewinterestinsrw-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsNewInterestLandArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewinterestinsrw-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsNewInterestLandArea)); } - //Land Act-Reserve - ChooseSpecificRadioButton(By.Name("takes."+ index +".isLandAct"), take.IsLandNotation); + //Land Act Tenure + ChooseSpecificRadioButton(By.Name("takes."+ index +".isNewLandAct"), take.IsLandActTenure); Wait(); if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0) @@ -161,27 +166,27 @@ public void InsertTake(Take take) sharedModals.ModalClickOKBttn(); } - if (take.IsLandNotation.Equals("true")) + if (take.IsLandActTenure.Equals("true")) { - ChooseSpecificSelectOption(By.Id("input-takes."+ index +".landActTypeCode"), take.IsLandNotationDetail); + ChooseSpecificSelectOption(By.Id("input-takes."+ index +".landActTypeCode"), take.IsLandActTenureDetail); - if (take.IsLandNotationArea != "") + if (take.IsLandActTenureArea != "") { - ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".islandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); - webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".islandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsLandNotationArea); + ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); + webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsLandActTenureArea); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsLandNotationArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsLandNotationArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsLandNotationArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsLandActTenureArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsLandActTenureArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlandact-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsLandActTenureArea)); } ClearInput(By.Id("datepicker-takes."+ index +".landActEndDt")); - webDriver.FindElement(By.Id("datepicker-takes."+ index +".landActEndDt")).SendKeys(take.IsLandNotationDate); + webDriver.FindElement(By.Id("datepicker-takes."+ index +".landActEndDt")).SendKeys(take.IsLandActTenureDate); webDriver.FindElement(By.Id("datepicker-takes."+ index +".landActEndDt")).SendKeys(Keys.Enter); } //License to Construct - ChooseSpecificRadioButton(By.Name("takes."+ index +".isLicenseToConstruct"), take.IsLicenseConstruct); + ChooseSpecificRadioButton(By.Name("takes."+ index +".isNewLicenseToConstruct"), take.IsLicenseConstruct); Wait(); if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0) @@ -196,12 +201,12 @@ public void InsertTake(Take take) { if (take.IsLicenseConstructArea != "") { - ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".islicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); - webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".islicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsLicenseConstructArea); + ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); + webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsLicenseConstructArea); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsLicenseConstructArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsLicenseConstructArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".islicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsLicenseConstructArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsLicenseConstructArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsLicenseConstructArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".isnewlicensetoconstruct-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsLicenseConstructArea)); } ClearInput(By.Id("datepicker-takes."+ index +".ltcEndDt")); @@ -210,7 +215,7 @@ public void InsertTake(Take take) } //Surplus - ChooseSpecificRadioButton(By.Name("takes."+ index +".isSurplus"), take.IsSurplus); + ChooseSpecificRadioButton(By.Name("takes."+ index +".isThereSurplus"), take.IsSurplus); Wait(); if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0) @@ -223,12 +228,12 @@ public void InsertTake(Take take) if (take.IsSurplus.Equals("true") && take.IsSurplusArea != "") { - ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".issurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); - webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".issurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsSurplusArea); + ClearDigitsInput(By.XPath("//input[@data-testid='radio-takes."+ index +".istheresurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")); + webDriver.FindElement(By.XPath("//input[@data-testid='radio-takes."+ index +".istheresurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-meters']")).SendKeys(take.IsSurplusArea); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".issurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsSurplusArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".issurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsSurplusArea)); - AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".issurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsSurplusArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".istheresurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-hectares']"), TransformSqMtToHectares(take.IsSurplusArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".istheresurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-sq-feet']"), TransformSqMtToSqFt(take.IsSurplusArea)); + AssertTrueDoublesEquals(By.XPath("//input[@data-testid='radio-takes."+ index +".istheresurplus-yes']/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/div/div/div/div/input[@name='area-acres']"), TransformSqMtToAcres(take.IsSurplusArea)); } } @@ -274,10 +279,11 @@ public void VerifyInitCreateForm() AssertTrueIsDisplayed(take1SiteContaminationSelect); AssertTrueIsDisplayed(takeDescriptionLabel); AssertTrueIsDisplayed(take1DescriptionInput); - AssertTrueIsDisplayed(takeAreaSubtitle); AssertTrueIsDisplayed(takeRightOfWayLabel); AssertTrueIsDisplayed(takeRightOfWayRadioBttnGroup); + AssertTrueIsDisplayed(takeMOTIInventoryLabel); + AssertTrueIsDisplayed(takeMOTIInventoryBttnGroup); AssertTrueIsDisplayed(takeSRWLabel); AssertTrueIsDisplayed(takeSRWRadioBttnGroup); AssertTrueIsDisplayed(takeLandActLabel); @@ -314,31 +320,31 @@ public void VerifyCreatedTakeViewForm(Take take) AssertTrueIsDisplayed(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a new right of way?')]")); Assert.True(webDriver.FindElements(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/div/div/div/div/input[@id='input-newRightOfWayToggle']")).Count.Equals(2)); - if (take.IsNewRightWay.Equals("True") && take.IsNewRightWayArea != "") - AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a new right of way?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsNewRightWayArea); + if (take.IsNewHighwayDedication.Equals("True") && take.IsNewHighwayDedicationArea != "") + AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a new right of way?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsNewHighwayDedicationArea); AssertTrueIsDisplayed(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a Statutory Right of Way: (SRW)?')]")); Assert.True(webDriver.FindElements(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/div/div/div/div/input[@id='input-statutoryRightOfWayToggle']")).Count.Equals(2)); - if (take.IsStatutoryRightWay.Equals("True") && take.IsStatutoryRightWayArea != "") - AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsStatutoryRightWayArea); + if (take.IsNewInterestLand.Equals("True") && take.IsNewInterestLandArea != "") + AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsNewInterestLandArea); AssertTrueIsDisplayed(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]")); Assert.True(webDriver.FindElements(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/div/div/div/div/input[@id='input-statutoryRightOfWayToggle']")).Count.Equals(2)); - if (take.IsLandNotation.Equals("True")) + if (take.IsLandActTenure.Equals("True")) { - AssertTrueContentEquals(By.XPath("(//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/label[contains(text(),'Land Act')]/parent::div/following-sibling::div)[2]"),take.IsLandNotationDetail); + AssertTrueContentEquals(By.XPath("(//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/label[contains(text(),'Land Act')]/parent::div/following-sibling::div)[2]"),take.IsLandActTenureDetail); - if(take.IsLandNotationArea != "") - AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsStatutoryRightWayArea); + if(take.IsLandActTenureArea != "") + AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsNewInterestLandArea); - AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/label[contains(text(),'End date')]/parent::div/following-sibling::div"), TransformDateFormat(take.IsLandNotationDate)); + AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there Land Act-Reserve(s)/Withdrawal(s)/Notation(s)?')]/parent::div/parent::div/parent::div/div/div/label[contains(text(),'End date')]/parent::div/following-sibling::div"), TransformDateFormat(take.IsLandActTenureDate)); } AssertTrueIsDisplayed(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a License to Construct (LTC)?')]")); Assert.True(webDriver.FindElements(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/div/div/div/div/input[@id='input-licenseToConstructToggle']")).Count.Equals(2)); if (take.IsLicenseConstruct.Equals("True")) { - if (take.IsLandNotationArea != "") + if (take.IsLandActTenureArea != "") AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a License to Construct (LTC)?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsLicenseConstructArea); AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a License to Construct (LTC)?')]/parent::div/parent::div/parent::div/div/div/label[contains(text(),'LTC end date')]/parent::div/following-sibling::div"), TransformDateFormat(take.IsLicenseConstructDate)); @@ -349,7 +355,7 @@ public void VerifyCreatedTakeViewForm(Take take) AssertTrueIsDisplayed(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a Surplus?')]")); Assert.True(webDriver.FindElements(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/div/div/div/div/input[@id='input-surplusToggle']")).Count.Equals(2)); - if (take.IsNewRightWay.Equals("True") && take.IsSurplusArea != "") + if (take.IsNewHighwayDedication.Equals("True") && take.IsSurplusArea != "") AssertTrueContentEquals(By.XPath("//div[@data-testid='take-"+ index +"']/div/div/div/div/div/div/div/label[contains(text(),'Is there a Surplus?')]/parent::div/parent::div/parent::div/div/div/div/div/div/div/div[contains(text(),'sq. metres')]/preceding-sibling::div"), take.IsSurplusArea); } diff --git a/testing/PIMS.Tests.Automation/PageObjects/Activities.cs b/testing/PIMS.Tests.Automation/PageObjects/Activities.cs deleted file mode 100644 index 11d15f4545..0000000000 --- a/testing/PIMS.Tests.Automation/PageObjects/Activities.cs +++ /dev/null @@ -1,294 +0,0 @@ - - -using OpenQA.Selenium; - -namespace PIMS.Tests.Automation.PageObjects -{ - public class Activities : PageObjectBase - { - //Activity List View Elements - //Add Activities Elements - // private By activitiesTab = By.CssSelector("a[data-rb-event-key='activities']"); - // private By activitiesTitle = By.XPath("//div[contains(text(),'Activities')]"); - // private By activityTypeSelect = By.Id("input-activityTypeId"); - // private By activityAddBttn = By.CssSelector("div[class='col-md-4'] button"); - - // //Activities Filter Elements - // private By activityFilterLabel = By.XPath("//form/div/div/label[contains(text(),'Filter by')]"); - // private By activityTypeFilterSelect = By.Id("input-activityTypeId"); - // private By activityStatusFilterSelect = By.Id("input-status"); - // private By activityFilterSearchBttn = By.XPath("//div[contains(text(),'Activities')]/parent::div/parent::h2/following-sibling::div/form/div/div[4]/button"); - // private By activityFilterResetBttn = By.XPath("//div[contains(text(),'Activities')]/parent::div/parent::h2/following-sibling::div/form/div/div[5]/button"); - - // //Activity List View Results - // private By activityTable = By.CssSelector("div[data-testid='ActivityTable']"); - // private By activityTypeColumn = By.XPath("//div[@data-testid='ActivityTable']/div/div/div/div[contains(text(),'Activity type')]"); - // private By activityDescColumn = By.XPath("//div[@data-testid='ActivityTable']/div/div/div/div[contains(text(),'Description')]"); - // private By activityPropertyColumn = By.XPath("//div[@data-testid='ActivityTable']/div/div/div/div[contains(text(),'Property')]"); - // private By activityStatusColumn = By.XPath("//div[@data-testid='ActivityTable']/div/div/div/div[contains(text(),'Status')]"); - // private By activityActionsColumn = By.XPath("//div[@data-testid='ActivityTable']/div/div/div/div[contains(text(),'Actions')]"); - // private By activity1stGeneralActBttn = By.XPath("(//div[contains(text(),'General')]/parent::button)[1]"); - // private By activity1stViewActionBttn = By.XPath("(//button[@title='View Activity'])[1]"); - // private By activity1stDeleteActionBttn = By.XPath("(//button[@title='View Activity']/following-sibling::button)[1]"); - // private By activity1stPropertyCell = By.CssSelector("div[data-testid='ActivityTable'] div[class='tbody'] div[class='tr-wrapper']:nth-child(1) div:nth-child(3)"); - // private By activity1stStatusCell = By.CssSelector("div[data-testid='ActivityTable'] div[class='tbody'] div[class='tr-wrapper']:nth-child(1) div:nth-child(4)"); - // private By activityNoFound = By.XPath("//div[contains(text(),'No matching Activity found')]"); - // private By activitiesListTotal = By.CssSelector("div[data-testid='ActivityTable'] div[class='tbody'] div[class='tr-wrapper']"); - - // //Activity Pagination Elements - // private By activityPaginationSpan = By.CssSelector("div[class='align-self-center col-auto'] span"); - // private By activityPagination = By.CssSelector("ul[class='pagination']"); - - // //Activity Details Elements - // //Activity Details Header - // private By activityHeaderTittle = By.XPath("//div[@data-testid='activity-tray']/div[contains(text(),'Activity')]"); - // private By activityHeaderFileLabel = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div/div/div/label[contains(text(),'File')]"); - // private By activityHeaderFileContent = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div/div/div/label[contains(text(),'File')]/parent::div/following-sibling::div/strong"); - // private By activityHeaderCreatedLabel = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Created')]"); - // private By activityHeaderCreatedDate = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Created')]/strong"); - // private By activityHeaderCreatedByUser = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Created')]/span"); - // private By activityHeaderUpdatedLabel = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Last updated')]"); - // private By activityHeaderUpdatedDate = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Last updated')]/strong"); - // private By activityHeaderUpdateByUser = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div[contains(text(),'Last updated')]/span"); - // private By activityHeaderStatusLabel = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div/div/div/label[contains(text(),'Status')]"); - // private By activityHeaderStatusContent = By.XPath("//div[@data-testid='activity-tray']/div/div/div/div/div/div/div/div/label[contains(text(),'Status')]/parent::div/following-sibling::div/strong"); - - // //Activity Details Elements - // private By activityDetailsTitle = By.XPath("//div[@data-testid='activity-tray']/div/div/div[2]/div[1]/h2/div/div[contains(text(),'Details')]"); - // private By activityDetailsRelatedPropsBttn = By.XPath("//div[contains(text(),'Related properties')]/parent::button"); - // private By activityDescriptionLabel = By.XPath("//h2/div/div[contains(text(),'Description')]"); - // private By activityDescriptionTextArea = By.Id("input-description"); - // private By activityStatusSelect = By.Id("input-activityStatusTypeCode.id"); - // private By activityDetailsEditBttn = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[3]/div/button"); - - // //Related Properties Pop-up - // private By activityPropertiesModal = By.CssSelector("div[class='modal-content']"); - // private By activityPropertiesAllInput = By.CssSelector("input[data-testid='selectrow-parent']"); - - // private SharedDocumentsTab digitalDocuments; - // private Notes notes; - // private SharedModals sharedModals; - - - public Activities(IWebDriver webDriver) : base(webDriver) - { - // digitalDocuments = new SharedDocumentsTab(webDriver); - // notes = new Notes(webDriver); - // sharedModals = new SharedModals(webDriver); - } - - // public void AccessActivitiesTab() - // { - // Wait(2000); - // webDriver.FindElement(activitiesTab).Click(); - // } - - // public void CreateNewActivity(string activityType) - // { - // Wait(); - // ChooseSpecificSelectOption(activityTypeSelect, activityType); - // webDriver.FindElement(activityAddBttn).Click(); - - // Wait(); - // var lastActivityIndex = webDriver.FindElements(activitiesListTotal).Count(); - // webDriver.FindElement(By.CssSelector("div[class='tbody'] div[class='tr-wrapper']:nth-child("+ lastActivityIndex +") div[role='row'] div[role='cell']:nth-child(1) button")).Click(); - // } - - // public void SelectFirstActivity() - // { - // Wait(); - // webDriver.FindElement(activity1stGeneralActBttn).Click(); - // } - - // public void VerifyActivityListView() - // { - // Wait(); - // webDriver.FindElement(activity1stViewActionBttn).Click(); - - // Wait(); - // Assert.True(webDriver.FindElement(activitiesTitle).Displayed); - // Assert.True(webDriver.FindElement(activityTypeSelect).Displayed); - // Assert.True(webDriver.FindElement(activityAddBttn).Displayed); - - // Assert.True(webDriver.FindElement(activityFilterLabel).Displayed); - // Assert.True(webDriver.FindElement(activityTypeFilterSelect).Displayed); - // Assert.True(webDriver.FindElement(activityStatusFilterSelect).Displayed); - // Assert.True(webDriver.FindElement(activityFilterSearchBttn).Displayed); - // Assert.True(webDriver.FindElement(activityFilterResetBttn).Displayed); - - // Assert.True(webDriver.FindElement(activityTable).Displayed); - // Assert.True(webDriver.FindElement(activityTypeColumn).Displayed); - // Assert.True(webDriver.FindElement(activityDescColumn).Displayed); - // Assert.True(webDriver.FindElement(activityPropertyColumn).Displayed); - // Assert.True(webDriver.FindElement(activityStatusColumn).Displayed); - // Assert.True(webDriver.FindElement(activityActionsColumn).Displayed); - // Assert.True(webDriver.FindElement(activity1stGeneralActBttn).Displayed); - // Assert.True(webDriver.FindElement(activity1stViewActionBttn).Displayed); - // Assert.True(webDriver.FindElement(activity1stDeleteActionBttn).Displayed); - - // Assert.True(webDriver.FindElement(activityPaginationSpan).Displayed); - // Assert.True(webDriver.FindElement(activityPagination).Displayed); - - // } - - // public void VerifyActivityDetails() - // { - // Wait(); - - // //Header - // Assert.True(webDriver.FindElement(activityHeaderTittle).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderFileLabel).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderFileContent).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderCreatedLabel).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderCreatedDate).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderCreatedByUser).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderUpdatedLabel).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderUpdatedDate).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderUpdateByUser).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderStatusLabel).Displayed); - // Assert.True(webDriver.FindElement(activityHeaderStatusContent).Displayed); - - // //Details & Description - // Assert.True(webDriver.FindElement(activityDetailsTitle).Displayed); - // Assert.True(webDriver.FindElement(activityDetailsRelatedPropsBttn).Displayed); - // Assert.True(webDriver.FindElement(activityDescriptionLabel).Displayed); - - // //Documents - // digitalDocuments.VerifyActivityDocumentsListView(); - - // //Notes - // notes.VerifyNotesListView(); - - // //Edit button - // Assert.True(webDriver.FindElement(activityDetailsEditBttn).Displayed); - - // } - - // public void FilterActivities() - // { - // Wait(); - // ChooseSpecificSelectOption(activityStatusFilterSelect, "In Progress"); - // webDriver.FindElement(activityFilterSearchBttn).Click(); - - // Wait(); - // Assert.True(webDriver.FindElement(activityNoFound).Displayed); - - // webDriver.FindElement(activityFilterResetBttn).Click(); - - // ChangeStatus("In Progress"); - - // ChooseSpecificSelectOption(activityStatusFilterSelect, "In Progress"); - // webDriver.FindElement(activityFilterSearchBttn).Click(); - - // Wait(); - // Assert.True(webDriver.FindElements(activitiesListTotal).Count() > 0); - - // } - - // public void SelectAllProperties() - // { - // Wait(); - // Assert.True(webDriver.FindElement(activity1stPropertyCell).Text == ""); - - // Wait(); - // ButtonElement("Related properties"); - - // WaitUntil(activityPropertiesModal); - // webDriver.FindElement(activityPropertiesAllInput).Click(); - // sharedModals.ModalClickOKBttn(); - - // Wait(); - // Assert.True(webDriver.FindElement(activity1stPropertyCell).Text == "All"); - - // } - - // public void DesectAllProperties() - // { - // Wait(); - // Assert.True(webDriver.FindElement(activity1stPropertyCell).Text == "All"); - - // Wait(); - // ButtonElement("Related properties"); - - // WaitUntil(activityPropertiesModal); - // webDriver.FindElement(activityPropertiesAllInput).Click(); - // sharedModals.ModalClickOKBttn(); - - // Wait(); - // Assert.True(webDriver.FindElement(activity1stPropertyCell).Text == ""); - // } - - // public void NoProperties() - // { - // Wait(); - // ButtonElement("Related properties"); - - // WaitUntil(activityPropertiesModal); - // Assert.True(sharedModals.ModalHeader() == "Related properties"); - // Assert.True(sharedModals.ModalContent() == "To link activity to one or more properties, add properties to the parent file first"); - // sharedModals.ModalClickOKBttn(); - // } - - // public void EditActivity() - // { - // Wait(); - // webDriver.FindElement(activityDetailsEditBttn).Click(); - // } - - // public void ChangeStatus(string toStatus) - // { - // Wait(); - // var previousStatus = webDriver.FindElement(activity1stStatusCell).Text; - - // webDriver.FindElement(activityDetailsEditBttn).Click(); - - // ChooseSpecificSelectOption(activityStatusSelect, toStatus); - // ButtonElement("Save"); - - // Wait(); - // notes.VerifyAutomaticNotes(previousStatus, toStatus); - // } - - // public void InsertDescription(string description) - // { - // Wait(); - // webDriver.FindElement(activityDetailsEditBttn).Click(); - - // webDriver.FindElement(activityDescriptionTextArea).SendKeys(description); - - // } - - // public void DeleteActivity() - // { - // Wait(); - // webDriver.FindElement(activity1stDeleteActionBttn).Click(); - - // WaitUntil(activityPropertiesModal); - // sharedModals.ModalClickOKBttn(); - // } - - // public void SaveActivityChanges() - // { - // Wait(); - // ButtonElement("Save"); - // } - - // public void CancelActivityChanges() - // { - // Wait(); - // ButtonElement("Cancel"); - // } - - // public Boolean IsActivityBlocked() - // { - // Wait(); - // webDriver.FindElement(activityDetailsEditBttn).Click(); - // return webDriver.FindElements(activityDescriptionTextArea).Count() == 0; - // } - - // public int totalActivities() - // { - // return webDriver.FindElements(activitiesListTotal).Count(); - // } - } -} diff --git a/testing/PIMS.Tests.Automation/PageObjects/Contacts.cs b/testing/PIMS.Tests.Automation/PageObjects/Contacts.cs index adce518e5e..1e8b413b04 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/Contacts.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/Contacts.cs @@ -7,7 +7,7 @@ namespace PIMS.Tests.Automation.PageObjects public class Contacts : PageObjectBase { //Contact Menu Elements - private By menuContactsButton = By.XPath("//a/label[contains(text(),'Contacts')]/parent::a"); + private By menuContactsButton = By.CssSelector("div[data-testid='nav-tooltip-contacts'] a"); private By createContactButton = By.XPath("//a[contains(text(),'Add a Contact')]"); //Contacts Create Elements diff --git a/testing/PIMS.Tests.Automation/PageObjects/DigitalDocuments.cs b/testing/PIMS.Tests.Automation/PageObjects/DigitalDocuments.cs index d7768d0378..6a5f885d1c 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/DigitalDocuments.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/DigitalDocuments.cs @@ -271,25 +271,34 @@ public class DigitalDocuments: PageObjectBase private By documentFilterNameInput = By.XPath("//input[@data-testid='document-filename']"); private By documentFilterSearchBttn = By.XPath("//input[@id='input-filename']/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/button[@data-testid='search']"); private By documentFilterResetBttn = By.XPath("//input[@id='input-filename']/parent::div/parent::div/parent::div/parent::div/following-sibling::div/div/div/button[@data-testid='reset-button']"); - + + //Document List Sortable Columns Elements + private By documentDocumentTypeSortBttn = By.CssSelector("div[data-testid='sort-column-documentType']"); + private By documentDocumentNameSortBttn = By.CssSelector("div[data-testid='sort-column-fileName']"); + private By documentDocumentUploadedDateSortBttn = By.CssSelector("div[data-testid='sort-column-appCreateTimestamp']"); + private By documentDocumentStatusSortBttn = By.CssSelector("div[data-testid='sort-column-statusTypeCode']"); + //Documents Tab List Results - private By documentTableResults = By.XPath("//div[@data-testid='documentsTable']"); + private By documentTableListView = By.XPath("//div[@data-testid='documentsTable']"); private By documentTableTypeColumn = By.XPath("//div[@data-testid='documentsTable']/div/div/div/div[contains(text(),'Document type')]"); private By documentTableNameColumn = By.XPath("//div[@data-testid='documentsTable']/div/div/div/div[contains(text(),'File name')]"); private By documentTableDateColumn = By.XPath("//div[@data-testid='documentsTable']/div/div/div/div[contains(text(),'Uploaded')]"); private By documentTableStatusColumn = By.XPath("//div[@data-testid='documentsTable']/div/div/div/div[contains(text(),'Status')]"); private By documentTableActionsColumn = By.XPath("//div[@data-testid='documentsTable']/div/div/div/div[contains(text(),'Actions')]"); - private By documentTableContentTotal = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div"); + private By documentTableContentTotal = By.CssSelector("div[data-testid='documentsTable'] div[class='tbody'] div[class='tr-wrapper']"); private By documentTableWaitSpinner = By.CssSelector("div[class='table-loading']"); //Activities Documents List 1st Result Elements - private By documentTableResults1stDownloadBttn = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[5]/div/div/div/button[@data-testid='document-download-button']"); + private By documentTableResults1stDocumentTypeContent = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[1]"); + private By documentTableResults1stDocumentNameContent = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[2]/button/div"); + private By documentTableResults1stDocumentStatusContent = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[4]"); private By documentTableResults1stViewBttn = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[5]/div/div/button[@data-testid='document-view-button']"); private By documentTableResults1stDeleteBttn = By.XPath("//div[@data-testid='documentsTable']/div[@class='tbody']/div[1]/div/div[5]/div/div/button[@data-testid='document-delete-button']"); //Documents Tab Pagination private By documentPagination = By.XPath("//div[@class='row']/div[4]/ul[@class='pagination']"); private By documentMenuPagination = By.XPath("//div[@class='row']/div[3]/div[@class='Menu-root']"); + private By documentPaginationPrevPageLink = By.CssSelector("ul[class='pagination'] a[aria-label='Previous page']"); private By documentPaginationNextPageLink = By.CssSelector("ul[class='pagination'] a[aria-label='Next page']"); public DigitalDocuments(IWebDriver webDriver) : base(webDriver) @@ -301,6 +310,12 @@ public void NavigateDocumentsTab() webDriver.FindElement(documentsTab).Click(); } + public void NavigateToFirstPageDocumentsTable() + { + WaitUntilVisible(documentPaginationPrevPageLink); + FocusAndClick(documentPaginationPrevPageLink); + } + public void AddNewDocument(string fileType) { if (fileType.Equals("Lease") || fileType.Equals("CDOGS Templates") || fileType.Equals("Project")) @@ -390,27 +405,76 @@ public void VerifyDocumentsListView(string fileType) WaitUntilVisible(documentFilterTypeSelect); if (fileType.Equals("CDOGS Templates") || fileType.Equals("Project")) { - Assert.True(webDriver.FindElement(documentsTitle).Displayed); - Assert.True(webDriver.FindElement(addDocumentBttn).Displayed); + AssertTrueIsDisplayed(documentsTitle); + AssertTrueIsDisplayed(addDocumentBttn); } else { - Assert.True(webDriver.FindElement(documentsFileTitle).Displayed); - Assert.True(webDriver.FindElement(addFileDocumentBttn).Displayed); - + AssertTrueIsDisplayed(documentsFileTitle); + AssertTrueIsDisplayed(addFileDocumentBttn); } - Assert.True(webDriver.FindElement(documentFilterTypeSelect).Displayed); - Assert.True(webDriver.FindElement(documentFilterStatusSelect).Displayed); - Assert.True(webDriver.FindElement(documentFilterNameInput).Displayed); - Assert.True(webDriver.FindElement(documentFilterSearchBttn).Displayed); - Assert.True(webDriver.FindElement(documentFilterResetBttn).Displayed); - - Assert.True(webDriver.FindElement(documentTableResults).Displayed); - Assert.True(webDriver.FindElement(documentTableTypeColumn).Displayed); - Assert.True(webDriver.FindElement(documentTableNameColumn).Displayed); - Assert.True(webDriver.FindElement(documentTableDateColumn).Displayed); - Assert.True(webDriver.FindElement(documentTableStatusColumn).Displayed); - Assert.True(webDriver.FindElement(documentTableActionsColumn).Displayed); + AssertTrueIsDisplayed(documentFilterTypeSelect); + AssertTrueIsDisplayed(documentFilterStatusSelect); + AssertTrueIsDisplayed(documentFilterNameInput); + AssertTrueIsDisplayed(documentFilterSearchBttn); + AssertTrueIsDisplayed(documentFilterResetBttn); + + AssertTrueIsDisplayed(documentTableListView); + AssertTrueIsDisplayed(documentTableTypeColumn); + AssertTrueIsDisplayed(documentTableNameColumn); + AssertTrueIsDisplayed(documentTableDateColumn); + AssertTrueIsDisplayed(documentTableStatusColumn); + AssertTrueIsDisplayed(documentTableActionsColumn); + } + + public void VerifyPaginationElements() + { + AssertTrueIsDisplayed(documentPagination); + AssertTrueIsDisplayed(documentMenuPagination); + AssertTrueIsDisplayed(documentPaginationPrevPageLink); + AssertTrueIsDisplayed(documentPaginationNextPageLink); + } + + public int DigitalDocumentsTableResultNumber() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElements(documentTableContentTotal).Count; + } + + public void OrderByDocumentFileType() + { + WaitUntilClickable(documentDocumentTypeSortBttn); + webDriver.FindElement(documentDocumentTypeSortBttn).Click(); + } + + public void OrderByDocumentFileName() + { + WaitUntilClickable(documentDocumentNameSortBttn); + webDriver.FindElement(documentDocumentNameSortBttn).Click(); + } + + public void OrderByDocumentFileStatus() + { + WaitUntilClickable(documentDocumentStatusSortBttn); + webDriver.FindElement(documentDocumentStatusSortBttn).Click(); + } + + public string FirstDocumentFileType() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(documentTableResults1stDocumentTypeContent).Text; + } + + public string FirstDocumentFileName() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(documentTableResults1stDocumentNameContent).Text; + } + + public string FirstDocumentFileStatus() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(documentTableResults1stDocumentStatusContent).Text; } public void FilterByType(string documentType) @@ -1331,24 +1395,24 @@ private void VerifyBCAssessmentFields() VerifyGeneralUploadDocumentForm(); AssertTrueIsDisplayed(documentCivicAddressLabel); AssertTrueIsDisplayed(documentCivicAddressInput); - webDriver.FindElement(documentCivicAddressInput).Click(); - webDriver.FindElement(documentCivicAddressLabel).Click(); - AssertTrueIsDisplayed(documentBCAssessmentTypeAddressMandatory); + //webDriver.FindElement(documentCivicAddressInput).Click(); + //webDriver.FindElement(documentCivicAddressLabel).Click(); + //AssertTrueIsDisplayed(documentBCAssessmentTypeAddressMandatory); AssertTrueIsDisplayed(documentBCAssessmentTypeJurisdictionLabel); AssertTrueIsDisplayed(documentBCAssessmentTypeJurisdictionInput); - webDriver.FindElement(documentBCAssessmentTypeJurisdictionInput).Click(); - webDriver.FindElement(documentBCAssessmentTypeJurisdictionLabel).Click(); - AssertTrueIsDisplayed(documentBCAssessmentTypeJurisdictionMandatory); + //webDriver.FindElement(documentBCAssessmentTypeJurisdictionInput).Click(); + //webDriver.FindElement(documentBCAssessmentTypeJurisdictionLabel).Click(); + //AssertTrueIsDisplayed(documentBCAssessmentTypeJurisdictionMandatory); AssertTrueIsDisplayed(documentBCAssessmentTypeRollLabel); AssertTrueIsDisplayed(documentBCAssessmentTypeRollInput); AssertTrueIsDisplayed(documentYearLabel); AssertTrueIsDisplayed(documentYearInput); - webDriver.FindElement(documentYearInput).Click(); - webDriver.FindElement(documentYearLabel).Click(); - AssertTrueIsDisplayed(documentBCAssessmentTypeYearMandatory); + //webDriver.FindElement(documentYearInput).Click(); + //webDriver.FindElement(documentYearLabel).Click(); + //AssertTrueIsDisplayed(documentBCAssessmentTypeYearMandatory); } private void VerifyTransferAdministrationFields() @@ -1361,24 +1425,24 @@ private void VerifyTransferAdministrationFields() AssertTrueIsDisplayed(documentMOTIFileLabel); AssertTrueIsDisplayed(documentTypeMotiFileInput); - webDriver.FindElement(documentTypeMotiFileInput).Click(); - webDriver.FindElement(documentMOTIFileLabel).Click(); - AssertTrueIsDisplayed(documentTransferAdmTypeMOTIFileMandatory); + //webDriver.FindElement(documentTypeMotiFileInput).Click(); + //webDriver.FindElement(documentMOTIFileLabel).Click(); + //AssertTrueIsDisplayed(documentTransferAdmTypeMOTIFileMandatory); AssertTrueIsDisplayed(documentTransferAdmTypeProIdLabel); AssertTrueIsDisplayed(documentTypePropertyIdentifierInput); AssertTrueIsDisplayed(documentRoadNameLabel); AssertTrueIsDisplayed(documentRoadNameInput); - webDriver.FindElement(documentRoadNameInput).Click(); - webDriver.FindElement(documentRoadNameLabel).Click(); - AssertTrueIsDisplayed(documentTransferAdmTypeRoadNameMandatory); + //webDriver.FindElement(documentRoadNameInput).Click(); + //webDriver.FindElement(documentRoadNameLabel).Click(); + //AssertTrueIsDisplayed(documentTransferAdmTypeRoadNameMandatory); AssertTrueIsDisplayed(documentTransferAdmTypeTransferLabel); AssertTrueIsDisplayed(documentTransferAdmTypeTransferInput); - webDriver.FindElement(documentTransferAdmTypeTransferInput).Click(); - webDriver.FindElement(documentTransferAdmTypeTransferLabel).Click(); - AssertTrueIsDisplayed(documentTransferAdmTypeTransferMandatory); + //webDriver.FindElement(documentTransferAdmTypeTransferInput).Click(); + //webDriver.FindElement(documentTransferAdmTypeTransferLabel).Click(); + //AssertTrueIsDisplayed(documentTransferAdmTypeTransferMandatory); } private void VerifyMinisterialOrderFields() @@ -1405,15 +1469,15 @@ private void VerifyCanadaLandsSurveyFields() VerifyGeneralUploadDocumentForm(); AssertTrueIsDisplayed(documentCanLandSurveyTypeCanLandSurveyLabel); AssertTrueIsDisplayed(documentCanLandSurveyTypeCanLandSurveyInput); - webDriver.FindElement(documentCanLandSurveyTypeCanLandSurveyInput).Click(); - webDriver.FindElement(documentCanLandSurveyTypeCanLandSurveyLabel).Click(); - AssertTrueIsDisplayed(documentCanLandSurveyTypeCanLandSurveyMandatory); + //webDriver.FindElement(documentCanLandSurveyTypeCanLandSurveyInput).Click(); + //webDriver.FindElement(documentCanLandSurveyTypeCanLandSurveyLabel).Click(); + //AssertTrueIsDisplayed(documentCanLandSurveyTypeCanLandSurveyMandatory); AssertTrueIsDisplayed(documentCanLandSurveyTypeIndianReserveLabel); AssertTrueIsDisplayed(documentCanLandSurveyTypeIndianReserveInput); - webDriver.FindElement(documentCanLandSurveyTypeIndianReserveInput).Click(); - webDriver.FindElement(documentCanLandSurveyTypeIndianReserveLabel).Click(); - AssertTrueIsDisplayed(documentCanLandSurveyTypeIndianReserveMandatory); + //webDriver.FindElement(documentCanLandSurveyTypeIndianReserveInput).Click(); + //webDriver.FindElement(documentCanLandSurveyTypeIndianReserveLabel).Click(); + //AssertTrueIsDisplayed(documentCanLandSurveyTypeIndianReserveMandatory); } private void VerifyPhotosCorrespondenceFields() @@ -1465,9 +1529,9 @@ private void VerifyHistoricalFileFields() AssertTrueIsDisplayed(documentHistoricFileTypeFileLabel); AssertTrueIsDisplayed(documentHistoricFileTypeFileInput); - webDriver.FindElement(documentHistoricFileTypeFileInput).Click(); - webDriver.FindElement(documentHistoricFileTypeFileLabel).Click(); - AssertTrueIsDisplayed(documentHistoricFileTypeFileMandatory); + //webDriver.FindElement(documentHistoricFileTypeFileInput).Click(); + //webDriver.FindElement(documentHistoricFileTypeFileLabel).Click(); + //AssertTrueIsDisplayed(documentHistoricFileTypeFileMandatory); AssertTrueIsDisplayed(documentHistoricFileTypePhyLocationLabel); AssertTrueIsDisplayed(documentHistoricFileTypePhyLocationInput); @@ -1484,9 +1548,9 @@ private void VerifyCrownGrantFields() VerifyGeneralUploadDocumentForm(); AssertTrueIsDisplayed(documentCrownGrantTypeCrownLabel); AssertTrueIsDisplayed(documentCrownGrantTypeCrownInput); - webDriver.FindElement(documentCrownGrantTypeCrownInput).Click(); - webDriver.FindElement(documentCrownGrantTypeCrownLabel).Click(); - AssertTrueIsDisplayed(documentCrownGrantTypeCrownMandatory); + //webDriver.FindElement(documentCrownGrantTypeCrownInput).Click(); + //webDriver.FindElement(documentCrownGrantTypeCrownLabel).Click(); + //AssertTrueIsDisplayed(documentCrownGrantTypeCrownMandatory); } private void VerifyPrivyCouncilFields() @@ -1496,9 +1560,9 @@ private void VerifyPrivyCouncilFields() VerifyGeneralUploadDocumentForm(); AssertTrueIsDisplayed(documentPrivyCouncilTypePrivyLabel); AssertTrueIsDisplayed(documentPrivyCouncilTypePrivyInput); - webDriver.FindElement(documentPrivyCouncilTypePrivyInput).Click(); - webDriver.FindElement(documentPrivyCouncilTypePrivyLabel).Click(); - AssertTrueIsDisplayed(documentPrivyCounciltTypePrivyMandatory); + //webDriver.FindElement(documentPrivyCouncilTypePrivyInput).Click(); + //webDriver.FindElement(documentPrivyCouncilTypePrivyLabel).Click(); + //AssertTrueIsDisplayed(documentPrivyCounciltTypePrivyMandatory); } private void VerifyOICFields() @@ -1560,15 +1624,15 @@ private void VerifyGazetteFields() AssertTrueIsDisplayed(documentGazettePublishedDateLabel); AssertTrueIsDisplayed(documentGazettePublishedDateInput); - webDriver.FindElement(documentGazettePublishedDateInput).Click(); - webDriver.FindElement(documentGazettePublishedDateLabel).Click(); - AssertTrueIsDisplayed(documentGazettePublishedDateMandatory); + //webDriver.FindElement(documentGazettePublishedDateInput).Click(); + //webDriver.FindElement(documentGazettePublishedDateLabel).Click(); + //AssertTrueIsDisplayed(documentGazettePublishedDateMandatory); AssertTrueIsDisplayed(documentGazettePublishedTypeLabel); AssertTrueIsDisplayed(documentGazettePublishedTypeInput); - webDriver.FindElement(documentGazettePublishedTypeInput).Click(); - webDriver.FindElement(documentGazettePublishedTypeLabel).Click(); - AssertTrueIsDisplayed(documentGazettePublishedTypeMandatory); + //webDriver.FindElement(documentGazettePublishedTypeInput).Click(); + //webDriver.FindElement(documentGazettePublishedTypeLabel).Click(); + //AssertTrueIsDisplayed(documentGazettePublishedTypeMandatory); AssertTrueIsDisplayed(documentGazetteLegalSurveyPlanLabel); AssertTrueIsDisplayed(documentLegalSurveyInput); @@ -1579,9 +1643,9 @@ private void VerifyGazetteFields() AssertTrueIsDisplayed(documentRoadNameLabel); AssertTrueIsDisplayed(documentRoadNameInput); - webDriver.FindElement(documentRoadNameInput).Click(); - webDriver.FindElement(documentRoadNameLabel).Click(); - AssertTrueIsDisplayed(documentGazetteRoadNameMandatory); + //webDriver.FindElement(documentRoadNameInput).Click(); + //webDriver.FindElement(documentRoadNameLabel).Click(); + //AssertTrueIsDisplayed(documentGazetteRoadNameMandatory); } private void VerifyPAPlansFields() @@ -1591,9 +1655,9 @@ private void VerifyPAPlansFields() VerifyGeneralUploadDocumentForm(); AssertTrueIsDisplayed(documentPAPlanNbrLabel); AssertTrueIsDisplayed(documentPAPlanNbrInput); - webDriver.FindElement(documentPAPlanNbrInput).Click(); - webDriver.FindElement(documentPAPlanNbrLabel).Click(); - AssertTrueIsDisplayed(documentPAPlanNbrMandatory); + //webDriver.FindElement(documentPAPlanNbrInput).Click(); + //webDriver.FindElement(documentPAPlanNbrLabel).Click(); + //AssertTrueIsDisplayed(documentPAPlanNbrMandatory); AssertTrueIsDisplayed(documentPAPlanRevisionLabel); AssertTrueIsDisplayed(documentPAPlanRevisionInput); @@ -1602,9 +1666,9 @@ private void VerifyPAPlansFields() AssertTrueIsDisplayed(documentPAPlanProjectNameLabel); AssertTrueIsDisplayed(documentPAPlanProjectNameInput); - webDriver.FindElement(documentPAPlanProjectNameInput).Click(); - webDriver.FindElement(documentPAPlanProjectNameLabel).Click(); - AssertTrueIsDisplayed(documentPAPlanProjectNameMandatory); + //webDriver.FindElement(documentPAPlanProjectNameInput).Click(); + //webDriver.FindElement(documentPAPlanProjectNameLabel).Click(); + //AssertTrueIsDisplayed(documentPAPlanProjectNameMandatory); } private void VerifyShortDescriptorField() diff --git a/testing/PIMS.Tests.Automation/PageObjects/FinancialCodes.cs b/testing/PIMS.Tests.Automation/PageObjects/FinancialCodes.cs index d727a2a52e..4b972e18e8 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/FinancialCodes.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/FinancialCodes.cs @@ -22,10 +22,15 @@ public class FinancialCodes : PageObjectBase //Financial Codes Table private By financialCodeTableHeaderCodeValue = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Code value')]"); + private By financialCodeTableCodeSortBttn = By.CssSelector("div[data-testid='sort-column-code']"); private By financialCodeTableHeaderCodeDescription = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Code description')]"); + private By financialCodeTableDescriptionSortBttn = By.CssSelector("div[data-testid='sort-column-description']"); private By financialCodeTableHeaderCodeType = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Code type')]"); + private By financialCodeTableTypeSortBttn = By.CssSelector("div[data-testid='sort-column-type']"); private By financialCodeTableHeaderEffectiveDate = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Effective date')]"); + private By financialCodeTableEffectiveDateSortBttn = By.CssSelector("div[data-testid='sort-column-effectiveDate']"); private By financialCodeTableHeaderExpiryDate = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Expiry date')]"); + private By financialCodeTableExpiryDateSortBttn = By.CssSelector("div[data-testid='sort-column-expiryDate']"); private By financialCodeTableResultsTotal = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='tbody']/div[@class='tr-wrapper']"); private By financialResults1stResultCodeValue = By.XPath("//div[@data-testid='FinancialCodeTable']/div[@class='tbody']/div[@class='tr-wrapper'][1]/div/div[1]/a"); @@ -142,9 +147,49 @@ public void FilterFinancialCode(string value) webDriver.FindElement(financialCodeSearchBttn).Click(); } + public void FilterFinancialCodeByType(string value) + { + WaitUntilClickable(financialCodeResetBttn); + webDriver.FindElement(financialCodeResetBttn).Click(); + + WaitUntilVisible(financialCodeTypeSelect); + ChooseSpecificSelectOption(financialCodeTypeSelect, value); + webDriver.FindElement(financialCodeSearchBttn).Click(); + } + + public void OrderByFinancialCodeValue() + { + WaitUntilClickable(financialCodeTableCodeSortBttn); + webDriver.FindElement(financialCodeTableCodeSortBttn).Click(); + } + + public void OrderByFinancialCodeDescription() + { + WaitUntilClickable(financialCodeTableDescriptionSortBttn); + webDriver.FindElement(financialCodeTableDescriptionSortBttn).Click(); + } + + public void OrderByFinancialCodeType() + { + WaitUntilClickable(financialCodeTableTypeSortBttn); + webDriver.FindElement(financialCodeTableTypeSortBttn).Click(); + } + + public void OrderByFinancialCodeEffectiveDate() + { + WaitUntilClickable(financialCodeTableEffectiveDateSortBttn); + webDriver.FindElement(financialCodeTableEffectiveDateSortBttn).Click(); + } + + public void OrderByFinancialCodeExpiryDate() + { + WaitUntilClickable(financialCodeTableExpiryDateSortBttn); + webDriver.FindElement(financialCodeTableExpiryDateSortBttn).Click(); + } + public int CountTotalFinancialCodeResults() { - Wait(); + WaitUntilTableSpinnerDisappear(); return webDriver.FindElements(financialCodeTableResultsTotal).Count(); } @@ -154,6 +199,36 @@ public Boolean DuplicateErrorMessageDisplayed() return webDriver.FindElement(financialCodeDuplicateErrorMessage).Displayed; } + public string FirstFinancialCodeValue() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(financialResults1stResultCodeValue).Text; + } + + public string FirstFinancialCodeDescription() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(financialResults1stResultCodeDescription).Text; + } + + public string FirstFinancialCodeType() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(financialResults1stResultCodeType).Text; + } + + public string FirstFinancialCodeEffectiveDate() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(financialResults1stResultEffectiveDate).Text; + } + + public string FirstFinancialCodeExpiryDate() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(financialResults1stResultExpiryDate).Text; + } + public void ChooseFirstSearchCodeValue() { WaitUntilClickable(financialResults1stResultCodeValue); @@ -162,95 +237,94 @@ public void ChooseFirstSearchCodeValue() public void VerifyFinancialCodeListView() { - WaitUntilVisible(financialCodeTitle); - Assert.True(webDriver.FindElement(financialCodeTitle).Displayed); - Assert.True(webDriver.FindElement(financialCodeTypeSelect).Displayed); - Assert.True(webDriver.FindElement(financialCodeDescriptionInput).Displayed); - Assert.True(webDriver.FindElement(financialCodeShowExpiredInput).Displayed); - Assert.True(webDriver.FindElement(financialCodeShowExpiredSpan).Displayed); - Assert.True(webDriver.FindElement(financialCodeSearchBttn).Displayed); - Assert.True(webDriver.FindElement(financialCodeResetBttn).Displayed); - Assert.True(webDriver.FindElement(financialCodeCreateNewBttn).Displayed); - - Assert.True(webDriver.FindElement(financialCodeTableHeaderCodeValue).Displayed); - Assert.True(webDriver.FindElement(financialCodeTableHeaderCodeDescription).Displayed); - Assert.True(webDriver.FindElement(financialCodeTableHeaderCodeType).Displayed); - Assert.True(webDriver.FindElement(financialCodeTableHeaderEffectiveDate).Displayed); - Assert.True(webDriver.FindElement(financialCodeTableHeaderExpiryDate).Displayed); - Assert.True(webDriver.FindElements(financialCodeTableResultsTotal).Count() > 1); - - Assert.True(webDriver.FindElement(financialCodePaginationEntries).Displayed); - Assert.True(webDriver.FindElement(financialCodePaginationList).Displayed); + AssertTrueIsDisplayed(financialCodeTitle); + AssertTrueIsDisplayed(financialCodeTypeSelect); + AssertTrueIsDisplayed(financialCodeDescriptionInput); + AssertTrueIsDisplayed(financialCodeShowExpiredInput); + AssertTrueIsDisplayed(financialCodeShowExpiredSpan); + AssertTrueIsDisplayed(financialCodeSearchBttn); + AssertTrueIsDisplayed(financialCodeResetBttn); + AssertTrueIsDisplayed(financialCodeCreateNewBttn); + + AssertTrueIsDisplayed(financialCodeTableHeaderCodeValue); + AssertTrueIsDisplayed(financialCodeTableHeaderCodeDescription); + AssertTrueIsDisplayed(financialCodeTableHeaderCodeType); + AssertTrueIsDisplayed(financialCodeTableHeaderEffectiveDate); + AssertTrueIsDisplayed(financialCodeTableHeaderExpiryDate); + + Assert.True(webDriver.FindElements(financialCodeTableResultsTotal).Count() > 0); + + AssertTrueIsDisplayed(financialCodePaginationEntries); + AssertTrueIsDisplayed(financialCodePaginationList); } public void VerifyCreateNewFinancialCodeForm() { - WaitUntilVisible(financialCodeCreateTitle); - Assert.True(webDriver.FindElement(financialCodeCreateTitle).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormTypeLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormTypeSelect).Displayed); + AssertTrueIsDisplayed(financialCodeCreateTitle); + + AssertTrueIsDisplayed(financialCodeFormTypeLabel); + AssertTrueIsDisplayed(financialCodeFormTypeSelect); webDriver.FindElement(financialCodeFormTypeSelect).Click(); webDriver.FindElement(financialCodeFormTypeLabel).Click(); - Assert.True(webDriver.FindElement(financialCodeFormTypeErrorMessage).Displayed); + AssertTrueIsDisplayed(financialCodeFormTypeErrorMessage); - Assert.True(webDriver.FindElement(financialCodeFormValueLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormValueInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormValueLabel); + AssertTrueIsDisplayed(financialCodeFormValueInput); webDriver.FindElement(financialCodeFormValueInput).Click(); webDriver.FindElement(financialCodeFormValueLabel).Click(); - Assert.True(webDriver.FindElement(financialCodeFormValueErrorMessage).Displayed); + AssertTrueIsDisplayed(financialCodeFormValueErrorMessage); - Assert.True(webDriver.FindElement(financialCodeFormDescriptionLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormDescriptionInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormDescriptionLabel); + AssertTrueIsDisplayed(financialCodeFormDescriptionInput); webDriver.FindElement(financialCodeFormDescriptionInput).Click(); webDriver.FindElement(financialCodeFormDescriptionLabel).Click(); - Assert.True(webDriver.FindElement(financialCodeFormDescriptionErrorMessage).Displayed); + AssertTrueIsDisplayed(financialCodeFormDescriptionErrorMessage); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateTooltip).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateLabel); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateTooltip); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateInput); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateTooltip).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormExpiryDateLabel); + AssertTrueIsDisplayed(financialCodeFormExpiryDateTooltip); + AssertTrueIsDisplayed(financialCodeFormExpiryDateInput); - Assert.True(webDriver.FindElement(financialCodeFormOrderLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormOrderInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormOrderLabel); + AssertTrueIsDisplayed(financialCodeFormOrderInput); - Assert.True(webDriver.FindElement(financialCodeFormCancelBttn).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormSaveBttn).Displayed); + AssertTrueIsDisplayed(financialCodeFormCancelBttn); + AssertTrueIsDisplayed(financialCodeFormSaveBttn); } public void VerifyUpdateFinancialCodeForm() { - WaitUntilVisible(financialCodeUpdateTitle); - Assert.True(webDriver.FindElement(financialCodeUpdateTitle).Displayed); + AssertTrueIsDisplayed(financialCodeUpdateTitle); - Assert.True(webDriver.FindElement(financialCodeFormTypeLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormValueContent).Displayed); + AssertTrueIsDisplayed(financialCodeFormTypeLabel); + AssertTrueIsDisplayed(financialCodeFormValueContent); - Assert.True(webDriver.FindElement(financialCodeFormValueLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormValueInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormValueLabel); + AssertTrueIsDisplayed(financialCodeFormValueInput); - Assert.True(webDriver.FindElement(financialCodeFormDescriptionLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormDescriptionInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormDescriptionLabel); + AssertTrueIsDisplayed(financialCodeFormDescriptionInput); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateTooltip).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormEffectiveDateInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateLabel); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateTooltip); + AssertTrueIsDisplayed(financialCodeFormEffectiveDateInput); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateTooltip).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormExpiryDateInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormExpiryDateLabel); + AssertTrueIsDisplayed(financialCodeFormExpiryDateTooltip); + AssertTrueIsDisplayed(financialCodeFormExpiryDateInput); - Assert.True(webDriver.FindElement(financialCodeFormOrderLabel).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormOrderInput).Displayed); + AssertTrueIsDisplayed(financialCodeFormOrderLabel); + AssertTrueIsDisplayed(financialCodeFormOrderInput); - Assert.True(webDriver.FindElement(financialCodeFormCancelBttn).Displayed); - Assert.True(webDriver.FindElement(financialCodeFormSaveBttn).Displayed); + AssertTrueIsDisplayed(financialCodeFormCancelBttn); + AssertTrueIsDisplayed(financialCodeFormSaveBttn); } } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/LeaseDetails.cs b/testing/PIMS.Tests.Automation/PageObjects/LeaseDetails.cs index ad62aa3a93..8727e042a0 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/LeaseDetails.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/LeaseDetails.cs @@ -8,7 +8,7 @@ namespace PIMS.Tests.Automation.PageObjects public class LeaseDetails : PageObjectBase { //Main Menu links Elements - private By menuManagementButton = By.XPath("//a/label[contains(text(),'Management')]/parent::a"); + private By menuManagementButton = By.CssSelector("div[data-testid='nav-tooltip-leases&licenses'] a"); private By createLicenseButton = By.XPath("//a[contains(text(),'Create a Lease/License File')]"); //File Details Edit Icon diff --git a/testing/PIMS.Tests.Automation/PageObjects/Notes.cs b/testing/PIMS.Tests.Automation/PageObjects/Notes.cs index dcbc7c92ba..bdb37048d0 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/Notes.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/Notes.cs @@ -22,17 +22,6 @@ public class Notes : PageObjectBase private By notesTab1stResultViewBttn = By.XPath("//div[@data-testid='notesTable']/div[@class='tbody']/div[@class='tr-wrapper'][2]/div/div[4]/div/button[@title='View Note']"); private By notesTab1stResultDeleteBttn = By.XPath("//div[@data-testid='notesTable']/div[@class='tbody']/div[@class='tr-wrapper'][1]/div/div[4]/div/button[@title='Delete Note']"); - //Notes Add New button Element - //private By notesAddNoteBttn = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/h2/div/div/div/div[contains(text(),'Notes')]/following-sibling::div/button"); - - //Notes List View Elements - //private By notesTitle = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/h2/div/div/div/div[contains(text(),'Notes')]"); - //private By notesTable = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/div/div[@data-testid='notesTable']"); - //private By notesNoteColumn = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/div/div[@data-testid='notesTable']/div/div/div/div[contains(text(),'Note')]"); - //private By notesCreatedDateColumn = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/div/div[@data-testid='notesTable']/div/div/div/div[contains(text(),'Created date')]"); - //private By notesCreatedByColumn = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/div/div[@data-testid='notesTable']/div/div/div/div[contains(text(),'Last updated by')]"); - //private By notesBodyRows = By.XPath("//div[@data-testid='activity-tray']/div[2]/div/div[2]/div[7]/div/div/div/div[@data-testid='notesTable']/div[@class='tbody']/div[@class='tr-wrapper']"); - //Notes 1st result Elements private By note1stViewNoteBttn = By.CssSelector("div[data-testid='notesTable'] div[class='tbody'] div[class='tr-wrapper']:nth-child(1) div[role='cell']:nth-child(4) div button[title='View Note']"); private By note1stNoteContent = By.CssSelector("div[data-testid='notesTable'] div[class='tbody'] div[class='tr-wrapper']:nth-child(1) div[class='tr'] div[class='td']:nth-child(1)"); @@ -81,8 +70,8 @@ public void NavigateNotesTab() public void CreateNotesTabButton() { - Wait(2000); - webDriver.FindElement(notesTabAddBttn).Click(); + Wait(3000); + FocusAndClick(notesTabAddBttn); } public void AddNewNoteDetails(string note) @@ -132,74 +121,69 @@ public void DeleteLastSecondNote() webDriver.FindElement(note2ndDeleteNoteBttn).Click(); WaitUntilVisible(notesDeletePopupHeader); - Assert.True(webDriver.FindElement(notesDeletePopupHeader).Text.Equals("Delete Note")); - Assert.True(webDriver.FindElement(notesDeletePopupBody).Text.Equals("Are you sure you want to delete this note?")); + AssertTrueContentEquals(notesDeletePopupHeader, "Delete Note"); + AssertTrueContentEquals(notesDeletePopupBody, "Are you sure you want to delete this note?"); + webDriver.FindElement(notesDeleteOkBttn).Click(); } public void VerifyNotesAddNew() { - WaitUntilVisible(notesAddDetailsHeader); - Assert.True(webDriver.FindElement(notesAddDetailsHeader).Displayed); - Assert.True(webDriver.FindElement(notesAddDetailsHeader).Text == "Notes"); - Assert.True(webDriver.FindElement(notesAddDetailsLabel).Displayed); - Assert.True(webDriver.FindElement(notesAddDetailsTextarea).Displayed); - Assert.True(webDriver.FindElement(notesAddDetailsSaveBttn).Displayed); - Assert.True(webDriver.FindElement(notesAddDetailsCancelBttn).Displayed); + AssertTrueIsDisplayed(notesAddDetailsHeader); + AssertTrueContentEquals(notesAddDetailsHeader, "Notes"); + AssertTrueIsDisplayed(notesAddDetailsLabel); + AssertTrueIsDisplayed(notesAddDetailsTextarea); + AssertTrueIsDisplayed(notesAddDetailsSaveBttn); + AssertTrueIsDisplayed(notesAddDetailsCancelBttn); } public void VerifyNotesEditForm() { - WaitUntilVisible(notesEditCreatedLabel); - Assert.True(webDriver.FindElement(notesEditCreatedLabel).Displayed); - Assert.True(webDriver.FindElement(notesEditCreatedDate).Displayed); - Assert.True(webDriver.FindElement(notesEditCreatedBy).Displayed); + AssertTrueIsDisplayed(notesEditCreatedLabel); + AssertTrueIsDisplayed(notesEditCreatedDate); + AssertTrueIsDisplayed(notesEditCreatedBy); if(webDriver.FindElements(notesEditUpdatedLabel).Count > 0) - Assert.True(webDriver.FindElement(notesEditUpdatedDate).Displayed); + AssertTrueIsDisplayed(notesEditUpdatedDate); - Assert.True(webDriver.FindElement(notesEditUpdatedBy).Displayed); - Assert.True(webDriver.FindElement(notedEditBttn).Displayed); - Assert.True(webDriver.FindElement(noteEditViewTextarea).Displayed); - Assert.True(webDriver.FindElement(notesAddDetailsSaveBttn).Displayed); + AssertTrueIsDisplayed(notesEditUpdatedBy); + AssertTrueIsDisplayed(notedEditBttn); + AssertTrueIsDisplayed(noteEditViewTextarea); + AssertTrueIsDisplayed(notesAddDetailsSaveBttn); } public void VerifyNotesTabListView() { Wait(3000); - Assert.True(webDriver.FindElement(notesTabTitle).Displayed); - Assert.True(webDriver.FindElement(notesTabAddBttn).Displayed); - Assert.True(webDriver.FindElement(notesTabTableHeaderNoteColumn).Displayed); - Assert.True(webDriver.FindElement(notesTabTableHeaderCreatedDateColumn).Displayed); - Assert.True(webDriver.FindElement(notesTabTableHeaderUpdatedByColumn).Displayed); + AssertTrueIsDisplayed(notesTabTitle); + AssertTrueIsDisplayed(notesTabAddBttn); + AssertTrueIsDisplayed(notesTabTableHeaderNoteColumn); + AssertTrueIsDisplayed(notesTabTableHeaderCreatedDateColumn); + AssertTrueIsDisplayed(notesTabTableHeaderUpdatedByColumn); if (webDriver.FindElements(notesTabTableContentTotal).Count > 0) - { - Assert.True(webDriver.FindElement(notesTabTableBody).Displayed); - } + AssertTrueIsDisplayed(notesTabTableBody); else - { - Assert.True(webDriver.FindElement(notesTabTableNoContent).Displayed); - } + AssertTrueIsDisplayed(notesTabTableNoContent); } public int NotesTabCount() { - Wait(); + WaitUntilTableSpinnerDisappear(); return webDriver.FindElements(notesTabTableContentTotal).Count(); } public void VerifyAutomaticNotes(string fileType, string fromStatus, string toStatus) { WaitUntilVisibleText(note1stNoteContent, webDriver.FindElement(note1stNoteContent).Text); - Assert.True(webDriver.FindElement(note1stNoteContent).Text == fileType + " status changed from "+ fromStatus +" to " + toStatus); + AssertTrueContentEquals(note1stNoteContent, fileType + " status changed from "+ fromStatus +" to " + toStatus); } public void VerifyAutomaticNotesCompensation(string CompensationNbr, string fromStatus, string toStatus) { WaitUntilVisibleText(note1stNoteContent, webDriver.FindElement(note1stNoteContent).Text); - Assert.True(webDriver.FindElement(note1stNoteContent).Text == "Compensation Requisition with # " + CompensationNbr + ", changed status from '"+ fromStatus +"' to '" + toStatus + "'"); + AssertTrueContentEquals(note1stNoteContent, "Compensation Requisition with # " + CompensationNbr + ", changed status from '"+ fromStatus +"' to '" + toStatus + "'"); } } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/Projects.cs b/testing/PIMS.Tests.Automation/PageObjects/Projects.cs index 8148a9cf32..f6f37120ee 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/Projects.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/Projects.cs @@ -1,12 +1,13 @@ using OpenQA.Selenium; using PIMS.Tests.Automation.Classes; +using System.Text.RegularExpressions; namespace PIMS.Tests.Automation.PageObjects { public class Projects : PageObjectBase { //Menu Elements - private By projectMenuBttn = By.XPath("//a/label[contains(text(),'Project')]/parent::a"); + private By projectMenuBttn = By.CssSelector("div[data-testid='nav-tooltip-project'] a"); private By createProjectButton = By.XPath("//a[contains(text(),'Create Project')]"); private By projectDetailTabLink = By.CssSelector("a[data-rb-event-key='projectDetails]"); @@ -79,8 +80,9 @@ public class Projects : PageObjectBase private By projectSaveButton = By.XPath("//div[contains(text(),'Save')]/parent::button"); //Modals Elements - private By deleteProductModal = By.CssSelector("div[class='modal-dialog']"); - private By duplicateProjectToast = By.CssSelector("div[class='Toastify__toast-body']"); + private By productDeleteModal = By.CssSelector("div[class='modal-dialog']"); + private By projectDuplicateToast = By.CssSelector("div[class='Toastify__toast-body']"); + private By projectOverrideConfirmationModal = By.CssSelector("div[class='modal-content']"); private SharedModals sharedModals; @@ -218,34 +220,22 @@ public void UpdateProject(Project project) public void UpdateProduct(Product product, int index) { - By productCodeDynamicInput = By.Id("input-products."+ index +".code"); - By productNameDynamicInput = By.Id("input-products."+ index +".description"); By productStartDateDynamicInput = By.Id("datepicker-products."+ index +".startDate"); By productCostEstimateDynamicInput = By.Id("input-products."+ index +".costEstimate"); By productEstimateDateDynamicInput = By.Id("datepicker-products."+ index +".costEstimateDate"); By productObjectiveDynamicInput = By.Id("input-products."+ index +".objective"); By productScopeDynamicInput = By.Id("input-products."+ index +".scope"); - WaitUntilClickable(productCodeDynamicInput); + //Cleaning previous input - if (webDriver.FindElements(productEstimateDateDynamicInput).Count > 0) { ClearInput(productEstimateDateDynamicInput); } - ClearInput(productCodeDynamicInput); - ClearInput(productCodeDynamicInput); - ClearInput(productNameDynamicInput); + if (webDriver.FindElements(productEstimateDateDynamicInput).Count > 0) + ClearInput(productEstimateDateDynamicInput); + ClearInput(productStartDateDynamicInput); ClearInput(productCostEstimateDynamicInput); ClearInput(productObjectiveDynamicInput); ClearInput(productScopeDynamicInput); - - if (product.ProductCode != "") - { - webDriver.FindElement(productCodeDynamicInput).SendKeys(product.ProductCode); - } - if (product.ProductName != "") - { - webDriver.FindElement(productNameDynamicInput).SendKeys(product.ProductName); - } if (product.StartDate != "") { webDriver.FindElement(productStartDateDynamicInput).SendKeys(product.StartDate); @@ -275,8 +265,9 @@ public void DeleteProduct(int productIndex) WaitUntilClickable(deleteButtonElement); webDriver.FindElement(deleteButtonElement).Click(); - if (webDriver.FindElements(deleteProductModal).Count > 0) + if (webDriver.FindElements(productDeleteModal).Count > 0) { + Wait(); Assert.True(sharedModals.ModalHeader().Equals("Remove Product")); Assert.True(sharedModals.ModalContent().Equals("Deleting this product will remove it from all \"Product\" dropdowns. Are you certain you wish to proceed?")); sharedModals.ModalClickOKBttn(); @@ -287,6 +278,18 @@ public void SaveProject() { WaitUntilClickable(projectSaveButton); FocusAndClick(projectSaveButton); + + Wait(); + if (webDriver.FindElements(projectOverrideConfirmationModal).Count() > 0) + { + if (sharedModals.ModalHeader().Equals("User Override Required")) + { + Assert.Contains("can also be found in one or more other projects. Please verify the correct product is being added", sharedModals.ModalContent()); + } + sharedModals.ModalClickOKBttn(); + } + + AssertTrueIsDisplayed(projectEditButton); } public void CancelProject() @@ -297,33 +300,34 @@ public void CancelProject() public void VerifyCreateProjectForm() { - WaitUntilVisible(projectNameLabel); - Assert.True(webDriver.FindElement(projectCreateTitle).Displayed); - Assert.True(webDriver.FindElement(projectInstructionParagraph).Displayed); - - Assert.True(webDriver.FindElement(projectNameLabel).Displayed); - Assert.True(webDriver.FindElement(projectNameInput).Displayed); - Assert.True(webDriver.FindElement(projectNumberLabel).Displayed); - Assert.True(webDriver.FindElement(projectNumberInput).Displayed); - Assert.True(webDriver.FindElement(projectStatusLabel).Displayed); - Assert.True(webDriver.FindElement(projectStatusSelect).Displayed); - Assert.True(webDriver.FindElement(projectMOTIRegionLabel).Displayed); - Assert.True(webDriver.FindElement(projectMOTIRegionInput).Displayed); - Assert.True(webDriver.FindElement(projectSummaryLabel).Displayed); - Assert.True(webDriver.FindElement(projectSummaryTextarea).Displayed); - - Assert.True(webDriver.FindElement(projectCostTypeLabel).Displayed); - Assert.True(webDriver.FindElement(projectCostTypeSelect).Displayed); - Assert.True(webDriver.FindElement(projectWorkActivityLabel).Displayed); - Assert.True(webDriver.FindElement(projectWorkActivitySelect).Displayed); - Assert.True(webDriver.FindElement(projectBusinessFunctionLabel).Displayed); - Assert.True(webDriver.FindElement(projectBusinessFunctionSelect).Displayed); - - Assert.True(webDriver.FindElement(projectAssociatedProdsSubtitle).Displayed); - Assert.True(webDriver.FindElement(projectAddProductButton).Displayed); + Wait(2000); - Assert.True(webDriver.FindElement(projectCancelButton).Displayed); - Assert.True(webDriver.FindElement(projectSaveButton).Displayed); + AssertTrueIsDisplayed(projectCreateTitle); + AssertTrueIsDisplayed(projectInstructionParagraph); + + AssertTrueIsDisplayed(projectNameLabel); + AssertTrueIsDisplayed(projectNameInput); + AssertTrueIsDisplayed(projectNumberLabel); + AssertTrueIsDisplayed(projectNumberInput); + AssertTrueIsDisplayed(projectStatusLabel); + AssertTrueIsDisplayed(projectStatusSelect); + AssertTrueIsDisplayed(projectMOTIRegionLabel); + AssertTrueIsDisplayed(projectMOTIRegionInput); + AssertTrueIsDisplayed(projectSummaryLabel); + AssertTrueIsDisplayed(projectSummaryTextarea); + + AssertTrueIsDisplayed(projectCostTypeLabel); + AssertTrueIsDisplayed(projectCostTypeSelect); + AssertTrueIsDisplayed(projectWorkActivityLabel); + AssertTrueIsDisplayed(projectWorkActivitySelect); + AssertTrueIsDisplayed(projectBusinessFunctionLabel); + AssertTrueIsDisplayed(projectBusinessFunctionSelect); + + AssertTrueIsDisplayed(projectAssociatedProdsSubtitle); + AssertTrueIsDisplayed(projectAddProductButton); + + AssertTrueIsDisplayed(projectCancelButton); + AssertTrueIsDisplayed(projectSaveButton); } public void VerifyCreateProductForm() @@ -331,20 +335,20 @@ public void VerifyCreateProductForm() WaitUntilClickable(projectAddProductButton); webDriver.FindElement(projectAddProductButton).Click(); - WaitUntilVisible(productCodeLabel); - Assert.True(webDriver.FindElement(productCodeLabel).Displayed); - Assert.True(webDriver.FindElement(productCodeInput).Displayed); - Assert.True(webDriver.FindElement(productNameLabel).Displayed); - Assert.True(webDriver.FindElement(productNameInput).Displayed); - Assert.True(webDriver.FindElement(productStartDateLabel).Displayed); - Assert.True(webDriver.FindElement(productStartDateInput).Displayed); - Assert.True(webDriver.FindElement(productCostEstimateLabel).Displayed); - Assert.True(webDriver.FindElement(productCostEstimateInput).Displayed); - Assert.True(webDriver.FindElement(productObjectiveLabel).Displayed); - Assert.True(webDriver.FindElement(productObjectiveInput).Displayed); - Assert.True(webDriver.FindElement(productScopeLabel).Displayed); - Assert.True(webDriver.FindElement(productScopeInput).Displayed); - Assert.True(webDriver.FindElement(productDeleteButton).Displayed); + Wait(); + AssertTrueIsDisplayed(productCodeLabel); + AssertTrueIsDisplayed(productCodeInput); + AssertTrueIsDisplayed(productNameLabel); + AssertTrueIsDisplayed(productNameInput); + AssertTrueIsDisplayed(productStartDateLabel); + AssertTrueIsDisplayed(productStartDateInput); + AssertTrueIsDisplayed(productCostEstimateLabel); + AssertTrueIsDisplayed(productCostEstimateInput); + AssertTrueIsDisplayed(productObjectiveLabel); + AssertTrueIsDisplayed(productObjectiveInput); + AssertTrueIsDisplayed(productScopeLabel); + AssertTrueIsDisplayed(productScopeInput); + AssertTrueIsDisplayed(productDeleteButton); DeleteProduct(1); } @@ -406,86 +410,77 @@ public void VerifyProductViewForm(Product product, int index, string validationT By productScopeContent = By.XPath("//div[contains(text(),'Associated Products')]/parent::div/parent::h2/following-sibling::div/div[" + child + "]/div/div/label[contains(text(),'Scope')]/parent::div/following-sibling::div"); WaitUntilVisible(productStartDateLabel); + if (validationType == "Create") { - Assert.True(webDriver.FindElement(productHeader).Displayed); - Assert.True(webDriver.FindElement(productStartDateLabel).Displayed); - Assert.True(webDriver.FindElement(productStartDateContent).Text.Equals(TransformDateFormat(product.StartDate))); - Assert.True(webDriver.FindElement(productCostEstimateLabel).Displayed); + AssertTrueIsDisplayed(productHeader); + AssertTrueIsDisplayed(productStartDateLabel); + AssertTrueContentEquals(productStartDateContent, TransformDateFormat(product.StartDate)); + AssertTrueIsDisplayed(productCostEstimateLabel); + if (product.EstimateDate != "") - { - Assert.True(webDriver.FindElement(productCostEstimateContent).Text.Equals(TransformCurrencyFormat(product.CostEstimate) + " as of " + TransformDateFormat(product.EstimateDate))); - } + AssertTrueContentEquals(productCostEstimateContent, TransformCurrencyFormat(product.CostEstimate) + " as of " + TransformDateFormat(product.EstimateDate)); else - { - Assert.True(webDriver.FindElement(productCostEstimateContent).Text.Equals(TransformCurrencyFormat(product.CostEstimate) + " no estimate date entered")); - } - Assert.True(webDriver.FindElement(productObjectivesLabel).Displayed); + AssertTrueContentEquals(productCostEstimateContent, TransformCurrencyFormat(product.CostEstimate) + " no estimate date entered"); + + AssertTrueIsDisplayed(productObjectivesLabel); + if (product.Objectives != "") - { - Assert.True(webDriver.FindElement(productObjectivesContent).Text.Equals(product.Objectives)); - } + AssertTrueContentEquals(productObjectivesContent, product.Objectives); else - { - Assert.True(webDriver.FindElement(productObjectivesContent).Text.Equals("no objective entered")); - } - Assert.True(webDriver.FindElement(productScopeLabel).Displayed); + AssertTrueContentEquals(productObjectivesContent, "no objective entered"); + + AssertTrueIsDisplayed(productScopeLabel); if (product.Scope != "") - { - Assert.True(webDriver.FindElement(productScopeContent).Text.Equals(product.Scope)); - } + + AssertTrueContentEquals(productScopeContent, product.Scope); else - { - Assert.True(webDriver.FindElement(productScopeContent).Text.Equals("no scope entered")); - } + AssertTrueContentEquals(productScopeContent, "no scope entered"); } else { - Assert.True(webDriver.FindElement(productHeader).Displayed); - Assert.True(webDriver.FindElement(productStartDateLabel).Displayed); - Assert.True(webDriver.FindElement(productStartDateContent).Text.Equals(TransformDateFormat(product.StartDate))); - Assert.True(webDriver.FindElement(productCostEstimateLabel).Displayed); + AssertTrueIsDisplayed(productHeader); + AssertTrueIsDisplayed(productStartDateLabel); + AssertTrueContentEquals(productStartDateContent, TransformDateFormat(product.StartDate)); + AssertTrueIsDisplayed(productCostEstimateLabel); + if (product.EstimateDate != "") - { - Assert.True(webDriver.FindElement(productCostEstimateContent).Text.Equals(TransformCurrencyFormat(product.CostEstimate) + " as of " + TransformDateFormat(product.EstimateDate))); - } + AssertTrueContentEquals(productCostEstimateContent, TransformCurrencyFormat(product.CostEstimate) + " as of " + TransformDateFormat(product.EstimateDate)); else - { - Assert.True(webDriver.FindElement(productCostEstimateContent).Text.Equals(TransformCurrencyFormat(product.CostEstimate) + " no estimate date entered")); - } - Assert.True(webDriver.FindElement(productObjectivesLabel).Displayed); + AssertTrueContentEquals(productCostEstimateContent, TransformCurrencyFormat(product.CostEstimate) + " no estimate date entered"); + + AssertTrueIsDisplayed(productObjectivesLabel); + if (product.Objectives != "") - { - Assert.True(webDriver.FindElement(productObjectivesContent).Text.Equals(product.Objectives)); - } + AssertTrueContentEquals(productObjectivesContent, product.Objectives); else if (product.Objectives != "") - { - Assert.True(webDriver.FindElement(productObjectivesContent).Text.Equals(product.Objectives)); - } + AssertTrueContentEquals(productObjectivesContent, product.Objectives); else - { - Assert.True(webDriver.FindElement(productObjectivesContent).Text.Equals("no objective entered")); - } - Assert.True(webDriver.FindElement(productScopeLabel).Displayed); + AssertTrueContentEquals(productObjectivesContent, "no objective entered"); + + AssertTrueIsDisplayed(productScopeLabel); if (product.Scope != "") - { - Assert.True(webDriver.FindElement(productScopeContent).Text.Equals(product.Scope)); - } + AssertTrueContentEquals(productScopeContent, product.Scope); else if (product.Scope != "") - { - Assert.True(webDriver.FindElement(productScopeContent).Text.Equals(product.Scope)); - } - else - { - Assert.True(webDriver.FindElement(productScopeContent).Text.Equals("no scope entered")); - } + AssertTrueContentEquals(productScopeContent, product.Scope); + else + AssertTrueContentEquals(productScopeContent, "no scope entered"); } } - public Boolean duplicateProject() + public Boolean DuplicateProject() { Wait(); - return webDriver.FindElements(duplicateProjectToast).Count > 0; + return webDriver.FindElements(projectDuplicateToast).Count > 0; + } + + public string GetProjectName() + { + WaitUntilVisible(projectHeaderProjectNameContent); + + var totalProjectName = webDriver.FindElement(projectHeaderProjectNameContent).Text; + return Regex.Match(totalProjectName, "[^ ]* (.*)").Groups[1].Value; } + } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/ResearchFiles.cs b/testing/PIMS.Tests.Automation/PageObjects/ResearchFiles.cs index 42bc697cee..1997cd169a 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/ResearchFiles.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/ResearchFiles.cs @@ -8,7 +8,7 @@ namespace PIMS.Tests.Automation.PageObjects public class ResearchFiles : PageObjectBase { //Research File Menu options - private By menuResearchButton = By.XPath("//a/label[contains(text(),'Research')]/parent::a"); + private By menuResearchButton = By.CssSelector("div[data-testid='nav-tooltip-research'] a"); private By createResearchFileButton = By.XPath("//a[contains(text(),'Create a Research File')]"); //File Details Tab Element diff --git a/testing/PIMS.Tests.Automation/PageObjects/SearchAcquisitionFiles.cs b/testing/PIMS.Tests.Automation/PageObjects/SearchAcquisitionFiles.cs index 9deb53d438..01b6521f98 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/SearchAcquisitionFiles.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/SearchAcquisitionFiles.cs @@ -7,7 +7,7 @@ namespace PIMS.Tests.Automation.PageObjects { public class SearchAcquisitionFiles : PageObjectBase { - private By menuAcquisitionButton = By.XPath("//a/label[contains(text(),'Acquisition')]/parent::a"); + private By menuAcquisitionButton = By.CssSelector("div[data-testid='nav-tooltip-acquisition'] a"); private By searchAcquisitionButton = By.XPath("//a[contains(text(),'Manage Acquisition Files')]"); //Acquisition File Search Filters Elements @@ -25,12 +25,16 @@ public class SearchAcquisitionFiles : PageObjectBase //Acquisition Files List Elements private By searchAcquisitionFileNumberHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Acquisition file #')]"); + private By searchAcquisitionOrderFileNumberBttn = By.CssSelector("div[data-testid='sort-column-fileNumber']"); + private By searchAcquisitionLegacyNumberHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Historical file #')]"); + private By searchAcquisitionOrderLegacyNumberBttn = By.CssSelector("div[data-testid='sort-column-legacyFileNumber']"); private By searchAcquisitionFileNameHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Acquisition file name')]"); + private By searchAcquisitionOrderFileNameBttn = By.CssSelector("div[data-testid='sort-column-fileName']"); private By searchAcquisitionFileMOTIRegionHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'MOTI Region')]"); private By searchAcquisitionFileProjectHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Project')]"); private By searchAcquisitionFileAddressHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Civic Address')]"); private By searchAcquisitionFileStatusHeader = By.XPath("//div[@role='table']/div[@class='thead thead-light']/div/div/div[contains(text(),'Status')]"); - private By searchAcquisitionFileTableContent = By.XPath("//div[@role='table']/div[@class='tbody']/div"); + private By searchAcquisitionFileTableContent = By.CssSelector("div[data-testid='acquisitionFilesTable'] div[class='tbody'] div[class='tr-wrapper']"); //Search Acquisition File Pagination private By searchAcquisitionFilePaginationMenu = By.CssSelector("div[class='Menu-root']"); @@ -93,6 +97,24 @@ public void SearchLastAcquisitionFile() webDriver.FindElement(searchAcquisitionFileSortByAFileBttn).Click(); } + public void OrderByAcquisitionFileNumber() + { + WaitUntilClickable(searchAcquisitionOrderFileNumberBttn); + webDriver.FindElement(searchAcquisitionOrderFileNumberBttn).Click(); + } + + public void OrderByAcquisitionFileHistoricalNumber() + { + WaitUntilClickable(searchAcquisitionOrderLegacyNumberBttn); + webDriver.FindElement(searchAcquisitionOrderLegacyNumberBttn).Click(); + } + + public void OrderByAcquisitionFileName() + { + WaitUntilClickable(searchAcquisitionOrderFileNameBttn); + webDriver.FindElement(searchAcquisitionOrderFileNameBttn).Click(); + } + public void SelectFirstOption() { WaitUntilClickable(searchAcquisitionFile1stResultLink); @@ -122,6 +144,30 @@ public Boolean SearchFoundResults() return webDriver.FindElements(searchAcquisitionFile1stResult).Count > 0; } + public string FirstAcquisitionFileNumber() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchAcquisitionFile1stResultLink).Text; + } + + public string FirstAcquisitionLegacyFileNumber() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchAcquisitionFile1stResultHistoricalFile).Text; + } + + public string FirstAcquisitionFileName() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchAcquisitionFile1stResultName).Text; + } + + public int AcquisitionFileTableResultNumber() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElements(searchAcquisitionFileTableContent).Count; + } + public void VerifyAcquisitionFileListView() { Wait(); @@ -141,7 +187,11 @@ public void VerifyAcquisitionFileListView() //Acquisition Files List View AssertTrueIsDisplayed(searchAcquisitionFileNumberHeader); + AssertTrueIsDisplayed(searchAcquisitionOrderFileNumberBttn); + AssertTrueIsDisplayed(searchAcquisitionLegacyNumberHeader); + AssertTrueIsDisplayed(searchAcquisitionOrderLegacyNumberBttn); AssertTrueIsDisplayed(searchAcquisitionFileNameHeader); + AssertTrueIsDisplayed(searchAcquisitionOrderFileNameBttn); AssertTrueIsDisplayed(searchAcquisitionFileMOTIRegionHeader); AssertTrueIsDisplayed(searchAcquisitionFileProjectHeader); AssertTrueIsDisplayed(searchAcquisitionFileAddressHeader); @@ -160,7 +210,7 @@ public void VerifyAcquisitionFileTableContent(AcquisitionFile acquisition) AssertTrueContentEquals(searchAcquisitionFile1stResultName, acquisition.AcquisitionFileName); AssertTrueContentEquals(searchAcquisitionFile1stResultMOTIRegion, acquisition.AcquisitionMOTIRegion); AssertTrueContentEquals(searchAcquisitionFile1stResultProject, acquisition.AcquisitionProjCode + " " + acquisition.AcquisitionProject); - Assert.True(webDriver.FindElements(searchAcquisitionFile1stResultAddress).Count() > 0); + Assert.True(webDriver.FindElements(searchAcquisitionFile1stResultAddress).Count().Equals(0)); AssertTrueContentEquals(searchAcquisitionFile1stResultStatus, acquisition.AcquisitionStatus); } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/SearchContacts.cs b/testing/PIMS.Tests.Automation/PageObjects/SearchContacts.cs index 8f243f7789..d8b9a4e27b 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/SearchContacts.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/SearchContacts.cs @@ -5,7 +5,7 @@ namespace PIMS.Tests.Automation.PageObjects { public class SearchContacts : PageObjectBase { - private By menuContactsButton = By.XPath("//a/label[contains(text(),'Contacts')]/parent::a"); + private By menuContactsButton = By.CssSelector("div[data-testid='nav-tooltip-contacts'] a"); private By searchContactButton = By.XPath("//a[contains(text(),'Manage Contacts')]"); private By searchContactOrgRadioBttn = By.Id("input-organizations"); diff --git a/testing/PIMS.Tests.Automation/PageObjects/SearchLease.cs b/testing/PIMS.Tests.Automation/PageObjects/SearchLease.cs index 3ef170565f..b185f02b21 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/SearchLease.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/SearchLease.cs @@ -7,7 +7,7 @@ namespace PIMS.Tests.Automation.PageObjects public class SearchLease : PageObjectBase { //Main Menu Elements - private By menuManagementButton = By.XPath("//a/label[contains(text(),'Management')]/parent::a"); + private By menuManagementButton = By.CssSelector("div[data-testid='nav-tooltip-leases&licenses'] a"); private By searchLicenseButton = By.XPath("//a[contains(text(),'Manage Lease/License Files')]"); private By searchLicenseTitle = By.XPath("//h3[contains(text(),'Leases & Licenses')]"); diff --git a/testing/PIMS.Tests.Automation/PageObjects/SearchProjects.cs b/testing/PIMS.Tests.Automation/PageObjects/SearchProjects.cs index 380989cdbc..851cd7efa2 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/SearchProjects.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/SearchProjects.cs @@ -9,7 +9,7 @@ namespace PIMS.Tests.Automation.PageObjects public class SearchProjects : PageObjectBase { //Menu Elements - private By projectMenuBttn = By.XPath("//a/label[contains(text(),'Project')]/parent::a"); + private By projectMenuBttn = By.CssSelector("div[data-testid='nav-tooltip-project'] a"); private By manageProjectButton = By.XPath("//a[contains(text(),'Manage Project')]"); //Search Projects Filters Elements @@ -24,13 +24,18 @@ public class SearchProjects : PageObjectBase //Search Projects Table Column header Elements private By searchProjectNbrHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Project #')]"); + private By searchProjectNbrOrderBttn = By.CssSelector("div[data-testid='sort-column-code']"); private By searchProjectNameHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Project name')]"); + private By searchProjectNameOrderBttn = By.CssSelector("div[data-testid='sort-column-description']"); private By searchProjectRegionHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Region')]"); private By searchProjectStatusHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Status')]"); private By searchProjectLastUpdatedByHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Last updated by')]"); + private By searchProjectLastUpdatedByOrderBttn = By.CssSelector("div[data-testid='sort-column-lastUpdatedBy']"); private By searchProjectUpdatedDateHeaderColumn = By.XPath("//div[@data-testid='projectsTable']/div[@class='thead thead-light']/div/div/div[contains(text(),'Updated date')]"); + private By searchProjectLastUpdatedDateOrderBttn = By.CssSelector("div[data-testid='sort-column-lastUpdatedDate']"); //Search Projects Table 1st result Element + private By searchProject1stResult = By.CssSelector("div[data-testid='projectsTable'] div[class='tbody'] div[class='tr-wrapper']:nth-child(1)"); private By searchProject1stResultNbrLink = By.XPath("//div[@data-testid='projectsTable']/div[@class='tbody']/div[@class='tr-wrapper'][1]/div/div[1]/a"); private By searchProject1stResultNameLink = By.XPath("//div[@data-testid='projectsTable']/div[@class='tbody']/div[@class='tr-wrapper'][1]/div/div[2]/a"); private By searchProject1stResultRegionContent = By.XPath("//div[@data-testid='projectsTable']/div[@class='tbody']/div[@class='tr-wrapper'][1]/div/div[3]"); @@ -41,10 +46,13 @@ public class SearchProjects : PageObjectBase private By searchProjectTotalCount = By.XPath("//div[@data-testid='projectsTable']/div[@class='tbody']/div[@class='tr-wrapper']"); + //Search Projects Pagination elements private By searchProjectShowEntries = By.CssSelector("div[class='Menu-root']"); private By searchProjectPagination = By.CssSelector("ul[class='pagination']"); + public SearchProjects(IWebDriver webDriver) : base(webDriver) {} + //Navigates to Search a Project public void NavigateToSearchProject() { @@ -124,30 +132,54 @@ public void SelectFirstResult() webDriver.FindElement(searchProject1stResultNbrLink).Click(); } + public void OrderByProjectNumber() + { + WaitUntilClickable(searchProjectNbrOrderBttn); + webDriver.FindElement(searchProjectNbrOrderBttn).Click(); + } + + public void OrderByProjectName() + { + WaitUntilClickable(searchProjectNameOrderBttn); + webDriver.FindElement(searchProjectNameOrderBttn).Click(); + } + + public void OrderByProjectLastUpdatedBy() + { + WaitUntilClickable(searchProjectLastUpdatedByOrderBttn); + webDriver.FindElement(searchProjectLastUpdatedByOrderBttn).Click(); + } + + public void OrderByProjectLastUpdatedDate() + { + WaitUntilClickable(searchProjectLastUpdatedDateOrderBttn); + webDriver.FindElement(searchProjectLastUpdatedDateOrderBttn).Click(); + } + public void VerifySearchView() { WaitUntilVisible(searchProjectSubtitle); //Search Projects Filters Section - Assert.True(webDriver.FindElement(searchProjectSubtitle).Displayed); - Assert.True(webDriver.FindElement(searchProjectNumberInput).Displayed); - Assert.True(webDriver.FindElement(searchProjectNameInput).Displayed); - Assert.True(webDriver.FindElement(searchProjectRegionSelect).Displayed); - Assert.True(webDriver.FindElement(searchProjectStatusSelect).Displayed); - Assert.True(webDriver.FindElement(searchProjectButton).Displayed); - Assert.True(webDriver.FindElement(searchProjectResetButton).Displayed); - Assert.True(webDriver.FindElement(searchProjectAddProjectBttn).Displayed); + AssertTrueIsDisplayed(searchProjectSubtitle); + AssertTrueIsDisplayed(searchProjectNumberInput); + AssertTrueIsDisplayed(searchProjectNameInput); + AssertTrueIsDisplayed(searchProjectRegionSelect); + AssertTrueIsDisplayed(searchProjectStatusSelect); + AssertTrueIsDisplayed(searchProjectButton); + AssertTrueIsDisplayed(searchProjectResetButton); + AssertTrueIsDisplayed(searchProjectAddProjectBttn); //Search Projects Table Column header Elements - Assert.True(webDriver.FindElement(searchProjectNbrHeaderColumn).Displayed); - Assert.True(webDriver.FindElement(searchProjectNameHeaderColumn).Displayed); - Assert.True(webDriver.FindElement(searchProjectRegionHeaderColumn).Displayed); - Assert.True(webDriver.FindElement(searchProjectStatusHeaderColumn).Displayed); - Assert.True(webDriver.FindElement(searchProjectLastUpdatedByHeaderColumn).Displayed); - Assert.True(webDriver.FindElement(searchProjectUpdatedDateHeaderColumn).Displayed); - - Assert.True(webDriver.FindElement(searchProjectShowEntries).Displayed); - Assert.True(webDriver.FindElement(searchProjectPagination).Displayed); + AssertTrueIsDisplayed(searchProjectNbrHeaderColumn); + AssertTrueIsDisplayed(searchProjectNameHeaderColumn); + AssertTrueIsDisplayed(searchProjectRegionHeaderColumn); + AssertTrueIsDisplayed(searchProjectStatusHeaderColumn); + AssertTrueIsDisplayed(searchProjectLastUpdatedByHeaderColumn); + AssertTrueIsDisplayed(searchProjectUpdatedDateHeaderColumn); + + AssertTrueIsDisplayed(searchProjectShowEntries); + AssertTrueIsDisplayed(searchProjectPagination); } public void VerifyViewSearchResult(Project project) @@ -155,19 +187,48 @@ public void VerifyViewSearchResult(Project project) DateTime thisDay = DateTime.Today; string today = thisDay.ToString("MMM d, yyyy"); - WaitUntilVisible(searchProject1stResultNbrLink); - Assert.True(webDriver.FindElement(searchProject1stResultNbrLink).Text.Equals(project.Number)); - Assert.True(webDriver.FindElement(searchProject1stResultNameLink).Text.Equals(project.Name)); - Assert.True(webDriver.FindElement(searchProject1stResultRegionContent).Text.Equals(project.ProjectMOTIRegion)); - Assert.True(webDriver.FindElement(searchProject1stResultStatusContent).Text.Equals(project.ProjectStatus)); - Assert.True(webDriver.FindElement(searchProject1stResultLastUpdatedByContent).Text.Equals(project.UpdatedBy)); - Assert.True(webDriver.FindElement(searchProject1stResultLastUpdatedDateContent).Text.Equals(today)); + AssertTrueContentEquals(searchProject1stResultNbrLink, project.Number); + AssertTrueContentEquals(searchProject1stResultNameLink, project.Name); + AssertTrueContentEquals(searchProject1stResultRegionContent, project.ProjectMOTIRegion); + AssertTrueContentEquals(searchProject1stResultStatusContent, project.ProjectStatus); + AssertTrueContentEquals(searchProject1stResultLastUpdatedByContent, project.UpdatedBy); + AssertTrueContentEquals(searchProject1stResultLastUpdatedDateContent, today); } - public int TotalSearchedProjects() + public int ProjectsTableResultNumber() { - Wait(2000); + WaitUntilTableSpinnerDisappear(); return webDriver.FindElements(searchProjectTotalCount).Count(); } + + public Boolean SearchFoundResults() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElements(searchProject1stResult).Count > 0; + } + + public string FirstProjectCode() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchProject1stResultNbrLink).Text; + } + + public string FirstProjectName() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchProject1stResultNameLink).Text; + } + + public string FirstProjectLastUpdatedBy() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchProject1stResultLastUpdatedByContent).Text; + } + + public string FirstProjectLastUpdatedDate() + { + WaitUntilTableSpinnerDisappear(); + return webDriver.FindElement(searchProject1stResultLastUpdatedDateContent).Text; + } } } diff --git a/testing/PIMS.Tests.Automation/PageObjects/SearchResearchFiles.cs b/testing/PIMS.Tests.Automation/PageObjects/SearchResearchFiles.cs index 07df61dc6c..e3d20c6a4c 100644 --- a/testing/PIMS.Tests.Automation/PageObjects/SearchResearchFiles.cs +++ b/testing/PIMS.Tests.Automation/PageObjects/SearchResearchFiles.cs @@ -5,7 +5,7 @@ namespace PIMS.Tests.Automation.PageObjects { public class SearchResearchFiles : PageObjectBase { - private By menuResearchButton = By.XPath("//a/label[contains(text(),'Research')]/parent::a"); + private By menuResearchButton = By.CssSelector("div[data-testid='nav-tooltip-research'] a"); private By searchResearchButton = By.XPath("//a[contains(text(),'Manage Research File')]"); //Search Research File Elements diff --git a/testing/PIMS.Tests.Automation/PageObjects/SharedPagination.cs b/testing/PIMS.Tests.Automation/PageObjects/SharedPagination.cs new file mode 100644 index 0000000000..9eb058274d --- /dev/null +++ b/testing/PIMS.Tests.Automation/PageObjects/SharedPagination.cs @@ -0,0 +1,49 @@ +using OpenQA.Selenium; + +namespace PIMS.Tests.Automation.PageObjects +{ + public class SharedPagination : PageObjectBase + { + //Search Acquisition File Pagination + + private By searchTableEntriesSpan = By.XPath("//span[contains(text(),'Entries')]"); + private By searchTablePagination5 = By.CssSelector("div[title='menu-item-5']"); + private By searchTablePagination10 = By.CssSelector("div[title='menu-item-10']"); + private By searchTablePagination20 = By.CssSelector("div[title='menu-item-20']"); + private By searchTablePagination50 = By.CssSelector("div[title='menu-item-50']"); + private By searchTablePagination100 = By.CssSelector("div[title='menu-item-100']"); + + public SharedPagination(IWebDriver webDriver) : base(webDriver) + {} + + public void ChoosePaginationOption(int pagination) + { + WaitUntilClickable(searchTableEntriesSpan); + webDriver.FindElement(searchTableEntriesSpan).Click(); + + switch (pagination) + { + case 5: + WaitUntilVisible(searchTablePagination5); + webDriver.FindElement(searchTablePagination5).Click(); + break; + case 10: + WaitUntilVisible(searchTablePagination10); + webDriver.FindElement(searchTablePagination10).Click(); + break; + case 20: + WaitUntilClickable(searchTablePagination20); + webDriver.FindElement(searchTablePagination20).Click(); + break; + case 50: + WaitUntilClickable(searchTablePagination50); + webDriver.FindElement(searchTablePagination50).Click(); + break; + case 100: + WaitUntilClickable(searchTablePagination100); + webDriver.FindElement(searchTablePagination100).Click(); + break; + } + } + } +} diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/AcquisitionFileSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/AcquisitionFileSteps.cs index 23af72dbfe..6a15f7b640 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/AcquisitionFileSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/AcquisitionFileSteps.cs @@ -15,6 +15,7 @@ public class AcquisitionFileSteps private readonly AcquisitionFilesDetails acquisitionFilesDetails; private readonly SearchAcquisitionFiles searchAcquisitionFiles; private readonly SharedSearchProperties sharedSearchProperties; + private readonly SharedPagination sharedPagination; private readonly SearchProperties searchProperties; private readonly AcquisitionProperties acquisitionProperties; private readonly AcquisitionTakes acquisitionTakes; @@ -27,7 +28,6 @@ public class AcquisitionFileSteps private readonly Notes notes; private readonly string userName = "TRANPSP1"; - //private readonly string userName = "sutairak"; private AcquisitionFile acquisitionFile; protected string acquisitionFileCode = ""; @@ -41,6 +41,7 @@ public AcquisitionFileSteps(BrowserDriver driver) acquisitionFilesDetails = new AcquisitionFilesDetails(driver.Current); searchAcquisitionFiles = new SearchAcquisitionFiles(driver.Current); sharedSearchProperties = new SharedSearchProperties(driver.Current); + sharedPagination = new SharedPagination(driver.Current); searchProperties = new SearchProperties(driver.Current); acquisitionProperties = new AcquisitionProperties(driver.Current); acquisitionTakes = new AcquisitionTakes(driver.Current); @@ -56,7 +57,7 @@ public AcquisitionFileSteps(BrowserDriver driver) [StepDefinition(@"I create a new Acquisition File from row number (.*)")] public void CreateAcquisitionFile(int rowNumber) { - /* TEST COVERAGE: PSP-4163, PSP-4164, PSP-4323, PSP-4553 */ + /* TEST COVERAGE: PSP-4163, PSP-4164, PSP-4165, PSP-4323, PSP-4472, PSP-4553 */ //Login to PIMS loginSteps.Idir(userName); @@ -81,7 +82,7 @@ public void CreateAcquisitionFile(int rowNumber) [StepDefinition(@"I add additional information to the Acquisition File Details")] public void AddAdditionalInfoAcquisitionFile() { - /* TEST COVERAGE: PSP-4469, PSP-4471, PSP-4553, PSP-5308, PSP-5590, PSP-5634, PSP-5637, PSP-5790, PSP-6041 */ + /* TEST COVERAGE: PSP-4469, PSP-4471, PSP-4553, PSP-5308, PSP-5590, PSP-5634, PSP-5637, PSP-5790, PSP-5979, PSP-6041 */ //Enter to Edit mode of Acquisition File acquisitionFilesDetails.EditAcquisitionFileBttn(); @@ -106,7 +107,7 @@ public void AddAdditionalInfoAcquisitionFile() [StepDefinition(@"I update the File details from an existing Acquisition File from row number (.*)")] public void UpdateFileDetails(int rowNumber) { - /* TEST COVERAGE: PSP-4331, PSP-4544, PSP-4545, PSP-5638, PSP-5639, PSP-5970 */ + /* TEST COVERAGE: PSP-4331, PSP-4544, PSP-4545, PSP-5638, PSP-5639, PSP-5970, PSP-5979s */ PopulateAcquisitionFile(rowNumber); @@ -775,7 +776,7 @@ public void UpdateExpropriation(int rowNumber) [StepDefinition(@"I create an Acquisition File from a pin on map from row number (.*)")] public void CreateAcquisitionFileFromPin(int rowNumber) { - /* TEST COVERAGE: PSP-1546, PSP-1556, PSP-4164, PSP-4167, PSP-4601, PSP-4704, PSP-5308 */ + /* TEST COVERAGE: PSP-1546, PSP-1556, PSP-4164, PSP-4165, PSP-4167, PSP-4472, PSP-4601, PSP-4704, PSP-5308 */ //Login to PIMS loginSteps.Idir(userName); @@ -880,7 +881,7 @@ public void NavigateMainResearchFileSection() [StepDefinition(@"I search for an existing Acquisition File from row number (.*)")] public void SearchExistingAcquisitionFile(int rowNumber) { - /* TEST COVERAGE: PSP-4252, PSP-5589 */ + /* TEST COVERAGE: PSP-4252, PSP-4255, PSP-5589 */ //Login to PIMS loginSteps.Idir(userName); @@ -889,15 +890,55 @@ public void SearchExistingAcquisitionFile(int rowNumber) PopulateAcquisitionFile(rowNumber); searchAcquisitionFiles.NavigateToSearchAcquisitionFile(); - //Filter research Files - searchAcquisitionFiles.FilterAcquisitionFiles(acquisitionFile.SearchProperties.PID, acquisitionFile.AcquisitionFileName, acquisitionFile.AcquisitionStatus); - Assert.True(searchAcquisitionFiles.SearchFoundResults()); + //Verify Pagination + sharedPagination.ChoosePaginationOption(5); + Assert.Equal(5, searchAcquisitionFiles.AcquisitionFileTableResultNumber()); + + sharedPagination.ChoosePaginationOption(10); + Assert.Equal(10, searchAcquisitionFiles.AcquisitionFileTableResultNumber()); + + sharedPagination.ChoosePaginationOption(20); + Assert.Equal(20, searchAcquisitionFiles.AcquisitionFileTableResultNumber()); + + sharedPagination.ChoosePaginationOption(50); + Assert.Equal(50, searchAcquisitionFiles.AcquisitionFileTableResultNumber()); + + sharedPagination.ChoosePaginationOption(100); + Assert.Equal(100, searchAcquisitionFiles.AcquisitionFileTableResultNumber()); + + //Verify Column Sorting by File Number + searchAcquisitionFiles.OrderByAcquisitionFileNumber(); + var firstFileNbrDescResult = searchAcquisitionFiles.FirstAcquisitionFileNumber(); + + searchAcquisitionFiles.OrderByAcquisitionFileNumber(); + var firstFileNbrAscResult = searchAcquisitionFiles.FirstAcquisitionFileNumber(); + + Assert.NotEqual(firstFileNbrDescResult, firstFileNbrAscResult); + //Verify Column Sorting by Historical File Number + searchAcquisitionFiles.OrderByAcquisitionFileHistoricalNumber(); + var firstHistoricalDescResult = searchAcquisitionFiles.FirstAcquisitionLegacyFileNumber(); + + searchAcquisitionFiles.OrderByAcquisitionFileHistoricalNumber(); + var firstHistoricalAscResult = searchAcquisitionFiles.FirstAcquisitionLegacyFileNumber(); + + Assert.NotEqual(firstHistoricalDescResult, firstHistoricalAscResult); + + //Verify Column Sorting by File Name + searchAcquisitionFiles.OrderByAcquisitionFileName(); + var firstFileNameDescResult = searchAcquisitionFiles.FirstAcquisitionFileName(); + + searchAcquisitionFiles.OrderByAcquisitionFileName(); + var firstFileNameAscResult = searchAcquisitionFiles.FirstAcquisitionFileName(); + + Assert.NotEqual(firstFileNameDescResult, firstFileNameAscResult); + + //Filter research Files searchAcquisitionFiles.FilterAcquisitionFiles("003-549-551", "Acquisition from Jonathan Doe", "Cancelled"); Assert.False(searchAcquisitionFiles.SearchFoundResults()); //Look for the last created research file - searchAcquisitionFiles.FilterAcquisitionFiles(acquisitionFile.SearchProperties.PID, acquisitionFile.AcquisitionFileName, acquisitionFile.AcquisitionStatus); + searchAcquisitionFiles.FilterAcquisitionFiles("", acquisitionFile.AcquisitionFileName, acquisitionFile.AcquisitionStatus); } [StepDefinition(@"A new Acquisition file is created successfully")] @@ -1152,15 +1193,17 @@ private void PopulateTakesCollection(int startRow, int rowsCount) take.SiteContamination = ExcelDataContext.ReadData(i, "SiteContamination"); take.TakeDescription = ExcelDataContext.ReadData(i, "TakeDescription"); - take.IsNewRightWay = ExcelDataContext.ReadData(i, "IsNewRightWay"); - take.IsNewRightWayArea = ExcelDataContext.ReadData(i, "IsNewRightWayArea"); - take.IsStatutoryRightWay = ExcelDataContext.ReadData(i, "IsStatutoryRightWay"); - take.IsStatutoryRightWayArea = ExcelDataContext.ReadData(i, "IsStatutoryRightWayArea"); + take.IsNewHighwayDedication = ExcelDataContext.ReadData(i, "IsNewHighwayDedication"); + take.IsNewHighwayDedicationArea = ExcelDataContext.ReadData(i, "IsNewHighwayDedicationArea"); + take.IsMotiInventory = ExcelDataContext.ReadData(i, "IsMotiInventory"); + + take.IsNewInterestLand = ExcelDataContext.ReadData(i, "IsNewInterestLand"); + take.IsNewInterestLandArea = ExcelDataContext.ReadData(i, "IsNewInterestLandArea"); - take.IsLandNotation = ExcelDataContext.ReadData(i, "IsLandNotation"); - take.IsLandNotationDetail = ExcelDataContext.ReadData(i, "IsLandNotationDetail"); - take.IsLandNotationArea = ExcelDataContext.ReadData(i, "IsLandNotationArea"); - take.IsLandNotationDate = ExcelDataContext.ReadData(i, "IsLandNotationDate"); + take.IsLandActTenure = ExcelDataContext.ReadData(i, "IsLandActTenure"); + take.IsLandActTenureDetail = ExcelDataContext.ReadData(i, "IsLandActTenureDetail"); + take.IsLandActTenureArea = ExcelDataContext.ReadData(i, "IsLandActTenureArea"); + take.IsLandActTenureDate = ExcelDataContext.ReadData(i, "IsLandActTenureDate"); take.IsLicenseConstruct = ExcelDataContext.ReadData(i, "IsLicenseConstruct"); take.IsLicenseConstructArea = ExcelDataContext.ReadData(i, "IsLicenseConstructArea"); diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/ActivitiesSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/ActivitiesSteps.cs deleted file mode 100644 index 2b835cceaf..0000000000 --- a/testing/PIMS.Tests.Automation/StepDefinitions/ActivitiesSteps.cs +++ /dev/null @@ -1,316 +0,0 @@ -using Microsoft.Extensions.Configuration; -using PIMS.Tests.Automation.Classes; - -namespace PIMS.Tests.Automation.StepDefinitions -{ - [Binding] - public class ActivitiesSteps - { - private readonly Activities activities; - private readonly Notes notes; - private readonly DigitalDocuments digitalDocuments; - private readonly IEnumerable documentFiles; - - private string activityDescription = "Automated Test - Description on activity"; - private string note1 = "Automated Test - Inserting a new note"; - private string note2 = "Automated Test - Editing existing note"; - private string note3 = "Automated Test - Editing existing note for second time"; - - private string dateSigned = "03/10/2020"; - private string motiFile = "1245-6778"; - private string pid = "004-537-360"; - private string roadName = "Automated Test Road"; - private string transferNbr = "9090876-1234"; - - private string gazettePage = "67"; - private string publishedDate = "04/15/2020"; - private string gazetteType = "Testing Gazette"; - private string legalPlan = "334-090980"; - private string LTSASchedule = "23-0909"; - private string motiPlan = "234-898999"; - - protected int totalDigitalDocumentsUploaded = 0; - - public ActivitiesSteps(BrowserDriver driver) - { - //activities = new Activities(driver.Current); - notes = new Notes(driver.Current); - digitalDocuments = new DigitalDocuments(driver.Current); - documentFiles = driver.Configuration.GetSection("UploadDocuments").Get>(); - } - - //[StepDefinition(@"I create a new activity")] - //public void CreateActivityWithproperties() - //{ - // /* TEST COVERAGE: PSP-4364, PSP-4363, PSP-4361, PSP-4360, PSP-4169, PSP-4170, PSP-4683, PSP-4478, PSP-4479, PSP-4275 */ - - // //Acess the activity tab - // activities.AccessActivitiesTab(); - - // //Create new activity - // activities.CreateNewActivity("General"); - - // //Verify activities list view - // activities.VerifyActivityListView(); - - // //Verify activity Details view - // activities.VerifyActivityDetails(); - - // //Filter Activities - // activities.FilterActivities(); - - // //Select All Properties - // activities.SelectAllProperties(); - - // //Deselect All Properties - // activities.DesectAllProperties(); - //} - - //[StepDefinition(@"I create and delete an activity")] - //public void CreateDeleteActivity() - //{ - // /* TEST COVERAGE: PSP-4275, PSP-4362, PSP-4477, PSP-4784, PSP-4785 */ - - // //Acess the activity tab - // activities.AccessActivitiesTab(); - - // //Create new activity - // activities.CreateNewActivity("General"); - - // //Verify activities list view - // activities.VerifyActivityListView(); - - // //Verify activity Details view - // activities.VerifyActivityDetails(); - - // //Check No Properties pop-up - // activities.NoProperties(); - - // //Change Status to Completed - // activities.ChangeStatus("Completed"); - // Assert.True(activities.IsActivityBlocked()); - // activities.CancelActivityChanges(); - - // //Change Status to In Progress - // activities.ChangeStatus("In Progress"); - // Assert.False(activities.IsActivityBlocked()); - // activities.CancelActivityChanges(); - - // //Change Status to Cancel - // activities.ChangeStatus("Cancelled"); - // Assert.True(activities.IsActivityBlocked()); - // activities.CancelActivityChanges(); - - // //Delete Activity - // activities.DeleteActivity(); - - //} - - //[StepDefinition(@"I create an activity with notes and delete notes")] - //public void ActivityWithNotes() - //{ - // /* TEST COVERAGE: PSP-4006, PSP-4008, PSP-4009, PSP-4010, PSP-4012, PSP-4013, PSP-4019, PSP-4021 */ - - // //Acess the activity tab - // activities.AccessActivitiesTab(); - - // //Create new activity - // activities.CreateNewActivity("File Document"); - - // //Add a new note - // notes.AddNewNote(); - - // //Verify New Note Create Form - // notes.VerifyNotesAddNew(); - - // //Create New Note - // notes.AddNewNoteDetails(note1); - - // //Save New Note - // notes.SaveNote(); - - // //Edit existing note - // notes.ViewFirstNoteButton(); - - // //Verify edit note form - // notes.VerifyNotesEditForm(); - - // //Save edited note - // notes.EditNote(note2); - // notes.SaveNote(); - - // //Edit existed note - // notes.ViewFirstNoteButton(); - // notes.EditNote(note3); - - // //Cancel edited note - // notes.CancelNote(); - - // //Create new note - // notes.AddNewNote(); - // notes.AddNewNoteDetails(note1); - - // //Cancel new note - // notes.CancelNote(); - - // //Verify List view UI/UX - // notes.VerifyNotesListView(); - - // //Delete created note - // notes.DeleteFirstNote(); - //} - - //[StepDefinition(@"I create an Acquisition File with activity and a document attached")] - //public void ActivityWithDocuments() - //{ - // /* TEST COVERAGE: PSP-4159, PSP-4339, PSP-4340, PSP-4341 PSP-4342, PSP-4343, PSP-4344, PSP-4345, PSP-4346, PSP-4347, PSP-4348, PSP-4349, PSP-4350, PSP-4351, PSP-4352, PSP-4353, PSP-4354, PSP-4355, PSP-4356, PSP-4357 */ - - // //Access the activity tab - // activities.AccessActivitiesTab(); - - // //Create new activity - // activities.CreateNewActivity("File Document"); - - // //Get total uploaded documents - // totalDigitalDocumentsUploaded = digitalDocuments.GetTotalUploadedDocuments(); - - // //Add a New Document - // digitalDocuments.AddNewDocument(); - - // //Verify different types of document types - // digitalDocuments.VerifyDocumentFields("BC assessment search"); - // digitalDocuments.VerifyDocumentFields("Privy council"); - // digitalDocuments.VerifyDocumentFields("Photos / Images/ Video"); - // digitalDocuments.VerifyDocumentFields("PA plans / Design drawings"); - // digitalDocuments.VerifyDocumentFields("Other"); - // digitalDocuments.VerifyDocumentFields("OIC"); - // digitalDocuments.VerifyDocumentFields("MoTI plan"); - // digitalDocuments.VerifyDocumentFields("Miscellaneous notes (LTSA)"); - // digitalDocuments.VerifyDocumentFields("Ministerial order"); - // digitalDocuments.VerifyDocumentFields("Title search / Historical title"); - // digitalDocuments.VerifyDocumentFields("Legal survey plan"); - // digitalDocuments.VerifyDocumentFields("Historical file"); - // digitalDocuments.VerifyDocumentFields("Gazette"); - // digitalDocuments.VerifyDocumentFields("Field notes"); - // digitalDocuments.VerifyDocumentFields("District road register"); - // digitalDocuments.VerifyDocumentFields("Crown grant"); - // digitalDocuments.VerifyDocumentFields("Correspondence"); - // digitalDocuments.VerifyDocumentFields("Canada lands survey"); - // digitalDocuments.VerifyDocumentFields("Transfer of administration"); - - // //Upload one digital document - // Random random = new Random(); - // var index = random.Next(0, documentFiles.Count()); - // var document = documentFiles.ElementAt(index); - - // digitalDocuments.UploadDocument(document.Url); - // digitalDocuments.UploadTransferAdminFile(dateSigned, motiFile, pid, roadName, transferNbr); - - // //Save digital document - // digitalDocuments.SaveDigitalDocument(); - //} - - //[StepDefinition(@"I create an Acquisition File with activity and edit attached document")] - //public void ActivityWithDocumentEdited() - //{ - // /* TEST COVERAGE: PSP-4030, PSP-4168, PSP-4335, PSP-4336, PSP-4338 */ - - // //Access the activity tab - // activities.AccessActivitiesTab(); - - // //Create new activity - // activities.CreateNewActivity("File Document"); - - // //Add a New Document - // digitalDocuments.AddNewDocument(); - - // //Upload one digital document - // Random random = new Random(); - // var index = random.Next(0, documentFiles.Count()); - // var document = documentFiles.ElementAt(index); - - // digitalDocuments.UploadDocument(document.Url); - // digitalDocuments.UploadGazetteFile(dateSigned, gazettePage, publishedDate, gazetteType, legalPlan, LTSASchedule, motiPlan, roadName); - - // //Save digital document - // digitalDocuments.SaveDigitalDocument(); - - // //Get total uploaded documents - // totalDigitalDocumentsUploaded = digitalDocuments.GetTotalUploadedDocuments(); - - // //Add new digital document - // digitalDocuments.AddNewDocument(); - // var index2 = random.Next(0, documentFiles.Count()); - // var document2 = documentFiles.ElementAt(index2); - - // digitalDocuments.UploadDocument(document2.Url); - // digitalDocuments.UploadTransferAdminFile(dateSigned, motiFile, pid, roadName, transferNbr); - - // //Cancel uploading a new document - // digitalDocuments.CancelDigitalDocument(); - - // //Edit digital document's details - // digitalDocuments.View1stDocument(); - // digitalDocuments.EditDocument(); - - // //Verify Edit Form - // digitalDocuments.VerifyGazetteEditForm(); - - // //Make changes on the document details - // digitalDocuments.ChangeStatus("Approved"); - - // //Save document's changes - // digitalDocuments.SaveEditDigitalDocument(); - - // //Edit digital document's details - // digitalDocuments.View1stDocument(); - // digitalDocuments.EditDocument(); - // digitalDocuments.ChangeStatus("None"); - - // //Cancel digital document's details - // digitalDocuments.CancelEditDigitalDocument(); - - // //Close Digital Documents Details View - // digitalDocuments.CloseDigitalDocumentViewDetails(); - - // //Delete digital document - // digitalDocuments.Delete1stDocument(); - //} - - //[StepDefinition(@"An activity is created successfully")] - //public void ActivityCreatedSuccess() - //{ - // Assert.True(activities.totalActivities() > 0); - //} - - //[StepDefinition(@"An activity is deleted successfully")] - //public void ActivityDeletedSuccess() - //{ - // Assert.True(activities.totalActivities() == 0); - //} - - //[StepDefinition(@"A note has been deleted successfully")] - //public void NoteDeletedSuccess() - //{ - // Assert.True(notes.NotesTotal() == 0); - //} - - //[StepDefinition(@"A digital document has been uploaded successfully")] - //public void DocumentUploadSuccess() - //{ - // Assert.True(digitalDocuments.GetTotalUploadedDocuments() == totalDigitalDocumentsUploaded + 1); - //} - - //[StepDefinition(@"A digital document has been deleted successfully")] - //public void DocumentDeleteSuccess() - //{ - // Assert.True(digitalDocuments.GetTotalUploadedDocuments() == 0); - //} - - } -} - -//public class DocumentFile -//{ -// public string Url { get; set; } = null!; -//} diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/AdminToolSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/AdminToolSteps.cs index e6d6f971a6..99ecba8534 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/AdminToolSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/AdminToolSteps.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.Configuration; using PIMS.Tests.Automation.Classes; using PIMS.Tests.Automation.Data; +using PIMS.Tests.Automation.PageObjects; using System.Data; namespace PIMS.Tests.Automation.StepDefinitions @@ -15,6 +16,7 @@ public class AdminToolSteps private readonly DigitalDocuments digitalDocuments; private readonly CDOGSTemplates cdogsTemplates; private readonly FinancialCodes financialCodes; + private readonly SharedPagination sharedPagination; private readonly IEnumerable documentFiles; private readonly string userName = "TRANPSP1"; @@ -30,6 +32,7 @@ public AdminToolSteps(BrowserDriver driver) digitalDocuments = new DigitalDocuments(driver.Current); financialCodes = new FinancialCodes(driver.Current); cdogsTemplates = new CDOGSTemplates(driver.Current); + sharedPagination = new SharedPagination(driver.Current); documentFiles = digitalDocumentSteps.UploadFileDocuments(); financialCode = new FinancialCode(); } @@ -215,6 +218,110 @@ public void DuplicateFinancialCode(int rowNumber) financialCodes.SaveFinancialCode(); } + [StepDefinition(@"I search for an existing Financial Code from row number (.*)")] + public void SearchFinancialCodes(int rowNumber) + { + /* TEST COVERAGE: PSP-5310, PSP-5318 */ + + //Login to PIMS + loginSteps.Idir(userName); + + //Navigate to Admin Tools + PopulateFinancialCode(rowNumber); + manageUsers.NavigateAdminTools(); + + //Navigate to Financial Codes + financialCodes.NavigateAdminFinancialCodes(); + + //Verify Pagination + sharedPagination.ChoosePaginationOption(5); + Assert.Equal(5, financialCodes.CountTotalFinancialCodeResults()); + + sharedPagination.ChoosePaginationOption(10); + Assert.Equal(10, financialCodes.CountTotalFinancialCodeResults()); + + sharedPagination.ChoosePaginationOption(20); + Assert.Equal(20, financialCodes.CountTotalFinancialCodeResults()); + + sharedPagination.ChoosePaginationOption(50); + Assert.Equal(50, financialCodes.CountTotalFinancialCodeResults()); + + sharedPagination.ChoosePaginationOption(100); + Assert.Equal(100, financialCodes.CountTotalFinancialCodeResults()); + + + //Verify Column Sorting by Financial Code Value + financialCodes.OrderByFinancialCodeValue(); + var firstCodeValueDescResult = financialCodes.FirstFinancialCodeValue(); + + financialCodes.OrderByFinancialCodeValue(); + var firstCodeValueAscResult = financialCodes.FirstFinancialCodeValue(); + + Assert.NotEqual(firstCodeValueDescResult, firstCodeValueAscResult); + + //Verify Column Sorting by Financial Code Description + financialCodes.OrderByFinancialCodeDescription(); + var firstFinCodeDescriptionDescResult = financialCodes.FirstFinancialCodeDescription(); + + financialCodes.OrderByFinancialCodeDescription(); + var firstFinCodeDescriptionAscResult = financialCodes.FirstFinancialCodeDescription(); + + Assert.NotEqual(firstFinCodeDescriptionDescResult, firstFinCodeDescriptionAscResult); + + //Verify Column Sorting by Financial Code Type Date + financialCodes.OrderByFinancialCodeType(); + var firstFinCodeTypeDescResult = financialCodes.FirstFinancialCodeType(); + + financialCodes.OrderByFinancialCodeType(); + var firstFinCodeTypeAscResult = financialCodes.FirstFinancialCodeType(); + + Assert.NotEqual(firstFinCodeTypeDescResult, firstFinCodeTypeAscResult); + + //Verify Column Sorting by Financial Code Effective Date + financialCodes.OrderByFinancialCodeEffectiveDate(); + var firstFinCodeEffectiveDateDescResult = financialCodes.FirstFinancialCodeEffectiveDate(); + + financialCodes.OrderByFinancialCodeEffectiveDate(); + var firstFinCodeEffectiveAscResult = financialCodes.FirstFinancialCodeEffectiveDate(); + + Assert.NotEqual(firstFinCodeEffectiveDateDescResult, firstFinCodeEffectiveAscResult); + + //Verify Column Sorting by Financial Code Expiry Date + financialCodes.OrderByFinancialCodeExpiryDate(); + var firstFinCodeExpiryDateDescResult = financialCodes.FirstFinancialCodeExpiryDate(); + + financialCodes.OrderByFinancialCodeExpiryDate(); + var firstFinCodeExpiryDateAscResult = financialCodes.FirstFinancialCodeExpiryDate(); + + Assert.NotEqual(firstFinCodeExpiryDateDescResult, firstFinCodeExpiryDateAscResult); + + + //Filter Financial Codes by Cost Types + financialCodes.FilterFinancialCodeByType("Business function"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Business function"); + + financialCodes.FilterFinancialCodeByType("Cost types"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Cost types"); + + financialCodes.FilterFinancialCodeByType("Work activity"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Work activity"); + + financialCodes.FilterFinancialCodeByType("Chart of accounts"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Chart of accounts"); + + financialCodes.FilterFinancialCodeByType("Financial activity"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Financial activity"); + + financialCodes.FilterFinancialCodeByType("Responsibility"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Responsibility"); + + financialCodes.FilterFinancialCodeByType("Yearly financial"); + Assert.Equal(financialCodes.FirstFinancialCodeType(), "Yearly financial"); + + //Filter by Code Value + financialCodes.FilterFinancialCode(financialCode.CodeValue); + } + [StepDefinition(@"Help Desk rendered successfully")] public void HelpDeskRenderSuccessfully() { diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/DigitalDocumentSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/DigitalDocumentSteps.cs index 83c45cf51f..19a54447b0 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/DigitalDocumentSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/DigitalDocumentSteps.cs @@ -8,6 +8,7 @@ namespace PIMS.Tests.Automation.StepDefinitions public class DigitalDocumentSteps { private readonly DigitalDocuments digitalDocumentsTab; + private readonly SharedPagination sharedPagination; private readonly IEnumerable documentFiles; private int documentsRowStart; private int documentsRowsQuantity; @@ -17,8 +18,8 @@ public class DigitalDocumentSteps public DigitalDocumentSteps(BrowserDriver driver) { digitalDocumentsTab = new DigitalDocuments(driver.Current); + sharedPagination = new SharedPagination(driver.Current); documentFiles = UploadFileDocuments(); - digitalDocumentList = new List(); documentsRowStart = 0; documentsRowsQuantity = 0; } @@ -67,7 +68,8 @@ public void DocumentTabCreate(string fileType, int rowNumber) [StepDefinition(@"I edit a Digital Document for a ""(.*)"" from row number (.*)")] public void UpdateDigitalDocuments(string fileType, int rowNumber) { - /* TEST COVERAGE: PSP-4030, PSP-4168, PSP-4335, PSP-4336, PSP-4338, PSP-5417, PSP-5418, PSP-5420, PSP-5436, PSP-5437, PSP-5439, PSP-5762, PSP-5765, PSP-5930 */ + /* TEST COVERAGE: PSP-4026, PSP-4027, PSP-4030, PSP-4168, PSP-4335, PSP-4336, PSP-4338, PSP-5417, PSP-5418, PSP-5420, PSP-5436, PSP-5437, PSP-5439, PSP-5459, + * PSP-5762, PSP-5765, PSP-5930 */ //Access the documents tab digitalDocumentsTab.NavigateDocumentsTab(); @@ -77,17 +79,19 @@ public void UpdateDigitalDocuments(string fileType, int rowNumber) //Add new digital document digitalDocumentsTab.AddNewDocument(fileType); + digitalDocumentsTab.CreateNewDocumentType(digitalDocumentList[0]); + Random random = new Random(); var index2 = random.Next(0, documentFiles.Count()); var document2 = documentFiles.ElementAt(index2); digitalDocumentsTab.UploadDocument(document2.Url); - digitalDocumentsTab.UpdateNewDocumentType(digitalDocumentList[0]); - + //Cancel uploading a new document digitalDocumentsTab.CancelDigitalDocument(); //Edit digital document's details + digitalDocumentsTab.NavigateToFirstPageDocumentsTable(); digitalDocumentsTab.View1stDocument(); digitalDocumentsTab.EditDocument(); digitalDocumentsTab.UpdateNewDocumentType(digitalDocumentList[0]); @@ -111,6 +115,47 @@ public void UpdateDigitalDocuments(string fileType, int rowNumber) //Close Digital Documents Details View digitalDocumentsTab.CloseDigitalDocumentViewDetails(); + //Verify Pagination Elements + digitalDocumentsTab.VerifyPaginationElements(); + + //Verify Pagination Functionality + sharedPagination.ChoosePaginationOption(5); + Assert.Equal(5, digitalDocumentsTab.DigitalDocumentsTableResultNumber()); + + sharedPagination.ChoosePaginationOption(10); + Assert.Equal(10, digitalDocumentsTab.DigitalDocumentsTableResultNumber()); + + sharedPagination.ChoosePaginationOption(20); + Assert.True(digitalDocumentsTab.DigitalDocumentsTableResultNumber() <= 20); + + //Verify Column Sorting by Document Type + digitalDocumentsTab.OrderByDocumentFileType(); + var firstFileTypeDescResult = digitalDocumentsTab.FirstDocumentFileType(); + + digitalDocumentsTab.OrderByDocumentFileType(); + var firstFileTypeAscResult = digitalDocumentsTab.FirstDocumentFileType(); + + Assert.NotEqual(firstFileTypeDescResult, firstFileTypeAscResult); + + //Verify Column Sorting by Document Type + digitalDocumentsTab.OrderByDocumentFileName(); + var firstFileNameDescResult = digitalDocumentsTab.FirstDocumentFileName(); + + digitalDocumentsTab.OrderByDocumentFileName(); + var firstFileNameAscResult = digitalDocumentsTab.FirstDocumentFileName(); + + Assert.NotEqual(firstFileNameDescResult, firstFileNameAscResult); + + //Verify Column Sorting by File Name + digitalDocumentsTab.OrderByDocumentFileStatus(); + var firstFileStatusDescResult = digitalDocumentsTab.FirstDocumentFileStatus(); + + digitalDocumentsTab.OrderByDocumentFileStatus(); + var firstFileStatusAscResult = digitalDocumentsTab.FirstDocumentFileStatus(); + + Assert.NotEqual(firstFileStatusDescResult, firstFileStatusAscResult); + digitalDocumentsTab.OrderByDocumentFileStatus(); + //Filter Documents by Type digitalDocumentsTab.FilterByType(digitalDocumentList[0].DocumentType); Assert.True(digitalDocumentsTab.TotalSearchDocuments() > 0); @@ -155,6 +200,8 @@ private void PopulateDigitalDocumentIndex(int rowNumber) DataTable documentsIndexSheet = ExcelDataContext.GetInstance().Sheets["DocumentsIndex"]; ExcelDataContext.PopulateInCollection(documentsIndexSheet); + digitalDocumentList = new List(); + documentsRowStart = int.Parse(ExcelDataContext.ReadData(rowNumber, "DigitalDocumentDetailsRowStart")); documentsRowsQuantity = int.Parse(ExcelDataContext.ReadData(rowNumber, "DigitalDocumentsRowEnd")); diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/NotesSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/NotesSteps.cs index 2684581cfe..20d9e46429 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/NotesSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/NotesSteps.cs @@ -1,6 +1,7 @@  using PIMS.Tests.Automation.Classes; using PIMS.Tests.Automation.Data; +using PIMS.Tests.Automation.PageObjects; using System.Data; namespace PIMS.Tests.Automation.StepDefinitions @@ -9,6 +10,7 @@ namespace PIMS.Tests.Automation.StepDefinitions public class NotesSteps { private readonly Notes notes; + private readonly SharedPagination sharedPagination; private readonly GenericSteps genericSteps; private List notesData; @@ -17,6 +19,7 @@ public class NotesSteps public NotesSteps(BrowserDriver driver) { notes = new Notes(driver.Current); + sharedPagination = new SharedPagination(driver.Current); genericSteps = new GenericSteps(driver); notesData = new List(); notesCount = 0; @@ -52,7 +55,7 @@ public void CreateNotesTab(int rowNumber) [StepDefinition(@"I edit a Note on the Notes Tab from row number (.*)")] public void EditNotesTab(int rowNumber) { - /* TEST COVERAGE: PSP-5506, PSP-5507 */ + /* TEST COVERAGE: PSP-4020, PSP-5506, PSP-5507 */ //Navigate to the Notes Tab notes.NavigateNotesTab(); @@ -73,6 +76,13 @@ public void EditNotesTab(int rowNumber) //Save changes notes.SaveNote(); + //Verify Pagination on the list view + sharedPagination.ChoosePaginationOption(5); + Assert.Equal(5, notes.NotesTabCount()); + + sharedPagination.ChoosePaginationOption(10); + Assert.Equal(10, notes.NotesTabCount()); + //Delete Note notesCount = notes.NotesTabCount(); notes.DeleteLastSecondNote(); diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/ProjectSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/ProjectSteps.cs index cc492c3ddf..53fbf1257e 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/ProjectSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/ProjectSteps.cs @@ -1,6 +1,7 @@ using System.Data; using PIMS.Tests.Automation.Data; using PIMS.Tests.Automation.Classes; +using PIMS.Tests.Automation.PageObjects; namespace PIMS.Tests.Automation.StepDefinitions { @@ -10,18 +11,19 @@ public class ProjectSteps private readonly LoginSteps loginSteps; private readonly Projects projects; private readonly SearchProjects searchProjects; + private readonly SharedPagination sharedPagination; private readonly string userName = "TRANPSP1"; private Project project; + protected string projectName = ""; public ProjectSteps(BrowserDriver driver) { loginSteps = new LoginSteps(driver); projects = new Projects(driver.Current); searchProjects = new SearchProjects(driver.Current); - - project = new Project(); + sharedPagination = new SharedPagination(driver.Current); } [StepDefinition(@"I create a new Project from row number (.*)")] @@ -46,66 +48,44 @@ public void CreateProject(int rowNumber) projects.VerifyCreateProductForm(); //Add Products - for (int i = 0; i < project.ProductsCount; i++) + if (project.Products.Count > 0) { - projects.CreateProduct(project.Products[i], i); + for (int i = 0; i < project.ProductsCount; i++) + { + projects.CreateProduct(project.Products[i], i); + } } //Save Project projects.SaveProject(); - } - [StepDefinition(@"I verify The Project View Form")] - public void VerifyCreatedProject() - { + //Get the project's name + projectName = projects.GetProjectName(); + //Verify Project View projects.VerifyProjectViewForm(project); //Verify Products within a Project - for (int i = 0; i < project.ProductsCount; i++) + if (project.Products.Count > 0) { - projects.VerifyProductViewForm(project.Products[i], i, "Create"); + for (int i = 0; i < project.ProductsCount; i++) + { + projects.VerifyProductViewForm(project.Products[i], i, "Create"); + } } } - [StepDefinition(@"I search for an existing project")] - public void SearchExistingProject() - { - /* TEST COVERAGE: */ - - //Navigate to Search a Contact - searchProjects.NavigateToSearchProject(); - - //Look for existing Project by name - searchProjects.SearchProjectByName(project.Name); - } - [StepDefinition(@"I update an existing project from row number (.*)")] public void UpdateProject(int rowNumber) { /* TEST COVERAGE: PSP-5321, PSP-5536, PSP-5537 */ - //Login to PIMS - loginSteps.Idir(userName); - //Navigate to Manage Projects searchProjects.NavigateToSearchProject(); - //Look for Projects by number - searchProjects.SearchProjectByNumber("AU-0003"); - Assert.True(searchProjects.TotalSearchedProjects().Equals(1)); - - //Look for Projects by Region - searchProjects.SearchProjectByRegion("Northern Region"); - Assert.True(searchProjects.TotalSearchedProjects().Equals(10)); - - //Look for Projects by Status - searchProjects.SearchProjectByStatus("Planning (PL)"); - Assert.True(searchProjects.TotalSearchedProjects().Equals(6)); - //Look for existing Project by name PopulateProjectData(rowNumber); - searchProjects.SearchProjectByName(project.Name); + searchProjects.SearchProjectByName(projectName); //Select the 1st found Project searchProjects.SelectFirstResult(); @@ -114,48 +94,134 @@ public void UpdateProject(int rowNumber) projects.UpdateProject(project); //Edit Products - for (int i = 0; i < project.ProductsCount; i++) + if (project.Products.Count > 0) { - projects.UpdateProduct(project.Products[i], i); + for (int i = 0; i < project.ProductsCount; i++) + { + projects.UpdateProduct(project.Products[i], i); + } } //Save Project projects.SaveProject(); + + //Verify Project View + projects.VerifyProjectViewForm(project); + + //Verify Products within a Project + if (project.Products.Count > 0) + { + for (int i = 0; i < project.ProductsCount; i++) + { + projects.VerifyProductViewForm(project.Products[i], i, "Update"); + } + } + } + + [StepDefinition(@"I search for existing Projects from row number (.*)")] + public void SearchExistingProjects(int rowNumber) + { + /* TEST COVERAGE: PSP-5320, PSP-5321, PSP-5322, PSP-5536, PSP-5537 */ + + //Login to PIMS + loginSteps.Idir(userName); + + //Navigate to Manage Projects + PopulateProjectData(rowNumber); + searchProjects.NavigateToSearchProject(); + + //Verify Pagination + sharedPagination.ChoosePaginationOption(5); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(5)); + + sharedPagination.ChoosePaginationOption(10); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(10)); + + sharedPagination.ChoosePaginationOption(20); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(20)); + + sharedPagination.ChoosePaginationOption(50); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(50)); + + sharedPagination.ChoosePaginationOption(100); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(100)); + + //Verify Column Sorting by Project Number + searchProjects.OrderByProjectNumber(); + var firstProjectNbrDescResult = searchProjects.FirstProjectCode(); + + searchProjects.OrderByProjectNumber(); + var firstProjectNbrAscResult = searchProjects.FirstProjectCode(); + + Assert.True(firstProjectNbrDescResult != firstProjectNbrAscResult); + + //Verify Column Sorting by Project Name + searchProjects.OrderByProjectName(); + var firstProjectNameResult = searchProjects.FirstProjectName(); + + searchProjects.OrderByProjectName(); + var firstProjectNameAscResult = searchProjects.FirstProjectName(); + + Assert.True(firstProjectNameResult != firstProjectNameAscResult); + + //Verify Column Sorting Last Updated By + searchProjects.OrderByProjectLastUpdatedBy(); + var firstProjectLastUpdatedByDescResult = searchProjects.FirstProjectLastUpdatedBy(); + + searchProjects.OrderByProjectLastUpdatedBy(); + var firstProjectLastUpdatedByAscResult = searchProjects.FirstProjectLastUpdatedBy(); + + Assert.True(firstProjectLastUpdatedByDescResult != firstProjectLastUpdatedByAscResult); + + //Verify Column Sorting Last Updated Date + searchProjects.OrderByProjectLastUpdatedDate(); + var firstProjectLastUpdatedDateDescResult = searchProjects.FirstProjectLastUpdatedDate(); + + searchProjects.OrderByProjectLastUpdatedDate(); + var firstProjectLastUpdatedDateAscResult = searchProjects.FirstProjectLastUpdatedDate(); + + Assert.True(firstProjectLastUpdatedDateDescResult != firstProjectLastUpdatedDateAscResult); + + //Filter Projects by Region + searchProjects.SearchProjectByRegion("Northern Region"); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(100)); + + //Filter Projects by Status + searchProjects.SearchProjectByStatus("Planning (PL)"); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(7)); + + //Filter Projects by number + searchProjects.SearchProjectByNumber(project.Number); + Assert.True(searchProjects.ProjectsTableResultNumber().Equals(1)); + } - [StepDefinition(@"I navigate back to Project Details")] - public void NavigateProjectDetails() + [StepDefinition(@"A new Project is created successfully")] + public void VerifyProjectsCreationSuccess() { - projects.NavigateProjectDetails(); + //Navigate to Manage Projects + searchProjects.NavigateToSearchProject(); + searchProjects.SearchProjectByName(projectName); + + Assert.True(searchProjects.SearchFoundResults()); } - [StepDefinition(@"Expected Content is displayed on Projects Table")] + [StepDefinition(@"Expected Project Content is displayed on Projects Table")] public void VerifyProjectsTableContent() { /* TEST COVERAGE: PSP-5319 */ + + //Verify List View searchProjects.VerifySearchView(); searchProjects.VerifyViewSearchResult(project); } - [StepDefinition(@"The Project is updated successfully")] - public void UpdateProjectSuccessfully() - { - //Verify Project View - projects.VerifyProjectViewForm(project); - - //Verify Products within a Project - for (int i = 0; i < project.ProductsCount; i++) - { - projects.VerifyProductViewForm(project.Products[i], i, "Update"); - } - } - [StepDefinition(@"Duplicate Project Alert is displayed")] public void DuplicateProject() { /* TEST COVERAGE: PSP-5670 */ - Assert.True(projects.duplicateProject()); + Assert.True(projects.DuplicateProject()); } private void PopulateProjectData(int rowNumber) @@ -163,6 +229,8 @@ private void PopulateProjectData(int rowNumber) DataTable projectsSheet = ExcelDataContext.GetInstance().Sheets["Projects"]; ExcelDataContext.PopulateInCollection(projectsSheet); + project = new Project(); + project.Number = ExcelDataContext.ReadData(rowNumber, "Number"); project.Name = ExcelDataContext.ReadData(rowNumber, "Name"); project.CodeName = ExcelDataContext.ReadData(rowNumber, "CodeName"); diff --git a/testing/PIMS.Tests.Automation/StepDefinitions/ResearchFileSteps.cs b/testing/PIMS.Tests.Automation/StepDefinitions/ResearchFileSteps.cs index 55f7489a46..0f37e99832 100644 --- a/testing/PIMS.Tests.Automation/StepDefinitions/ResearchFileSteps.cs +++ b/testing/PIMS.Tests.Automation/StepDefinitions/ResearchFileSteps.cs @@ -93,8 +93,8 @@ public void UpdateResearchFileDetails(int rowNumber) researchFiles.NavigateToFileDetailsTab(); //Cancel Changes - researchFiles.EditResearchFileForm(researchFile); - researchFiles.CancelResearchFile(); + //researchFiles.EditResearchFileForm(researchFile); + //researchFiles.CancelResearchFile(); //Save Changes researchFiles.EditResearchFileForm(researchFile);