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

PSP-8182: Automation update based on last changes on TST Environment #3976

Merged
merged 14 commits into from
Apr 26, 2024
Merged
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
1 change: 1 addition & 0 deletions testing/PIMS.Tests.Automation/Classes/AcquisitionFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public class Take
{
public string TakeType { get; set; } = null!;
public string TakeStatus { get; set; } = null!;
public string TakeCompleteDate { get; set; } = null!;
public string SiteContamination { get; set; } = null!;
public string TakeDescription { get; set; } = null!;
public string IsNewHighwayDedication { get; set; } = null!;
Expand Down
Binary file modified testing/PIMS.Tests.Automation/Data/PIMS_Testing_Data.xlsx
Binary file not shown.
18 changes: 18 additions & 0 deletions testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,21 @@ Scenario: 13. Acquisition File Property Takes Logic
When I add Properties to the Acquisition File
And I create Takes within Acquisition File's Properties
Then A new Acquisition file is created successfully

Scenario: 14. Acquisition File Error Message - Draft Items
Given I create a new Acquisition File from row number 20
When I create Agreements within an Acquisition File
And I add additional information to complete the Acquisition File
Then Acquisition File cannot be completed due to Draft items

Scenario: 15. Acquisition File Error Message - No Takes
Given I create a new Acquisition File from row number 20
When I add additional information to complete the Acquisition File
Then Acquisition File cannot be completed without Takes

Scenario: 16. Acquisition File Error Message - Takes In-Progress
Given I create a new Acquisition File from row number 21
When I add Properties to the Acquisition File
And I create Takes within Acquisition File's Properties
And I add additional information to complete the Acquisition File
Then Acquisition File cannot be completed due to In-Progress Takes
102 changes: 102 additions & 0 deletions testing/PIMS.Tests.Automation/Features/AcquisitionFiles.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ Scenario: 07. Disposition File from PIN
Then A new Disposition file is created successfully

Scenario: 08. Disposition Files List View
Given I search for an existing Disposition File from row number 2
Given I search for an existing Disposition File from row number 3
Then Expected Disposition File Content is displayed on Disposition File List View

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testing/PIMS.Tests.Automation/Features/SmokeTest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Scenario: 09. Research File Details
Then A new Research File is created successfully

Scenario: 10. Research File Properties
Given I create a basic Research File from row number 9
Given I create a basic Research File from row number 10
When I add Properties to a Research File
Then A new Research File is created successfully

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions testing/PIMS.Tests.Automation/PIMS.Tests.Automation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Selenium.Support" Version="4.18.1" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="123.0.6312.5800" />
<PackageReference Include="Selenium.Support" Version="4.19.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="123.0.6312.12200" />
<PackageReference Include="SpecFlow.Plus.LivingDocPlugin" Version="3.9.57" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="SpecFlow.xUnit" Version="3.9.74" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
54 changes: 31 additions & 23 deletions testing/PIMS.Tests.Automation/PageObjects/AcquisitionDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ public class AcquisitionDetails : PageObjectBase
private By acquisitionFileOwnerCommentContent = By.XPath("//label[contains(text(),'Comment')]/parent::div/following-sibling::div");

private By acquisitionFileEditButton = By.CssSelector("button[title='Edit acquisition file']");

//Acquisition File Confirmation Modal Elements
private By acquisitionFileConfirmationModal = By.CssSelector("div[class='modal-content']");
private By acquisitionFileSaveConfirmationModal = By.XPath("//div[@class='modal-content']/div[@class='modal-header']/div[contains(text(),'User Override Required')]");

private SharedSelectContact sharedSelectContact;
private SharedModals sharedModals;
Expand All @@ -135,6 +136,12 @@ public void NavigateToCreateNewAcquisitionFile()
FocusAndClick(createAcquisitionFileButton);
}

public void NavigateToFileSummary()
{
WaitUntilVisible(acquisitionFileSummaryBttn);
FocusAndClick(acquisitionFileSummaryBttn);
}

public void NavigateToFileDetailsTab()
{
WaitUntilClickable(acquisitionFileDetailsTab);
Expand Down Expand Up @@ -398,10 +405,8 @@ public void SaveAcquisitionFileDetails()
ButtonElement("Save");

Wait();
if (webDriver.FindElements(acquisitionFileConfirmationModal).Count() > 0)
if (webDriver.FindElements(acquisitionFileSaveConfirmationModal).Count() > 0)
{
Assert.Equal("User Override Required", sharedModals.ModalHeader());

if (sharedModals.ModalContent().Contains("The selected Ministry region is different from that associated to one or more selected properties"))
{
Assert.Contains("The selected Ministry region is different from that associated to one or more selected properties", sharedModals.ModalContent());
Expand All @@ -415,9 +420,6 @@ public void SaveAcquisitionFileDetails()

sharedModals.ModalClickOKBttn();
}

Wait();
AssertTrueIsDisplayed(acquisitionFileEditButton);
}

public void SaveAcquisitionFileDetailsWithExpectedErrors()
Expand All @@ -434,19 +436,6 @@ public void CancelAcquisitionFile()
ButtonElement("Cancel");

sharedModals.CancelActionModal();

//try
//{
// WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(3));
// if (wait.Until(ExpectedConditions.AlertIsPresent()) != null)
// {
// webDriver.SwitchTo().Alert().Accept();
// }
//}
//catch (WebDriverTimeoutException)
//{
// sharedModals.CancelActionModal();
//}
}

public string GetAcquisitionFileCode()
Expand Down Expand Up @@ -697,12 +686,31 @@ public void DeleteFirstStaffMember()
webDriver.FindElement(acquisitionFileTeamFirstMemberDeleteBttn).Click();

WaitUntilVisible(acquisitionFileConfirmationModal);
Assert.True(sharedModals.ModalHeader() == "Remove Team Member");
Assert.True(sharedModals.ModalContent() == "Are you sure you want to remove this row?");
Assert.Equal("Remove Team Member", sharedModals.ModalHeader());
Assert.Equal("Are you sure you want to remove this row?", sharedModals.ModalContent());

sharedModals.ModalClickOKBttn();
}

public void VerifyErrorMessageDraftItems()
{
WaitUntilVisible(acquisitionFileConfirmationModal);
Assert.Contains("You cannot complete a file when there are one or more draft agreements, or one or more draft compensations requisitions.", sharedModals.ModalContent());
Assert.Contains("Remove any draft compensations requisitions. Agreements should be set to final, cancelled, or removed.", sharedModals.ModalContent());
}

public void VerifyErrorCannotCompleteWithoutTakes()
{
WaitUntilVisible(acquisitionFileConfirmationModal);
Assert.Equal("You cannot complete an acquisition file that has no takes.", sharedModals.ModalContent());
}

public void VerifyErrorCannotCompleteInProgressTakes()
{
WaitUntilVisible(acquisitionFileConfirmationModal);
Assert.Equal("Please ensure all in-progress property takes have been completed or canceled before completing an Acquisition File.", sharedModals.ModalContent());
}

private void AddTeamMembers(TeamMember teamMember)
{
WaitUntilClickable(acquisitionFileAddAnotherMemberLink);
Expand Down Expand Up @@ -791,7 +799,7 @@ private void DeleteOwner()
WaitUntilClickable(acquisitionFileDeleteFirstOwnerBttn);
webDriver.FindElement(acquisitionFileDeleteFirstOwnerBttn).Click();

WaitUntilVisible(acquisitionFileConfirmationModal);
WaitUntilVisible(acquisitionFileSaveConfirmationModal);
Assert.True(sharedModals.ModalHeader() == "Remove Owner");
Assert.True(sharedModals.ModalContent() == "Are you sure you want to remove this Owner?");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void CancelTake()

public void InsertTake(Take take)
{
Wait(2000);
Wait();

var index = take.TakeCounter;

Expand All @@ -99,6 +99,12 @@ public void InsertTake(Take take)
if (take.TakeStatus != "")
ChooseSpecificSelectOption(By.Id("input-takes."+ index +".takeStatusTypeCode"), take.TakeStatus);

if (take.TakeCompleteDate != "")
{
webDriver.FindElement(By.Id("datepicker-takes."+ index +".completionDt")).SendKeys(take.TakeCompleteDate);
webDriver.FindElement(By.Id("datepicker-takes."+ index +".completionDt")).SendKeys(Keys.Enter);
}

if (take.SiteContamination != "")
ChooseSpecificSelectOption(By.Id("input-takes."+ index +".takeSiteContamTypeCode"), take.SiteContamination);

Expand Down
2 changes: 1 addition & 1 deletion testing/PIMS.Tests.Automation/PageObjects/Notes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class Notes : PageObjectBase
private By notesCancelOkBttn = By.XPath("//div[contains(text(),'Confirm Changes')]/parent::div/parent::div/div/div[@class='button-wrap']/button[@title='ok-modal']");

//Notes Delete pop-up Elements
private By notesDeletePopupHeader = By.CssSelector("div[class='modal-header'] div");
private By notesDeletePopupHeader = By.CssSelector("div[class='modal-header'] div[class='modal-title h4']");
private By notesDeletePopupBody = By.CssSelector("div[class='modal-body']");
private By notesDeleteOkBttn = By.XPath("//div[contains(text(),'Delete Note')]/parent::div/parent::div/div/div[@class='button-wrap']/button[@title='ok-modal']");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void VerifyDispositionFileListView()
AssertTrueIsDisplayed(searchDispositionFileSearchButton);
AssertTrueIsDisplayed(searchDispositionFileCreateNewButton);

//DIsposition Files List View
//Disposition Files List View
AssertTrueIsDisplayed(searchDispositionFileNumberHeader);
AssertTrueIsDisplayed(searchDispositionOrderFileNumberBttn);
AssertTrueIsDisplayed(searchDispositionReferenceHeader);
Expand Down
4 changes: 2 additions & 2 deletions testing/PIMS.Tests.Automation/PageObjects/SharedModals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace PIMS.Tests.Automation.PageObjects
public class SharedModals : PageObjectBase
{
private By generalModal = By.CssSelector("div[class='modal-content']");
private By generalModalHeader = By.CssSelector("div[class='modal-header'] div");
private By generalModalHeader = By.CssSelector("div[class='modal-header'] div[class='modal-title h4']");
private By generalModalContent = By.CssSelector("div[class='modal-body']");
private By generalModalOkBttn = By.CssSelector("button[title='ok-modal']");
private By generalModalCancelBttn = By.CssSelector("button[title='cancel-modal']");

private By secondaryModal = By.XPath("//div[@role='dialog'][2]/div/div[@class='modal-content']");
private By secondaryModalHeader = By.XPath("//div[@role='dialog'][2]/div/div/div[@class='modal-header']/div[1]");
private By secondaryModalHeader = By.XPath("//div[@role='dialog'][2]/div/div/div[@class='modal-header']/div[2]");
private By secondaryModalContent = By.XPath("//div[@role='dialog'][2]/div/div/div[@class='modal-body']");
private By secondaryModalOkBttn = By.XPath("//div[@role='dialog'][2]/div/div/div[@class='modal-footer']/div/button[@title='ok-modal']");
private By secondaryModalCancelBttn = By.XPath("//div[@role='dialog'][2]/div/div/div[@class='modal-footer']/div/button[@title='cancel-modal']");
Expand Down
Loading
Loading