public static IncomingEmailMessageMock CreateWithRandomData(int numAttachments) { var mock = new IncomingEmailMessageMock { Subject = RandomDataHelper.GetSubject(_seed++), RawBody = RandomDataHelper.GetBody(_seed++), PlainTextBody = RandomDataHelper.GetBody(_seed++), ConversationIndex = RandomDataHelper.GetConversationId(_seed++), ConversationTopic = RandomDataHelper.GetSubject(_seed++), SenderName = RandomDataHelper.GetName(_seed++), SenderAlias = RandomDataHelper.GetAlias(_seed++) }; mock.SenderAddress = mock.SenderAlias + "@blah.com"; mock.ToAddresses = GetRandomAliasList(Rand.Next(1, 30)); mock.CcAddresses = GetRandomAliasList(Rand.Next(0, 30)); mock.ToNames = GetRandomNamesList(mock.ToAddresses.Count()); mock.CcNames = GetRandomNamesList(mock.CcAddresses.Count()); mock.SentOn = new DateTime(Rand.Next(2012, 2525), Rand.Next(1, 12), Rand.Next(1, 28)); mock.ReceivedOn = new DateTime(Rand.Next(2012, 2525), Rand.Next(1, 12), Rand.Next(1, 28)); mock.IsHtmlBody = Rand.Next(0, 1) == 0; var attachments = new List <IIncomingEmailAttachment>(numAttachments); for (var i = 0; i < numAttachments; i++) { attachments.Add(new IncomingAttachmentMock(Rand.Next(1, 100000))); } mock.Attachments = attachments; return(mock); }
public string TypeInRandomNumber(int length = 10) { var random = RandomDataHelper.Cifers(length); TypeIn(random); return(random); }
public VirtualCard GenerateVirtualCardAboveMaxValues() { VirtualCard vc = new VirtualCard(); vc.LoyaltyIdNumber = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(255, 300)).ToString(); return(vc); }
public void TestProcessingThread() { var seed = _rand.Next(); Logger.InfoFormat("Using seed {0}", seed); var mailManager = new MailManagerMock(); var message1 = mailManager.AddMessage(false); var message2 = mailManager.AddReply(message1, RandomDataHelper.GetBody(seed)); var message3 = mailManager.AddReply(message2, RandomDataHelper.GetBody(seed)); var instanceConfig = GetConfig().Instances.First(); var workItemManagerMock = new WorkItemManagerMock(instanceConfig.WorkItemSettings.ConversationIndexFieldName); ProcessMailbox(mailManager, instanceConfig, workItemManagerMock); Assert.AreEqual(1, workItemManagerMock.Bugs.Count, "Only one bug should exist"); var bug = workItemManagerMock.Bugs.First(); var bugFields = bug.Value; var expectedValues = new Dictionary <string, string>(); instanceConfig.WorkItemSettings.DefaultFieldValues.ForEach(x => expectedValues[x.Field] = x.Value); expectedValues["Changed By"] = message3.SenderName; expectedValues[WorkItemManagerMock.HistoryField] = TextUtils.FixLineBreaks(message2.GetLastMessageText() + message3.GetLastMessageText()); ValidateBugValues(expectedValues, bugFields); }
public Attendee() { ObjectHelper.SetDefaultValues(this); this.Name = RandomDataHelper.GetRandomString(5); this.SurName = RandomDataHelper.GetRandomString(5); this.Email = RandomDataHelper.GetRandomMail(); this.PhoneNumber = RandomDataHelper.GetRandomNumber(9); }
public void TestApplyingOverridesInUpdateMessage() { var seed = _rand.Next(); Logger.InfoFormat("Using seed {0}", seed); var mailManager = new MailManagerMock(); var message1 = mailManager.AddMessage(false); var mnemonicDef = new Config.MnemonicDefinition { Mnemonic = "myMnemonic", Field = "Mnemonic Field", Value = "Mnemonic Value" }; var mnemonicLine = string.Format("\n@@@{0}\n", mnemonicDef.Mnemonic); var explicitOverride1 = new KeyValuePair <string, string>("IsThisExplicit?", "Indeed"); var explicitLine1 = string.Format("\n###{0}:{1}\n", explicitOverride1.Key, explicitOverride1.Value); var explicitOverride2 = new KeyValuePair <string, string>("WillThisOneBeProcessed?", "No"); var explicitLine2 = string.Format("\n###{0}:{1}\n", explicitOverride2.Key, explicitOverride2.Value); var message2 = mailManager.AddReply(message1, mnemonicLine + RandomDataHelper.GetBody(seed)); var message3 = mailManager.AddReply(message2, RandomDataHelper.GetBody(seed) + explicitLine1); // This last override will not be considered, because it's not part of the last message (it's at the // end of the message text, so considered as part of the first message) var message4 = mailManager.AddReply(message3, RandomDataHelper.GetBody(seed)); message4.PlainTextBody += explicitLine2; var instanceConfig = GetConfig().Instances.First(); instanceConfig.WorkItemSettings.ApplyOverridesDuringUpdate = true; instanceConfig.WorkItemSettings.Mnemonics.Add(mnemonicDef); var workItemManagerMock = new WorkItemManagerMock(instanceConfig.WorkItemSettings.ConversationIndexFieldName); ProcessMailbox(mailManager, instanceConfig, workItemManagerMock); Assert.AreEqual(1, workItemManagerMock.Bugs.Count, "Only one bug should exist"); var bug = workItemManagerMock.Bugs.First(); var bugFields = bug.Value; var expectedValues = new Dictionary <string, string>(); instanceConfig.WorkItemSettings.DefaultFieldValues.ForEach(x => expectedValues[x.Field] = x.Value); expectedValues["Changed By"] = message4.SenderName; expectedValues[WorkItemManagerMock.HistoryField] = TextUtils.FixLineBreaks(message2.GetLastMessageText() + message3.GetLastMessageText() + message4.GetLastMessageText()); expectedValues[mnemonicDef.Field] = mnemonicDef.Value; expectedValues[explicitOverride1.Key] = explicitOverride1.Value; ValidateBugValues(expectedValues, bugFields); Assert.IsFalse(bugFields.ContainsKey(explicitOverride2.Key)); }
public SessionData() { ObjectHelper.SetDefaultValues(this); var rand = new Random(); this.SessionDate = DateTime.Now.AddDays(rand.Next(1, 30)).AddHours(rand.Next(1, 12)); this.ProposedSessionDate = this.SessionDate; this.Address = RandomDataHelper.GetRandomString(5); this.City = RandomDataHelper.GetRandomString(8); this.PostCode = string.Format("0{0}-{1}", RandomDataHelper.GetRandomNumber(1), RandomDataHelper.GetRandomNumber(3)); this.Comment = string.Format("A-Team {0}", DateTime.Now); }
public void CorrectEditUser() { UserForm editUser = GoToEditUserForm(); string email = editUser.Header.Text; string newName = RandomDataHelper.RandomString(6); string lastName = RandomDataHelper.RandomString(6); editUser.EditUser(newName, lastName); UserPage userPageAfterEdit = editUser.SubmitForm <UserPage>(); Assert.IsTrue(userPageAfterEdit.Table.IsDataExistsInTableRows(newName, lastName, email)); }
public Member GenerateMemberBasicInfo() { Common common = new Common(DriverContext); Member member = new Member(); member.FirstName = "WEB" + RandomDataHelper.RandomString(6) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.LastName = "WEB" + RandomDataHelper.RandomString(6) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.MiddleName = "WEB" + RandomDataHelper.RandomString(6) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.Username = member.FirstName; member.Password = "******"; member.PrimaryEmailAddress = member.FirstName + "@test.com"; member.PrimaryPhoneNumber = new System.Random().Next(1, 9999999).ToString(); return(member); }
public IncomingEmailMessageMock AddReply(IIncomingEmailMessage message, string replyText) { // Reply body contains the reply text, then a message separator, then the previous message's full text var bodyBuilder = new StringBuilder(replyText); bodyBuilder.AppendLine(RandomDataHelper.GetRandomMessageSeparator(_rand.Next())); bodyBuilder.AppendLine(message.PlainTextBody); var newMessage = AddMessage("RE: " + message.Subject, bodyBuilder.ToString()); newMessage.SentOn = message.SentOn.AddSeconds(1); newMessage.ConversationId = GenerateReplyIndex(message.ConversationId); return(newMessage); }
private static IEnumerable <string> GetRandomNamesList(int numNames) { if (numNames == 0) { return(new List <string>()); } var names = new List <string>(numNames); for (var i = 0; i < numNames; ++i) { names.Add(RandomDataHelper.GetName(_seed++)); } return(names); }
public Member GenerateMemberBasicInfoWithAboveMaxValues() { Common common = new Common(DriverContext); Member member = new Member(); member.FirstName = "WEB" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(51, 100)) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.LastName = "WEB" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(51, 100)) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.MiddleName = "WEB" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(51, 100)) + "_" + NameGenerator.GenerateFirstName(Gender.Male); member.Username = "******" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(255, 300)); member.Password = "******"; member.PrimaryEmailAddress = "WEB" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(255, 300)) + "@test.com"; member.PrimaryPhoneNumber = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(26, 50)).ToString(); return(member); }
private static IEnumerable <string> GetRandomAliasList(int numAliases) { if (numAliases == 0) { return(new List <string>()); } var aliases = new List <string>(numAliases); for (var i = 0; i < numAliases; ++i) { aliases.Add(RandomDataHelper.GetAlias(_seed++) + EmailSuffix); } return(aliases); }
public void TestGetLastMessageTextBasic() { var message = new IncomingEmailMessageMock(); var lastMessageText = RandomDataHelper.GetBody(_rand.Next()); var numOfReplies = _rand.Next(0, 100); var bodyBuilder = new StringBuilder(lastMessageText); for (var i = 0; i < numOfReplies; i++) { bodyBuilder.AppendLine(RandomDataHelper.GetRandomMessageSeparator(_rand.Next())); bodyBuilder.Append(RandomDataHelper.GetBody(_rand.Next())); } message.PlainTextBody = bodyBuilder.ToString(); Assert.AreEqual(lastMessageText, EmailBodyProcessingUtils.GetLastMessageText(message), "Verifying extracted last message text correctness"); }
public MemberDetails GenerateMemberDetailsWithAboveMaxValues() { MemberDetails memberdetails = new MemberDetails(); memberdetails.AddressLineOne = "WEB_Address1_" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(101, 150)); memberdetails.AddressLineTwo = "WEB_Address2_" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(101, 150)); memberdetails.City = "Web_City_" + RandomDataHelper.RandomString(RandomDataHelper.RandomNumber(51, 100)); memberdetails.StateOrProvince = "Texas"; memberdetails.Country = "USA"; memberdetails.Gender = "Female"; memberdetails.ZipOrPostalCode = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(26, 50)).ToString(); memberdetails.MobilePhone = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(26, 50)).ToString(); memberdetails.HomePhone = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(26, 50)).ToString(); memberdetails.WorkPhone = RandomDataHelper.RandomNumber(RandomDataHelper.RandomNumber(26, 50)).ToString(); return(memberdetails); }
public MemberDetails GenerateMemberDetails() { MemberDetails memberdetails = new MemberDetails(); memberdetails.AddressLineOne = "WEB_Address1_" + RandomDataHelper.RandomString(3); memberdetails.AddressLineTwo = "WEB_Address2_" + RandomDataHelper.RandomString(3); memberdetails.City = "austin"; memberdetails.StateOrProvince = "Texas"; memberdetails.Country = "USA"; memberdetails.Gender = "Female"; memberdetails.ZipOrPostalCode = "765456"; memberdetails.MobilePhone = new System.Random().Next(1, 9999999).ToString(); memberdetails.HomePhone = new System.Random().Next(1, 9999999).ToString(); memberdetails.WorkPhone = new System.Random().Next(1, 9999999).ToString(); return(memberdetails); }
public ContactData() { ObjectHelper.SetDefaultValues(this); this.PersonDataName = RandomDataHelper.GetRandomString(5); this.PersonDataSurname = RandomDataHelper.GetRandomString(5); this.PersonDataPhone = RandomDataHelper.GetRandomNumber(9); this.PersonDataEmail = RandomDataHelper.GetRandomMail(); this.ContactName = RandomDataHelper.GetRandomString(5); this.ContactSurname = RandomDataHelper.GetRandomString(5); this.ContactAddress = RandomDataHelper.GetRandomString(5); this.ContactCity = string.Format("Waw{0}", RandomDataHelper.GetRandomString(5)); this.ContactPostCode = string.Format("0{0}-{1}", RandomDataHelper.GetRandomNumber(1), RandomDataHelper.GetRandomNumber(3)); this.InvoiceCompanyName = RandomDataHelper.GetRandomString(5); this.InvoiceEmail = RandomDataHelper.GetRandomMail(); this.InvoiceAddress = RandomDataHelper.GetRandomString(5); this.InvoiceCity = string.Format("Waw{0}", RandomDataHelper.GetRandomString(5)); this.InvoicePostalCode = string.Format("0{0}-{1}", RandomDataHelper.GetRandomNumber(1), RandomDataHelper.GetRandomNumber(3)); this.LetterCompanyName = RandomDataHelper.GetRandomString(5); this.LetterAddress = RandomDataHelper.GetRandomString(5); this.LetterCity = string.Format("Waw{0}", RandomDataHelper.GetRandomString(5)); this.LetterPostalCode = string.Format("0{0}-{1}", RandomDataHelper.GetRandomNumber(1), RandomDataHelper.GetRandomNumber(3)); this.Comment = string.Format("A-Team {0}", DateTime.Now); this.InvoiceNip = RandomDataHelper.GetRandomNip(); }
public void BTA_102_LN_Migration_Email_AWS() { #region Object Initialization CategoryFields coupon = new CategoryFields(); Migration Migration = new Migration(driverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); var couponData = new NonAdminUserData(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var navigator_Users_EmailAWSPage = new Navigator_AWSEmail_EmailsPage(DriverContext); string randomStr = RandomDataHelper.RandomString(4); string template = WebsiteData.AWSEmailTemplate; string template_description = "Testing"; string awsEmailName = WebsiteData.AWSEmailName + randomStr; string subject = WebsiteData.Subject + randomStr; string fromEmail = WebsiteData.FromMail; testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Verify Email Template exists if not create one stepName = "Verify Email Template exists if not create one "; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.email_aws); navigator_Users_EmailAWSPage.NavigateToEmailAWSTab(Navigator_AWSEmail_EmailsPage.AWSEMailTabs.Templates); navigator_Users_EmailAWSPage.CreateNewTemplate(template, template_description, out string outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Create new AWS email message stepName = "Create new AWS email message"; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_EmailAWSPage.NavigateToEmailAWSTab(Navigator_AWSEmail_EmailsPage.AWSEMailTabs.Emails); navigator_Users_EmailAWSPage.CreateNewAWSEmailMessage(awsEmailName, template, subject, fromEmail, out outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Switch to Migration Environment stepName = "Switching to Migration Environment :" + Migration.MigrationEnvironment; testStep = TestStepHelper.StartTestStep(testStep); navigator_UsersHomePage.Navigator_Users_SwitchEnvironment(); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(Migration.MigrationEnvironment, Migration.MigrationOrderId, out string _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Navigate to Migration Page and Delete Migration Set if any stepName = "Navigate to Migration Page and Delete Migration Set if any"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.migration); Navigator_MigrationPage _MigrationPage = new Navigator_MigrationPage(DriverContext); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_EmailAWS.ToString() + "_" + DateHelper.GetDate("Current"); _MigrationPage.DeleteIfMigrationSetExists(Migration.MigrationSets.Migration_EmailAWS.ToString(), out string output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Create New Migration Set stepName = "Create New Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.MigrationSetCreation(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Edit Items and Generate Items stepName = "Edit Items and Generate Items"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.EditItems(Migration.BuildMigrationSetName, ProjectBasePage.Env_value, DateHelper.GeneratePastTimeStampBasedonMin(2)); _MigrationPage.SelectItemsForAWSEMail(false, "", awsEmailName, out _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Initiate Migration Set stepName = "Initiate Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.InitiateMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Approve Migration Set stepName = "Approve Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.ApproveMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Run Migration Set stepName = "Run Now Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.RunNowMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13:Verify Email(AWS) migrated on mails page stepName = "Verify Email(AWS) migrated on mails page"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.email_aws); navigator_Users_EmailAWSPage.NavigateToEmailAWSTab(Navigator_AWSEmail_EmailsPage.AWSEMailTabs.Emails); bool status = navigator_Users_EmailAWSPage.VerifyMailWithTemplate(awsEmailName, template); if (status) { testStep.SetOutput(" Email :" + awsEmailName + " Migrated Successfully and Appeared on Mails Page"); } testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_263_LN_Migration_Email() { #region Object Initialization Migration Migration = new Migration(driverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var EmailPage = new Navigator_EmailMessagePage(DriverContext); var navigator_Users_EmailAWSPage = new Navigator_AWSEmail_EmailsPage(DriverContext); bool StepStatus = true; string randomStr = RandomDataHelper.RandomString(4); string EmailMessageName = ProjectBasePage.Orgnization_value + WebsiteData.EmailMessageName + randomStr; string Description = "Description"; string DMCCode = WebsiteData.DMCCode; testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Create new email message stepName = "Create new email message"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.email); StepStatus = EmailPage.CreateNewEmailMessage(EmailMessageName, Description, DMCCode, out string outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Switch to Migration Environment stepName = "Switching to Migration Environment :" + Migration.MigrationEnvironment; testStep = TestStepHelper.StartTestStep(testStep); navigator_UsersHomePage.Navigator_Users_SwitchEnvironment(); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(Migration.MigrationEnvironment, Migration.MigrationOrderId, out string _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Navigate to Migration Page and Delete Migration Set if any stepName = "Navigate to Migration Page and Delete Migration Set if any"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.migration); Navigator_MigrationPage _MigrationPage = new Navigator_MigrationPage(DriverContext); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_Email.ToString() + "_" + DateHelper.GetDate("Current"); _MigrationPage.DeleteIfMigrationSetExists(Migration.MigrationSets.Migration_Email.ToString(), out string output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Create New Migration Set stepName = "Create New Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.MigrationSetCreation(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Edit Items and Generate Items stepName = "Edit Items and Generate Items"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.EditItems(Migration.BuildMigrationSetName, ProjectBasePage.Env_value, DateHelper.GeneratePastTimeStampBasedonMin(2)); _MigrationPage.SelectItemsForAWSEMail(false, "", EmailMessageName, out _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Initiate Migration Set stepName = "Initiate Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.InitiateMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Approve Migration Set stepName = "Approve Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.ApproveMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Run Migration Set stepName = "Run Now Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.RunNowMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Verify migrated email message displayed on Email Messages page stepName = "Verify migrated email message displayed on Email Messages page"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.email); StepStatus = EmailPage.VerifyMailingNameMessageDetails(EmailMessageName, DMCCode); if (StepStatus) { testStep.SetOutput(" Email :" + EmailMessageName + " Migrated Successfully and Appeared on Mails Page"); } testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, StepStatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_513_MP_ForgotPassword() { ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; string stepOutput = ""; bool stepstatus = false; string BTA_DEV_MP_LogPath = MemberPortalData.BTA_DEV_MP_LogPath; try { var MP_ForgotPassword = new MemberPortal_ForgotPassword(DriverContext); var MPortal_LoginPage = new MemberPortal_LoginPage(DriverContext); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); var CSP_SearchPage = new CSPortal_SearchPage(DriverContext); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSP_RegistrationPage = new CSPortal_MemberRegistrationPage(DriverContext); var MP_Profile = new MemberProfile(DriverContext); var member = MP_Profile.GenerateMemberBasicInfo(); var details = MP_Profile.GenerateMemberDetails(); var myAccountPage = new MemberPortal_MyAccountPage(driverContext); var myProfilePage = new MemberPortal_MyProfilePage(driverContext); #region Step1:Launch CSPortal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Create new member user as per config file,if not existed stepName = "Create new member user as per config file,if not existed"; testStep = TestStepHelper.StartTestStep(testStep); member.FirstName = MemberPortalData.ForgotPasswordTestMember; member.LastName = MemberPortalData.ForgotPasswordTestMember; member.Username = MemberPortalData.ForgotPasswordTestMember; member.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); bool isMemberExists = CSP_SearchPage.VerifyMemberExists(member.Username, out stepOutput); testStep.SetOutput(stepOutput); if (!isMemberExists) { CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.MemberRegistration, out stepOutput); stepstatus = CSP_RegistrationPage.EnterBasicInfo_Details(member.FirstName, member.LastName, member.MiddleName, details.Gender, out stepOutput); stepstatus = CSP_RegistrationPage.EnterContactInfo_Details(member.PrimaryEmailAddress, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, member.PrimaryPhoneNumber, out stepOutput); stepstatus = CSP_RegistrationPage.EnterLoginCredentials_Details(member.Username, member.Password, out stepOutput); stepstatus = CSP_RegistrationPage.EnterOptIn_Out_Details("DirectMailOptIn", "EmailOptIn", "SmsOptIn", out stepOutput); CSP_RegistrationPage.SaveRegistration(); testStep.SetOutput("Member created successfully with username: "******"WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Logout as Csadmin stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("Logout is Successful as User: "******"Launch Member Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); MPortal_LoginPage.LaunchMemberPortal(login.MemberPortal_url, out string Message); MP_ForgotPassword.GetInitialWordCountFromLogFile(BTA_DEV_MP_LogPath); testStep.SetOutput("Launch Member Portal URL is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Click on Forgot Password stepName = "Click on Forgot Password"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MPortal_LoginPage.ClickForgotPassword(); testStep.SetOutput("Clicked on Forgot Password Successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Enter valid user name and click Submit button stepName = "Enter a valid user name and click Submit button"; testStep = TestStepHelper.StartTestStep(testStep); MP_ForgotPassword.EnterUserName(member.Username); MP_ForgotPassword.ClickSubmitButton(); testStep.SetOutput("Entered User name: " + member.Username + " and clicked on Submit button"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Select Email option to receive reset code stepName = "Select Email option to receive reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.SelectEmailOption(); testStep.SetOutput("Selected Email Option to receive reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Click on Send my reset code stepName = "Click on Send my reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.ClickSendResetCodeButton(); testStep.SetOutput("Clicked on Send my reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10: Select I already have a reset code option stepName = "Select I already have a reset code option"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.SelectAlreadyHaveResetCode(); testStep.SetOutput("Selected I already have a reset code option"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Click on Send my reset code stepName = "Click on Send my reset code"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.ClickSendResetCodeButton(); testStep.SetOutput("Clicked on Send my reset code"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Enter the reset code received in the Log stepName = "Enter the reset code received in the Log"; testStep = TestStepHelper.StartTestStep(testStep); MP_ForgotPassword.EnterResetCodeFromLogFile(BTA_DEV_MP_LogPath, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13:Click on Submit button stepName = "Click on Submit button"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.ClickSubmitButton(); testStep.SetOutput("Clicked on Submit button"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step14:Create new Password for Test User stepName = "Create new Passwod for Test User"; testStep = TestStepHelper.StartTestStep(testStep); member.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); stepstatus = MP_ForgotPassword.CreateNewPassword(member.Username, member.Password, member.Password, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15:Return back to login page stepName = "Return back to login page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = MP_ForgotPassword.ReturnToLoginPage(out stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepOutput); listOfTestSteps.Add(testStep); #endregion #region Step16:Login with the newly created Password stepName = "Login with User, User Name: " + member.FirstName + " with newly reset Password: "******"WEB")); testStep.SetOutput(stepName); listOfTestSteps.Add(testStep); #endregion #region Step17:Verify successful navigation to Member Portal home page stepName = "Verify successful navigation to Member Portal home page"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(MPortal_LoginPage.VerifyMemberPortalLoginSuccessfulForUser(member.FirstName, member.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step18:Navigate to My Profile page stepName = "Navigate to My Profile page"; testStep = TestStepHelper.StartTestStep(testStep); myAccountPage.NavigateToMPDashBoardMenu(MemberPortal_MyAccountPage.MPDashboard.MyProfile, out var Step_Output); var strStatus = Step_Output; testStep.SetStatus(myProfilePage.VerifyMyProfilePage(MemberPortal_MyProfilePage.Sections.MyProfile.ToString(), out Step_Output)); strStatus = strStatus + ". " + Step_Output; testStep.SetOutput(strStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Stept19:Change Password for Test Member to default testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Member to default"; string agen_OldPassword = member.Password; string agent_DefaultPassword = AgentValues.Agentpassword; myProfilePage.ChangePassword(agen_OldPassword, agent_DefaultPassword, agent_DefaultPassword); stepstatus = myProfilePage.VerifySuccessMessage(agen_OldPassword, agent_DefaultPassword, out stepOutput); testStep.SetOutput(stepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step20:Logout from Member portal stepName = "Logout from Member Portal"; testStep = TestStepHelper.StartTestStep(testStep); MPortal_LoginPage.LogoutMPPortal(); testStep.SetOutput("Logout from Member Portal is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA120_Navigator_Create_Targeted_Promotion() { MethodBase method = MethodBase.GetCurrentMethod(); string methodName = method.Name; testCase = new TestCase(methodName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); Promotions promotions = new Promotions(); NonAdminUserData promotion = new NonAdminUserData(DriverContext); promotions.StartDate = DateHelper.GetDate("Current"); promotions.EndDate = DateHelper.GetDate("Future"); string stepName = ""; try { #region stepName 1: "Open Navigator URL"; stepName = "Open Navigator URL"; var navigator_LoginPage = new Navigator_LoginPage(DriverContext); testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 2: "Login to Navigator using User With AllRoles"; stepName = "Login to Navigator using User With AllRoles"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 3: "Select organization and environment on USER page"; stepName = "Select organization and environment on USER page"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 4: "Create Targeted Promotion"; stepName = "Create Targeted Promotion"; promotions.Code = RandomDataHelper.RandomString(3); promotions.Name = promotion.PromotionName + RandomDataHelper.RandomString(5); promotions.Description = "Value for " + promotions.Name; var navigator_PromotionPage = new Navigator_PromotionsPage(DriverContext); testStep = TestStepHelper.StartTestStep(testStep); string enrollmentType = Navigator_PromotionsPage.EnrollmentTypes.Supported.ToString(); testStep.SetOutput(navigator_PromotionPage.Create_Promotions(Navigator_PromotionsPage.PromotionTypes.Targeted.ToString(), promotions, enrollmentType)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 5: "Verify Targeted Promotion on Model -> Attribute Sets -> TxnHeader -> Rules Page"; stepName = "Verify Targeted Promotion on Model -> Attribute Sets -> TxnHeader -> Rules Page"; testStep = TestStepHelper.StartTestStep(testStep); var result = navigator_PromotionPage.VerifyPromotionisCreatedOrNot(promotions.Code); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, result, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 6:"Create Non-Targeted Promotion"; stepName = "Create Non-Targeted Promotion"; testStep = TestStepHelper.StartTestStep(testStep); promotions.Code = RandomDataHelper.RandomString(3); promotions.Name = "AutoPromo_" + RandomDataHelper.RandomString(5); promotions.Description = "Value for " + promotions.Name; testStep.SetOutput(navigator_PromotionPage.Create_Promotions(Navigator_PromotionsPage.PromotionTypes.NonTargeted.ToString(), promotions, enrollmentType)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 7: "Verify Non-Targeted Promotion on Model -> Attribute Sets -> TxnHeader -> Rules Page"; stepName = "Verify Non-Targeted Promotion on Model -> Attribute Sets -> TxnHeader -> Rules Page"; testStep = TestStepHelper.StartTestStep(testStep); result = navigator_PromotionPage.VerifyPromotionisCreatedOrNot(promotions.Code); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, result, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region stepName 8 :"Logout from USER page"; stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(true); #endregion ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Passed"); } catch (Exception e) { ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Failed"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); if (!OrderTest_Status.Contains("true")) { Assert.Fail(); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); } } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA85_Navigator_Users_CreateAttributSets() { ProjectBasePage basePages = new ProjectBasePage(driverContext); var attributeSetData = new NonAdminUserData(driverContext); MethodBase method = MethodBase.GetCurrentMethod(); string methodName = method.Name; testCase = new TestCase(methodName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; NonAdminUserData Wesitedata = new NonAdminUserData(driverContext); navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigating Model and Navigate to Attribute Set page stepName = "Navigating Model and Navigate to Attribute Set page"; testStep = TestStepHelper.StartTestStep(testStep); var models_HomePage = new Navigator_ModelHomePage(DriverContext); models_HomePage.NavigateToModels_Page(out string Pageoutput); testStep.SetOutput(Pageoutput); models_HomePage.NavigatetoToAttributeSet_Page(out Pageoutput); testStep.SetOutput(Pageoutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Create Attributes set , Add Attribute sets and Generate Table var attributeSetPage = new Navigator_AttributeSetPage(DriverContext); attribute.MainAttributeSets = "Member"; string randomStr = RandomDataHelper.RandomString(4); attribute.AttributeSets = attributeSetData.AttributeSets; attribute.Attributes = attributeSetData.Attribute; stepName = "Create Attributes set" + attribute.MainAttributeSets + " Add Attributes to the attribute set:" + attribute.Attributes + " is Successful and Generate Table is successful"; testStep = TestStepHelper.StartTestStep(testStep); attributeSetPage.CreateAttributeSet(attribute.MainAttributeSets, attribute.AttributeSets); if (attributeSetPage.CreateAttributes(attribute.MainAttributeSets, attribute.AttributeSets, attribute.Attributes, attribute.Attributes, attribute.Attributes, "String", "1", "20").Contains("Attribute Element is Created Successfully")) { attributeSetPage.GenerateTable(attribute.MainAttributeSets, attribute.AttributeSets); } testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Navigate to Websites and Select Website as BTA_Dev_CS and Module Type as Member Profile stepName = "Navigate to Websites and Select Website as BTA_Dev_CS and Module Type as Member Profile"; testStep = TestStepHelper.StartTestStep(testStep); var Website = new Application_Nav_Util_Page(DriverContext); Website.OpenApplication(NavigatorEnums.ApplicationName.website); var websitePage = new Navigator_Users_WebsitePage(DriverContext); websitePage.NavigateToWebsiteTab(Navigator_Users_WebsitePage.WebsiteTabs.Modules, out string msg); var Website_Modules = new Navigator_Users_Website_ModulesPage(DriverContext); var webSiteName = Wesitedata.CSPortal_WebSiteName; var moduleType = EnumUtils.GetDescription(Navigator_Users_Website_ModulesPage.ModuleTypeList.MemberProfile); Website_Modules.Website_Select_WebsiteAndModuleType(webSiteName, moduleType); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Config Attribute set to CS portal stepName = "Select CSMemberRegConfig file and Drag Drap above created Attribute"; testStep = TestStepHelper.StartTestStep(testStep); Website_Modules.CSMemberRegConfigurebutton(); Website_Modules.DragandDropAttibuteSet(attribute.Attributes, "Country"); Website_Modules.SaveConfigSetting(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Bounce the CS portal App pool stepName = "Bounce the CS Portal App pool"; testStep = TestStepHelper.StartTestStep(testStep); var WebsiteManagement = new Navigator_Users_WebsiteManagementPage(DriverContext); WebsiteManagement.Navigator_Website_Select_WebsiteManagementTab(); WebsiteManagement.BounceAppPool("CSPortal"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Launch CS Portal and Login to CS Portal as csadmin stepName = "Launch CS Portal and Login to CS Portal as csadmin"; testStep = TestStepHelper.StartTestStep(testStep); var CSPortal_LoginPage = new CSPortal_LoginPage(DriverContext); CSPortal_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); string username = CsPortalData.csadmin; string password = CsPortalData.csadmin_password; CSPortal_LoginPage.LoginCSPortal(username, password, out Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Navigate to Member Registration page and Verify Attribute stepName = "Navigate to Member Registration page and Verify Attribute:" + attribute.Attributes; testStep = TestStepHelper.StartTestStep(testStep); var CSPortal_HomePage = new CSPortal_HomePage(DriverContext); CSPortal_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.MemberRegistration, out string message); var CSPortal_MemberRegistration = new CSPortal_MemberRegistrationPage(DriverContext); CSPortal_MemberRegistration.VerifyAttributeSetonRegisterPage(attribute.Attributes); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Passed"); } catch (Exception e) { ProjectBasePage.UpdateTestcaseStatus(method.Name.ToString(), "Failed"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); if (!OrderTest_Status.Contains("true")) { Assert.Fail(); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); } } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA270_CSP_Change_Password() { ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; bool stepstatus; string StepOutput; try { var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); AgentRegistration agent = new AgentRegistration(); #region Step1:Launch CSPortal Portal stepName = "Launch Customer Service Portal URL"; testStep = TestStepHelper.StartTestStep(testStep); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); CSP_LoginPage.LaunchCSPortal(login.Csp_url, out string Step_Output); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As csadmin stepName = "Login As csadmin User"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; CSP_LoginPage.LoginCSPortal(login.UserName, login.Password, out Step_Output); testStep.SetOutput(Step_Output); testStep.SetOutput("Login As csadmin User is Successful"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Navigate to User Administration stepName = "Navigate to UserAdministration Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Navigate to Agent Page stepName = "Navigate to Agent Page"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("Navigate to Agent Page is Successful"); listOfTestSteps.Add(testStep); #endregion #region Step5:Create new TestAgent user as per config file,if not existed testStep = TestStepHelper.StartTestStep(testStep); agent.FistName = AgentValues.ChangePasswordTestAgent; agent.LastName = AgentValues.ChangePasswordTestAgent; agent.Role = RoleValue.Admin.ToString(); agent.Status = AgentRegistration.AgentStatus.Active.ToString(); agent.UserName = AgentValues.ChangePasswordTestAgent; stepName = "Create New Agent if user is not existed"; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); testStep.SetOutput(CSPortal_UserAdministrationAgentPage.CreateAgent(agent.FistName, agent.LastName, agent.Role, agent.UserName, agent.Password, agent.Status)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Change Password for Test Agent testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Agent"; stepstatus = CSPortal_UserAdministrationAgentPage.ChangeAgentPassword(agent.UserName, agent.Password, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Logout As Test User stepName = "Logout from CS Portal"; testStep = TestStepHelper.StartTestStep(testStep); CSP_HomePage.LogoutCSPortal(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput("LogOut is Successful as csadmin"); listOfTestSteps.Add(testStep); #endregion #region Step8:Login As Test User stepName = "Login As User, User Name:" + agent.UserName; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LoginCSPortal(agent.UserName, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepName); listOfTestSteps.Add(testStep); #endregion #region Step9:Verify First Name and Last Name stepName = "Verify First Name and Last Name"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(CSP_HomePage.VerifyFirstNameAndLastName(agent.FistName, agent.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Navigate to Change Password testStep = TestStepHelper.StartTestStep(testStep); stepName = "Navigate to Change Password"; stepstatus = CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.ChangePassword, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Stept11: Change Password testStep = TestStepHelper.StartTestStep(testStep); stepName = "Change Password for Test Agent"; var cSP_ChangePassword = new CSPortal_ChangePassword(DriverContext); string agen_OldPassword = agent.Password; agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); cSP_ChangePassword.EnterPasswordDetails(agen_OldPassword, agent.Password, agent.Password, out string ValidationMessage); cSP_ChangePassword.SavePassword(); stepstatus = cSP_ChangePassword.VerifySuccessMessage(agen_OldPassword, agent.Password, out StepOutput); testStep.SetOutput(StepOutput); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Logout As Test User stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("LogOut is Successful as User:"******"Login As User, User Name:" + agent.UserName; testStep = TestStepHelper.StartTestStep(testStep); CSP_LoginPage.LoginCSPortal(agent.UserName, agent.Password, out StepOutput); testStep.SetOutput(Step_Output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); testStep.SetOutput(stepName); #endregion #region Step14:Verify First Name and Last Name stepName = "Verify First Name and Last Name"; testStep = TestStepHelper.StartTestStep(testStep); testStep.SetOutput(CSP_HomePage.VerifyFirstNameAndLastName(agent.FistName, agent.LastName)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15:Logout As Test User stepName = "Logout from CS Portal User:"******"WEB")); testStep.SetOutput("LogOut is Successful as User:"******"WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testStep.SetOutput(e.Message); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_01_LN_Program_eCollateral_CreateBonus() { #region Object Declaration testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); CategoryFields bonus = new CategoryFields(); ProjectBasePage basePages = new ProjectBasePage(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var navigator_Users_Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var navigator_Users_Program_eCollateralPage = new Navigator_Users_Program_eCollateralPage(DriverContext); var navigator_CreateBonus_Category = new Navigator_Users_Program_Components_CategoriesPage(DriverContext); var navigator_CreateBonus = new Navigator_Users_Program_eCollateral_BonusesPage(DriverContext); var bonusData = new NonAdminUserData(driverContext); string stepOutput = ""; string stepName = ""; #endregion try { #region Object Initialization string BonusName = bonusData.BonusName; string randomStr = RandomDataHelper.RandomString(4); bonus.Name = BonusName + randomStr; bonus.CategoryName = bonusData.BonusCategoryName; var date = DateTime.Now; bonus.StartDate = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); bonus.ExpiryDate = date.AddYears(10).ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); bonus.Logo_Img_Hero = "Null"; bonus.CategoryTypeValue = CategoryFields.CategoryType.Bonus.ToString(); bonus.ValueToSetInAttribute = "ValueGivenForAttribute"; bonus.SetType = CategoryFields.Property.Name.ToString(); bonus.MultiLanguage = CategoryFields.Languages.English.ToString(); bonus.ChannelProperties = CategoryFields.Channel.Web.ToString(); #endregion #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Create New Category with Bonus stepName = "Create new Category as " + bonus.CategoryName; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components); navigator_Users_Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Categories); testStep.SetOutput(navigator_CreateBonus_Category.CreateCategory(bonus)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Create new bonus stepName = "Create bonus with Category " + bonus.CategoryName; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.eCollateral); navigator_Users_Program_eCollateralPage.NavigateToProgramECollateralTab(Navigator_Users_Program_eCollateralPage.eCollateralTabs.Bonuses); testStep.SetOutput(navigator_CreateBonus.CreateBonus(bonus)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Generate PDF and Verify in Download folder stepName = " Generate PDF and Verify in Download folder"; testStep = TestStepHelper.StartTestStep(testStep); string bonusPDFFilePath = basePages.ConfigDownloadPath; testStep.SetOutput(navigator_CreateBonus.GenerateAndVerifyBonusesPDF(bonusPDFFilePath, "Bonuses_*.pdf", out stepOutput)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6:Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA11_CSP_ForgotPasswordNegativeScenario() { #region TestData login.UserName = CsPortalData.csadmin; login.Password = CsPortalData.csadmin_password; AgentRegistration agent = new AgentRegistration(); agent.FistName = AgentValues.ForgotPasswordTestAgent; agent.LastName = AgentValues.ForgotPasswordTestAgent; agent.Role = RoleValue.Admin.ToString(); agent.UserName = AgentValues.ForgotPasswordTestAgent; agent.Status = AgentRegistration.AgentStatus.Active.ToString(); agent.Password = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(8); string ResetCode = RandomDataHelper.RandomAlphanumericStringWithSpecialChars(4); string ExpectedErrorMessage = "The reset code you entered is invalid."; #endregion #region Object Initialization ProjectBasePage basePages = new ProjectBasePage(driverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); var CSP_HomePage = new CSPortal_HomePage(DriverContext); var CSPortal_UserAdministration = new CSPortal_UserAdministration(DriverContext); var CSPortal_UserAdministrationAgentPage = new CSPortal_UserAdministrationAgentPage(DriverContext); var CSP_ForgotPassword = new CSPortal_ForgotPassword(DriverContext); var CSP_LoginPage = new CSPortal_LoginPage(DriverContext); #endregion try { CSP_LoginPage.LaunchCSPortal(login.Csp_url, listOfTestSteps); CSP_LoginPage.LoginCSPortal(login, listOfTestSteps); CSP_HomePage.NavigateToDashBoardMenu(CSPortal_HomePage.DashBoard.UserAdministration, listOfTestSteps); CSPortal_UserAdministration.NavigateToSectionMenu(CSPortal_UserAdministration.Menu.Agents, listOfTestSteps); CSPortal_UserAdministrationAgentPage.CreateAgent(agent, listOfTestSteps); CSP_HomePage.LogoutCSPortal(listOfTestSteps); CSP_LoginPage.LaunchCSPortal(login.Csp_url, listOfTestSteps); CSP_LoginPage.ClickForgotPassword(listOfTestSteps); CSP_ForgotPassword.EnterUserNameandClickOnSubmit(agent.UserName, listOfTestSteps); CSP_ForgotPassword.SelectEmailOption(listOfTestSteps); CSP_ForgotPassword.ClickSendResetCodeButton(listOfTestSteps); CSP_ForgotPassword.SelectAlreadyHaveResetCode(listOfTestSteps); CSP_ForgotPassword.ClickSendResetCodeButton(listOfTestSteps); CSP_ForgotPassword.EnterResetCodeAnd_ClickOnSubmit(ResetCode, listOfTestSteps); CSP_ForgotPassword.VerifyInvalidResetCodeError(ExpectedErrorMessage, listOfTestSteps); testCase.SetStatus(true); } catch (Exception e) { testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_119_Navigator_Migrate_Message() { #region Object Initialization Migration Migration = new Migration(driverContext); var Website_Modules = new Navigator_Users_Website_ModulesPage(DriverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); var websitePage = new Navigator_Users_WebsitePage(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var navigator_Users_Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var navigator_Users_Program_eCollateralPage = new Navigator_Users_Program_eCollateralPage(DriverContext); var messagesPage = new Navigator_Users_Program_eCollateral_MessagesPage(driverContext); string randomStr = RandomDataHelper.RandomString(4); var attributeSetData = new NonAdminUserData(driverContext); testCase = new TestCase(TestContext.TestName); CategoryFields messageData = new CategoryFields(); messageData.Name = ProjectBasePage.Orgnization_value + NonAdminUserData.MessageName; var date = DateTime.Now; date = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date, TimeZoneInfo.Local.Id, "Central Standard Time"); messageData.StartDate = date.ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); messageData.ExpiryDate = date.AddYears(10).ToString("MM/dd/yyyy HH:mm:ss", new CultureInfo("en-US")); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Create new message if message does not exist already stepName = "Create new message if message does not exist already"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.eCollateral); navigator_Users_Program_eCollateralPage.NavigateToProgramECollateralTab(Navigator_Users_Program_eCollateralPage.eCollateralTabs.Messages); testStep = messagesPage.CreateNewMessage(messageData, out string messageStatus); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Switch to Migration Environment stepName = "Switching to Migration Environment :" + Migration.MigrationEnvironment; testStep = TestStepHelper.StartTestStep(testStep); navigator_UsersHomePage.Navigator_Users_SwitchEnvironment(); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(Migration.MigrationEnvironment, Migration.MigrationOrderId, out string _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Verify and Delete Message if available in QA Env stepName = "Verify and Delete Message if available in QA Env"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.eCollateral); navigator_Users_Program_eCollateralPage.NavigateToProgramECollateralTab(Navigator_Users_Program_eCollateralPage.eCollateralTabs.Messages); bool OutputStr = messagesPage.DeleteIfMessageExists(messageData.Name, out string Message); testStep.SetOutput(Message); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Navigate to Migration Page and Delete Message Migration Set if any stepName = "Navigate to Migration Page and Delete Message Migration Set if any"; testStep = TestStepHelper.StartTestStep(testStep); Navigator_MigrationPage _MigrationPage = new Navigator_MigrationPage(DriverContext); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.migration); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_Message_Set.ToString(); bool status = _MigrationPage.DeleteIfMigrationSetExists(Migration.BuildMigrationSetName, out string output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7:Create New Migration Set stepName = "Create New Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_Message_Set.ToString() + "_" + DateHelper.GetDate("Current"); _MigrationPage.MigrationSetCreation(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8:Edit Items and Generate Items stepName = "Edit Items and Generate Items"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.EditItems_All(Migration.BuildMigrationSetName, ProjectBasePage.Env_value, DateHelper.GetDate("Current")); _MigrationPage.SelectItemsForMessage(messageData.Name, out _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9:Initiate Migration Set stepName = "Initiate Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.InitiateMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10:Approve Migration Set stepName = "Approve Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.ApproveMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11:Run Migration Set stepName = "Run Now Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); _MigrationPage.RunNowMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12:Verify Migrated Message is available in QA Env stepName = "Verify Migrated Message is available in QA Env"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.eCollateral); navigator_Users_Program_eCollateralPage.NavigateToProgramECollateralTab(Navigator_Users_Program_eCollateralPage.eCollateralTabs.Messages); bool Out_status = messagesPage.VerifyMessageExists(messageData.Name); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, Out_status, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_75_LN_VerifyFinishedWithErrorsMessageShownWhileMigratingProductImage() { #region Object Initialization bool stepstatus = true; CategoryFields product = new CategoryFields(); Migration Migration = new Migration(driverContext); ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var Program_RewardCatalogPage = new Navigator_Users_Program_RewardCatalogPage(DriverContext); var rewardCatlog_productImagePage = new Navigator_Users_Program_RewardCatalog_ProductImagesPage(DriverContext); product.CategoryName = WebsiteData.ProductCategoryName; product.Name = WebsiteData.ProductName; string imageName = Migration.MigrationSets.Migration_ProductImage.ToString() + RandomDataHelper.RandomString(5); string imageOrder = WebsiteData.ProductImageOrder; testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string Status = "FinishedWithErrors"; string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Select the program application and verify the program configuration panel displayed stepName = "Select the program application and verify the program configuration panel displayed"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); testStep.SetOutput("Program configuration panel opened successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Click on reward catalog and verify product images tab displayed stepName = "Click on reward catalog and verify product images tab displayed"; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog); testStep.SetOutput("Reward catalog panel opened successfully with all the tabs including product image"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Click on product images tab and verify product images panel displayed stepName = "Click on product images tab and verify product images panel displayed"; testStep = TestStepHelper.StartTestStep(testStep); Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.ProductImages); testStep.SetOutput("Product images panel Openedsuccessfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Verify the existence of category and create category if doesn't exist stepName = "Verify the existence of category and create category if doesn't exist"; testStep = TestStepHelper.StartTestStep(testStep); rewardCatlog_productImagePage.VerifyCategoryExistanceAndCreateIfNotExists(product, out string outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7: Verify the existence of product and create product if doesn't exist stepName = "Verify the existence of product and create product if doesn't exist"; testStep = TestStepHelper.StartTestStep(testStep); rewardCatlog_productImagePage.VerifyProductExistanceAndCreateIfNotExists(product, out outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8: Click on create new product image button and verify new product image panel opened successfully stepName = "Click on create new product image button and verify new product image panel opened successfully"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = rewardCatlog_productImagePage.ClickOnCreateNewProductImageAndVerifyNewProductImagePanel(out outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9: Create a new product image stepName = "Create a new product image"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = rewardCatlog_productImagePage.CreateProductImage(product, imageName, imageOrder, out outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10: Verify the product image displayed in the table stepName = "Verify the product image displayed in the Product Image Grid"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = rewardCatlog_productImagePage.VerifyProductImageExists(imageName); testStep.SetOutput("ProductImage :" + imageName + " in the Product Image Grid"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11: Switch to Migration Environment stepName = "Switching to Migration Environment :" + Migration.MigrationEnvironment; testStep = TestStepHelper.StartTestStep(testStep); navigator_UsersHomePage.Navigator_Users_SwitchEnvironment(); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(Migration.MigrationEnvironment, Migration.MigrationOrderId, out string _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12: Navigate to Migration Page and Delete Migration Set if any stepName = "Navigate to Migration Page and Delete Migration Set if any"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.migration); Navigator_MigrationPage MigrationPage = new Navigator_MigrationPage(DriverContext); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_ProductImage.ToString() + "_" + DateHelper.GetDate("Current"); MigrationPage.DeleteIfMigrationSetExists(Migration.MigrationSets.Migration_ProductImage.ToString(), out string output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step13: Create New Migration Set stepName = "Create New Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.MigrationSetCreation(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step14: Edit Items and Generate Items stepName = "Edit Items and Generate Items"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.EditItems_All(Migration.BuildMigrationSetName, ProjectBasePage.Env_value, DateHelper.GeneratePastTimeStampBasedonMin(2)); MigrationPage.SelectItemsForProductImage(imageName, out _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step15: Initiate Migration Set stepName = "Initiate Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.InitiateMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step16: Approve Migration Set stepName = "Approve Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.ApproveMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step17: Run Migration Set stepName = "Run Now Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.RunNowMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step18: Verify that the Finished with Errors status is displayed while migrating the image to an environment that doesn't have the associated product stepName = "Verify that the Finished with Errors status is displayed while migrating the image to an environment that doesn't have the associated product"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.VerifyErrorStatusInMigrationPage(Migration.BuildMigrationSetName, Status, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step19: "Verify The product no longer exists in the destination database error message while migrating product image"; stepName = "Verify The product with name " + imageName + " no longer exists in the destination database error message while migrating product image"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.VerifyProductNoLongerExistsExceptionInMigrationViewItemsPage(Migration.BuildMigrationSetName, Status, out output, imageName); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step20: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_76_LN_Migrate_Product_And_VerifyProductMigrated() { #region Object Declaration testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); CategoryFields product = new CategoryFields(); ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData data = new NonAdminUserData(driverContext); Migration Migration = new Migration(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var rewardCatlog_productImagePage = new Navigator_Users_Program_RewardCatalog_ProductImagesPage(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var navigator_CreateProduct_Category = new Navigator_Users_Program_Components_CategoriesPage(DriverContext); var navigator_CreateBonus = new Navigator_Users_Program_eCollateral_BonusesPage(DriverContext); var RewardCatalog_ProductsPage = new Navigator_Users_Program_RewardCatalog_ProductsPage(DriverContext); var Program_RewardCatalogPage = new Navigator_Users_Program_RewardCatalogPage(DriverContext); var RewardCatalog_RewardsPage = new Navigator_Users_Program_RewardCatalog_RewardsPage(DriverContext); var RewardCatalog_ProductVariantsPage = new Navigator_Users_Program_RewardCatalog_ProductVariantsPage(DriverContext); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); product.Name = Migration.MigrationSets.Migration_Product.ToString() + RandomDataHelper.RandomString(4); string stepName = ""; #endregion try { #region Object Initialization product.SetType = "Product Name"; var attName = data.AttributeAllContentType; #endregion #region Step1: Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2: Login As User Admin stepName = "Login As User Admin and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3: Verify the existence of category and create category if doesn't exist stepName = "Verify the existence of category and create category if doesn't exist"; product.CategoryTypeValue = CategoryFields.CategoryType.Product.ToString(); product.CategoryName = data.ProductCategoryName; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components); Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Categories); testStep.SetOutput(navigator_CreateProduct_Category.CreateCategory(product)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Create new product and Verify var contentType = Navigator_Users_Program_Components_AttributesPage.ContentTypes.Product; product.AttributeName = attName + contentType.ToString(); product.ValueToSetInAttribute = "ValueGivenForAttributeSetProduct"; stepName = "Create New Product with Category as " + product.Name + ""; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog); Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Products); testStep.SetOutput(RewardCatalog_ProductsPage.CreateProduct_With_ProductCategory(product)); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9: Switch to Migration Environment stepName = "Switching to Migration Environment :" + Migration.MigrationEnvironment; testStep = TestStepHelper.StartTestStep(testStep); navigator_UsersHomePage.Navigator_Users_SwitchEnvironment(); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(Migration.MigrationEnvironment, Migration.MigrationOrderId, out string _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Navigate to Migration Page and Delete Migration Set if any stepName = "Navigate to Migration Page and Delete Migration Set if any"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.migration); Navigator_MigrationPage MigrationPage = new Navigator_MigrationPage(DriverContext); Migration.BuildMigrationSetName = Migration.MigrationSets.Migration_Product.ToString() + "_" + DateHelper.GetDate("Current"); MigrationPage.DeleteIfMigrationSetExists(Migration.MigrationSets.Migration_Product.ToString(), out string output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Create New Migration Set stepName = "Create New Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.MigrationSetCreation(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7: Edit Items and Generate Items stepName = "Edit Items and Generate Items"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.EditItems_All(Migration.BuildMigrationSetName, ProjectBasePage.Env_value, DateHelper.GeneratePastTimeStampBasedonMin(2)); MigrationPage.SelectItemsForProductCategoryAndProduct(product.Name, product.CategoryName, out _output); testStep.SetOutput(_output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step8: Initiate Migration Set stepName = "Initiate Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.InitiateMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step9: Approve Migration Set stepName = "Approve Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.ApproveMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step10: Run Migration Set stepName = "Run Now Migration Set"; testStep = TestStepHelper.StartTestStep(testStep); MigrationPage.RunNowMigrationSet(Migration.BuildMigrationSetName, out output); testStep.SetOutput(output); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step11: Verify Product Migrated on Product Page stepName = "Verify Product Migrated on Product Page"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.RewardCatalog); Program_RewardCatalogPage.NavigateToProgramRewardCatalogTab(Navigator_Users_Program_RewardCatalogPage.RewardCatalogTabs.Products); RewardCatalog_ProductsPage.VerifyCreatedProduct(product.SetType, product.Name, product.CategoryName); testStep.SetOutput(" Product :" + Migration.MigrationSets.Migration_Product.ToString() + " Migrated Successfully and appeared on Product Page"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step12: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName + e, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_224_LN_Regression_Navigator_Store_CreateAndEditStore() { #region Object Initialization bool stepstatus = true; ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var navigator_Users_Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var StorePage = new Navigator_Users_Program_Components_StoresPage(driverContext); Store store = new Store { StoreNumber = RandomDataHelper.RandomNumber(4), StoreName = "Auto_Store" + RandomDataHelper.RandomString(4), PhoneNumber = RandomDataHelper.RandomNumber(10), City = "TestCity", State = "TestState", Country = "TestCountry", Address = "TestAddress" }; testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Select the program application and verify the program configuration panel displayed stepName = "Select the program application and verify the program configuration panel displayed"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); testStep.SetOutput("Program configuration panel opened successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4: Create new Store stepName = "Create new Store"; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components); navigator_Users_Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Stores); StorePage.CreateStore(store, out string msg); testStep.SetOutput(msg); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5: Verify the presence of newly created store in the grid stepName = "Verify the presence of newly created store in the grid"; testStep = TestStepHelper.StartTestStep(testStep); StorePage.VerifyTheExistanceOfStore(store, out msg); testStep.SetOutput(msg); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Edit and Verify the updated store details stepName = "Edit and Verify the updated store details"; testStep = TestStepHelper.StartTestStep(testStep); StorePage.EditAndVerify_StoreDetails(store, out msg); testStep.SetOutput(msg); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step7: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }
public void BTA_103_LN_Programa_Components_Tier_CreateTier() { #region Object Initialization bool stepstatus = true; CategoryFields product = new CategoryFields(); ProjectBasePage basePages = new ProjectBasePage(driverContext); NonAdminUserData WebsiteData = new NonAdminUserData(driverContext); var application_Nav_Util_Page = new Application_Nav_Util_Page(DriverContext); var navigator_Users_ProgramPage = new Navigator_Users_ProgramPage(DriverContext); var Program_ComponentsPage = new Navigator_Users_Program_ComponentsPage(DriverContext); var navigator_Users_Program_Components_TiersPage = new Navigator_Users_Program_Components_TiersPage(DriverContext); testCase = new TestCase(TestContext.TestName); listOfTestSteps = new List <TestStep>(); testStep = new TestStep(); string stepName = ""; #endregion try { #region Step1:Launch Navigator Portal stepName = "Launch Navigator URL"; testStep = TestStepHelper.StartTestStep(testStep); var navigator_LoginPage = new Navigator_LoginPage(DriverContext); navigator_LoginPage.LaunchNavigatorPortal(login.Url, out string LaunchMessage); testStep.SetOutput(LaunchMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step2:Login As User Admin User stepName = "Login As User Admin User and Navigate to Home page by selecting Organization and Environment"; testStep = TestStepHelper.StartTestStep(testStep); login.UserName = NavigatorUsers.NonAdminUser; login.Password = NavigatorUsers.NavigatorPassword; navigator_LoginPage.Login(login, Users.AdminRole.USER.ToString(), out string stroutput); testStep.SetOutput(stroutput); var navigator_UsersHomePage = new Navigator_UsersHomePage(DriverContext); navigator_UsersHomePage.Navigator_Users_SelectOrganizationEnvironment(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step3:Select the program application and verify the program configuration panel displayed stepName = "Select the program application and verify the program configuration panel displayed"; testStep = TestStepHelper.StartTestStep(testStep); application_Nav_Util_Page.OpenApplication(NavigatorEnums.ApplicationName.program); testStep.SetOutput("Program configuration panel opened successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step4:Select the tier application under components and verify the tiers panel displayed stepName = "Select the tier application under components and verify the tiers panel displayed"; testStep = TestStepHelper.StartTestStep(testStep); navigator_Users_ProgramPage.NavigateToProgramTab(Navigator_Users_ProgramPage.ProgramTabs.Components); Program_ComponentsPage.NavigateToProgramComponentsTab(Navigator_Users_Program_ComponentsPage.ComponentsTabs.Tiers); testStep.SetOutput("Tiers panel opened successfully"); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step5:Create a new tier and verify it is present in the grid string TierName = CategoryFields.TierType.Tier_Defaults.ToString() + RandomDataHelper.RandomAlphanumericString(4); stepName = "Create a new tier and verify it is present in the grid"; testStep = TestStepHelper.StartTestStep(testStep); stepstatus = navigator_Users_Program_Components_TiersPage.CreateTierAndVerify(TierName, out string outMessage); testStep.SetOutput(outMessage); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, stepstatus, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion #region Step6: Logout stepName = "Logout from USER page"; testStep = TestStepHelper.StartTestStep(testStep); navigator_LoginPage.Logout(); testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, true, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); #endregion testCase.SetStatus(true); } catch (Exception e) { testStep = TestStepHelper.EndTestStep(testCase, testStep, stepName, false, DriverContext.SendScreenshotImageContent("WEB")); listOfTestSteps.Add(testStep); testCase.SetStatus(false); testCase.SetErrorMessage(e.Message); testCase.SetImageContent(DriverContext.TakeScreenshot().ToString()); Assert.Fail(); } finally { testCase.SetTestCaseSteps(listOfTestSteps); testCase.SetEndTime(new StringHelper().GetFormattedDateTimeNow()); listOfTestCases.Add(testCase); } }