Guest User

Untitled

a guest
Nov 17th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 39.57 KB | None | 0 0
  1. package com.dachisgroup.sbi.verification.mainSite;
  2.  
  3. import java.io.IOException;
  4. import java.util.ArrayList;
  5. import java.util.Date;
  6.  
  7. import jxl.read.biff.BiffException;
  8.  
  9. import org.testng.annotations.Test;
  10.  
  11. import com.dachisgroup.sbi.filtersBlock.BrandsFilter;
  12. import com.dachisgroup.sbi.init.Common;
  13. import com.dachisgroup.sbi.init.SeleniumInit;
  14. import com.dachisgroup.sbi.init.TestData;
  15. import com.dachisgroup.sbi.pages.advocates.AdvocatesPage;
  16. import com.dachisgroup.sbi.pages.index.IndexPage;
  17. import org.testng.Assert;
  18. import org.openqa.selenium.By;
  19. import org.openqa.selenium.NoSuchElementException;
  20. import org.openqa.selenium.WebElement;
  21.  
  22.  
  23. public class TS_Advocate extends SeleniumInit implements TestData{
  24.  
  25.     Date date = new Date();
  26.     Common common = new Common(driver);
  27.  
  28.     String url = "123123"; 
  29.     String time = common.toGmtString(date);
  30.     String name = "mister" + time;
  31.     String name2 = "miss" + time;
  32.     String namesub1 = name.substring(0, 1);
  33.     String namesub2 = name.substring(6, 11);
  34.     String firstName = common.generateRandomChars(5);
  35.     String lastName = common.generateRandomChars(6);
  36.     String email = time + "@mailinator.com";
  37.     String message = common.generateRandomSymbols(12);
  38.    
  39.     @Test
  40.     public void companyPortfolioTest() throws InterruptedException{
  41.    
  42.         String advocateName = "Asex";
  43.         String advocateDetailRange = "30d";            
  44.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);           
  45.         advocatesPage.clickAdvocateDetailRange(advocateName, advocateDetailRange);
  46.  
  47.     }
  48.    
  49.     /**
  50.      * <b>Scenario</b> "Multiple 'Platforms' filters work correctly" <br>
  51.      * <b>given</b>    "User is on the 'Advocate Insight' page" <br>
  52.      * <b>when</b>     "user selects 'Facebook' platform filter" </br>
  53.      * <b>then</b>     "only 'Facebook' social profile is displayed" </br>
  54.      * QA-618
  55.      */
  56.    
  57.     @Test
  58.     public void multiplePlatformsFiltersWorkCorrectly(){
  59.         boolean areOnlyAccountsSpecifiedPresent;
  60.        
  61.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  62.         advocatesPage = advocatesPage.checkMultiplePlatformAndShowResult("Facebook", "Twitter");
  63.         areOnlyAccountsSpecifiedPresent = advocatesPage.areOnlyAccountsSpecifiedPresent("Facebook", "Twitter");
  64.         Assert.assertTrue(areOnlyAccountsSpecifiedPresent, "Accounts aren't specified");
  65.     }
  66.    
  67.    
  68.     /**
  69.      * <b>Scenario</b> "Subsidiaries' filters work correctly" <br>
  70.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  71.      * <b>when</b>     "user selects 'PepsiCo, Inc.' susidiaries filter" </br>
  72.      * <b>then</b>     "only 'PepsiCo, Inc.' social profile is displayed" </br>
  73.      * QA-618
  74.      */
  75.    
  76.     @Test
  77.     public void subsidiariesFiltersWorkCorrectly(){
  78.         int accountsNumbers, realAccountsNumber;
  79.         boolean areAllSubsidiariesAreEqualToExpected;
  80.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qanokia, qapassword);
  81.         advocatesPage = advocatesPage.checkSubsidiaryAndShowResult("Navigeishn Teknolodzhiz C-I-S OOO");       
  82.         advocatesPage.clickShowAllAccs();
  83.         accountsNumbers = advocatesPage.getAccountsNumbers();
  84.         realAccountsNumber = advocatesPage.getRealAccountNumbers();
  85.         Assert.assertEquals(accountsNumbers, realAccountsNumber);
  86.         areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected("Navigeishn Teknolodzhiz C-I-S OOO", "Subsidiaries", accountsNumbers);
  87.         Assert.assertTrue(areAllSubsidiariesAreEqualToExpected, "Subsidiary is unexpected");
  88.     }
  89.    
  90.     @Test
  91.     public void selectAllFilterIsWorkingCorrectlyForDifferentFilters(){
  92.         int accountsNumbers;
  93.         boolean platformFilterState, brandsFilterState;
  94.        
  95.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  96.         platformsFilter = advocatesPage.clickOnPlatformsFilter();
  97.         platformsFilter.selectAllPlatformFilters();
  98.         platformFilterState = platformsFilter.areAllPlatformCheckboxesChecked();
  99.        
  100.         Assert.assertEquals(platformFilterState, true);
  101.        
  102.         advocatesPage = new AdvocatesPage(driver);
  103.        
  104.         brandsFilter = advocatesPage.clickOnBrandsFilter();
  105.         brandsFilter.selectAllBrandsFilters();
  106.         brandsFilterState = brandsFilter.areAllBrandsCheckboxesChecked();
  107.        
  108.         Assert.assertEquals(brandsFilterState, true);
  109.     }
  110.    
  111.     /**
  112.      * <b>Scenario</b> "Regions' filters work correctly" </br>
  113.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  114.      * <b>when</b>     "user selects 'North America' regions filter" </br>
  115.      * <b>then</b>     "only 'North America' social profile is displayed" </br>
  116.      * QA-618
  117.      */
  118.    
  119.     @Test
  120.     public void regionsFiltersWorkCorrectly(){
  121.         int accountsNumbers, accountsNumbersFromLabel;
  122.         boolean isShown;
  123.         String accountName, regionName;
  124.        
  125.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  126.         accountName = advocatesPage.clickRandomAdvocateAcc();
  127.         advocatesPage.clickAssigmentsTabLink();
  128.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  129.         editAssignmentsForm.expandAll();
  130.         editAssignmentsForm.uncheckAllBoxes();
  131.         regionName = editAssignmentsForm.clickAndGetRandomCountry();
  132.         advocatesPage = editAssignmentsForm.clickSaveButton();     
  133.         advocatesPage.checkRegionsAndShowResult(regionName);   
  134.         accountsNumbers = advocatesPage.getAccountsNumbers();
  135.         accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
  136.         Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
  137.         isShown = advocatesPage.isAccountsAreShown(accountName);
  138.         Assert.assertTrue(isShown, "Accoutn isn't shown");
  139.     }
  140.    
  141.     /**
  142.      * <b>Scenario</b> "User is able to edit associations in the advocate accounts" </br>
  143.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  144.      * <b>when</b>     "user expands advocate account" </br>
  145.      * <b>and</b>      "user clicks 'Company Associations' Tab and click 'edit' link" </br>
  146.      * <b>then</b>     "'Edit Assignments' form appears" </br>
  147.      * <b>when</b>     "user check 'Location', 'Brands' checkboxes and clicks [Save] button" </br>
  148.      * <b>then</b>     "advocate account is updated according to the set data and displayed correctly on the 'Advocates' page." </br>
  149.      * QA-656
  150.      */
  151.    
  152.     @Test        
  153.     public void userIsAbleToEditAssociationsInTheAdvocateAccounts(){
  154.         String account;
  155.         boolean isEditAssigmentFormDisplayed;
  156.         String socAssigments;
  157.         String assigments;
  158.        
  159.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  160.         account = advocatesPage.clickRandomAdvocateAcc();
  161.         advocatesPage.clickAssigmentsTabLink();
  162.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  163.         isEditAssigmentFormDisplayed = editAssignmentsForm.isEditAssigmentFormDisplayed();
  164.         Assert.assertTrue(isEditAssigmentFormDisplayed, "Form isn't displayed");
  165.         editAssignmentsForm.expandAll();
  166.         editAssignmentsForm.uncheckAllBoxes();
  167.         assigments = editAssignmentsForm.checkRandomAssociations();
  168.         advocatesPage = editAssignmentsForm.clickSaveButton();
  169.         advocatesPage.submitNewSearch(account);
  170.         advocatesPage.clickRandomAdvocateAcc();
  171.         advocatesPage.clickAssigmentsTabLink();
  172.         socAssigments = advocatesPage.geAdvocateAccountAssociations();
  173.         Assert.assertEquals(assigments, socAssigments);
  174.     }
  175.    
  176.     /**
  177.      * <b>Scenario</b> "Grouping by each type should return correct result on the 'Avocates' page" </br>
  178.      * <b>given</b>    "User is on the 'Avocates' page" </br>
  179.      * <b>then</b>     "'Group by:' menu has 'None' value by default" </br>
  180.      * <b>when</b>     "user sets 'Platform' type in the 'Group by:' drop-down menu" </br>
  181.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  182.      * <b>and</b>      "all existed in the system social platforms with and without social account(s) are displayed correctly" </br>
  183.      * <b>when</b>     "user sets 'Brand' type in the 'Group by:' drop-down menu" </br>
  184.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  185.      * <b>and</b>      "all existed in the system brands with assigned social account(s) are displayed correctly" </b>
  186.      * <b>and</b>      "text '<#number> brands with no social accounts associated' is displayed" </br>
  187.      * <b>when</b>     "user sets 'Region' type in the 'GroTup by:' drop-down menu" </br>
  188.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  189.      * <b>and</b>      "all existed in the system regions with assigned social account(s) are displayed correctly" </br>
  190.      * <b>and</b>      "text '<#number> regions with no social accounts associated' is displayed" </br>
  191.      * <b>when</b>     "user sets 'Country' type in the 'Group by:' drop-down menu" </br>
  192.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  193.      * <b>and</b>      "all existed in the system countries with assigned social account(s) are displayed correctly" </br>
  194.      * <b>and</b>      "text '<#number> countries with no social accounts associated' is displayed" </br>
  195.      * <b>when</b>     "user sets 'Subsidiary' type in the 'Group by:' drop-down menu" </br>
  196.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  197.      * <b>and</b>      "all existed in the system subsidiaries with assigned social account(s) are displayed correctly" </br>
  198.      * <b>when</b>     "user sets 'Last activity' type in the 'Group by:' drop-down menu" </br>
  199.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  200.      * <b>and</b>      "corresponding to the last activiy search request advocate account(s) is/are displayed correctly." </br>
  201.      * <b>and</b>      "text 'No known activity <#number>' is displayed" </br>
  202.      * <b>when</b>     "user sets 'Relationship' type in the 'Group by:' drop-down menu" </br>
  203.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  204.      * <b>and</b>      "all existed in the system relationship(s) with and without account(s) is/are displayed correctly" </br>
  205.      * <b>when</b>     "user sets 'Tag' type in the 'Group by:' drop-down menu" </br>
  206.      * <b>then</b>     "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
  207.      * <b>and<br>      "corresponding to the last activiy search request tag(s) is/are displayed correctly." </br>
  208.      * <b>and</b>      "text '<#number> Tags with no Social Accounts associated' is displayed" <br>
  209.      * QA-658
  210.      */
  211.    
  212.     @Test
  213.     public void groupingByEachTypeShouldReturnCorrectResultOnTheAvocatesPage(){
  214.         String dropDownLabelText;
  215.         boolean isGroupByValueCorrect;
  216.         ArrayList<String> platformsList;
  217.         ArrayList<String> togglesList;
  218.         boolean isContainsAll;
  219.         ArrayList<String> brandsList;
  220.         String notAssociatedText;
  221.         boolean checkNotAssociatedText;
  222.         ArrayList<String> regionsList;
  223.  
  224.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  225.         dropDownLabelText = advocatesPage.getDropDownLabelText();
  226.         Assert.assertEquals("Group by:", dropDownLabelText);
  227.         isGroupByValueCorrect = advocatesPage.isGroupByValueCorrect("None");
  228.         Assert.assertTrue(isGroupByValueCorrect);
  229.         advocatesPage.selectNeededPivotFilter("Platform");
  230.         advocatesPage.clickOnPlatformsLink();
  231.         platformsList = advocatesPage.getPlatformsText();
  232.         togglesList = advocatesPage.getToggleNames();
  233.         isContainsAll = advocatesPage.isContainsAll(platformsList, togglesList);
  234.         Assert.assertTrue(isContainsAll);
  235.         advocatesPage.selectNeededPivotFilter("Brand");
  236.         advocatesPage.clickOnBrandsFilterLink();
  237.         brandsList = advocatesPage.getBrandsLabelsText();
  238.         togglesList = advocatesPage.getToggleNames();
  239.         isContainsAll = advocatesPage.isContainsAll(brandsList, togglesList);
  240.         Assert.assertTrue(isContainsAll);
  241.         notAssociatedText = advocatesPage.getTextFromNotAssociatedRow();
  242.         checkNotAssociatedText = notAssociatedText.contains("Brands with no Social Accounts associated");
  243.         Assert.assertTrue(checkNotAssociatedText);
  244.         advocatesPage.selectNeededPivotFilter("Region");
  245.         advocatesPage.clickOnRegionsFilterLink();
  246.         regionsList = advocatesPage.getRegionLabels();
  247.         togglesList =  advocatesPage.getToggleNames();
  248.         isContainsAll = advocatesPage.isContainsAll(regionsList, togglesList);
  249.         Assert.assertTrue(isContainsAll);
  250.     }
  251.    
  252.     /**
  253.      * <b>Scenario</b> "Close filter popup" </br>
  254.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  255.      * <b>when</b>     "user opens regions popup and press cancel link" </br>
  256.      * <b>then</b>     "filters popup is dissapear" </br>
  257.      *
  258.      */
  259.    
  260.     @Test
  261.     public void closeFilterPopup(){
  262.         boolean isRegionsFilterPopupDisplayed;
  263.  
  264.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  265.         regionsFilter = advocatesPage.clickOnRegionsFilter();
  266.         regionsFilter.clickOnCancelLink();
  267.         isRegionsFilterPopupDisplayed = regionsFilter.isRegionsFilterPopupDisplayed();
  268.         Assert.assertFalse(isRegionsFilterPopupDisplayed, "Filter popup isn't displayed");
  269.     }
  270.    
  271.    
  272.     /**
  273.      * <b>Scenario</b> "2 different filters select" </br>
  274.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  275.      * <b>when</b>     "user selects 'Naked Juice' brands filter and 'North America' regions filter" </br>
  276.      * <b>then</b>     "social accounts with Naked Juice' brands and 'North America' regions are displayed" </br>
  277.      * QA-618 + QA-1084
  278.      */
  279.    
  280.     @Test
  281.     public void twoDifferentFiltersSelect(){
  282.         int accountsNumbers, accountsNumbersFromLabel;
  283.         String brandName, regionName, randomAccountName;
  284.         boolean isShown;
  285.  
  286.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  287.         randomAccountName = advocatesPage.clickAndGetRandomAccountName();
  288.         advocatesPage.clickAssigmentsTabLink();
  289.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  290.         editAssignmentsForm.expandAll();
  291.         editAssignmentsForm.uncheckAllBoxes();
  292.         brandName = editAssignmentsForm.clickAndGetRandomBrand();
  293.         regionName = editAssignmentsForm.clickAndGetRandomCountry();
  294.         advocatesPage = editAssignmentsForm.clickSaveButton();     
  295.         advocatesPage.checkBrandsAndShowResult(brandName);
  296.         advocatesPage.checkRegionsAndShowResult(regionName);   
  297.         accountsNumbers = advocatesPage.getAccountsNumbers();
  298.         accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
  299.         Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
  300.         isShown = advocatesPage.isAccountsAreShown(randomAccountName);
  301.         Assert.assertTrue(isShown, "Accoutn isn't shown");
  302.     }
  303.    
  304.    
  305.     /**
  306.      * <b>Scenario</b> "Brands' filters work correctly" </br>
  307.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  308.      * <b>when</b>     "user selects 'Naked Juice' brands filter" </br>
  309.      * <b>then</b>     "only 'Naked Juice' social profile is displayed" </br>
  310.      * QA-618
  311.      */
  312.    
  313.     @Test
  314.     public void brandsFiltersWorkCorrectly(){
  315.         int accountsNumbers, accountsNumbersFromLabel;;
  316.         boolean areAllSubsidiariesAreEqualToExpected;
  317.         String brandName;
  318.        
  319.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);    
  320.         advocatesPage.expandRandomAdvocateAccount();
  321.         advocatesPage.clickAssigmentsTabLink();
  322.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  323.         editAssignmentsForm.expandAll();
  324.         editAssignmentsForm.uncheckAllBoxes();
  325.         brandName = editAssignmentsForm.clickAndGetRandomBrand();
  326.         advocatesPage = editAssignmentsForm.clickSaveButton();     
  327.         advocatesPage.checkBrandsAndShowResult(brandName);         
  328.         accountsNumbers = advocatesPage.getAccountsNumbers();
  329.         accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
  330.         Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
  331.         areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected(brandName, "Brands", accountsNumbers);
  332.         Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
  333.     }
  334.    
  335.     /**
  336.      * <b>Scenario</b> "Additional accounts should be displayed in the employee governance after the [Show more accounts] link pressed" </br>
  337.      * <b>given</b>    "User is on the 'Social Business Graph' page" </br>
  338.      * <b>when</b>     "user clicks 'Advocate Insight' tab" </br>
  339.      * <b>then</b>     "'25' or less accounts should be shown" </br>
  340.      * <b>and</b>      "when [Show more accounts] link is pressed" </br>
  341.      * <b>then</b>     "additional accounts are displayed in the employee portfolio." </br>
  342.      * QA-662
  343.      */
  344.    
  345.     @Test
  346.     public void additionalAccountsShouldBeDisplayedInTheEmployeeGovernanceAfterTheShowMoreAccountsLinkPressed(){
  347.         boolean isAccountsOnPageCountValid;
  348.         boolean isMoreAccountsShown;
  349.    
  350.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword );
  351.         isAccountsOnPageCountValid = advocatesPage.isAccountsOnPageCountValid(25);
  352.         Assert.assertTrue(isAccountsOnPageCountValid);
  353.         advocatesPage.showMoreAccounts();
  354.         isMoreAccountsShown = advocatesPage.isMoreAccountsShown(25);
  355.         Assert.assertTrue(isMoreAccountsShown);
  356.     }
  357.    
  358.     /**
  359.      * <b>Scenario</b> "Removing account is working correctly" </br>
  360.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  361.      * <b>when</b>     "user expands account" </br>
  362.      * <b>and</b>      "click on settings menu" </br>
  363.      * <b>and</b>      "clicks on'Remove account' link" </br>
  364.      * <b>then</b>     "[Remove account] form and [Close], [Yes], [No] buttons are displayed" </br>
  365.      * <b>when</b>     "user selects 'Permanently remove'" </br>
  366.      * <b>and</b>      "clicks [Yes] button" </br>
  367.      * <b>then</b>     "form 'Advocate account is removed' is displayed" </br>
  368.      * <b>when</b>     "user clicks [close] button" </br>
  369.      * <b>then</b>     "social account is removed." </br>
  370.      * QA-660
  371.      */
  372.    
  373.     @Test
  374.     public void removingAccountIsWorkingCorrectly(){
  375.        
  376.         String userName1 = "test56@dachisgroup.com";
  377.         String password1 = "Passw0rd!";
  378.        
  379.         String accountName;
  380.         boolean isFormDisplayed;
  381.         boolean isNameFormCorrect;
  382.         boolean isCloseButtonDisplayed;
  383.         boolean isYesButtonDisplayed;
  384.         boolean isNoButtonDisplayed;
  385.         boolean isAccountsAreShown;
  386.  
  387.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qanokia, qapassword);
  388.         accountName = advocatesPage.clickRandomAdvocateAcc();
  389.         System.out.println(accountName);
  390.         advocatesPage.mouseOverAccountSettings();
  391.         removeAccountForm = advocatesPage.clickRemoveAccountLink();
  392.         isFormDisplayed = removeAccountForm.isFormDisplayed();
  393.         Assert.assertTrue(isFormDisplayed, "Form isn't displayed");
  394.        
  395.        
  396.         isNameFormCorrect = removeAccountForm.isNameFormCorrect("REMOVE ACCOUNT");
  397.         Assert.assertTrue(isNameFormCorrect, "Form name isn't correct");
  398.         isCloseButtonDisplayed = removeAccountForm.isCloseButtonDisplayed();
  399.         Assert.assertTrue(isCloseButtonDisplayed, "[Close] button isn't displayed");
  400.         isYesButtonDisplayed = removeAccountForm.isYesButtonDisplayedOnAdvocate();
  401.         Assert.assertTrue(isYesButtonDisplayed, "[Yes] button isn't displayed");
  402.         isNoButtonDisplayed = removeAccountForm.isNoButtonDisplayed();
  403.         Assert.assertTrue(isNoButtonDisplayed, "[No] button isn't displayed");
  404.        
  405.         removeAccountForm.clickPermRadioButton();
  406.         removeAccountForm.clickYesButtonOnAdvocate();
  407.         isFormDisplayed = removeAccountForm.isFormDisplayed();
  408.         Assert.assertTrue(isFormDisplayed, "Form isn't displayed");
  409.         removeAccountForm.clickCloseButton();
  410.         advocatesPage.submitNewSearch(accountName);
  411.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  412.         Assert.assertFalse(isAccountsAreShown, "Account isn't removed");
  413.     }
  414.    
  415.     /**
  416.      * <b>Scenario</b> "After clicking [No] button on the 'Remove account' form, user backs to the Advocate page" </br>
  417.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  418.      * <b>when</b>     "user expands account" </br>
  419.      * <b>and</b>      "click on settings menu" </br>
  420.      * <b>and</b>      "clicks on'Remove account' link" </br>
  421.      * <b>and</b>      "clicks [No] button" </br>
  422.      * <b>then</b>     "advocate page is displayed." </br>
  423.      * QA-660
  424.      */
  425.    
  426.     @Test
  427.     public void afterClickingNoButtonOnTheRemoveAccountFormUserBacksToTheAdvocatePage(){
  428.         String accountName;
  429.         boolean isAdvocatesPageDisplayed, isAccountsAreShown;
  430.  
  431.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  432.         accountName = advocatesPage.clickRandomAdvocateAcc();
  433.         advocatesPage.mouseOverAccountSettings();
  434.         removeAccountForm = advocatesPage.clickRemoveAccountLink();
  435.         advocatesPage = removeAccountForm.clickNoButtonInAdvocateAccMenu();
  436.         isAdvocatesPageDisplayed = advocatesPage.isAdvocatesPageDisplayed();
  437.         Assert.assertTrue(isAdvocatesPageDisplayed, "Page isn't displayed");
  438.         advocatesPage.submitNewSearch(accountName);
  439.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  440.         Assert.assertTrue(isAccountsAreShown, "Account isn't found");
  441.     }
  442.    
  443.     /**
  444.      * <b>Scenario</b> "Change advocate account to employee works correctly" </br>
  445.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  446.      * <b>when</b>     "user expands random account" </br>
  447.      * <b>and</b>      "clicks on settings menu" </br>
  448.      * <b>and</b>      "clicks on 'Change to Employee' link" </br>
  449.      * <b>then</b>     "'Change this account to an Employee Account' form appears" </br>
  450.      * <b>and</b>      "[Close] / [Yes] / [No] buttons are displayed on the form correctly" </br>
  451.      * <b>when</b>     "user clicks [Yes] button" </br>
  452.      * <b>then</b>     "'Advocate account is changed to employee account' form appears" </br>
  453.      * <b>when</b>     "user clicks [Close] button on the appeared form" </br>
  454.      * <b>then</b>     "advocate account was changed to the employee" </br>
  455.      * <b>and</b>      "changed account has disappeared from the 'Advocate insight' page and appeared on the 'Employee portfolio' page." </br>
  456.      * QA-676
  457.      * @throws InterruptedException
  458.      */
  459.    
  460.     @Test
  461.     public void changeAdvocateAccountToEmployeeWorksCorrectly() throws InterruptedException{
  462.        
  463.         common.log("This script is being failed due to issue: SBI-3121");
  464.        
  465.         String accountName;
  466.         boolean isChangeToEmployeeFormDisplayed;
  467.         boolean isCloseButtonDisplayed;
  468.         boolean isYesButtonDisplayed;
  469.         boolean isNoButtonDisplayed;
  470.         boolean isChangeToEmployeeConfirmFormDisplayed;
  471.         boolean isAccountsAreShown;
  472.        
  473.         String username = "test56@dachisgroup.com";
  474.         String password = "Passw0rd!";
  475.  
  476.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  477.         accountName = advocatesPage.clickRandomAdvocateAcc();
  478.         advocatesPage.mouseOverAccountSettings();
  479.         changeToEmployeeForm = advocatesPage.clickChangeToEmployeeLink();
  480.         isChangeToEmployeeFormDisplayed = changeToEmployeeForm.isChangeToEmployeeFormDisplayed("CHANGE THIS ACCOUNT TO AN EMPLOYEE ACCOUNT");
  481.         Assert.assertTrue(isChangeToEmployeeFormDisplayed);
  482.         isCloseButtonDisplayed = changeToEmployeeForm.isCloseButtonDisplayed();
  483.         Assert.assertTrue(isCloseButtonDisplayed, "[Close] button isn't displayed");
  484.         isYesButtonDisplayed =changeToEmployeeForm.isYesButtonDisplayed();
  485.         Assert.assertTrue(isYesButtonDisplayed, "[Yes] button isn't displayed");
  486.         isNoButtonDisplayed = changeToEmployeeForm.isNoButtonDisplayed();
  487.         Assert.assertTrue(isNoButtonDisplayed, "[No] button isn't displayed");
  488.         accountIsChangeForm = changeToEmployeeForm.clickYesButton();
  489.         isChangeToEmployeeConfirmFormDisplayed = accountIsChangeForm.isChangeToEmployeeConfirmFormDisplayed("ADVOCATE ACCOUNT CHANGED TO EMPLOYEE ACCOUNT");       
  490.         Assert.assertTrue(isChangeToEmployeeConfirmFormDisplayed, "Form isn't displayed");
  491.         advocatesPage = accountIsChangeForm.clickCloseButton();
  492.         advocatesPage.submitNewSearch(accountName);
  493.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  494.         Assert.assertFalse(isAccountsAreShown, "Account is found");
  495.         employeePortfolioPage = advocatesPage.clickEmployeePortfolioLink();
  496.         employeePortfolioPage.searchEmployee(accountName);
  497.         isAccountsAreShown = employeePortfolioPage.isAccountsAreShown(accountName);
  498.         Assert.assertTrue(isAccountsAreShown, "Account isn't found");  
  499.     }
  500.    
  501.     /**
  502.      * <b>Scenario</b> "Search by name is working correctly" </br>
  503.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  504.      * <b>when</b>     "user enter account name in the search field" </br>
  505.      * <b>then</b>     "search result according to the search criteria is displayed correctly." </br>
  506.      * QA-678
  507.      */
  508.    
  509.     @Test
  510.     public void searchByNameIsWorkingCorrectly(){
  511.         String accountName;
  512.         boolean isSearchWork;
  513.  
  514.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  515.         accountName = advocatesPage.getRandomAccountName();
  516.         advocatesPage.submitNewSearch(accountName);
  517.         isSearchWork = advocatesPage.isSearchWork(accountName);
  518.         Assert.assertTrue(isSearchWork, "Search isn't working");
  519.     }
  520.    
  521.     /**
  522.      * <b>Scenario</b> "Remove filter is working correctly" </br>
  523.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  524.      * <b>when</b>     "user selects 'Naked Juice' brands filter" </br>
  525.      * <b>then</b>     "the number of clear filter tabs should be 1" </br>
  526.      * <b>when</b>     "user remove filter" </br>
  527.      * <b>then</b>     "all accounts which were present before filter removed are shown"
  528.      * QA-618
  529.      */
  530.    
  531.     @Test
  532.     public void removeFilterIsWorkingCorrectly(){
  533.         int accountsNumber;
  534.         int clearFilterNumbers;
  535.         int accountsNumbers;
  536.         String brandName;
  537.  
  538.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  539.         accountsNumber = advocatesPage.getAccountsNumbers();
  540.         brandsFilter = advocatesPage.clickOnBrandsFilter();
  541.         brandName = brandsFilter.getRandomBrandName();
  542.         brandsFilter.clickOnCancelLink();
  543.         advocatesPage.checkBrandsAndShowResult(brandName);
  544.         clearFilterNumbers = advocatesPage.getClearFilterNumbers();
  545.         Assert.assertEquals(1, clearFilterNumbers);
  546.         advocatesPage.removeAllFilters();
  547.         accountsNumbers = advocatesPage.getAccountsNumbers();
  548.         Assert.assertEquals(accountsNumber, accountsNumbers);
  549.     }
  550.    
  551.    
  552.     /**
  553.      * <b>Scenario</b> "Search functionality is working correctly" </br>
  554.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  555.      * <b>when</b>     "user inputs account name in the search field" </br>
  556.      * <b>then</b>     "Verify that only account expected is represented in the list" </br>
  557.      * QA-621
  558.      */
  559.    
  560.     @Test
  561.     public void searchFunctionalityIsWorkingCorrectly(){
  562.         String accountName;
  563.         int accountsNumbers;
  564.         String getFirstAccountName;
  565.  
  566.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  567.         accountName = advocatesPage.getRandomAccountName();
  568.         advocatesPage.submitNewSearch(accountName);
  569.         accountsNumbers = advocatesPage.getAccountsNumbers();
  570.         Assert.assertEquals(1, accountsNumbers);
  571.         getFirstAccountName = advocatesPage.getFirstAccountName();
  572.         Assert.assertEquals(accountName, getFirstAccountName);
  573.     }
  574.    
  575.    
  576.     /**
  577.      * <b>Scenario</b> "Edit and Save Account Info with empty fields" </br>
  578.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  579.      * <b>when</b>     "user opens social account" </br>
  580.      * <b>and</b>      "clicks on [Edit Account Info] link" </br>
  581.      * <b>then</b>     "[Edit Account] form appears" </br>
  582.      * <b>when</b>     "user erased all required data" </br>
  583.      * <b>and</b>      "presses [Save and Close] button" </br>
  584.      * <b>then</b>     "error notification appears" </br>
  585.      * QA-619
  586.      */
  587.     @Test
  588.     public void editAndSaveAccountInfoWithEmptyFields(){
  589.         String formHeaderText, alertText;  
  590.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  591.         String accName = advocatesPage.getRandomAccountName();
  592.         advocatesPage.submitNewSearch(accName);
  593.         advocatesPage.clickRandomAdvocateAcc();
  594.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  595.         formHeaderText = editAccountInfoForm.getFormHeaderText();
  596.         Assert.assertEquals("Social Account Setup", formHeaderText);
  597.         editAccountInfoForm.clearAccountInfoSection();
  598.         editAccountInfoForm.clickSaveAndCloseButton(); 
  599.         alertText = editAccountInfoForm.getErrorMessageText();
  600.         Assert.assertEquals(alertText, "Please provide the Account Name.");
  601.     }
  602.    
  603.    
  604.     /**
  605.      * <b>Scenario</b> "Cancel feature on Edit Account Info form" </br>
  606.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  607.      * <b>when</b>     "clicks on [Edit Account Info] link from account details section" </br>
  608.      * <b>and</b>      "user changes all data" </br>
  609.      * <b>and</b>      "presses [Cancel] button" </br>
  610.      * <b>then</b>     "changes were not saved" </br>
  611.      */
  612.     @Test
  613.     public void cancelFeatureOnEditAccountInfoForm(){      
  614.         String accountInfo, updatedAccountInfo;
  615.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  616.         advocatesPage.clickRandomAdvocateAcc();
  617.         accountInfo = advocatesPage.getAccountInfo();
  618.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  619.         editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
  620.         advocatesPage = editAccountInfoForm.clickCancelButton();
  621.         updatedAccountInfo = advocatesPage.getAccountInfo();
  622.         accountInfo.equals(updatedAccountInfo);
  623.         Assert.assertEquals(updatedAccountInfo, accountInfo);
  624.     }
  625.    
  626.    
  627.     /**
  628.      * <b>Scenario</b> "Close feature on Edit Account Info form" </br>
  629.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  630.      * <b>when</b>     "clicks on [Edit Account Info] link from random account details section" </br>
  631.      * <b>and</b>      "user changes all data" </br>
  632.      * <b>and</b>      "presses [Close] button" </br>
  633.      * <b>then</b>     "changes were not saved" </br>
  634.      * QA-619
  635.      */
  636.    
  637.     @Test
  638.     public void closeFeatureOnEditAccountInfoForm(){
  639.         String accountInfo, updatedAccountInfo;
  640.  
  641.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  642.         advocatesPage.clickRandomAdvocateAcc();
  643.         accountInfo = advocatesPage.getAccountInfo();
  644.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  645.         editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
  646.         advocatesPage = editAccountInfoForm.clickCloseButton();
  647.         updatedAccountInfo = advocatesPage.getAccountInfo();
  648.         accountInfo.equals(updatedAccountInfo);
  649.         Assert.assertEquals(updatedAccountInfo, accountInfo);
  650.     }
  651.    
  652.    
  653.     /**
  654.      * <b>Scenario</b> "Edit Account Info feature" </br>
  655.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  656.      * <b>when</b>     "clicks on [Edit Account Info] link from random account details section" </br>
  657.      * <b>and</b>      "user changes all data" </br>
  658.      * <b>and</b>      "presses [Save and Close] button" </br>
  659.      * <b>then</b>     "changes were successfully saved" </br>
  660.      * QA-619
  661.      */
  662.    
  663.     @Test
  664.     public void editAccountInfoFeature(){
  665.         String accountDescription;
  666.         String description = common.generateRandomChars(10);
  667.  
  668.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman,qapassword);
  669.         advocatesPage.clickRandomAdvocateAcc();
  670.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  671.         editAccountInfoForm.fillAccountInfoSection(name, description, "");
  672.         advocatesPage = editAccountInfoForm.clickSaveAndCloseButton();
  673.         advocatesPage.submitNewSearch(name);
  674.         advocatesPage.clickSpecifiedName(name);
  675.         accountDescription = advocatesPage.getAccountDescription();
  676.         Assert.assertEquals(accountDescription, description);
  677.     }
  678.    
  679.    
  680.     /**
  681.      * <b>Scenario</b> "Exported accounts data should be the same as accounts data on the Advocates Page" </br>
  682.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  683.      * <b>when</b>     "clicks 'Show more accounts link'" </br>
  684.      * <b>and</b>      "user mouses over 'Settings' image and clicks 'Export Result' link" </br>
  685.      * <b>then</b>     "'Export Results to Excel' window appears" </br>
  686.      * <b>and</b>      "file with data is downloaded correctly" </br>
  687.      * <b>and</b>      "exported account data are the same as on Advocates Page."
  688.      * SBI-1751
  689.      * @throws IOException
  690.      * @throws BiffException
  691.      */
  692.    
  693.     @Test
  694.     public void exportedAccountsDataShouldBeTheSameAsAccountsDataOnTheAdvocatesPage() throws BiffException, IOException{
  695.         String exportWindowTitle;
  696.         boolean isAccountsAreExported;
  697.    
  698.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  699.         advocatesPage.clickAccountSortLink();      
  700.         advocatesPage.clickShowAllAccs();
  701.         ArrayList<String> accounts = advocatesPage.getAccountsData();
  702.         advocatesPage.mouseOverSettingsImage();
  703.         advocatesPage.clickSettingsImage();
  704.         advocatesPage.clickExportLink();
  705.         exportWindowTitle = advocatesPage.exportWindowTitle();
  706.         Assert.assertEquals("EXPORT RESULTS TO EXCEL", exportWindowTitle);
  707.         ArrayList<String> accountsFromXml = common.getAccountsInfoFromXlsFile("C:\\accounts.xls",2);
  708.         isAccountsAreExported = advocatesPage.isAccountsAreExported(accounts, accountsFromXml);
  709.         Assert.assertTrue(isAccountsAreExported);
  710.     }
  711.    
  712.    
  713.    
  714.     /**
  715.      * <b>Scenario</b> "User is able to add and delete tag in 'Attributes (Tags)' column" </br>
  716.      * <b>given</b>    "User is on employee Portfolio Page" </br>
  717.      * <b>when</b>     "user clicks on tag" </br>
  718.      * <b>then</b>     "'Add tag' form is displayed" </br>
  719.      * <b>when</b>     "user adds tag" </br>
  720.      * <b>then</b>     "tag was added" </br>
  721.      * <b>and</b>      "tag number increased." </b>
  722.      * <b>when</b>     "user deletes tag" </b>
  723.      * <b>then</b>     "tag was deleted" </b>
  724.      * <b>and</b>      "tag number decreased." </br>
  725.      * QA-655
  726.      */
  727.    
  728.     @Test
  729.     public void userIsAbleToAddAndDeleteTagInAttributesTagsColumn(){
  730.         boolean isAddTagFormDisplayed, isTagAdded;
  731.         String accountName;
  732.        
  733.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  734.         accountName = advocatesPage.getRandomSocialAccountName();
  735.         attributeTagForm = advocatesPage.clickTag(accountName);
  736.         isAddTagFormDisplayed = attributeTagForm.isAddTagFormDisplayed();
  737.         Assert.assertTrue(isAddTagFormDisplayed, "Form isn't displayed");
  738.         attributeTagForm.setTag("Test" +time);     
  739.         isTagAdded = attributeTagForm.isTagAdded("Test" +time);
  740.         Assert.assertTrue(isTagAdded, "Tag isn't added");
  741.         attributeTagForm.closeAddTagForm();
  742.         attributeTagForm = advocatesPage.clickTag(accountName);
  743.         attributeTagForm.deleteTag("Test" +time);
  744.         isTagAdded = attributeTagForm.isTagAdded("Test" +time);
  745.         Assert.assertFalse(isTagAdded, "Tag isn't removed");
  746.         attributeTagForm.closeAddTagForm();
  747.     }
  748.    
  749.    
  750.     /**
  751.      * <b>Scenario</b> "User is able to add and delete tag on the employee social profile details" </br>
  752.      * <b>given</b>    "User is on employee Portfolio Page" </br>
  753.      * <b>when</b>     "user expands social employee details" </br>
  754.      * <b>and</b>      "adds tag" </br>
  755.      * <b>then</b>     "tag was added" </B>
  756.      * <b>and</b>      "tag number increased on the 'Tags' tab" </br>
  757.      * <b>when</b>     "user deletes tag" </br>
  758.      * <b>then</b>     "tag was deleted" </br>
  759.      * <b>and</b>      "tag number decreased." </br>
  760.      * QA-655
  761.      */
  762.    
  763.     @Test
  764.     public void userIsAbleToAddAndDeleteTagOnTheEmployeeSocialProfileDetails(){
  765.         boolean isTagAdded;
  766.  
  767.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);       
  768.         String accountName = advocatesPage.getRandomSocialAccountName();   
  769.         advocatesPage.submitNewSearch(accountName);
  770.         advocatesPage.clickSpecifiedName(accountName);
  771.         advocatesPage.clickTagsTab();
  772.         advocatesPage.addTag("Test" +time);
  773.         isTagAdded = advocatesPage.isTagAdded("Test" +time);
  774.         Assert.assertTrue(isTagAdded, "Tag isn't added");//
  775.         advocatesPage.deleteTag("Test" +time);
  776.         isTagAdded = advocatesPage.isTagAdded("Test" +time);
  777.         Assert.assertFalse(isTagAdded, "Tag isn't removed");
  778. //     
  779.     }
  780.    
  781.    
  782.     /**
  783.      * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
  784.      * <b>given</b>    "User is on Advocate Insight Page" </br>
  785.      * <b>when</b>     "user clicks on an advocate account" </br>
  786.      * <b>and</b>      "adds a note" </br>
  787.      * <b>and</b>      "clicks on add author note button" </br>
  788.      * <b>then</b>     "note was added at top place" </B>
  789.      * <b>when</b>     "adds another note" </br>
  790.      * <b>and</b>      "clicks on add author note button" </br>
  791.      * <b>then</b>     "note was added at top place" </br>
  792.      * <b>and</b>      "previous note was shifted to second place" </br>
  793.      * QA-703
  794.      */
  795.     @Test
  796.     public void userCanAddNotes(){
  797.         String randomNote1 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  798.         String randomNote2 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  799.         boolean isDisplayed;
  800.    
  801.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  802.         String accountName = advocatesPage.getRandomSocialAccountName();
  803.         System.out.println(accountName);
  804.         advocatesPage.clickSpecifiedName(accountName);
  805.          
  806.         advocatesPage.addAuthorNote(randomNote1);
  807.         isDisplayed = advocatesPage.isNoteDisplayed(randomNote1);
  808.         Assert.assertTrue(isDisplayed, "Note isn't displayed");
  809.        
  810.         advocatesPage.addAuthorNote(randomNote2);
  811.         isDisplayed = advocatesPage.isNoteDisplayed(randomNote2);
  812.         Assert.assertTrue(isDisplayed, "Note isn't displayed");
  813.        
  814.     }
  815.  
  816.    
  817.     /**
  818.      * <b>Scenario</b> "User is able to delete notes in Advocate account" </br>
  819.      * <b>given</b>    "User is on Advocate Insight Page" </br>
  820.      * <b>when</b>     "user clicks on an advocate account" </br>
  821.      * <b>and</b>      "adds a note" </br>
  822.      * <b>and</b>      "clicks on add author note button" </br>
  823.      * <b>then</b>     "note was added at top place" </B>
  824.      * <b>and</b>      "adding date was current date" </br>
  825.      * <b>and</b>      "authour's name was same as logged-in user" </br>
  826.      * <b>when</b>     "user clicks on delete note button" </br>
  827.      * <b>then</b>     "note was deleted" </br>
  828.      * QA-705
  829.      */
  830.     @Test
  831.     public void userCanDeleteNotes(){
  832.         String accountName;
  833.         String randomNote = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  834.         boolean isAuthorNotePresent, isAuthorNameCorrect, isRandomNotePresent, isRandomDatePresent;
  835.  
  836.         advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  837.         accountName = advocatesPage.getRandomSocialAccountName();
  838.         advocatesPage.clickSpecifiedName(accountName);
  839.         advocatesPage.addAuthorNote(randomNote);
  840.         isAuthorNotePresent = advocatesPage.isNoteDisplayed(randomNote);
  841.         Assert.assertTrue(isAuthorNotePresent, "Note isn't added");
  842.        
  843.         // Verify author name in note.     
  844.         isAuthorNameCorrect = advocatesPage.isNoteAuthorNameCorrect(randomNote);
  845.         Assert.assertTrue(isAuthorNameCorrect);
  846.        
  847.         // Verify date in note.
  848.         String noteDate = common.dateForNotes(new Date());     
  849.         isRandomNotePresent = advocatesPage.isRandomNotePresent(randomNote);
  850.         isRandomDatePresent = advocatesPage.isDatePresent(noteDate, randomNote);       
  851.         Assert.assertTrue(isRandomNotePresent);
  852.         Assert.assertTrue(isRandomDatePresent);
  853.        
  854.         advocatesPage.deleteAuthorNote(randomNote);
  855.         isAuthorNotePresent = advocatesPage.isNoteDisplayed(randomNote);
  856.         Assert.assertFalse(isAuthorNotePresent);
  857.     }
  858.    
  859.    
  860.         /**
  861.          * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
  862.          * <b>given</b>    "User is on Advocate Insight Page" </br>
  863.          * <b>when</b>     "user clicks on an advocate account" </br>
  864.          * <b>and</b>      "adds a note" </br>
  865.          * <b>and</b>      "clicks on add author note button" </br>
  866.          * <b>then</b>     "note was added at top place" </B>
  867.          * <b>and</b>      "clicks on edit author note button" </br>
  868.          * <b>then</b>     "updates the notes" </br>
  869.          * <b>and</b>      "clicks on add author note button" </br>
  870.          * <b>and</b>      "note was updated at top place" </br>
  871.          * QA-704
  872.          */
  873.    
  874.         @Test
  875.         public void userCanEditNotes(){
  876.             String accountName, randomEditNote, randomNote;
  877.             boolean isDisplayed;
  878.                
  879.             advocatesPage = indexPage.openAdvocatesPageUsingApi(qapepsiman, qapassword);
  880.             accountName = advocatesPage.getRandomSocialAccountName();
  881.             advocatesPage.clickSpecifiedName(accountName);   
  882.             randomNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
  883.             advocatesPage.addAuthorNote(randomNote);
  884.             isDisplayed = advocatesPage.isNoteDisplayed(randomNote);
  885.             Assert.assertTrue(isDisplayed, "Note isn't displayed");
  886.            
  887.             randomEditNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
  888.             advocatesPage.editAuthorNote( randomNote , randomEditNote );
  889.             common.pause(2000);
  890.             isDisplayed = advocatesPage.isNoteDisplayed(randomEditNote);
  891.             Assert.assertTrue(isDisplayed, "Note isn't displayed");
  892.     }
  893. }
Add Comment
Please, Sign In to add comment