Skip to content

Commit

Permalink
CP Cross browser pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
pallaviyewaleDefra committed Jan 20, 2025
1 parent 7c89a56 commit d28100f
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 69 deletions.
13 changes: 1 addition & 12 deletions CP-pipeline-crossbrowserAndroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,7 @@ parameters:
type: string
default: 'Edge'

schedules:
- cron: "0 16 * * Mon,Tue,Wed,Thu,Fri"
displayName: Daily CrossBrowser build
branches:
include:
- dev
exclude:
- feature/*
- task/*
- master



resources:
repositories:
- repository: clientautomationreponew
Expand Down
13 changes: 1 addition & 12 deletions CP-pipeline-crossbrowserIOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@ parameters:
- name: Target
type: string
default: 'Edge'

schedules:
- cron: "0 14 * * Mon,Tue,Wed,Thu,Fri"
displayName: Daily CrossBrowser build
branches:
include:
- dev
exclude:
- feature/*
- task/*
- master



resources:
repositories:
Expand Down
12 changes: 0 additions & 12 deletions CP-pipeline-crossbrowserMacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ parameters:
type: string
default: 'Edge'

schedules:
- cron: "0 15 * * Mon,Tue,Wed,Thu,Fri"
displayName: Daily CrossBrowser build
branches:
include:
- dev
exclude:
- feature/*
- task/*
- master


resources:
repositories:
- repository: clientautomationreponew
Expand Down
13 changes: 1 addition & 12 deletions CP-pipeline-crossbrowserWindows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,7 @@ parameters:
- name: Target
type: string
default: 'Edge'

schedules:
- cron: "0 17 * * Mon,Tue,Wed,Thu,Fri"
displayName: Daily CrossBrowser build
branches:
include:
- dev
exclude:
- feature/*
- task/*
- master



resources:
repositories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Scenario Outline: Verify validation text for empty text box checking a flight
Then I provide the '<Flight number>' in the box
And I have provided Scheduled departure time
When I click save and continue button from route checke page
Then I should see an error message "Enter the flight number you are checking" in route checking page
Then I should see an error message "Enter the flight number. For example, RK 103" in route checking page
Examples:
| Transportation | Flight number |
| Flight | |
Expand All @@ -46,7 +46,7 @@ Scenario Outline: Verify validation text for special character text box checking
Then I provide the '<FlightNumber>' in the box
And I have provided Scheduled departure time
When I click save and continue button from route checke page
Then I should navigate to Welcome page
Then I should see an error message "Enter the flight number using up to 8 letters and numbers (for example, RK 103)" in route checking page
Examples:
| Transportation | FlightNumber |
| Flight | $$£@lk |
Expand Down
16 changes: 11 additions & 5 deletions nipts-pts-automation-tests/Pages/CP/Pages/RouteCheckingPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,21 @@ public void SelectTransportationOption(string radioButtonValue)
if (radioButtonValue == "Ferry")
{

if (!rdoFerry.Selected)
{
rdoFerry.Click();
}
//if (!rdoFerry.Selected)
//{
//rdoFerry.Click();
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)_driver;
jsExecutor.ExecuteScript("arguments[0].click();", rdoFerry);
//}
}
else if (radioButtonValue == "Flight")
{

if (!rdoFlight.Selected)
{
rdoFlight.Click();
//rdoFlight.Click();
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)_driver;
jsExecutor.ExecuteScript("arguments[0].click();", rdoFlight);
}
}
}
Expand All @@ -81,6 +85,7 @@ public string SelectDropDownDepartureTime()
var hour = DateTime.Now.ToString("HH");
var minutes = DateTime.Now.ToString("mm");
string departureTime = $"'{hour}':'{minutes}'";
((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", hourDropdown);

SelectElement selectHour = new SelectElement(hourDropdown);
selectHour.SelectByValue(hour);
Expand All @@ -95,6 +100,7 @@ public void SelectDropDownDepartureTimeWithSPS()
var hour = DateTime.Now.ToString("HH");
var minutes = DateTime.Now.ToString("mm");

((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", hourDropdown);
SelectElement selectHour = new SelectElement(hourDropdown);
selectHour.SelectByValue(hour);
SelectElement selectMinute = new SelectElement(minuteDropdown);
Expand Down
37 changes: 30 additions & 7 deletions nipts-pts-automation-tests/Pages/CP/Pages/SignInCPPage.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using BoDi;
using Defra.UI.Framework.Driver;
using nipts_pts_automation_tests.Configuration;
using nipts_pts_automation_tests.HelperMethods;
using nipts_pts_automation_tests.Pages.CP.Interfaces;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using SeleniumExtras.WaitHelpers;


Expand All @@ -25,10 +27,11 @@ public SignInCPPage(IObjectContainer container)
private By signInConfirmBy => By.XPath("//h1[contains(@class,'govuk-heading-xl')]");
private IWebElement UserId => _driver.FindElement(By.CssSelector("#user_id"));
private IWebElement Password => _driver.FindElement(By.CssSelector("#password"));
private IWebElement SignIn => _driver.WaitForElement(By.Id("continue"));
private IWebElement SignIn => _driver.WaitForElement(By.XPath("//button[contains(@id,'continue')]"));
private IWebElement txtLoging => _driver.WaitForElement(By.XPath("//input[@id='password']"));
private IWebElement btnContinue => _driver.WaitForElement(By.XPath("//button[normalize-space()='Continue']"));
private IWebElement signOutBy => _driver.WaitForElement(By.XPath("//a[@href='/signout']//*[name()='svg']"));
private IWebElement SignOut => _driver.WaitForElement(By.XPath("//a[@href='/signout']"));
#endregion

#region Methods
Expand All @@ -41,27 +44,47 @@ public void IsSignedIn(string userName, string password)
{
if (PageHeading.Text == "Sign in using Government Gateway")
{
((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", SignIn);
UserId.SendKeys(userName);
Password.SendKeys(password);
_driver.WaitForElementCondition(ExpectedConditions.ElementToBeClickable(SignIn)).Click();
//_driver.WaitForElementCondition(ExpectedConditions.ElementToBeClickable(SignIn)).Click();
Thread.Sleep(2000);
((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].click();", SignIn);
Thread.Sleep(2000);
}
}

public bool IsSignedOut()
{
((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", signOutBy);
signOutBy.Click();
//((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", SignOut);
//signOutBy.Click();
Thread.Sleep(1000);
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)_driver;
jsExecutor.ExecuteScript("arguments[0].click();", SignOut);
Thread.Sleep(2000);
return PageHeading.Text.Contains("You have signed out") || PageHeading.Text.Contains("Your Defra account");
}

public void EnterPassword()
{
Thread.Sleep(1000);
if(PageHeading.Text == "This is a test environment")
{
txtLoging.SendKeys(ConfigSetup.BaseConfiguration.TestConfiguration.EnvPassword);
btnContinue.Click();
{
string envPassword = ConfigSetup.BaseConfiguration.TestConfiguration.EnvPassword;
IJavaScriptExecutor jse = (IJavaScriptExecutor)_driver;
IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor)_driver;
Thread.Sleep(3000);
((IJavaScriptExecutor)_driver).ExecuteScript("arguments[0].scrollIntoView()", btnContinue);
jsExecutor.ExecuteScript("arguments[0].click();", btnContinue);
Thread.Sleep(5000);
txtLoging.SendKeys(envPassword);
//jse.ExecuteScript("arguments[0].setAttribute('value','" + envPassword + "')", txtLoging);
Thread.Sleep(3000);
jsExecutor.ExecuteScript("arguments[0].click();", btnContinue);
Thread.Sleep(5000);

//IAlert alert = _driver.SwitchTo().Alert();
//alert.Dismiss();
}
}
#endregion
Expand Down
39 changes: 32 additions & 7 deletions nipts-pts-automation-tests/Pages/CP/Pages/WelcomePage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BoDi;
using nipts_pts_automation_tests.Configuration;
using nipts_pts_automation_tests.HelperMethods;
using nipts_pts_automation_tests.Pages.CP.Interfaces;
using OpenQA.Selenium;
Expand Down Expand Up @@ -53,12 +54,21 @@ public void clickOnView()
string departureDate = "";
string departureTime = "";
string headerTime = headerDepartureTime.Text.Trim();
string route = headerTime.Substring(7,29).Trim();
string route = headerTime.Substring(7, 29).Trim();
if (route.Contains("Birkenhead to Belfast (Stena)"))
{
departureDate = headerTime.Substring(53, 10);
departureTime = headerTime.Substring(64, 5);
departTime = headerTime.Substring(64, 5);
if (ConfigSetup.BaseConfiguration.TestConfiguration.BSBrowserVersion == "16.5")
{
departureDate = headerTime.Substring(60, 10);
departureTime = headerTime.Substring(71, 5);
departTime = headerTime.Substring(71, 5);
}
else
{
departureDate = headerTime.Substring(53, 10);
departureTime = headerTime.Substring(64, 5);
departTime = headerTime.Substring(64, 5);
}
}
else if (route.Contains("Cairnryan to Larne (P&O)"))
{
Expand Down Expand Up @@ -88,7 +98,14 @@ public void clickOnViewWithSPSUser(string departureRoute)
string departureDate = "";
if (departureRoute.Contains("Birkenhead to Belfast (Stena)"))
{
departureDate = headerTime.Substring(53, 10);
if (ConfigSetup.BaseConfiguration.TestConfiguration.BSBrowserVersion == "16.5")
{
departureDate = headerTime.Substring(60, 10);
}
else
{
departureDate = headerTime.Substring(53, 10);
}
}
else if (departureRoute.Contains("Cairnryan to Larne (P&O)"))
{
Expand Down Expand Up @@ -117,8 +134,16 @@ public bool DepartureDateTimeCheck()
string route = headerTime.Substring(7,29).Trim();
if (route.Contains("Birkenhead to Belfast (Stena)"))
{
departureDate = headerTime.Substring(53, 10);
departureTime = headerTime.Substring(64, 5);
if (ConfigSetup.BaseConfiguration.TestConfiguration.BSBrowserVersion == "16.5")
{
departureDate = headerTime.Substring(60, 10);
departureTime = headerTime.Substring(71, 5);
}
else
{
departureDate = headerTime.Substring(53, 10);
departureTime = headerTime.Substring(64, 5);
}
}
else if (route.Contains("Cairnryan to Larne (P&O)"))
{
Expand Down

0 comments on commit d28100f

Please sign in to comment.