|
| 1 | +using Configuration; |
| 2 | +using NUnit.Framework.Legacy; |
| 3 | +using SpecFlowProjectBDD.Helpers; |
| 4 | +using SpecFlowProjectBDD.Utilities; |
| 5 | +using System; |
| 6 | +using System.Xml.Linq; |
| 7 | +using TechTalk.SpecFlow; |
| 8 | +using TestFrameWork.Models; |
| 9 | +using UITest.PageObjects; |
| 10 | +using UITest.TestDriver; |
| 11 | + |
| 12 | +namespace SpecFlowProjectBDD.StepDefinitions |
| 13 | +{ |
| 14 | + [Binding] |
| 15 | + [Scope(Scenario = "ManageJurisdiction")] |
| 16 | + public class ManageJurisdiction |
| 17 | + { |
| 18 | + private IDriver _Driver; |
| 19 | + private LandingPage _LandingPage; |
| 20 | + private ManageJurisdictionPage _ManageJurisdictionPage; |
| 21 | + private UpdateJurisdictionInformationPage _UpdateJurisdictionInformationPage; |
| 22 | + private PathFinderPage _PathFinderPage; |
| 23 | + private IDirLoginPage _IDRLoginPage; |
| 24 | + private BCIDPage _BCIDPage; |
| 25 | + |
| 26 | + private string _TestUserName; |
| 27 | + private string _TestPassword; |
| 28 | + private bool _ExpectedResult = false; |
| 29 | + |
| 30 | + private StrUtilities _strUtilities; |
| 31 | + |
| 32 | + private AppSettings _AppSettings; |
| 33 | + private SFEnums.UserTypeEnum _UserType; |
| 34 | + |
| 35 | + private SFEnums.LogonTypeEnum? _LogonType; |
| 36 | + |
| 37 | + public ManageJurisdiction(SeleniumDriver Driver) |
| 38 | + { |
| 39 | + _Driver = Driver; |
| 40 | + _LandingPage = new LandingPage(_Driver); |
| 41 | + _ManageJurisdictionPage = new ManageJurisdictionPage(_Driver); |
| 42 | + _UpdateJurisdictionInformationPage = new UpdateJurisdictionInformationPage(_Driver); |
| 43 | + _PathFinderPage = new PathFinderPage(_Driver); |
| 44 | + _IDRLoginPage = new IDirLoginPage(_Driver); |
| 45 | + _BCIDPage = new BCIDPage(_Driver); |
| 46 | + |
| 47 | + _AppSettings = new AppSettings(); |
| 48 | + _strUtilities = new StrUtilities(); |
| 49 | + } |
| 50 | + [Given(@"I am an authenticated CEU staff member ""([^""]*)"" with the appropriate permissions \(ADD\) and the expected result is ""([^""]*)"" and I am a ""([^""]*)"" user")] |
| 51 | + public void GivenIAmAnAuthenticatedCEUStaffMemberWithTheAppropriatePermissionsADDAndTheExpectedResultIsAndIAmAUser(string UserName, string ExpectedResult, string UserType) |
| 52 | + { |
| 53 | + _TestUserName = UserName; |
| 54 | + _TestPassword = _AppSettings.GetUser(_TestUserName) ?? string.Empty; |
| 55 | + _ExpectedResult = ExpectedResult.ToUpper() == "PASS" ? true : false; |
| 56 | + |
| 57 | + _Driver.Url = _AppSettings.GetServer("default"); |
| 58 | + _Driver.Navigate(); |
| 59 | + |
| 60 | + AuthHelper authHelper = new AuthHelper(_Driver); |
| 61 | + UserHelper userHelper = new UserHelper(); |
| 62 | + |
| 63 | + _UserType = userHelper.SetUserType(UserType); |
| 64 | + //Authenticate user using IDir or BCID depending on the user |
| 65 | + _LogonType = authHelper.Authenticate(_TestUserName, _TestPassword, _UserType); |
| 66 | + ClassicAssert.IsNotNull(_LogonType, "Logon FAILED"); |
| 67 | + |
| 68 | + TermsAndConditionsHelper termsAndConditionsHelper = new TermsAndConditionsHelper(_Driver); |
| 69 | + termsAndConditionsHelper.HandleTermsAndConditions(); |
| 70 | + } |
| 71 | + |
| 72 | + [When(@"I log in and navigate to the Manage Jurisdictions feature")] |
| 73 | + public void WhenILogInAndNavigateToTheManageJurisdictionsFeature() |
| 74 | + { |
| 75 | + _LandingPage.ManageJurisdictionsButton.Click(); |
| 76 | + } |
| 77 | + |
| 78 | + [Then(@"I should be presented with a list of platforms with a list of local government jurisdictions")] |
| 79 | + public void ThenIShouldBePresentedWithAListOfPlatformsWithAListOfLocalGovernmentJurisdictions() |
| 80 | + { |
| 81 | + ClassicAssert.IsTrue(_ManageJurisdictionPage.LGListingsTable.Exists()); |
| 82 | + List<string> headerRow = _ManageJurisdictionPage.LGListingsTable.GetHeaderRow(); |
| 83 | + ClassicAssert.IsTrue(headerRow[1] == "Local Government Name"); |
| 84 | + ClassicAssert.IsTrue(headerRow[2] == "Local Government Type"); |
| 85 | + ClassicAssert.IsTrue(headerRow[3] == "Local Government Code"); |
| 86 | + ClassicAssert.IsTrue(headerRow[4] == "BL Format"); |
| 87 | + ClassicAssert.IsTrue(headerRow[5] == "Update Local Government Information"); |
| 88 | + } |
| 89 | + |
| 90 | + [When(@"I view the list of jurisdictions")] |
| 91 | + public void WhenIViewTheListOfJurisdictions() |
| 92 | + { |
| 93 | + _ManageJurisdictionPage.ExpandJurisdictionsButton.Click(); |
| 94 | + } |
| 95 | + |
| 96 | + [Then(@"I should see key information about each one")] |
| 97 | + public void ThenIShouldSeeKeyInformationAboutEachOne() |
| 98 | + { |
| 99 | + List<string> headerRow = _ManageJurisdictionPage.JurisdictionsListingsTable.GetHeaderRow(); |
| 100 | + ClassicAssert.IsTrue(headerRow[0] == "Jurisdiction Name"); |
| 101 | + ClassicAssert.IsTrue(headerRow[1] == "Shape File ID"); |
| 102 | + ClassicAssert.IsTrue(headerRow[2] == "Principle Residence Requirement?"); |
| 103 | + ClassicAssert.IsTrue(headerRow[3] == "STR Prohibited?"); |
| 104 | + ClassicAssert.IsTrue(headerRow[4] == "BL Requirement?"); |
| 105 | + ClassicAssert.IsTrue(headerRow[5] == "Update Jurisdiction Info"); |
| 106 | + |
| 107 | + } |
| 108 | + |
| 109 | + [Then(@"I should have the ability to edit key information about each one \(as above\)")] |
| 110 | + public void ThenIShouldHaveTheAbilityToEditKeyInformationAboutEachOneAsAbove() |
| 111 | + { |
| 112 | + _ManageJurisdictionPage.EditJurisdictionButton.Click(); |
| 113 | + _UpdateJurisdictionInformationPage.LocalGovernmentNameDropDown.Click(); |
| 114 | + Thread.Sleep(1000); |
| 115 | + _UpdateJurisdictionInformationPage.LocalGovernmentNameDropDown.Click(); |
| 116 | + _UpdateJurisdictionInformationPage.PrincipleResidenceRequirementTrueButton.Click(); |
| 117 | + _UpdateJurisdictionInformationPage.PrincipleResidenceRequirementFalseButton.Click(); |
| 118 | + _UpdateJurisdictionInformationPage.ShortTermRentalProhibitedTrueButton.Click(); |
| 119 | + _UpdateJurisdictionInformationPage.ShortTermRentalProhibitedFalseButton.Click(); |
| 120 | + _UpdateJurisdictionInformationPage.BusinessLiscenseRequirementTrueButton.Click(); |
| 121 | + _UpdateJurisdictionInformationPage.BusinessLiscenseRequirementFalseButton.Click(); |
| 122 | + _UpdateJurisdictionInformationPage.EconomicRegionDropDown.Click(); |
| 123 | + |
| 124 | + _UpdateJurisdictionInformationPage.SelectEconomicRegionListItem(1); |
| 125 | + |
| 126 | + _UpdateJurisdictionInformationPage.CancelButton.Click(); |
| 127 | + } |
| 128 | + } |
| 129 | +} |
0 commit comments