Friday, August 5, 2016

TestReportAnIssue

package com.mridul.framework.selenium.tests;  
 import com.mridul.framework.selenium.pages.LoginPage;  
 import static org.testng.Assert.*;  
 import org.testng.annotations.Test;  
 /**  
  * Created by Mridul on 3/10/2016.  
  */  
 //@ContextConfiguration(classes = ApplicationConfig.class)  
 public class TestReportAnIssue extends AbstractTest{  
   //Fluent tests  
   @Test(enabled = true, groups = "prerequisite") //, dependsOnMethods = {"testURLToDash"} )  
   public void testLoginToDashFluently(){  
     try {  
       loginPage = new LoginPage(driver);  
       assertNotNull(loginPage);  
       homePage=loginPage.navigateToURL(expectedURL).and().typeInUserId("UserId")  
           .and().typeInPassword("Password").and().then().clickOnSubmitButton();  
       assertNotNull(homePage);  
     }catch (Exception e){  
       System.out.printf("Exception thrown : %s%n", e);  
     }  
   }  
   @Test(enabled = true, dependsOnMethods = {"testLoginToDashFluently"}, groups = "prerequisite" )  
   public void testReportAnIssueModal(){  
     try {  
       reportAnIssueModal=homePage.clickOnReportAnIssue();  
       assertNotNull(reportAnIssueModal);  
     }catch (Exception e){  
       System.out.printf("Exception thrown : %s%n",e);  
     }  
   }  
   @Test(enabled = false, dependsOnMethods = {"testReportAnIssueModal"} , dependsOnGroups = "prerequisite")  
   public void testReportAnIncidentWithoutUnlistedUser(){  
     try {  
       reportAnIssueModal.and().fillInRequestedBy("MRIDUL JAYAN")  
           .and().fillInCallbackNumber("1111111111")  
           .and().selectAnyBusinessUrgency()  
           .and().selectAnyBusinessImpact()  
           .and().selectAnyTypeOfIssue()  
           .and().selectAnyCategory()  
           .and().fillInPleaseDescribeYourIssue("Testing Portal")  
           .and().clickOnSubmitButton();  
       assertNotNull(reportAnIssueModal);  
     }catch (Exception e){  
       System.out.printf("Exception thrown : %s%n%n", e);  
       e.printStackTrace();  
     }  
   }  
   @Test(enabled = false, dependsOnMethods = {"testReportAnIssueModal"}, dependsOnGroups = "prerequisite" )  
   public void testReportAnIncidentWithUnlistedUser(){  
     try {  
       reportAnIssueModal.  
           and().fillInRequestedBy("MRIDUL JAYAN").  
           and().fillInCallbackNumber("1111111111").  
           and().checkUnlistedUser().  
           and().fillInUnlistedContactName("MRIDUL JAYAN").  
           and().fillInUnlistedContactEmail("test@testmail.com").  
           and().selectAnyBusinessUrgency().  
           and().selectAnyBusinessImpact().  
           and().selectAnyTypeOfIssue().  
           and().selectAnyCategory().  
           and().fillInPleaseDescribeYourIssue("Testing Portal").  
           and().clickOnSubmitButton();  
       assertNotNull(reportAnIssueModal);  
     }catch (Exception e){  
       System.out.printf("Exception thrown : %s%n%n", e);  
       e.printStackTrace();  
     }  
   }  
   @Test(enabled = true, dependsOnMethods = {"testReportAnIssueModal"}, dependsOnGroups = "prerequisite")  
   public void testReportAnIncidentWithUnlistedUserUsingSpecificText(){  
     try {  
       reportAnIssueModal.  
           and().fillInRequestedBy("MRIDUL JAYAN").  
           and().fillInCallbackNumber("1111111111").  
           and().checkUnlistedUser().  
           and().fillInUnlistedContactName("MRIDUL JAYAN").  
           and().fillInUnlistedContactEmail("test@testmail.com").  
           and().selectBusinessUrgency("Short amount of time").  
           and().selectBusinessImpact("Small business impact").  
           and().selectTypeOfIssue("Hardware").  
           and().selectCategory("Printer").  
           and().fillInPleaseDescribeYourIssue("Testing Portal").  
           and().clickOnSubmitButton();  
       assertNotNull(reportAnIssueModal);  
     }catch (Exception e){  
       System.out.printf("Exception thrown : %s%n%n", e);  
       e.printStackTrace();  
     }  
   }  
 }  

No comments:

Post a Comment