Guest User

Untitled

a guest
Sep 23rd, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 39.31 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.loginToAdvocatePage(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.loginToAdvocatePage(qapepsiman,qapassword);
  62.         advocatesPage = advocatesPage.checkMultiplePlatformAndShowResult("Facebook", "Twitter");
  63.         areOnlyAccountsSpecifiedPresent = advocatesPage.areOnlyAccountsSpecifiedPresent("Facebook", "Twitter");
  64.         Assert.assertTrue(areOnlyAccountsSpecifiedPresent);
  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.loginToAdvocatePage(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);
  88.     }
  89.    
  90.     @Test
  91.     public void selectAllFilterIsWorkingCorrectlyForDifferentFilters(){
  92.         int accountsNumbers;
  93.         boolean platformFilterState, brandsFilterState;
  94.        
  95.         advocatesPage = indexPage.loginToAdvocatePage(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.loginToAdvocatePage(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);
  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.loginToAdvocatePage(qapepsiman, qapassword);
  160.         account = advocatesPage.clickRandomAdvocateAcc();
  161.         advocatesPage.clickAssigmentsTabLink();
  162.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  163.         isEditAssigmentFormDisplayed = editAssignmentsForm.isEditAssigmentFormDisplayed();
  164.         Assert.assertTrue(isEditAssigmentFormDisplayed);
  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.loginToAdvocatePage(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.loginToAdvocatePage(qapepsiman,qapassword);
  265.         regionsFilter = advocatesPage.clickOnRegionsFilter();
  266.         regionsFilter.clickOnCancelLink();
  267.         isRegionsFilterPopupDisplayed = regionsFilter.isRegionsFilterPopupDisplayed();
  268.         Assert.assertFalse(isRegionsFilterPopupDisplayed);
  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 accountName, brandName, regionName, randomAccountName;
  284.         boolean areAllSubsidiariesAreEqualToExpected;
  285.  
  286.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  287. //      accountName = advocatesPage.getRandomAccountName(); //your var.    
  288. //      advocatesPage.expandNeededAdvocateAccount(accountName);
  289.        
  290.         randomAccountName = advocatesPage.clickAndGetRandomAccountName(); //my var.
  291.        
  292.         /* ispolzuy randomAccountName v proverke, v konce testovogo scenariya */
  293.        
  294.         advocatesPage.clickAssigmentsTabLink();
  295.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  296.         editAssignmentsForm.expandAll();
  297.         editAssignmentsForm.uncheckAllBoxes();
  298.         brandName = editAssignmentsForm.clickAndGetRandomBrand();
  299.         regionName = editAssignmentsForm.clickAndGetRandomCountry();
  300.         advocatesPage = editAssignmentsForm.clickSaveButton();     
  301.         advocatesPage.checkBrandsAndShowResult(brandName);
  302.         advocatesPage.checkRegionsAndShowResult(regionName);   
  303.         accountsNumbers = advocatesPage.getAccountsNumbers();
  304.         accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
  305.         Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
  306.         areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected(brandName, regionName, "Brands", "Regions", accountsNumbers);
  307.         Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
  308.     }
  309.    
  310.    
  311.     /**
  312.      * <b>Scenario</b> "Brands' filters work correctly" </br>
  313.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  314.      * <b>when</b>     "user selects 'Naked Juice' brands filter" </br>
  315.      * <b>then</b>     "only 'Naked Juice' social profile is displayed" </br>
  316.      * QA-618
  317.      */
  318.    
  319.     @Test
  320.     public void brandsFiltersWorkCorrectly(){
  321.         int accountsNumbers, accountsNumbersFromLabel;;
  322.         boolean areAllSubsidiariesAreEqualToExpected;
  323.         String brandName;
  324.        
  325.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);      
  326.         advocatesPage.expandRandomAdvocateAccount();
  327.         advocatesPage.clickAssigmentsTabLink();
  328.         editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
  329.         editAssignmentsForm.expandAll();
  330.         editAssignmentsForm.uncheckAllBoxes();
  331.         brandName = editAssignmentsForm.clickAndGetRandomBrand();
  332.         advocatesPage = editAssignmentsForm.clickSaveButton();     
  333.         advocatesPage.checkBrandsAndShowResult(brandName);         
  334.         accountsNumbers = advocatesPage.getAccountsNumbers();
  335.         accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
  336.         Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
  337.         areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected(brandName, "Brands", accountsNumbers);
  338.         Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
  339.     }
  340.    
  341.     /**
  342.      * <b>Scenario</b> "Additional accounts should be displayed in the employee governance after the [Show more accounts] link pressed" </br>
  343.      * <b>given</b>    "User is on the 'Social Business Graph' page" </br>
  344.      * <b>when</b>     "user clicks 'Advocate Insight' tab" </br>
  345.      * <b>then</b>     "'25' or less accounts should be shown" </br>
  346.      * <b>and</b>      "when [Show more accounts] link is pressed" </br>
  347.      * <b>then</b>     "additional accounts are displayed in the employee portfolio." </br>
  348.      * QA-662
  349.      */
  350.    
  351.     @Test
  352.     public void additionalAccountsShouldBeDisplayedInTheEmployeeGovernanceAfterTheShowMoreAccountsLinkPressed(){
  353.         boolean isAccountsOnPageCountValid;
  354.         boolean isMoreAccountsShown;
  355.    
  356.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword );
  357.         isAccountsOnPageCountValid = advocatesPage.isAccountsOnPageCountValid(25);
  358.         Assert.assertTrue(isAccountsOnPageCountValid);
  359.         advocatesPage.showMoreAccounts();
  360.         isMoreAccountsShown = advocatesPage.isMoreAccountsShown(25);
  361.         Assert.assertTrue(isMoreAccountsShown);
  362.     }
  363.    
  364.     /**
  365.      * <b>Scenario</b> "Removing account is working correctly" </br>
  366.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  367.      * <b>when</b>     "user expands account" </br>
  368.      * <b>and</b>      "click on settings menu" </br>
  369.      * <b>and</b>      "clicks on'Remove account' link" </br>
  370.      * <b>then</b>     "[Remove account] form and [Close], [Yes], [No] buttons are displayed" </br>
  371.      * <b>when</b>     "user selects 'Permanently remove'" </br>
  372.      * <b>and</b>      "clicks [Yes] button" </br>
  373.      * <b>then</b>     "form 'Advocate account is removed' is displayed" </br>
  374.      * <b>when</b>     "user clicks [close] button" </br>
  375.      * <b>then</b>     "social account is removed." </br>
  376.      * QA-660
  377.      */
  378.    
  379.     @Test
  380.     public void removingAccountIsWorkingCorrectly(){
  381.        
  382.         String userName1 = "test56@dachisgroup.com";
  383.         String password1 = "Passw0rd!";
  384.        
  385.         String accountName;
  386.         boolean isFormDisplayed;
  387.         boolean isNameFormCorrect;
  388.         boolean isCloseButtonDisplayed;
  389.         boolean isYesButtonDisplayed;
  390.         boolean isNoButtonDisplayed;
  391.         boolean isAccountsAreShown;
  392.  
  393.         advocatesPage = indexPage.loginToAdvocatePage(qanokia, qapassword);
  394.         accountName = advocatesPage.clickRandomAdvocateAcc();
  395.         System.out.println(accountName);
  396.         advocatesPage.mouseOverAccountSettings();
  397.         removeAccountForm = advocatesPage.clickRemoveAccountLink();
  398.         isFormDisplayed = removeAccountForm.isFormDisplayed();
  399.         Assert.assertTrue(isFormDisplayed);
  400.        
  401.        
  402.         isNameFormCorrect = removeAccountForm.isNameFormCorrect("REMOVE ACCOUNT");
  403.         Assert.assertTrue(isNameFormCorrect);
  404.         isCloseButtonDisplayed = removeAccountForm.isCloseButtonDisplayed();
  405.         Assert.assertTrue(isCloseButtonDisplayed);
  406.         isYesButtonDisplayed = removeAccountForm.isYesButtonDisplayedOnAdvocate();
  407.         Assert.assertTrue(isYesButtonDisplayed);
  408.         isNoButtonDisplayed = removeAccountForm.isNoButtonDisplayed();
  409.         Assert.assertTrue(isNoButtonDisplayed);
  410.        
  411.         removeAccountForm.clickPermRadioButton();
  412.         removeAccountForm.clickYesButtonOnAdvocate();
  413.         isFormDisplayed = removeAccountForm.isFormDisplayed();
  414.         Assert.assertTrue(isFormDisplayed);
  415.         removeAccountForm.clickCloseButton();
  416.         advocatesPage.submitNewSearch(accountName);
  417.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  418.         Assert.assertFalse(isAccountsAreShown);
  419.     }
  420.    
  421.     /**
  422.      * <b>Scenario</b> "After clicking [No] button on the 'Remove account' form, user backs to the Advocate page" </br>
  423.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  424.      * <b>when</b>     "user expands account" </br>
  425.      * <b>and</b>      "click on settings menu" </br>
  426.      * <b>and</b>      "clicks on'Remove account' link" </br>
  427.      * <b>and</b>      "clicks [No] button" </br>
  428.      * <b>then</b>     "advocate page is displayed." </br>
  429.      * QA-660
  430.      */
  431.    
  432.     @Test
  433.     public void afterClickingNoButtonOnTheRemoveAccountFormUserBacksToTheAdvocatePage(){
  434.         String accountName;
  435.         boolean isAdvocatesPageDisplayed, isAccountsAreShown;
  436.  
  437.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  438.         accountName = advocatesPage.clickRandomAdvocateAcc();
  439.         advocatesPage.mouseOverAccountSettings();
  440.         removeAccountForm = advocatesPage.clickRemoveAccountLink();
  441.         advocatesPage = removeAccountForm.clickNoButtonInAdvocateAccMenu();
  442.         isAdvocatesPageDisplayed = advocatesPage.isAdvocatesPageDisplayed();
  443.         Assert.assertTrue(isAdvocatesPageDisplayed);
  444.         advocatesPage.submitNewSearch(accountName);
  445.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  446.         Assert.assertTrue(isAccountsAreShown);
  447.     }
  448.    
  449.     /**
  450.      * <b>Scenario</b> "Change advocate account to employee works correctly" </br>
  451.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  452.      * <b>when</b>     "user expands random account" </br>
  453.      * <b>and</b>      "clicks on settings menu" </br>
  454.      * <b>and</b>      "clicks on 'Change to Employee' link" </br>
  455.      * <b>then</b>     "'Change this account to an Employee Account' form appears" </br>
  456.      * <b>and</b>      "[Close] / [Yes] / [No] buttons are displayed on the form correctly" </br>
  457.      * <b>when</b>     "user clicks [Yes] button" </br>
  458.      * <b>then</b>     "'Advocate account is changed to employee account' form appears" </br>
  459.      * <b>when</b>     "user clicks [Close] button on the appeared form" </br>
  460.      * <b>then</b>     "advocate account was changed to the employee" </br>
  461.      * <b>and</b>      "changed account has disappeared from the 'Advocate insight' page and appeared on the 'Employee portfolio' page." </br>
  462.      * QA-676
  463.      * @throws InterruptedException
  464.      */
  465.    
  466.     @Test
  467.     public void changeAdvocateAccountToEmployeeWorksCorrectly() throws InterruptedException{
  468.        
  469.         common.log("This script is being failed due to issue: SBI-3121");
  470.        
  471.         String accountName;
  472.         boolean isChangeToEmployeeFormDisplayed;
  473.         boolean isCloseButtonDisplayed;
  474.         boolean isYesButtonDisplayed;
  475.         boolean isNoButtonDisplayed;
  476.         boolean isChangeToEmployeeConfirmFormDisplayed;
  477.         boolean isAccountsAreShown;
  478.        
  479.         String username = "test56@dachisgroup.com";
  480.         String password = "Passw0rd!";
  481.  
  482.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  483.         accountName = advocatesPage.clickRandomAdvocateAcc();
  484.         advocatesPage.mouseOverAccountSettings();
  485.         changeToEmployeeForm = advocatesPage.clickChangeToEmployeeLink();
  486.         isChangeToEmployeeFormDisplayed = changeToEmployeeForm.isChangeToEmployeeFormDisplayed("CHANGE THIS ACCOUNT TO AN EMPLOYEE ACCOUNT");
  487.         Assert.assertTrue(isChangeToEmployeeFormDisplayed);
  488.         isCloseButtonDisplayed = changeToEmployeeForm.isCloseButtonDisplayed();
  489.         Assert.assertTrue(isCloseButtonDisplayed);
  490.         isYesButtonDisplayed =changeToEmployeeForm.isYesButtonDisplayed();
  491.         Assert.assertTrue(isYesButtonDisplayed);
  492.         isNoButtonDisplayed = changeToEmployeeForm.isNoButtonDisplayed();
  493.         Assert.assertTrue(isNoButtonDisplayed);
  494.         accountIsChangeForm = changeToEmployeeForm.clickYesButton();
  495.         isChangeToEmployeeConfirmFormDisplayed = accountIsChangeForm.isChangeToEmployeeConfirmFormDisplayed("ADVOCATE ACCOUNT CHANGED TO EMPLOYEE ACCOUNT");       
  496.         Assert.assertTrue(isChangeToEmployeeConfirmFormDisplayed);
  497.         advocatesPage = accountIsChangeForm.clickCloseButton();
  498.         advocatesPage.submitNewSearch(accountName);
  499.         isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
  500.         Assert.assertFalse(isAccountsAreShown);
  501.         employeePortfolioPage = advocatesPage.clickEmployeePortfolioLink();
  502.         employeePortfolioPage.searchEmployee(accountName);
  503.         isAccountsAreShown = employeePortfolioPage.isAccountsAreShown(accountName);
  504.         Assert.assertTrue(isAccountsAreShown); 
  505.     }
  506.    
  507.     /**
  508.      * <b>Scenario</b> "Search by name is working correctly" </br>
  509.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  510.      * <b>when</b>     "user enter account name in the search field" </br>
  511.      * <b>then</b>     "search result according to the search criteria is displayed correctly." </br>
  512.      * QA-678
  513.      */
  514.    
  515.     @Test
  516.     public void searchByNameIsWorkingCorrectly(){
  517.         String accountName;
  518.         boolean isSearchWork;
  519.  
  520.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  521.         accountName = advocatesPage.getRandomAccountName();
  522.         advocatesPage.submitNewSearch(accountName);
  523.         isSearchWork = advocatesPage.isSearchWork(accountName);
  524.         Assert.assertTrue(isSearchWork);
  525.     }
  526.    
  527.     /**
  528.      * <b>Scenario</b> "Remove filter is working correctly" </br>
  529.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  530.      * <b>when</b>     "user selects 'Naked Juice' brands filter" </br>
  531.      * <b>then</b>     "the number of clear filter tabs should be 1" </br>
  532.      * <b>when</b>     "user remove filter" </br>
  533.      * <b>then</b>     "all accounts which were present before filter removed are shown"
  534.      * QA-618
  535.      */
  536.    
  537.     @Test
  538.     public void removeFilterIsWorkingCorrectly(){
  539.         int accountsNumber;
  540.         int clearFilterNumbers;
  541.         int accountsNumbers;
  542.  
  543.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  544.         accountsNumber = advocatesPage.getAccountsNumbers();
  545.         advocatesPage = advocatesPage.checkBrandsAndShowResult("FritoLay");
  546.         clearFilterNumbers = advocatesPage.getClearFilterNumbers();
  547.         Assert.assertEquals(1, clearFilterNumbers);
  548.         advocatesPage.removeAllFilters();
  549.         accountsNumbers = advocatesPage.getAccountsNumbers();
  550.         Assert.assertEquals(accountsNumber, accountsNumbers);
  551.     }
  552.    
  553.    
  554.     /**
  555.      * <b>Scenario</b> "Search functionality is working correctly" </br>
  556.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  557.      * <b>when</b>     "user inputs account name in the search field" </br>
  558.      * <b>then</b>     "Verify that only account expected is represented in the list" </br>
  559.      * QA-621
  560.      */
  561.    
  562.     @Test
  563.     public void searchFunctionalityIsWorkingCorrectly(){
  564.         String accountName;
  565.         int accountsNumbers;
  566.         String getFirstAccountName;
  567.        
  568.         String username = "test56@dachisgroup.com";
  569.         String password = "Passw0rd!";
  570.  
  571.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  572.         accountName = advocatesPage.getRandomAccountName();
  573.         advocatesPage.submitNewSearch(accountName);
  574.         accountsNumbers = advocatesPage.getAccountsNumbers();
  575.         Assert.assertEquals(1, accountsNumbers);
  576.         getFirstAccountName = advocatesPage.getFirstAccountName();
  577.         Assert.assertEquals(accountName, getFirstAccountName);
  578.     }
  579.    
  580.    
  581.     /**
  582.      * <b>Scenario</b> "Edit and Save Account Info with empty fields" </br>
  583.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  584.      * <b>when</b>     "user opens social account" </br>
  585.      * <b>and</b>      "clicks on [Edit Account Info] link" </br>
  586.      * <b>then</b>     "[Edit Account] form appears" </br>
  587.      * <b>when</b>     "user erased all required data" </br>
  588.      * <b>and</b>      "presses [Save and Close] button" </br>
  589.      * <b>then</b>     "error notification appears" </br>
  590.      * QA-619
  591.      */
  592.     @Test
  593.     public void editAndSaveAccountInfoWithEmptyFields(){
  594.         String formHeaderText, alertText;  
  595.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  596.         String accName = advocatesPage.getRandomAccountName();
  597.         advocatesPage.submitNewSearch(accName);
  598.         advocatesPage.clickRandomAdvocateAcc();
  599.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  600.         formHeaderText = editAccountInfoForm.getFormHeaderText();
  601.         Assert.assertEquals("Social Account Setup", formHeaderText);
  602.         editAccountInfoForm.clearAccountInfoSection();
  603.         editAccountInfoForm.clickSaveAndCloseButton(); 
  604.         alertText = editAccountInfoForm.getErrorMessageText();
  605.         Assert.assertEquals(alertText, "Please provide the Account Name.");
  606.     }
  607.    
  608.    
  609.     /**
  610.      * <b>Scenario</b> "Cancel feature on Edit Account Info form" </br>
  611.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  612.      * <b>when</b>     "clicks on [Edit Account Info] link from account details section" </br>
  613.      * <b>and</b>      "user changes all data" </br>
  614.      * <b>and</b>      "presses [Cancel] button" </br>
  615.      * <b>then</b>     "changes were not saved" </br>
  616.      */
  617.     @Test
  618.     public void cancelFeatureOnEditAccountInfoForm(){      
  619.         String accountInfo, updatedAccountInfo;
  620.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  621.         advocatesPage.clickRandomAdvocateAcc();
  622.         accountInfo = advocatesPage.getAccountInfo();
  623.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  624.         editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
  625.         advocatesPage = editAccountInfoForm.clickCancelButton();
  626.         updatedAccountInfo = advocatesPage.getAccountInfo();
  627.         accountInfo.equals(updatedAccountInfo);
  628.         Assert.assertEquals(updatedAccountInfo, accountInfo);
  629.     }
  630.    
  631.    
  632.     /**
  633.      * <b>Scenario</b> "Close feature on Edit Account Info form" </br>
  634.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  635.      * <b>when</b>     "clicks on [Edit Account Info] link from random account details section" </br>
  636.      * <b>and</b>      "user changes all data" </br>
  637.      * <b>and</b>      "presses [Close] button" </br>
  638.      * <b>then</b>     "changes were not saved" </br>
  639.      * QA-619
  640.      */
  641.    
  642.     @Test
  643.     public void closeFeatureOnEditAccountInfoForm(){
  644.         String accountInfo, updatedAccountInfo;
  645.  
  646.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  647.         advocatesPage.clickRandomAdvocateAcc();
  648.         accountInfo = advocatesPage.getAccountInfo();
  649.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  650.         editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
  651.         advocatesPage = editAccountInfoForm.clickCloseButton();
  652.         updatedAccountInfo = advocatesPage.getAccountInfo();
  653.         accountInfo.equals(updatedAccountInfo);
  654.         Assert.assertEquals(updatedAccountInfo, accountInfo);
  655.     }
  656.    
  657.    
  658.     /**
  659.      * <b>Scenario</b> "Edit Account Info feature" </br>
  660.      * <b>given</b>    "User is on the 'Advocate Insight' page" </br>
  661.      * <b>when</b>     "clicks on [Edit Account Info] link from random account details section" </br>
  662.      * <b>and</b>      "user changes all data" </br>
  663.      * <b>and</b>      "presses [Save and Close] button" </br>
  664.      * <b>then</b>     "changes were successfully saved" </br>
  665.      * QA-619
  666.      */
  667.    
  668.     @Test
  669.     public void editAccountInfoFeature(){
  670.         String updatedAccountInfo;
  671.         boolean isContainUrl;
  672.         boolean isContainDiscriprion;
  673.  
  674.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman,qapassword);
  675.         advocatesPage.clickRandomAdvocateAcc();
  676.         editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
  677.         editAccountInfoForm.fillAccountInfoSection(name, "" , "");
  678.         advocatesPage = editAccountInfoForm.clickSaveAndCloseButton();
  679.         advocatesPage.submitNewSearch(name);
  680.         advocatesPage.clickRandomAdvocateAcc();
  681.         updatedAccountInfo = advocatesPage.getAccountInfo();
  682.         isContainDiscriprion = updatedAccountInfo.contains("");
  683.         Assert.assertTrue(isContainDiscriprion);
  684.         isContainUrl = updatedAccountInfo.contains("");
  685.         Assert.assertTrue(isContainUrl);
  686.     }
  687.    
  688.    
  689.     /**
  690.      * <b>Scenario</b> "Exported accounts data should be the same as accounts data on the Advocates Page" </br>
  691.      * <b>given</b>    "User is on the 'Advocates' page" </br>
  692.      * <b>when</b>     "clicks 'Show more accounts link'" </br>
  693.      * <b>and</b>      "user mouses over 'Settings' image and clicks 'Export Result' link" </br>
  694.      * <b>then</b>     "'Export Results to Excel' window appears" </br>
  695.      * <b>and</b>      "file with data is downloaded correctly" </br>
  696.      * <b>and</b>      "exported account data are the same as on Advocates Page."
  697.      * SBI-1751
  698.      * @throws IOException
  699.      * @throws BiffException
  700.      */
  701.    
  702.     @Test
  703.     public void exportedAccountsDataShouldBeTheSameAsAccountsDataOnTheAdvocatesPage() throws BiffException, IOException{
  704.         String exportWindowTitle;
  705.         boolean isAccountsAreExported;
  706.    
  707.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  708.         advocatesPage.clickAccountSortLink();      
  709.         advocatesPage.clickShowAllAccs();
  710.         ArrayList<String> accounts = advocatesPage.getAccountsData();
  711.         advocatesPage.mouseOverSettingsImage();
  712.         advocatesPage.clickSettingsImage();
  713.         advocatesPage.clickExportLink();
  714.         exportWindowTitle = advocatesPage.exportWindowTitle();
  715.         Assert.assertEquals("EXPORT RESULTS TO EXCEL", exportWindowTitle);
  716.         ArrayList<String> accountsFromXml = common.getAccountsInfoFromXlsFile("C:\\accounts.xls",2);
  717.         isAccountsAreExported = advocatesPage.isAccountsAreExported(accounts, accountsFromXml);
  718.         Assert.assertTrue(isAccountsAreExported);
  719.     }
  720.    
  721.    
  722.    
  723.     /**
  724.      * <b>Scenario</b> "User is able to add and delete tag in 'Attributes (Tags)' column" </br>
  725.      * <b>given</b>    "User is on employee Portfolio Page" </br>
  726.      * <b>when</b>     "user clicks on tag" </br>
  727.      * <b>then</b>     "'Add tag' form is displayed" </br>
  728.      * <b>when</b>     "user adds tag" </br>
  729.      * <b>then</b>     "tag was added" </br>
  730.      * <b>and</b>      "tag number increased." </b>
  731.      * <b>when</b>     "user deletes tag" </b>
  732.      * <b>then</b>     "tag was deleted" </b>
  733.      * <b>and</b>      "tag number decreased." </br>
  734.      * QA-655
  735.      */
  736.    
  737.     @Test
  738.     public void userIsAbleToAddAndDeleteTagInAttributesTagsColumn(){
  739.         int difference;
  740.         boolean isAddTagFormDisplayed;
  741.         boolean isTagAdded;
  742.         int tagNumberAfter;
  743.         int tagNumberBefore;
  744.  
  745.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  746.         String accountName = advocatesPage.getRandomSocialAccountName();
  747.         tagNumberBefore = advocatesPage.getTagNumber(accountName);
  748.         attributeTagForm = advocatesPage.clickTag(accountName);
  749.         isAddTagFormDisplayed = attributeTagForm.isAddTagFormDisplayed();
  750.         Assert.assertTrue(isAddTagFormDisplayed);
  751.         attributeTagForm.setTag("Test" +time);
  752.         tagNumberAfter = advocatesPage.getTagNumber(accountName);
  753.         isTagAdded = attributeTagForm.isTagAdded("Test" +time);
  754.         Assert.assertTrue(isTagAdded);
  755.         attributeTagForm.closeAddTagForm();
  756.         difference = tagNumberAfter-tagNumberBefore;
  757.         Assert.assertEquals(1, difference);
  758.         attributeTagForm = advocatesPage.clickTag(accountName);
  759.         attributeTagForm.deleteTag("Test" +time);
  760.         isTagAdded = attributeTagForm.isTagAdded("Test" +time);
  761.         Assert.assertFalse(isTagAdded);
  762.         attributeTagForm.closeAddTagForm();
  763.         tagNumberAfter = advocatesPage.getTagNumber(accountName);
  764.         difference = tagNumberAfter-tagNumberBefore;
  765.         Assert.assertEquals(0, difference);
  766.     }
  767.    
  768.    
  769.     /**
  770.      * <b>Scenario</b> "User is able to add and delete tag on the employee social profile details" </br>
  771.      * <b>given</b>    "User is on employee Portfolio Page" </br>
  772.      * <b>when</b>     "user expands social employee details" </br>
  773.      * <b>and</b>      "adds tag" </br>
  774.      * <b>then</b>     "tag was added" </B>
  775.      * <b>and</b>      "tag number increased on the 'Tags' tab" </br>
  776.      * <b>when</b>     "user deletes tag" </br>
  777.      * <b>then</b>     "tag was deleted" </br>
  778.      * <b>and</b>      "tag number decreased." </br>
  779.      * QA-655
  780.      */
  781.    
  782.     @Test
  783.     public void userIsAbleToAddAndDeleteTagOnTheEmployeeSocialProfileDetails(){
  784.         boolean isTagAdded;
  785.  
  786.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);     
  787.         String accountName = advocatesPage.getRandomSocialAccountName();   
  788.         advocatesPage.submitNewSearch(accountName);
  789.         advocatesPage.clickSpecifiedName(accountName);
  790.         advocatesPage.clickTagsTab();
  791.         advocatesPage.addTag("Test" +time);
  792.         isTagAdded = advocatesPage.isTagAdded("Test" +time);
  793.         Assert.assertTrue(isTagAdded);//   
  794.         advocatesPage.deleteTag("Test" +time);
  795.         isTagAdded = advocatesPage.isTagAdded("Test" +time);
  796.         Assert.assertFalse(isTagAdded);
  797. //     
  798.     }
  799.    
  800.    
  801.     /**
  802.      * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
  803.      * <b>given</b>    "User is on Advocate Insight Page" </br>
  804.      * <b>when</b>     "user clicks on an advocate account" </br>
  805.      * <b>and</b>      "adds a note" </br>
  806.      * <b>and</b>      "clicks on add author note button" </br>
  807.      * <b>then</b>     "note was added at top place" </B>
  808.      * <b>when</b>     "adds another note" </br>
  809.      * <b>and</b>      "clicks on add author note button" </br>
  810.      * <b>then</b>     "note was added at top place" </br>
  811.      * <b>and</b>      "previous note was shifted to second place" </br>
  812.      * QA-703
  813.      */
  814.     @Test
  815.     public void userCanAddNotes(){
  816.    
  817.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  818.         String accountName = advocatesPage.getRandomSocialAccountName();
  819.         System.out.println(accountName);
  820.         advocatesPage.clickSpecifiedName(accountName);
  821.         String randomNote1 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  822.         advocatesPage.addAuthorNote(randomNote1);
  823.         Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote1));
  824.        
  825.         String randomNote2 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  826.         advocatesPage.addAuthorNote(randomNote2);
  827.         Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote2));
  828.        
  829.     }
  830.  
  831.    
  832.     /**
  833.      * <b>Scenario</b> "User is able to delete notes in Advocate account" </br>
  834.      * <b>given</b>    "User is on Advocate Insight Page" </br>
  835.      * <b>when</b>     "user clicks on an advocate account" </br>
  836.      * <b>and</b>      "adds a note" </br>
  837.      * <b>and</b>      "clicks on add author note button" </br>
  838.      * <b>then</b>     "note was added at top place" </B>
  839.      * <b>and</b>      "adding date was current date" </br>
  840.      * <b>and</b>      "authour's name was same as logged-in user" </br>
  841.      * <b>when</b>     "user clicks on delete note button" </br>
  842.      * <b>then</b>     "note was deleted" </br>
  843.      * QA-705
  844.      */
  845.     @Test
  846.     public void userCanDeleteNotes(){
  847.         String accountName;
  848.         String randomNote = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
  849.         boolean isAuthorNotePresent, isAuthorNameCorrect, isRandomNotePresent, isRandomDatePresent;
  850.  
  851.         advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  852.         accountName = advocatesPage.getRandomSocialAccountName();
  853.         advocatesPage.clickSpecifiedName(accountName);
  854.         advocatesPage.addAuthorNote(randomNote);
  855.         isAuthorNotePresent = advocatesPage.isNoteDisplayed(randomNote);
  856.         Assert.assertTrue(isAuthorNotePresent);
  857.        
  858.         // Verify author name in note.     
  859.         isAuthorNameCorrect = advocatesPage.isNoteAuthorNameCorrect(randomNote);
  860.         Assert.assertTrue(isAuthorNameCorrect);
  861.        
  862.         // Verify date in note.
  863.         String noteDate = common.dateForNotes(new Date());     
  864.         isRandomNotePresent = advocatesPage.isRandomNotePresent(randomNote);
  865.         isRandomDatePresent = advocatesPage.isDatePresent(noteDate, randomNote);       
  866.         Assert.assertTrue(isRandomNotePresent);
  867.         Assert.assertTrue(isRandomDatePresent);
  868.        
  869.         advocatesPage.deleteAuthorNote(randomNote);
  870.         isAuthorNotePresent = advocatesPage.isNoteDisplayed(randomNote);
  871.         Assert.assertFalse(isAuthorNotePresent);
  872.     }
  873.    
  874.    
  875.         /**
  876.          * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
  877.          * <b>given</b>    "User is on Advocate Insight Page" </br>
  878.          * <b>when</b>     "user clicks on an advocate account" </br>
  879.          * <b>and</b>      "adds a note" </br>
  880.          * <b>and</b>      "clicks on add author note button" </br>
  881.          * <b>then</b>     "note was added at top place" </B>
  882.          * <b>and</b>      "clicks on edit author note button" </br>
  883.          * <b>then</b>     "updates the notes" </br>
  884.          * <b>and</b>      "clicks on add author note button" </br>
  885.          * <b>and</b>      "note was updated at top place" </br>
  886.          * QA-704
  887.          */
  888.    
  889.         @Test
  890.         public void userCanEditNotes(){
  891.                
  892.             advocatesPage = indexPage.loginToAdvocatePage(qapepsiman, qapassword);
  893.             String accountName = advocatesPage.getRandomSocialAccountName();
  894.             advocatesPage.clickSpecifiedName(accountName);
  895.             String randomNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
  896.             advocatesPage.addAuthorNote(randomNote);
  897.             advocatesPage.isNoteDisplayed(randomNote);
  898.             Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote));
  899.             String randomEditNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
  900.             advocatesPage.editAuthorNote( randomNote , randomEditNote );
  901.             common.pause(2000);
  902.             Assert.assertTrue(advocatesPage.isNoteDisplayed(randomEditNote));
  903.     }
  904. }
Add Comment
Please, Sign In to add comment