Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved 3 Exisiting Issues in the Project #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added drivers/chromedriver.exe
Binary file not shown.
Binary file added drivers/geckodriver.exe
Binary file not shown.
Binary file added screenshots/1630222794838.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630223221078.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630223262673.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630223615645.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630223688518.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630224102292.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630240538771.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630242176007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630242202926.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630244672611.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630244703872.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630244887937.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630245766290.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630246056462.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630246809363.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630246838945.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630246840575.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630246842351.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630247270887.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630257089867.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/1630257583562.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 8 additions & 12 deletions src/main/java/com/crm/qa/base/TestBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

import com.crm.qa.util.TestUtil;
import com.crm.qa.util.WebEventListener;
import com.qa.ExtentReportListener.ExtentReporterNG;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;

public class TestBase {

Expand All @@ -36,20 +39,21 @@ public TestBase(){
}
}


public static void initialization(){
String browserName = prop.getProperty("browser");

if(browserName.equals("chrome")){
System.setProperty("webdriver.chrome.driver", "/Users/naveenkhunteta/Downloads/chromedriver");

System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
else if(browserName.equals("FF")){
System.setProperty("webdriver.gecko.driver", "/Users/naveenkhunteta/Documents/SeleniumServer/geckodriver");
System.setProperty("webdriver.gecko.driver", "drivers/geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}


e_driver = new EventFiringWebDriver(driver);
// Now create object of EventListerHandler to register it with EventFiringWebDriver
eventListener = new WebEventListener();
Expand All @@ -64,13 +68,5 @@ else if(browserName.equals("FF")){
driver.get(prop.getProperty("url"));

}









}
3 changes: 2 additions & 1 deletion src/main/java/com/crm/qa/config/config.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
url = https://www.freecrm.com
#url = https://www.freecrm.com
url = https://classic.freecrm.com/index.html

username = naveenk
password = test@123
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/crm/qa/pages/HomePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@

public class HomePage extends TestBase {

@FindBy(xpath = "//td[contains(text(),'User: Naveen K')]")
// @FindBy(xpath = "//td[contains(text(),'User: Naveen K')]")
@FindBy(xpath = "//td[contains(text(),'User: Gayatri das')]")
@CacheLookup
WebElement userNameLabel;

@FindBy(xpath = "//a[contains(text(),'Contacts')]")
WebElement contactsLink;

@FindBy(xpath = "//a[contains(text(),'New Contact')]")
@FindBy(xpath = "//input[@value='New Contact']")
WebElement newContactLink;


Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/crm/qa/util/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class TestUtil extends TestBase {
public static long PAGE_LOAD_TIMEOUT = 20;
public static long IMPLICIT_WAIT = 20;

public static String TESTDATA_SHEET_PATH = "/Users/naveenkhunteta/Documents/workspace"
+ "/FreeCRMTest/src/main/java/com/crm/qa/testdata/FreeCrmTestData.xlsx";
public static String TESTDATA_SHEET_PATH = System.getProperty("user.dir")+ "/src/main/java/com/crm" + "/qa/testdata/FreeCrmTestData.xlsx";

static Workbook book;
static Sheet sheet;
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/com/qa/ExtentReportListener/ExtentReporterNG.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
package com.qa.ExtentReportListener;

import java.io.File;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.testng.IReporter;
import org.testng.IResultMap;
import org.testng.ISuite;
Expand All @@ -27,9 +32,8 @@ public class ExtentReporterNG implements IReporter {

public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
String outputDirectory) {
extent = new ExtentReports(outputDirectory + File.separator
+ "Extent.html", true);

extent = new ExtentReports(outputDirectory + File.separator+ "Extent.html", true);

for (ISuite suite : suites) {
Map<String, ISuiteResult> result = suite.getResults();

Expand All @@ -39,9 +43,11 @@ public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites,
buildTestNodes(context.getPassedTests(), LogStatus.PASS);
buildTestNodes(context.getFailedTests(), LogStatus.FAIL);
buildTestNodes(context.getSkippedTests(), LogStatus.SKIP);

}
}

}

extent.flush();
extent.close();
}
Expand Down Expand Up @@ -76,4 +82,5 @@ private Date getTime(long millis) {
calendar.setTimeInMillis(millis);
return calendar.getTime();
}

}
8 changes: 2 additions & 6 deletions src/test/java/com/crm/qa/testcases/ContactsPageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void selectSingleContactsTest(){
@Test(priority=3)
public void selectMultipleContactsTest(){
contactsPage.selectContactsByName("test2 test2");
contactsPage.selectContactsByName("ui uiii");
contactsPage.selectContactsByName("Tom Peter");

}

Expand All @@ -85,15 +85,11 @@ public void validateCreateNewContact(String title, String firstName, String last
contactsPage.createNewContact(title, firstName, lastName, company);

}




@AfterMethod
public void tearDown(){
driver.quit();
}




}
20 changes: 15 additions & 5 deletions src/test/java/com/crm/qa/testcases/FreeCrmTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import org.apache.commons.io.FileUtils;
import org.openqa.selenium.JavascriptExecutor;
Expand All @@ -13,17 +14,24 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import com.crm.qa.util.TestUtil;

public class FreeCrmTest {

static WebDriver driver;
static JavascriptExecutor js;

@BeforeMethod
public void setUp() throws Exception {
System.setProperty("webdriver.chrome.driver", "/Users/naveenkhunteta/Downloads/chromedriver");
System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
driver.get("https://www.freecrm.com/index.html");
// driver.get("https://www.freecrm.com/index.html");
driver.get("https://classic.freecrm.com/login.cfm");
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(TestUtil.PAGE_LOAD_TIMEOUT, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(TestUtil.IMPLICIT_WAIT, TimeUnit.SECONDS);
}

@Test
Expand All @@ -32,8 +40,10 @@ public void freeCrmTitleTest() throws InterruptedException, IOException {
System.out.println("title is: " + title);
getRunTimeInfoMessage("info", title);

if (title.equals("Free CRM software in the cloud powers sales and customer serviceQQQQ")) {
// if (title.equals("Free CRM software in the cloud powers sales and customer serviceQQQQ")) {
if (title.equals("#1 Free CRM customer relationship management software cloud")) {
getRunTimeInfoMessage("info", "title is correct!! YAY!!!");
takeScreenshot("freecrmloginpage");
Assert.assertTrue(true);
} else {
getRunTimeInfoMessage("error", "title is not correct!! BUG BUG BUG!!!");
Expand Down Expand Up @@ -82,8 +92,8 @@ public static void takeScreenshot(String fileName) throws IOException{
// Take screenshot and store as a file format
File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
// now copy the screenshot to desired location using copyFile //method
FileUtils.copyFile(src,
new File("/Users/NaveenKhunteta/Documents/MyPOMFramework/PageObjectModel/screenshots/" + fileName +".png"));
// FileUtils.copyFile(src, new File("/Users/NaveenKhunteta/Documents/MyPOMFramework/PageObjectModel/screenshots/" + fileName +".png"));
FileUtils.copyFile(src, new File("screenshots" + fileName +".png"));

}

Expand Down
14 changes: 7 additions & 7 deletions src/test/java/com/crm/qa/testcases/LoginPageTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.crm.qa.testcases;

import java.io.IOException;

import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

Expand All @@ -10,13 +14,15 @@
import com.crm.qa.pages.LoginPage;

public class LoginPageTest extends TestBase{

LoginPage loginPage;
HomePage homePage;

public LoginPageTest(){
super();
}


@BeforeMethod
public void setUp(){
initialization();
Expand All @@ -26,7 +32,7 @@ public void setUp(){
@Test(priority=1)
public void loginPageTitleTest(){
String title = loginPage.validateLoginPageTitle();
Assert.assertEquals(title, "#1 Free CRM for Any Business: Online Customer Relationship Software");
Assert.assertEquals(title, "Free CRM - CRM software for customer relationship management, sales, and support.");
}

@Test(priority=2)
Expand All @@ -40,15 +46,9 @@ public void loginTest(){
homePage = loginPage.login(prop.getProperty("username"), prop.getProperty("password"));
}



@AfterMethod
public void tearDown(){
driver.quit();
}





}
Binary file modified target/classes/com/crm/qa/base/TestBase.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/ContactsPage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/DealsPage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/HomePage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/LoginPage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/SignUpPage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/pages/TasksPage.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/util/TestUtil.class
Binary file not shown.
Binary file modified target/classes/com/crm/qa/util/WebEventListener.class
Binary file not shown.
Binary file modified target/classes/com/qa/ExtentReportListener/ExtentReporterNG.class
Binary file not shown.
Binary file modified target/test-classes/com/crm/qa/testcases/ContactsPageTest.class
Binary file not shown.
Binary file modified target/test-classes/com/crm/qa/testcases/HomePageTest.class
Binary file not shown.
Binary file modified target/test-classes/com/crm/qa/testcases/LoginPageTest.class
Binary file not shown.
Loading