diff --git a/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature b/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature index 1ad3a668..d241a6b1 100644 --- a/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature +++ b/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature @@ -1,7 +1,7 @@ Feature: ManagePlatforms Link to a feature: https://hous-hpb.atlassian.net/browse/DSS-226 -@LandingPage +@AddSubsidiaryPlatform Scenario: AddSubsidiaryPlatform #User Authentication Given that I am an authenticated User "" and the expected result is "" and I am a "" user diff --git a/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature.cs b/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature.cs index f643966e..3c26fcca 100644 --- a/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature.cs +++ b/Test/UITest/SpecFlowProjectBDD/Features/AddSubsidiaryPlatform.feature.cs @@ -75,12 +75,12 @@ public void ScenarioCleanup() [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("AddSubsidiaryPlatform")] - [NUnit.Framework.CategoryAttribute("LandingPage")] + [NUnit.Framework.CategoryAttribute("AddSubsidiaryPlatform")] [NUnit.Framework.TestCaseAttribute("CEUATST", "ceu_admin", "all", "pass", null)] public void AddSubsidiaryPlatform(string userName, string userType, string environment, string expectedResult, string[] exampleTags) { string[] @__tags = new string[] { - "LandingPage"}; + "AddSubsidiaryPlatform"}; if ((exampleTags != null)) { @__tags = System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Concat(@__tags, exampleTags)); diff --git a/Test/UITest/SpecFlowProjectBDD/SpecFlowProjectBDD.csproj b/Test/UITest/SpecFlowProjectBDD/SpecFlowProjectBDD.csproj index 690a7547..c114a5f2 100644 --- a/Test/UITest/SpecFlowProjectBDD/SpecFlowProjectBDD.csproj +++ b/Test/UITest/SpecFlowProjectBDD/SpecFlowProjectBDD.csproj @@ -8,10 +8,20 @@ + + + + + + + + + + diff --git a/Test/UITest/SpecFlowProjectBDD/StepDefinitions/AddSubsidiaryPlatform.cs b/Test/UITest/SpecFlowProjectBDD/StepDefinitions/AddSubsidiaryPlatform.cs index 8a22c835..8c73854e 100644 --- a/Test/UITest/SpecFlowProjectBDD/StepDefinitions/AddSubsidiaryPlatform.cs +++ b/Test/UITest/SpecFlowProjectBDD/StepDefinitions/AddSubsidiaryPlatform.cs @@ -1,4 +1,5 @@ using Configuration; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities; using NUnit.Framework.Legacy; using SpecFlowProjectBDD.Helpers; using System; @@ -7,6 +8,7 @@ using UITest.PageObjects; using UITest.TestDriver; using static SpecFlowProjectBDD.SFEnums; +using SpecFlowProjectBDD.Utilities; namespace SpecFlowProjectBDD.StepDefinitions { @@ -15,13 +17,24 @@ public class AddSubsidiaryPlatform { private IDriver _Driver; private LandingPage _LandingPage; - private DelistingWarningPage _DelistingWarningPage; + private ManagePlatformsPage _ManagePlatformsPage; + private DetailedPlatformContactInformationPage _DetailedPlatformContactInformationPage; + private AddNewPlatformPage _AddNewPlatformPage; private PathFinderPage _PathFinderPage; private IDirLoginPage _IDRLoginPage; - private NoticeOfTakeDownPage _NoticeOfTakeDownPage; + private string _TestUserName; private string _TestPassword; - private bool _ExpectedResult = false; + private bool _ExpectedResult = false; + private string _PlatformName = string.Empty ; + private string _PlatformCode = string.Empty; + private string _EmailForNonComplianceNotices = string.Empty; + private string _EmailForTakedownRequestLetters = string.Empty; + private string _SecondaryEmailForNonComplianceNotices = string.Empty; + private string _SecondaryEmailForTakedownRequest = string.Empty; + + private StrUtilities _strUtilities; + private AppSettings _AppSettings; private SFEnums.UserTypeEnum _UserType; private BCIDPage _BCIDPage; @@ -31,12 +44,20 @@ public AddSubsidiaryPlatform(SeleniumDriver Driver) { _Driver = Driver; _LandingPage = new LandingPage(_Driver); - _DelistingWarningPage = new DelistingWarningPage(_Driver); - + _ManagePlatformsPage = new ManagePlatformsPage(_Driver); + _DetailedPlatformContactInformationPage = new DetailedPlatformContactInformationPage(_Driver); + _AddNewPlatformPage = new AddNewPlatformPage(_Driver); _PathFinderPage = new PathFinderPage(_Driver); _IDRLoginPage = new IDirLoginPage(_Driver); _BCIDPage = new BCIDPage(_Driver); _AppSettings = new AppSettings(); + _strUtilities = new StrUtilities(); + _PlatformName = "Sub-PlatForm" + _strUtilities.GenerateRandomString(50); + _PlatformCode = "PC" + _strUtilities.GenerateRandomString(13); + _EmailForNonComplianceNotices = "Foo@foo.com"; + _EmailForTakedownRequestLetters = "Foo@foo.com"; + _SecondaryEmailForNonComplianceNotices = "Foo@foo.com"; + _SecondaryEmailForTakedownRequest = "Foo@foo.com"; } //User Authentication [Given(@"that I am an authenticated User ""([^""]*)"" and the expected result is ""([^""]*)"" and I am a ""([^""]*)"" user")] @@ -73,6 +94,7 @@ public void ThenIAmDirectedToTheLandingPage() [When(@"I click on the Manage Platforms button")] public void WhenIClickOnTheManagePlatformsButton() { + Thread.Sleep(3000); _LandingPage.ManagePlatformsButton.Click(); } @@ -80,24 +102,26 @@ public void WhenIClickOnTheManagePlatformsButton() public void ThenIShouldBePresentedWithAListOfPlatformsAndSub_Platforms() { + } [When(@"I click the edit button for a platform")] public void WhenIClickTheEditButtonForAPlatform() { - + _ManagePlatformsPage.EditPlatformButton.Click(); } [Then(@"I amd directed to the Platform view page")] public void ThenIAmdDirectedToThePlatformViewPage() { + } [When(@"I click on the add subsidiary platform button")] public void WhenIClickOnTheAddSubsidiaryPlatformButton() { - + _DetailedPlatformContactInformationPage.AddSubsidiaryPlatformButton.Click(); } [Then(@"I should be presented with the Add Platform page")] @@ -115,19 +139,24 @@ public void ThenIShouldSeeAFormWithTheRequiredInputFieldsForCreatingASub_Platfor [When(@"I fill in valid values for the input fields")] public void WhenIFillInValidValuesForTheInputFields() { - + _AddNewPlatformPage.PlatformNameTextBox.EnterText(_PlatformName); + _AddNewPlatformPage.PlatformCodeTextBox.EnterText(_PlatformCode); + _AddNewPlatformPage.EmailForNonComplianceNoticesTextBox.EnterText(_EmailForNonComplianceNotices); + _AddNewPlatformPage.EmailForTakedownRequestLettersTextBox.EnterText(_EmailForTakedownRequestLetters); + _AddNewPlatformPage.SecondaryEmailForNonComplianceNoticesTextBox.EnterText(_SecondaryEmailForNonComplianceNotices); + _AddNewPlatformPage.SecondaryEmailForTakedownRequest.EnterText(_SecondaryEmailForTakedownRequest); } [Then(@"the Save button should be enabled")] public void ThenTheSaveButtonShouldBeEnabled() { - + ClassicAssert.IsTrue(_AddNewPlatformPage.SaveButton.IsEnabled()); } [When(@"I click the Save button")] public void WhenIClickTheSaveButton() { - + _AddNewPlatformPage.SaveButton.Click(); } [Then(@"the sub platform should be created")] diff --git a/Test/UITest/SpecFlowProjectBDD/Utilities/StringUtilities.cs b/Test/UITest/SpecFlowProjectBDD/Utilities/StringUtilities.cs new file mode 100644 index 00000000..5bcbf4d4 --- /dev/null +++ b/Test/UITest/SpecFlowProjectBDD/Utilities/StringUtilities.cs @@ -0,0 +1,13 @@ +namespace SpecFlowProjectBDD.Utilities; +public class StrUtilities +{ + public string GenerateRandomString(int length) + { + const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var random = new Random(); + return new string(Enumerable.Repeat(chars, length) + .Select(s => s[random.Next(s.Length)]) + .ToArray()); + } + +} diff --git a/Test/UITest/TestFrameWork/Models/AddNewPlatformPageModel.cs b/Test/UITest/TestFrameWork/Models/AddNewPlatformPageModel.cs new file mode 100644 index 00000000..f9071669 --- /dev/null +++ b/Test/UITest/TestFrameWork/Models/AddNewPlatformPageModel.cs @@ -0,0 +1,19 @@ +using OpenQA.Selenium; + +namespace UITest.Models +{ + public class AddNewPlatformPageModel + { + + + public static string PlatformNameTextBox { get => "organizationNm"; } + public static string PlatformCodeTextBox { get => "organizationCd"; } + public static string EmailForNonComplianceNoticesTextBox { get => "primaryNoticeOfTakedownContactEmail"; } + public static string EmailForTakedownRequestLettersTextBox { get => "primaryTakedownRequestContactEmail"; } + public static string SecondaryEmailForNonComplianceNoticesTextBox {get => "secondaryNoticeOfTakedownContactEmail"; } + public static string SecondaryEmailForTakedownRequest { get => "secondaryTakedownRequestContactEmail"; } + public static string SaveButton { get => "body > app-root > app-layout > div.content > app-add-sub-platform > div.actions.ng-star-inserted > button:nth-child(1)"; } + public static string CancelButton { get => "body > app-root > app-layout > div.content > app-add-sub-platform > div.actions.ng-star-inserted > button.p-element.p-button-transparent.p-button.p-component"; } + + } +} diff --git a/Test/UITest/TestFrameWork/Models/DetailedPlatformContactInformationPageModel.cs b/Test/UITest/TestFrameWork/Models/DetailedPlatformContactInformationPageModel.cs new file mode 100644 index 00000000..355feff9 --- /dev/null +++ b/Test/UITest/TestFrameWork/Models/DetailedPlatformContactInformationPageModel.cs @@ -0,0 +1,7 @@ +namespace UITest.Models +{ + public class DetailedPlatformContactInformationPageModel + { + public static string AddSubsidiaryPlatformButton { get => "body > app-root > app-layout > div.content > app-view-platform > div.header > button"; } + } +} diff --git a/Test/UITest/TestFrameWork/Models/ManagePlatformsPageModel.cs b/Test/UITest/TestFrameWork/Models/ManagePlatformsPageModel.cs new file mode 100644 index 00000000..5c494223 --- /dev/null +++ b/Test/UITest/TestFrameWork/Models/ManagePlatformsPageModel.cs @@ -0,0 +1,11 @@ +namespace UITest.Models +{ + public class ManagePlatformsPageModel + { + + public static string EditPlatformButton { get => "#platform-edit-0-icon"; } + + public static string ListingsTable { get => "listings-table"; } + + } +} diff --git a/Test/UITest/TestFrameWork/PageObjects/AddNewPlatformPage.cs b/Test/UITest/TestFrameWork/PageObjects/AddNewPlatformPage.cs new file mode 100644 index 00000000..ee2b1e93 --- /dev/null +++ b/Test/UITest/TestFrameWork/PageObjects/AddNewPlatformPage.cs @@ -0,0 +1,51 @@ +using UITest.Models; +using UITest.SeleniumObjects; +using UITest.TestDriver; +using UITest.TestObjectFramework; + +namespace UITest.PageObjects +{ + public class AddNewPlatformPage + { + private IDriver _Driver; + + //No Valid URL since the URL must contain a unique and new platform number + //private string _URL = @"http://127.0.0.1:4200/add-sub-platform/590"; + + private TextBox _PlatformNameTextBox; + + private TextBox _PlatformCodeTextBox; + + private TextBox _EmailForNonComplianceNoticesTextBox; + private TextBox _EmailForTakedownRequestLettersTextBox; + private TextBox _SecondaryEmailForNonComplianceNoticesTextBox; + private TextBox _SecondaryEmailForTakedownRequest; + private Button _CancelButton; + private Button _SaveButton; + + public TextBox PlatformNameTextBox { get => _PlatformNameTextBox; } + public TextBox PlatformCodeTextBox { get => _PlatformCodeTextBox; } + public TextBox EmailForNonComplianceNoticesTextBox { get => _EmailForNonComplianceNoticesTextBox; } + public TextBox EmailForTakedownRequestLettersTextBox { get => _EmailForTakedownRequestLettersTextBox; } + public TextBox SecondaryEmailForNonComplianceNoticesTextBox { get => _SecondaryEmailForNonComplianceNoticesTextBox; } + public TextBox SecondaryEmailForTakedownRequest { get => _SecondaryEmailForTakedownRequest; } + public Button SaveButton { get => _SaveButton; } + public Button CancelButton { get => _CancelButton; } + //public string URL { get => _URL; set => _URL = value; } + public IDriver Driver { get => _Driver; } + + public AddNewPlatformPage(IDriver Driver) + { + _Driver = Driver; + + _PlatformNameTextBox = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.PlatformNameTextBox); + _PlatformCodeTextBox = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.PlatformCodeTextBox); + _EmailForNonComplianceNoticesTextBox = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.EmailForNonComplianceNoticesTextBox); + _EmailForTakedownRequestLettersTextBox = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.EmailForTakedownRequestLettersTextBox); + _SecondaryEmailForNonComplianceNoticesTextBox = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.SecondaryEmailForNonComplianceNoticesTextBox); + _SecondaryEmailForTakedownRequest = new TextBox(Driver, Enums.FINDBY.ID, AddNewPlatformPageModel.SecondaryEmailForTakedownRequest); + _SaveButton = new Button(Driver, Enums.FINDBY.CSSSELECTOR, AddNewPlatformPageModel.SaveButton); + _CancelButton = new Button(Driver, Enums.FINDBY.CSSSELECTOR, AddNewPlatformPageModel.CancelButton); + } + } +} diff --git a/Test/UITest/TestFrameWork/PageObjects/DetailedPlatformContactInformationPage.cs b/Test/UITest/TestFrameWork/PageObjects/DetailedPlatformContactInformationPage.cs new file mode 100644 index 00000000..6882ed78 --- /dev/null +++ b/Test/UITest/TestFrameWork/PageObjects/DetailedPlatformContactInformationPage.cs @@ -0,0 +1,32 @@ +using UITest.Models; +using UITest.SeleniumObjects; +using UITest.TestDriver; +using UITest.TestObjectFramework; + +namespace UITest.PageObjects +{ + public class DetailedPlatformContactInformationPage + { + private IDriver _Driver; + + private string _URL = @"http://127.0.0.1:4200/platform/590"; + + private Button _AddSubsidiaryPlatformButton; + + + public string URL { get => _URL; set => _URL = value; } + + public Button AddSubsidiaryPlatformButton { get => _AddSubsidiaryPlatformButton; set => _AddSubsidiaryPlatformButton = value; } + + + public IDriver Driver { get => _Driver; } + + public DetailedPlatformContactInformationPage(IDriver Driver) + { + _Driver = Driver; + + _AddSubsidiaryPlatformButton = new Button(Driver, Enums.FINDBY.CSSSELECTOR, DetailedPlatformContactInformationPageModel.AddSubsidiaryPlatformButton); + + } + } +} diff --git a/Test/UITest/TestFrameWork/PageObjects/ManagePlatformsPage.cs b/Test/UITest/TestFrameWork/PageObjects/ManagePlatformsPage.cs new file mode 100644 index 00000000..d78d8fa8 --- /dev/null +++ b/Test/UITest/TestFrameWork/PageObjects/ManagePlatformsPage.cs @@ -0,0 +1,35 @@ +using UITest.Models; +using UITest.SeleniumObjects; +using UITest.TestDriver; +using UITest.TestObjectFramework; + +namespace UITest.PageObjects +{ + public class ManagePlatformsPage + { + private IDriver _Driver; + + private string _URL = @"http://127.0.0.1:4200/platform-management"; + + private Button _EditPlatformButton; + + private Table _ListingsTable; + + public string URL { get => _URL; set => _URL = value; } + + + public Button EditPlatformButton { get => _EditPlatformButton; set => _EditPlatformButton = value; } + + public Table ListingsTable { get => _ListingsTable; } + public IDriver Driver { get => _Driver; } + + public ManagePlatformsPage(IDriver Driver) + { + _Driver = Driver; + + _EditPlatformButton = new Button(Driver, Enums.FINDBY.CSSSELECTOR, ManagePlatformsPageModel.EditPlatformButton); + + _ListingsTable = new Table(Driver, Enums.FINDBY.ID, ManagePlatformsPageModel.ListingsTable); + } + } +}