コード例 #1
0
ファイル: Global.java プロジェクト: ajitv/g6Automation
public class Global {

  /*/ DigEx URL  /*/
  // public static final String BaseUrlDigEx =
  // "https://www-qa.motel6.com/en/cp-landing-page-test.html";
  public static final String DigEx_Homepage_URL = "https://www-qa.motel6.com/#/home";
  public static final String BaseUrlDigEx = "https://www-qa.motel6.com/#/home";

  public static final String SS6_QA_URL = "https://qa.staystudio6.com";
  public static final String SS6_Corp_URL =
      "https://qa.staystudio6.com/en/studio6-cp-landing-page-new.html";
  public static final String SS6_Market_URL =
      "https://qa.staystudio6.com/en/cp-marketing-new-page.html";

  /* / RMO URL /*/

  /* RMO Stage Environment URL */
  public static final String RMOURL_Stage = "https://g6pricing-stg.g6hospitality.com";

  /* RMO QA Environment URL */
  public static final String RMOURL_QA = "https://g6pricing-stg.g6hospitality.com";

  /* RMO URL to be used for Automation Executions */
  public static final String BaseUrlRMO =
      "https://rmofeq1.motel6.com"; // "https://g6pricing-stg.g6hospitality.com";
  public static final String BaseUrlRMO_QA =
      "https://rmofeq1.motel6.com"; // "https://rmofeq1.motel6.com";

  /*/ RMO HMS URL & Login Credentials /*/
  public static final String RMO_HMS_URL = "http://172.18.9.55/Fols/default.asp";

  public static final String HMS_LoginUsername = "******";
  public static String HMS_LoginPassword = "******";

  /* / DigEx Login Credentials /*/
  public static final String LoginUsername = "******";
  public static String LoginPassword = "******";
  public static final String LoginUsername1 = "vinayaj1234";
  public static String LoginPassword1 = "vinayaj1234";

  /* / Google Wallet Login Credentials /*/
  public static final String GoogleWallet_Username = "******";
  public static final String GoogleWallet_Password = "******";

  /*/ CP Code Details /*/
  public static final String CPCode_NoDiscount = "CP547006";
  public static final String CPCode_Discount = "CP540176";

  /*/ Guest Details /*/
  public static final String Guest_FirstName = "Cybage";
  public static final String Guest_LastName = "User";
  public static final String Guest_Email1 = "*****@*****.**";
  public static final String Guest_Email2 = "*****@*****.**";
  public static final String Guest_Address = "Witmer Road";
  public static final String Guest_City = "New York";
  public static final String Guest_PostalCode = "35021";
  public static final String Guest_PhoneNumber = "9874563214";
  public static final String Guest_CCNumber = "987654321098";
  public static final String Guest_CCExpiry = "09/2024";

  /*/ Customer Details  /*/
  public static final String Cust_FirstName = "Cybage";
  public static final String Cust_LastName = "User";
  public static final String Cust_Email = "*****@*****.**";
  public static final String Cust_PhoneNumber = "9874563214";

  public static final String Cust_CCNumber = "987654321098";

  /*/Location Details /	*/
  public static final String Location1 = "Las Vegas";
  public static final String Location2 = "Dallas";
  public static final String Location3 = "Texas";
  public static final String Location4 = "San Francisco";
  public static final String Location5 = "New York";
  public static final String Location6 = "Chicago";

  /*/Location Details /	*/
  public static final String SS6_Prop_ID1 = "5037";
  public static final String SS6_Prop_ID2 = "5056";
  public static final String SS6_Prop_ID3 = "5007";
  public static final String SS6_Prop_ID4 = "5014";
  public static final String SS6_Prop_ID5 = "6012";
  public static final String SS6_Prop_ID6 = "6004";

  /*/ Night Input Details /*/
  public static final String Night1 = "1 Night";
  public static final String Night2 = "2 Nights";
  public static final String Night3 = "3 Nights";
  public static final String Night4 = "4 Nights";
  public static final String Night5 = "5 Nights";
  public static final String Night10 = "10 Nights";
  public static final String Night15 = "15 Nights";
  public static final String Night20 = "20 Nights";

  /*/Adult Input Details /*/
  public static final String Adult1 = "1 Adult";
  public static final String Adult2 = "2 Adults";
  public static final String Adult3 = "3 Adults";
  public static final String Adult4 = "4 Adults";

  /*/  New User Sign UP Details*/
  public static final String NewUser_FirstName = "Cybage";
  public static final String NewUser_LastName = "User";
  public static final String NewUser_Email = "*****@*****.**";

  public static final String NewUser_NewUsername = NewUser_FirstName + Generic.CreateDateAsString();
  public static final String NewUser_NewPassword = "******";
  public static final String NewUser_SecurityAnswer = "Pune";

  public static final String NewUser_AddressLine1 = "Test";
  public static final String NewUser_AddressLine2 = "Main Road";
  public static final String NewUser_City = "Florida";
  public static final String NewUser_ZipCode = "32042";
  public static final String NewUser_PhoneNumber = "9876543212";
  public static final String NewUser_CCNumber = "987654321098";
  public static final String NewUser_ExpiryDate = "08/2024";

  /* WebDriver SetUp */
  public static final String ExecutionMode_Grid = "false";
  public static final String Hub_IP = "172.21.254.168";
  // public static  WebDriver driver;

  /* / RMO Login Credentials /*/
  /*public static final String RMOLoginUsername = "******";
  public static String RMOLoginPassword = "******";*/
  public static final String RMOLoginUsername = "******";
  public static String RMOLoginPassword = "******";
  /*public static final String RMOLoginUsername = "******";
  public static String RMOLoginPassword = "******";*/
  public static final String RMOLoginUsername1 = "vinayaj1234";
  public static String RMOLoginPassword1 = "vinayaj1234";

  public static final String RMO_PropertyName1 =
      "TEST PROPERTY 3131"; // "DES MOINES SOUTH - AIRPORT";//"RMO TEST 1";
  public static final String RMO_PropertyName2 =
      "TEST PROPERTY 3131"; // "DES MOINES SOUTH - AIRPORT";//"RMO TEST 2";
  public static final String RMO_PropertyName3 = "RMO TEST 1";

  /* RMO New Pricing Details */
  public static final String BarValue1 = "10.23";
  public static final String BarValue2 = "99.99";
  public static final String BarValue3 = "9999.99";
  public static final String XP_Upcharge_Positive = "10";
  public static final String XP_Upcharge_Positive2 = "12";
  public static final String XP_Upcharge_Negative = "-10";
  public static final String XP_Upcharge_Zero = "0";
  public static final String XP_Upcharge_Negative_Sign = "-";
  public static final String XP_Upcharge_decimal = "10.10";

  public static final String RateCode_ConstantPercentage = "8";
  public static final String RapidEntry_RateCodeConstantPercentage = "12";
  public static final String DefaultUpcharge_1B_XP2 = "XP2";

  /* HMS VAlid Index Value */
  public static final String HMS_RateCodeIndexValue = "25";

  /* RMO Restriction Types*/
  public static final String Restriction_None = "None";
  public static final String Restriction_MinLos = "MinLOS";
  public static final String Restriction_ClosedToArrival = "Closed To arrival";
  public static final String Restriction_Closed = "Closed";

  public static final String MinLOS_Value = "25";
  public static final String RateCodeType_Fixed = "Fixed";
  public static final String RateCodeType_Floating = "Floating";

  /* RMO Rapid Entry Pricing Values */
  public static final String RapidEntry_FloatingRateCode = "12";

  public static final String RapidEntry_RateCodeName1 = "AUTO01";
  public static final String RapidEntry_RateCodeName2 = "AUTO02";
  public static final String RapidEntry_RateCodeName3 = "AUTO03";
  public static final String RapidEntry_RateCodeName4 = "FLAT";

  public static final String RapidEntry_MinLosValue = "4";

  /*BAR Price Point*/
  public static String PricePoint = "8.00";
  public static String PricePoint_Character = "abcd";
  public static String PricePoint_Max = "999.99";
  public static String PricePoint_Zero = "0.00";
  public static String PricePoint_Negative = "-11.11";
  public static String PricePoint_PositivePercentage = "11%";
  public static String PricePoint_NegativePercentage = "-11%";

  /* Default Upcharges */
  public static final String RMO_NonDefaultRoomUpchargeValue = "30";
  public static final String RMO_PersonUpchargeValue = "35";
  public static final String RMO_RoomUpchargeValue = "45";
}
  @Parameters("browser")
  @Test
  public void RMO_TC802_OverrideXPUpchargeforfixedRateCode_Positive_QA_Test(
      @Optional("FF") String BrowserType) {
    try {
      this.gc.log.logSetup(this);
      this.gc.log.logInfo("/////Execution Started/////");
      gc.browser.BrowserCloseAllBrowser();

      gc.browser.BrowserGetBrowserType(BrowserType);
      gc.browser.BrowserGet(Global.BaseUrlRMO_QA);
      gc.browser.BrowserWaitForPageToLoad();

      gc.rmo.RMO_Login(Global.RMOLoginUsername, Global.RMOLoginPassword);
      Thread.sleep(3000);
      //
      gc.rmo.RMOPricing_ClickProperty_QA(Global.RMO_PropertyName2);
      gc.browser.BrowserWaitForPageToLoad();
      gc.browser.BrowserClick("RMOPropertyPage_PropertiesLink_QA");
      gc.browser.BrowserWaitForPageToLoad();
      ;
      this.gc.log.logInfo("Navigated to Propert Pricing Page");

      gc.browser.BrowserClick("RMORateCode_RateCodeLink");
      gc.browser.BrowserWaitForPageToLoad();

      gc.browser.BrowserClick("RMORateCode_CreateRateCodeBtn");
      String RateCodeName = "FX" + Generic.CreateRandomString();
      gc.browser.BrowserEnterText("RMOCreateRateCode_RateCodename", RateCodeName);

      /*gc.browser.BrowserClick("RMOCreateRateCode_RateCodeType_Fixed");*/
      gc.rmo.SelectRateCodeType(Global.RateCodeType_Fixed);

      gc.browser.BrowserClick("RMOCreateRateCode_RateCodeSegment");
      gc.browser.BrowserClick("RMOCreateRateCode_RateCodeSegment_Continue");

      String Channel = gc.generic.findElement("RMOCreateRateCode_SellableChannel").getText();
      this.gc.log.logInfo("Selected channel is :" + Channel);
      gc.browser.BrowserClick("RMOCreateRateCode_RateCodeSegment_Continue1");

      List<WebElement> RoomTypeMaster = gc.generic.findElements("RMOCreateRateCode_RoomType");
      for (WebElement webElement : RoomTypeMaster) {
        webElement.click();
        break;
      }
      gc.browser.BrowserClick("RMOCreateRateCode_Rooms_ContinueBtn");

      gc.browser.BrowserClick("RMOCreateRateCode_AvailableForSaleStartDate");
      Thread.sleep(2000);
      String CurrentDate = gc.generic.findElement("RMOCreateRateCode_Today_Date").getText();
      System.out.println(CurrentDate);
      gc.browser.BrowserClick("RMOCreateRateCode_Today_Date");

      /* *Selecting Start Date * */
      gc.browser.BrowserClick("RMOCreateRateCode_AvailableForSaleEndDate");
      List<WebElement> CalenderDates = gc.generic.findElements("RMOCreateRateCode_DateList");
      int day = Integer.parseInt(CurrentDate);
      day = day + 3;
      if (day > 28) {
        gc.browser.BrowserClick("RMOAddNewPricing_Calendar_NextArrow");
        List<WebElement> CalenderDatesNxtMonth =
            gc.generic.findElements("RMOAddNewPricing_DateList");
        CalenderDatesNxtMonth.get(1).click();
      } else {
        CalenderDates.get(3).click();
      }

      /* * Selecting End Date * */
      gc.browser.BrowserClick("RMOCreateRateCode_FixedRateCodePrice_EndDate");
      List<WebElement> NewDates = gc.generic.findElements("RMOCreateRateCode_DateList");
      day = day + 3;
      /*if(day>28)
      {
      	gc.browser.BrowserClick("RMOAddNewPricing_Calendar_NextArrow");
      	List<WebElement> CalenderDatesNxtMonth = gc.generic.findElements("RMOAddNewPricing_DateList");
      	CalenderDatesNxtMonth.get(1).click();
      }
      else
      {*/
      NewDates.get(3).click();
      // }

      // String RateCodeValue = "333";
      List<WebElement> weekdays = gc.generic.findElements("RMOCreateRateCode_BarDays1");
      for (WebElement webElement : weekdays) {
        webElement.click();
        webElement.clear();
        webElement.sendKeys("333.00");
      }

      gc.browser.BrowserClick("RMOCreateRateCode_ReviewBtn");
      // Assert.assertTrue(gc.browser.BrowserIsWebElementPresentAsBool("RMOCreateRateCode_Negative_Error"), "Negative values are not accepted for per person overrides");
      gc.browser.BrowserClick("RMOCreateRateCode_CreateRateCodeButton");

      // gc.browser.BrowserClick("RMOCreateRateCode_DoneButton");
      gc.browser.BrowserClick("RMOCreateRateCode_802_DoneButton");

      Thread.sleep(5000);
      gc.browser.BrowserWaitForPageToLoad();
      String PageText = gc.browser.BrowserGetPageText();
      Assert.assertTrue(
          PageText.contains(RateCodeName),
          "The newly created rate code: "
              + RateCodeName
              + " is avaialable on Rate code Summary page!");
    } catch (Exception e) {
      this.gc.log.logException(e.getMessage());
      Assert.assertTrue(false, "Exception occured.... Failing the script...!!");
    } finally {
      gc.generic.Env_Teardown();
    }
  }