Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.dachisgroup.sbi.verification.mainSite;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.Date;
- import jxl.read.biff.BiffException;
- import org.testng.annotations.Test;
- import com.dachisgroup.sbi.filtersBlock.BrandsFilter;
- import com.dachisgroup.sbi.init.Common;
- import com.dachisgroup.sbi.init.SeleniumInit;
- import com.dachisgroup.sbi.init.TestData;
- import com.dachisgroup.sbi.pages.advocates.AdvocatesPage;
- import com.dachisgroup.sbi.pages.index.IndexPage;
- import org.testng.Assert;
- import org.openqa.selenium.By;
- import org.openqa.selenium.NoSuchElementException;
- import org.openqa.selenium.WebElement;
- public class TS_Advocate extends SeleniumInit implements TestData{
- Date date = new Date();
- Common common = new Common(driver);
- String url = "123123";
- String time = common.toGmtString(date);
- String name = "mister" + time;
- String name2 = "miss" + time;
- String namesub1 = name.substring(0, 1);
- String namesub2 = name.substring(6, 11);
- String firstName = common.generateRandomChars(5);
- String lastName = common.generateRandomChars(6);
- String email = time + "@mailinator.com";
- String message = common.generateRandomSymbols(12);
- @Test
- public void companyPortfolioTest() throws InterruptedException{
- String advocateName = "Asex";
- String advocateDetailRange = "30d";
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- advocatesPage.clickAdvocateDetailRange(advocateName, advocateDetailRange);
- }
- /**
- * <b>Scenario</b> "Multiple 'Platforms' filters work correctly" <br>
- * <b>given</b> "User is on the 'Advocate Insight' page" <br>
- * <b>when</b> "user selects 'Facebook' platform filter" </br>
- * <b>then</b> "only 'Facebook' social profile is displayed" </br>
- * QA-618
- */
- @Test
- public void multiplePlatformsFiltersWorkCorrectly(){
- boolean areOnlyAccountsSpecifiedPresent;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- advocatesPage = advocatesPage.checkMultiplePlatformAndShowResult("Facebook", "Twitter");
- areOnlyAccountsSpecifiedPresent = advocatesPage.areOnlyAccountsSpecifiedPresent("Facebook", "Twitter");
- Assert.assertTrue(areOnlyAccountsSpecifiedPresent);
- }
- /**
- * <b>Scenario</b> "Subsidiaries' filters work correctly" <br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user selects 'PepsiCo, Inc.' susidiaries filter" </br>
- * <b>then</b> "only 'PepsiCo, Inc.' social profile is displayed" </br>
- * QA-618
- */
- @Test
- public void subsidiariesFiltersWorkCorrectly(){
- int accountsNumbers, realAccountsNumber;
- boolean areAllSubsidiariesAreEqualToExpected;
- advocatesPage = indexPage.loginToAdvocatePage(qanokia, qapassword);
- advocatesPage = advocatesPage.checkSubsidiaryAndShowResult("Navigeishn Teknolodzhiz C-I-S OOO");
- advocatesPage.clickShowAllAccs();
- accountsNumbers = advocatesPage.getAccountsNumbers();
- realAccountsNumber = advocatesPage.getRealAccountNumbers();
- Assert.assertEquals(accountsNumbers, realAccountsNumber);
- areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected("Navigeishn Teknolodzhiz C-I-S OOO", "Subsidiaries", accountsNumbers);
- Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
- }
- @Test
- public void selectAllFilterIsWorkingCorrectlyForDifferentFilters(){
- int accountsNumbers;
- boolean platformFilterState, brandsFilterState;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- platformsFilter = advocatesPage.clickOnPlatformsFilter();
- platformsFilter.selectAllPlatformFilters();
- platformFilterState = platformsFilter.areAllPlatformCheckboxesChecked();
- Assert.assertEquals(platformFilterState, true);
- advocatesPage = new AdvocatesPage(driver);
- brandsFilter = advocatesPage.clickOnBrandsFilter();
- brandsFilter.selectAllBrandsFilters();
- brandsFilterState = brandsFilter.areAllBrandsCheckboxesChecked();
- Assert.assertEquals(brandsFilterState, true);
- }
- /**
- * <b>Scenario</b> "Regions' filters work correctly" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user selects 'North America' regions filter" </br>
- * <b>then</b> "only 'North America' social profile is displayed" </br>
- * QA-618
- */
- @Test
- public void regionsFiltersWorkCorrectly(){
- int accountsNumbers, accountsNumbersFromLabel;
- boolean areAllSubsidiariesAreEqualToExpected;
- String accountName, regionName;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- accountName = advocatesPage.getRandomAccountName();
- advocatesPage.expandNeededAdvocateAccount(accountName);
- advocatesPage.clickAssigmentsTabLink();
- editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
- editAssignmentsForm.expandAll();
- editAssignmentsForm.uncheckAllBoxes();
- regionName = editAssignmentsForm.clickAndGetRandomCountry();
- advocatesPage = editAssignmentsForm.clickSaveButton();
- advocatesPage.checkRegionsAndShowResult(regionName);
- accountsNumbers = advocatesPage.getAccountsNumbers();
- accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
- Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
- areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected(regionName, "Regions", accountsNumbers);
- Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
- }
- /**
- * <b>Scenario</b> "User is able to edit associations in the advocate accounts" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "user expands advocate account" </br>
- * <b>and</b> "user clicks 'Company Associations' Tab and click 'edit' link" </br>
- * <b>then</b> "'Edit Assignments' form appears" </br>
- * <b>when</b> "user check 'Location', 'Brands' checkboxes and clicks [Save] button" </br>
- * <b>then</b> "advocate account is updated according to the set data and displayed correctly on the 'Advocates' page." </br>
- * QA-656
- */
- @Test
- public void userIsAbleToEditAssociationsInTheAdvocateAccounts(){
- String account;
- boolean isEditAssigmentFormDisplayed;
- String socAssigments;
- String assigments;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- account = advocatesPage.clickRandomAdvocateAcc();
- advocatesPage.clickAssigmentsTabLink();
- editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
- isEditAssigmentFormDisplayed = editAssignmentsForm.isEditAssigmentFormDisplayed();
- Assert.assertTrue(isEditAssigmentFormDisplayed);
- editAssignmentsForm.expandAll();
- editAssignmentsForm.uncheckAllBoxes();
- assigments = editAssignmentsForm.checkRandomAssociations();
- advocatesPage = editAssignmentsForm.clickSaveButton();
- advocatesPage.submitNewSearch(account);
- advocatesPage.clickRandomAdvocateAcc();
- advocatesPage.clickAssigmentsTabLink();
- socAssigments = advocatesPage.geAdvocateAccountAssociations();
- Assert.assertEquals(assigments, socAssigments);
- }
- /**
- * <b>Scenario</b> "Grouping by each type should return correct result on the 'Avocates' page" </br>
- * <b>given</b> "User is on the 'Avocates' page" </br>
- * <b>then</b> "'Group by:' menu has 'None' value by default" </br>
- * <b>when</b> "user sets 'Platform' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system social platforms with and without social account(s) are displayed correctly" </br>
- * <b>when</b> "user sets 'Brand' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system brands with assigned social account(s) are displayed correctly" </b>
- * <b>and</b> "text '<#number> brands with no social accounts associated' is displayed" </br>
- * <b>when</b> "user sets 'Region' type in the 'GroTup by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system regions with assigned social account(s) are displayed correctly" </br>
- * <b>and</b> "text '<#number> regions with no social accounts associated' is displayed" </br>
- * <b>when</b> "user sets 'Country' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system countries with assigned social account(s) are displayed correctly" </br>
- * <b>and</b> "text '<#number> countries with no social accounts associated' is displayed" </br>
- * <b>when</b> "user sets 'Subsidiary' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system subsidiaries with assigned social account(s) are displayed correctly" </br>
- * <b>when</b> "user sets 'Last activity' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "corresponding to the last activiy search request advocate account(s) is/are displayed correctly." </br>
- * <b>and</b> "text 'No known activity <#number>' is displayed" </br>
- * <b>when</b> "user sets 'Relationship' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and</b> "all existed in the system relationship(s) with and without account(s) is/are displayed correctly" </br>
- * <b>when</b> "user sets 'Tag' type in the 'Group by:' drop-down menu" </br>
- * <b>then</b> "'Advocate insight' page is dimmed and spinner image during the loading of the result is displayed" </br>
- * <b>and<br> "corresponding to the last activiy search request tag(s) is/are displayed correctly." </br>
- * <b>and</b> "text '<#number> Tags with no Social Accounts associated' is displayed" <br>
- * QA-658
- */
- @Test
- public void groupingByEachTypeShouldReturnCorrectResultOnTheAvocatesPage(){
- String dropDownLabelText;
- boolean isGroupByValueCorrect;
- ArrayList<String> platformsList;
- ArrayList<String> togglesList;
- boolean isContainsAll;
- ArrayList<String> brandsList;
- String notAssociatedText;
- boolean checkNotAssociatedText;
- ArrayList<String> regionsList;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- dropDownLabelText = advocatesPage.getDropDownLabelText();
- Assert.assertEquals("Group by:", dropDownLabelText);
- isGroupByValueCorrect = advocatesPage.isGroupByValueCorrect("None");
- Assert.assertTrue(isGroupByValueCorrect);
- advocatesPage.selectNeededPivotFilter("Platform");
- advocatesPage.clickOnPlatformsLink();
- platformsList = advocatesPage.getPlatformsText();
- togglesList = advocatesPage.getToggleNames();
- isContainsAll = advocatesPage.isContainsAll(platformsList, togglesList);
- Assert.assertTrue(isContainsAll);
- advocatesPage.selectNeededPivotFilter("Brand");
- advocatesPage.clickOnBrandsFilterLink();
- brandsList = advocatesPage.getBrandsLabelsText();
- togglesList = advocatesPage.getToggleNames();
- isContainsAll = advocatesPage.isContainsAll(brandsList, togglesList);
- Assert.assertTrue(isContainsAll);
- notAssociatedText = advocatesPage.getTextFromNotAssociatedRow();
- checkNotAssociatedText = notAssociatedText.contains("Brands with no Social Accounts associated");
- Assert.assertTrue(checkNotAssociatedText);
- advocatesPage.selectNeededPivotFilter("Region");
- advocatesPage.clickOnRegionsFilterLink();
- regionsList = advocatesPage.getRegionLabels();
- togglesList = advocatesPage.getToggleNames();
- isContainsAll = advocatesPage.isContainsAll(regionsList, togglesList);
- Assert.assertTrue(isContainsAll);
- }
- /**
- * <b>Scenario</b> "Close filter popup" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user opens regions popup and press cancel link" </br>
- * <b>then</b> "filters popup is dissapear" </br>
- *
- */
- @Test
- public void closeFilterPopup(){
- boolean isRegionsFilterPopupDisplayed;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- regionsFilter = advocatesPage.clickOnRegionsFilter();
- regionsFilter.clickOnCancelLink();
- isRegionsFilterPopupDisplayed = regionsFilter.isRegionsFilterPopupDisplayed();
- Assert.assertFalse(isRegionsFilterPopupDisplayed);
- }
- /**
- * <b>Scenario</b> "2 different filters select" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user selects 'Naked Juice' brands filter and 'North America' regions filter" </br>
- * <b>then</b> "social accounts with Naked Juice' brands and 'North America' regions are displayed" </br>
- * QA-618 + QA-1084
- */
- @Test
- public void twoDifferentFiltersSelect(){
- int accountsNumbers, accountsNumbersFromLabel;
- String accountName, brandName, regionName;
- boolean areAllSubsidiariesAreEqualToExpected;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- accountName = advocatesPage.getRandomAccountName();
- advocatesPage.expandNeededAdvocateAccount(accountName);
- advocatesPage.clickAssigmentsTabLink();
- editAssignmentsForm = advocatesPage.clickEditAssigmentLink();
- editAssignmentsForm.expandAll();
- editAssignmentsForm.uncheckAllBoxes();
- brandName = editAssignmentsForm.clickAndGetRandomBrand();
- regionName = editAssignmentsForm.clickAndGetRandomCountry();
- advocatesPage = editAssignmentsForm.clickSaveButton();
- advocatesPage.checkBrandsAndShowResult(brandName);
- advocatesPage.checkRegionsAndShowResult(regionName);
- accountsNumbers = advocatesPage.getAccountsNumbers();
- accountsNumbersFromLabel = advocatesPage.getAccountsNumberFromLabel();
- Assert.assertEquals(accountsNumbersFromLabel, accountsNumbers);
- areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected(brandName, regionName, "Brands", "Regions", accountsNumbers);
- Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
- }
- /**
- * <b>Scenario</b> "Brands' filters work correctly" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user selects 'Naked Juice' brands filter" </br>
- * <b>then</b> "only 'Naked Juice' social profile is displayed" </br>
- * QA-618
- */
- @Test
- public void brandsFiltersWorkCorrectly(){
- int accountsNumbers, realAccountsNumber;;
- boolean areAllSubsidiariesAreEqualToExpected;
- indexPage = new IndexPage(driver);
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- advocatesPage = advocatesPage.checkBrandsAndShowResult("Big Crush");
- realAccountsNumber = advocatesPage.getRealAccountNumbers();
- accountsNumbers = advocatesPage.getAccountsNumbers();
- Assert.assertEquals(realAccountsNumber, accountsNumbers);
- areAllSubsidiariesAreEqualToExpected = advocatesPage.areAllSubsidiariesAreEqualToExpected("Big Crush", "Brands", accountsNumbers);
- Assert.assertTrue(areAllSubsidiariesAreEqualToExpected);
- }
- /**
- * <b>Scenario</b> "Additional accounts should be displayed in the employee governance after the [Show more accounts] link pressed" </br>
- * <b>given</b> "User is on the 'Social Business Graph' page" </br>
- * <b>when</b> "user clicks 'Advocate Insight' tab" </br>
- * <b>then</b> "'25' or less accounts should be shown" </br>
- * <b>and</b> "when [Show more accounts] link is pressed" </br>
- * <b>then</b> "additional accounts are displayed in the employee portfolio." </br>
- * QA-662
- */
- @Test
- public void additionalAccountsShouldBeDisplayedInTheEmployeeGovernanceAfterTheShowMoreAccountsLinkPressed(){
- boolean isAccountsOnPageCountValid;
- boolean isMoreAccountsShown;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword );
- isAccountsOnPageCountValid = advocatesPage.isAccountsOnPageCountValid(25);
- Assert.assertTrue(isAccountsOnPageCountValid);
- advocatesPage.showMoreAccounts();
- isMoreAccountsShown = advocatesPage.isMoreAccountsShown(25);
- Assert.assertTrue(isMoreAccountsShown);
- }
- /**
- * <b>Scenario</b> "Removing account is working correctly" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "user expands account" </br>
- * <b>and</b> "click on settings menu" </br>
- * <b>and</b> "clicks on'Remove account' link" </br>
- * <b>then</b> "[Remove account] form and [Close], [Yes], [No] buttons are displayed" </br>
- * <b>when</b> "user selects 'Permanently remove'" </br>
- * <b>and</b> "clicks [Yes] button" </br>
- * <b>then</b> "form 'Advocate account is removed' is displayed" </br>
- * <b>when</b> "user clicks [close] button" </br>
- * <b>then</b> "social account is removed." </br>
- * QA-660
- */
- @Test
- public void removingAccountIsWorkingCorrectly(){
- String userName1 = "test56@dachisgroup.com";
- String password1 = "Passw0rd!";
- String accountName;
- boolean isFormDisplayed;
- boolean isNameFormCorrect;
- boolean isCloseButtonDisplayed;
- boolean isYesButtonDisplayed;
- boolean isNoButtonDisplayed;
- boolean isAccountsAreShown;
- advocatesPage = indexPage.loginToAdvocatePage(qanokia, qapassword);
- accountName = advocatesPage.clickRandomAdvocateAcc();
- System.out.println(accountName);
- advocatesPage.mouseOverAccountSettings();
- removeAccountForm = advocatesPage.clickRemoveAccountLink();
- isFormDisplayed = removeAccountForm.isFormDisplayed();
- Assert.assertTrue(isFormDisplayed);
- isNameFormCorrect = removeAccountForm.isNameFormCorrect("REMOVE ACCOUNT");
- Assert.assertTrue(isNameFormCorrect);
- isCloseButtonDisplayed = removeAccountForm.isCloseButtonDisplayed();
- Assert.assertTrue(isCloseButtonDisplayed);
- isYesButtonDisplayed = removeAccountForm.isYesButtonDisplayedOnAdvocate();
- Assert.assertTrue(isYesButtonDisplayed);
- isNoButtonDisplayed = removeAccountForm.isNoButtonDisplayed();
- Assert.assertTrue(isNoButtonDisplayed);
- removeAccountForm.clickPermRadioButton();
- removeAccountForm.clickYesButtonOnAdvocate();
- isFormDisplayed = removeAccountForm.isFormDisplayed();
- Assert.assertTrue(isFormDisplayed);
- removeAccountForm.clickCloseButton();
- advocatesPage.submitNewSearch(accountName);
- isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
- Assert.assertFalse(isAccountsAreShown);
- }
- /**
- * <b>Scenario</b> "After clicking [No] button on the 'Remove account' form, user backs to the Advocate page" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "user expands account" </br>
- * <b>and</b> "click on settings menu" </br>
- * <b>and</b> "clicks on'Remove account' link" </br>
- * <b>and</b> "clicks [No] button" </br>
- * <b>then</b> "advocate page is displayed." </br>
- * QA-660
- */
- @Test
- public void afterClickingNoButtonOnTheRemoveAccountFormUserBacksToTheAdvocatePage(){
- String accountName;
- boolean isAdvocatesPageDisplayed, isAccountsAreShown;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- accountName = advocatesPage.clickRandomAdvocateAcc();
- advocatesPage.mouseOverAccountSettings();
- removeAccountForm = advocatesPage.clickRemoveAccountLink();
- advocatesPage = removeAccountForm.clickNoButtonInAdvocateAccMenu();
- isAdvocatesPageDisplayed = advocatesPage.isAdvocatesPageDisplayed();
- Assert.assertTrue(isAdvocatesPageDisplayed);
- advocatesPage.submitNewSearch(accountName);
- isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
- Assert.assertTrue(isAccountsAreShown);
- }
- /**
- * <b>Scenario</b> "Change advocate account to employee works correctly" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "user expands random account" </br>
- * <b>and</b> "clicks on settings menu" </br>
- * <b>and</b> "clicks on 'Change to Employee' link" </br>
- * <b>then</b> "'Change this account to an Employee Account' form appears" </br>
- * <b>and</b> "[Close] / [Yes] / [No] buttons are displayed on the form correctly" </br>
- * <b>when</b> "user clicks [Yes] button" </br>
- * <b>then</b> "'Advocate account is changed to employee account' form appears" </br>
- * <b>when</b> "user clicks [Close] button on the appeared form" </br>
- * <b>then</b> "advocate account was changed to the employee" </br>
- * <b>and</b> "changed account has disappeared from the 'Advocate insight' page and appeared on the 'Employee portfolio' page." </br>
- * QA-676
- * @throws InterruptedException
- */
- @Test
- public void changeAdvocateAccountToEmployeeWorksCorrectly() throws InterruptedException{
- common.log("This script is being failed due to issue: SBI-3121");
- String accountName;
- boolean isChangeToEmployeeFormDisplayed;
- boolean isCloseButtonDisplayed;
- boolean isYesButtonDisplayed;
- boolean isNoButtonDisplayed;
- boolean isChangeToEmployeeConfirmFormDisplayed;
- boolean isAccountsAreShown;
- String username = "test56@dachisgroup.com";
- String password = "Passw0rd!";
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- accountName = advocatesPage.clickRandomAdvocateAcc();
- advocatesPage.mouseOverAccountSettings();
- changeToEmployeeForm = advocatesPage.clickChangeToEmployeeLink();
- isChangeToEmployeeFormDisplayed = changeToEmployeeForm.isChangeToEmployeeFormDisplayed("CHANGE THIS ACCOUNT TO AN EMPLOYEE ACCOUNT");
- Assert.assertTrue(isChangeToEmployeeFormDisplayed);
- isCloseButtonDisplayed = changeToEmployeeForm.isCloseButtonDisplayed();
- Assert.assertTrue(isCloseButtonDisplayed);
- isYesButtonDisplayed =changeToEmployeeForm.isYesButtonDisplayed();
- Assert.assertTrue(isYesButtonDisplayed);
- isNoButtonDisplayed = changeToEmployeeForm.isNoButtonDisplayed();
- Assert.assertTrue(isNoButtonDisplayed);
- accountIsChangeForm = changeToEmployeeForm.clickYesButton();
- isChangeToEmployeeConfirmFormDisplayed = accountIsChangeForm.isChangeToEmployeeConfirmFormDisplayed("ADVOCATE ACCOUNT CHANGED TO EMPLOYEE ACCOUNT");
- Assert.assertTrue(isChangeToEmployeeConfirmFormDisplayed);
- advocatesPage = accountIsChangeForm.clickCloseButton();
- advocatesPage.submitNewSearch(accountName);
- isAccountsAreShown = advocatesPage.isAccountsAreShown(accountName);
- Assert.assertFalse(isAccountsAreShown);
- employeePortfolioPage = advocatesPage.clickEmployeePortfolioLink();
- employeePortfolioPage.searchEmployee(accountName);
- isAccountsAreShown = employeePortfolioPage.isAccountsAreShown(accountName);
- Assert.assertTrue(isAccountsAreShown);
- }
- /**
- * <b>Scenario</b> "Search by name is working correctly" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "user enter account name in the search field" </br>
- * <b>then</b> "search result according to the search criteria is displayed correctly." </br>
- * QA-678
- */
- @Test
- public void searchByNameIsWorkingCorrectly(){
- String accountName;
- boolean isSearchWork;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- accountName = advocatesPage.getRandomAccountName();
- advocatesPage.submitNewSearch(accountName);
- isSearchWork = advocatesPage.isSearchWork(accountName);
- Assert.assertTrue(isSearchWork);
- }
- /**
- * <b>Scenario</b> "Remove filter is working correctly" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user selects 'Naked Juice' brands filter" </br>
- * <b>then</b> "the number of clear filter tabs should be 1" </br>
- * <b>when</b> "user remove filter" </br>
- * <b>then</b> "all accounts which were present before filter removed are shown"
- * QA-618
- */
- @Test
- public void removeFilterIsWorkingCorrectly(){
- int accountsNumber;
- int clearFilterNumbers;
- int accountsNumbers;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- accountsNumber = advocatesPage.getAccountsNumbers();
- advocatesPage = advocatesPage.checkBrandsAndShowResult("Big Crush");
- clearFilterNumbers = advocatesPage.getClearFilterNumbers();
- Assert.assertEquals(1, clearFilterNumbers);
- advocatesPage.removeAllFilters();
- accountsNumbers = advocatesPage.getAccountsNumbers();
- Assert.assertEquals(accountsNumber, accountsNumbers);
- }
- /**
- * <b>Scenario</b> "Search functionality is working correctly" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user inputs account name in the search field" </br>
- * <b>then</b> "Verify that only account expected is represented in the list" </br>
- * QA-621
- */
- @Test
- public void searchFunctionalityIsWorkingCorrectly(){
- String accountName;
- int accountsNumbers;
- String getFirstAccountName;
- String username = "test56@dachisgroup.com";
- String password = "Passw0rd!";
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- accountName = advocatesPage.getRandomAccountName();
- advocatesPage.submitNewSearch(accountName);
- accountsNumbers = advocatesPage.getAccountsNumbers();
- Assert.assertEquals(1, accountsNumbers);
- getFirstAccountName = advocatesPage.getFirstAccountName();
- Assert.assertEquals(accountName, getFirstAccountName);
- }
- /**
- * <b>Scenario</b> "Edit and Save Account Info with empty fields" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "user opens social account" </br>
- * <b>and</b> "clicks on [Edit Account Info] link" </br>
- * <b>then</b> "[Edit Account] form appears" </br>
- * <b>when</b> "user erased all required data" </br>
- * <b>and</b> "presses [Save and Close] button" </br>
- * <b>then</b> "error notification appears" </br>
- * QA-619
- */
- @Test
- public void editAndSaveAccountInfoWithEmptyFields(){
- String formHeaderText;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- String accName = advocatesPage.getRandomAccountName();
- advocatesPage.submitNewSearch(accName);
- advocatesPage.clickRandomAdvocateAcc();
- editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
- formHeaderText = editAccountInfoForm.getFormHeaderText();
- Assert.assertEquals("Social Account Setup", formHeaderText);
- editAccountInfoForm.clearAccountInfoSection();
- editAccountInfoForm.clickSaveAndCloseButton();
- }
- /**
- * <b>Scenario</b> "Cancel feature on Edit Account Info form" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "clicks on [Edit Account Info] link from account details section" </br>
- * <b>and</b> "user changes all data" </br>
- * <b>and</b> "presses [Cancel] button" </br>
- * <b>then</b> "changes were not saved" </br>
- */
- @Test
- public void cancelFeatureOnEditAccountInfoForm(){
- String accountInfo, updatedAccountInfo;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- advocatesPage.clickRandomAdvocateAcc();
- accountInfo = advocatesPage.getAccountInfo();
- editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
- editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
- advocatesPage = editAccountInfoForm.clickCancelButton();
- updatedAccountInfo = advocatesPage.getAccountInfo();
- accountInfo.equals(updatedAccountInfo);
- Assert.assertEquals(updatedAccountInfo, accountInfo);
- }
- /**
- * <b>Scenario</b> "Close feature on Edit Account Info form" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "clicks on [Edit Account Info] link from random account details section" </br>
- * <b>and</b> "user changes all data" </br>
- * <b>and</b> "presses [Close] button" </br>
- * <b>then</b> "changes were not saved" </br>
- * QA-619
- */
- @Test
- public void closeFeatureOnEditAccountInfoForm(){
- String accountInfo, updatedAccountInfo;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- advocatesPage.clickRandomAdvocateAcc();
- accountInfo = advocatesPage.getAccountInfo();
- editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
- editAccountInfoForm.fillAccountInfoSection(name, "description" , "url");
- advocatesPage = editAccountInfoForm.clickCloseButton();
- updatedAccountInfo = advocatesPage.getAccountInfo();
- accountInfo.equals(updatedAccountInfo);
- Assert.assertEquals(updatedAccountInfo, accountInfo);
- }
- /**
- * <b>Scenario</b> "Edit Account Info feature" </br>
- * <b>given</b> "User is on the 'Advocate Insight' page" </br>
- * <b>when</b> "clicks on [Edit Account Info] link from random account details section" </br>
- * <b>and</b> "user changes all data" </br>
- * <b>and</b> "presses [Save and Close] button" </br>
- * <b>then</b> "changes were successfully saved" </br>
- * QA-619
- */
- @Test
- public void editAccountInfoFeature(){
- String updatedAccountInfo;
- boolean isContainUrl;
- boolean isContainDiscriprion;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola,qapassword);
- advocatesPage.clickRandomAdvocateAcc();
- editAccountInfoForm = advocatesPage.clickEditAccountInfoLink();
- editAccountInfoForm.fillAccountInfoSection(name, "" , "");
- advocatesPage = editAccountInfoForm.clickSaveAndCloseButton();
- advocatesPage.submitNewSearch(name);
- advocatesPage.clickRandomAdvocateAcc();
- updatedAccountInfo = advocatesPage.getAccountInfo();
- isContainDiscriprion = updatedAccountInfo.contains("");
- Assert.assertTrue(isContainDiscriprion);
- isContainUrl = updatedAccountInfo.contains("");
- Assert.assertTrue(isContainUrl);
- }
- /**
- * <b>Scenario</b> "Exported accounts data should be the same as accounts data on the Advocates Page" </br>
- * <b>given</b> "User is on the 'Advocates' page" </br>
- * <b>when</b> "clicks 'Show more accounts link'" </br>
- * <b>and</b> "user mouses over 'Settings' image and clicks 'Export Result' link" </br>
- * <b>then</b> "'Export Results to Excel' window appears" </br>
- * <b>and</b> "file with data is downloaded correctly" </br>
- * <b>and</b> "exported account data are the same as on Advocates Page."
- * SBI-1751
- * @throws IOException
- * @throws BiffException
- */
- @Test
- public void exportedAccountsDataShouldBeTheSameAsAccountsDataOnTheAdvocatesPage() throws BiffException, IOException{
- String exportWindowTitle;
- boolean isAccountsAreExported;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- advocatesPage.clickAccountSortLink();
- advocatesPage.clickShowAllAccs();
- ArrayList<String> accounts = advocatesPage.getAccountsData();
- advocatesPage.mouseOverSettingsImage();
- advocatesPage.clickSettingsImage();
- advocatesPage.clickExportLink();
- exportWindowTitle = advocatesPage.exportWindowTitle();
- Assert.assertEquals("EXPORT RESULTS TO EXCEL", exportWindowTitle);
- ArrayList<String> accountsFromXml = common.getAccountsInfoFromXlsFile("C:\\accounts.xls",2);
- isAccountsAreExported = advocatesPage.isAccountsAreExported(accounts, accountsFromXml);
- Assert.assertTrue(isAccountsAreExported);
- }
- /**
- * <b>Scenario</b> "User is able to add and delete tag in 'Attributes (Tags)' column" </br>
- * <b>given</b> "User is on employee Portfolio Page" </br>
- * <b>when</b> "user clicks on tag" </br>
- * <b>then</b> "'Add tag' form is displayed" </br>
- * <b>when</b> "user adds tag" </br>
- * <b>then</b> "tag was added" </br>
- * <b>and</b> "tag number increased." </b>
- * <b>when</b> "user deletes tag" </b>
- * <b>then</b> "tag was deleted" </b>
- * <b>and</b> "tag number decreased." </br>
- * QA-655
- */
- @Test
- public void userIsAbleToAddAndDeleteTagInAttributesTagsColumn(){
- int difference;
- boolean isAddTagFormDisplayed;
- boolean isTagAdded;
- int tagNumberAfter;
- int tagNumberBefore;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- String accountName = advocatesPage.getRandomSocialAccountName();
- tagNumberBefore = advocatesPage.getTagNumber(accountName);
- attributeTagForm = advocatesPage.clickTag(accountName);
- isAddTagFormDisplayed = attributeTagForm.isAddTagFormDisplayed();
- Assert.assertTrue(isAddTagFormDisplayed);
- attributeTagForm.setTag("Test" +time);
- tagNumberAfter = advocatesPage.getTagNumber(accountName);
- isTagAdded = attributeTagForm.isTagAdded("Test" +time);
- Assert.assertTrue(isTagAdded);
- attributeTagForm.closeAddTagForm();
- difference = tagNumberAfter-tagNumberBefore;
- Assert.assertEquals(1, difference);
- attributeTagForm = advocatesPage.clickTag(accountName);
- attributeTagForm.deleteTag("Test" +time);
- isTagAdded = attributeTagForm.isTagAdded("Test" +time);
- Assert.assertFalse(isTagAdded);
- attributeTagForm.closeAddTagForm();
- tagNumberAfter = advocatesPage.getTagNumber(accountName);
- difference = tagNumberAfter-tagNumberBefore;
- Assert.assertEquals(0, difference);
- }
- /**
- * <b>Scenario</b> "User is able to add and delete tag on the employee social profile details" </br>
- * <b>given</b> "User is on employee Portfolio Page" </br>
- * <b>when</b> "user expands social employee details" </br>
- * <b>and</b> "adds tag" </br>
- * <b>then</b> "tag was added" </B>
- * <b>and</b> "tag number increased on the 'Tags' tab" </br>
- * <b>when</b> "user deletes tag" </br>
- * <b>then</b> "tag was deleted" </br>
- * <b>and</b> "tag number decreased." </br>
- * QA-655
- */
- @Test
- public void userIsAbleToAddAndDeleteTagOnTheEmployeeSocialProfileDetails(){
- boolean isTagAdded;
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- String accountName = advocatesPage.getRandomSocialAccountName();
- advocatesPage.submitNewSearch(accountName);
- advocatesPage.clickSpecifiedName(accountName);
- advocatesPage.clickTagsTab();
- advocatesPage.addTag("Test" +time);
- isTagAdded = advocatesPage.isTagAdded("Test" +time);
- Assert.assertTrue(isTagAdded);//
- advocatesPage.deleteTag("Test" +time);
- isTagAdded = advocatesPage.isTagAdded("Test" +time);
- Assert.assertFalse(isTagAdded);
- //
- }
- /**
- * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
- * <b>given</b> "User is on Advocate Insight Page" </br>
- * <b>when</b> "user clicks on an advocate account" </br>
- * <b>and</b> "adds a note" </br>
- * <b>and</b> "clicks on add author note button" </br>
- * <b>then</b> "note was added at top place" </B>
- * <b>when</b> "adds another note" </br>
- * <b>and</b> "clicks on add author note button" </br>
- * <b>then</b> "note was added at top place" </br>
- * <b>and</b> "previous note was shifted to second place" </br>
- * QA-703
- */
- @Test
- public void userCanAddNotes(){
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- String accountName = advocatesPage.getRandomSocialAccountName();
- System.out.println(accountName);
- advocatesPage.clickSpecifiedName(accountName);
- String randomNote1 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
- advocatesPage.addAuthorNote(randomNote1);
- Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote1));
- String randomNote2 = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
- advocatesPage.addAuthorNote(randomNote2);
- Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote2));
- }
- /**
- * <b>Scenario</b> "User is able to delete notes in Advocate account" </br>
- * <b>given</b> "User is on Advocate Insight Page" </br>
- * <b>when</b> "user clicks on an advocate account" </br>
- * <b>and</b> "adds a note" </br>
- * <b>and</b> "clicks on add author note button" </br>
- * <b>then</b> "note was added at top place" </B>
- * <b>and</b> "adding date was current date" </br>
- * <b>and</b> "authour's name was same as logged-in user" </br>
- * <b>when</b> "user clicks on delete note button" </br>
- * <b>then</b> "note was deleted" </br>
- * QA-705
- */
- @Test
- public void userCanDeleteNotes(){
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- String accountName = advocatesPage.getRandomSocialAccountName();
- advocatesPage.clickSpecifiedName(accountName);
- String randomNote = common.generateRandomChars(5) + " " + common.generateRandomSymbols(7);
- advocatesPage.addAuthorNote(randomNote);
- WebElement notes = driver.findElement(
- By.xpath("//p[@class='noteText']/span[normalize-space(text())='"+randomNote+"']"));
- boolean isAuthorNotePresent=common.isElementPresent(notes);
- Assert.assertTrue(isAuthorNotePresent);
- // Verify author name in note.
- String welcomeText = driver.findElement(By.xpath("//li[@id='dachisgroupHome']/../li[2]")).getText();
- String loggedUser = welcomeText.substring(welcomeText.indexOf(" ")+1);
- boolean isAuthorNameCorrect = common.isElementPresent(
- driver.findElement(By.xpath("//p[@class='noteText']/span[normalize-space(text())='"+randomNote+"']"+
- "/../../div/b[@class='noteName'][text()='"+loggedUser+"']")));
- Assert.assertTrue(isAuthorNameCorrect);
- // Verify date in note.
- String noteDate = common.dateForNotes(new Date());
- boolean isRandomNotePresent = advocatesPage.isRandomNotePresent(randomNote);
- boolean isRandomDatePresent = advocatesPage.isDatePresent(noteDate, randomNote);
- Assert.assertTrue(isRandomNotePresent);
- Assert.assertTrue(isRandomDatePresent);
- advocatesPage.deleteAuthorNote(randomNote);
- try {
- driver.findElement(By.xpath("//p[@class='noteText']/span[normalize-space(text())='"+randomNote+"']"));
- } catch (NoSuchElementException noSuchElementException) {
- isAuthorNotePresent = false;
- }
- Assert.assertFalse(isAuthorNotePresent);
- }
- /**
- * <b>Scenario</b> "User is able to add notes in Advocate account" </br>
- * <b>given</b> "User is on Advocate Insight Page" </br>
- * <b>when</b> "user clicks on an advocate account" </br>
- * <b>and</b> "adds a note" </br>
- * <b>and</b> "clicks on add author note button" </br>
- * <b>then</b> "note was added at top place" </B>
- * <b>and</b> "clicks on edit author note button" </br>
- * <b>then</b> "updates the notes" </br>
- * <b>and</b> "clicks on add author note button" </br>
- * <b>and</b> "note was updated at top place" </br>
- * QA-704
- */
- @Test
- public void userCanEditNotes(){
- advocatesPage = indexPage.loginToAdvocatePage(qacocacola, qapassword);
- String accountName = advocatesPage.getRandomSocialAccountName();
- advocatesPage.clickSpecifiedName(accountName);
- String randomNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
- advocatesPage.addAuthorNote(randomNote);
- advocatesPage.isNoteDisplayed(randomNote);
- Assert.assertTrue(advocatesPage.isNoteDisplayed(randomNote));
- String randomEditNote = common.generateRandomChars(7) + " " + common.generateRandomSymbols(8);
- advocatesPage.editAuthorNote( randomNote , randomEditNote );
- common.pause(2000);
- Assert.assertTrue(advocatesPage.isNoteDisplayed(randomEditNote));
- }
- }
Add Comment
Please, Sign In to add comment