-
Notifications
You must be signed in to change notification settings - Fork 0
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
Induction edit start date #1779
Open
CathLass
wants to merge
16
commits into
main
Choose a base branch
from
induction-edit-start-date
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
253bec6
put test files into folder
CathLass d6be885
Basic stem of the longest journey through the pages
CathLass 5145454
remove unused
CathLass 1e05fa5
lint
CathLass 55ebc44
remove unwanted
CathLass d7171ce
Added test for navigate back using backlink
CathLass 39a2a50
rename
CathLass 82cd675
Merge branch 'main' into edit-induction-e2e-tests
CathLass 52554f2
edit start date page functionality and tests
CathLass 83f3378
E2E tests
CathLass da59287
show previously stored start date on page
CathLass 0213780
move earliest start date rule to person class
CathLass e0af7ad
fix and refactor tests
CathLass cf7731b
merge main
CathLass 612f58e
lint error
CathLass c16f548
Merge branch 'main' into induction-edit-start-date
CathLass File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...dSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/EditInductionPageExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using Microsoft.Playwright; | ||
|
||
namespace TeachingRecordSystem.SupportUi.EndToEndTests; | ||
|
||
public static class EditInductionPageExtensions | ||
{ | ||
public static Task GoToPersonInductionPageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.GotoAsync($"/persons/{personId}/induction"); | ||
} | ||
|
||
public static Task ClickEditInductionStatusPageAsync(this IPage page) | ||
{ | ||
return page.GetByTestId($"change-induction-status").ClickAsync(); | ||
} | ||
|
||
public static Task AssertOnEditInductionStatusPageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.WaitForUrlPathAsync($"/persons/{personId}/edit-induction/status"); | ||
} | ||
|
||
public static Task AssertOnEditInductionStartDatePageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.WaitForUrlPathAsync($"/persons/{personId}/edit-induction/start-date"); | ||
} | ||
|
||
public static Task AssertOnEditInductionCompletedDatePageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.WaitForUrlPathAsync($"/persons/{personId}/edit-induction/date-completed"); | ||
} | ||
|
||
public static Task AssertOnEditInductionChangeReasonPageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.WaitForUrlPathAsync($"/persons/{personId}/edit-induction/change-reason"); | ||
} | ||
|
||
public static Task AssertOnEditInductionCheckYourAnswersPageAsync(this IPage page, Guid personId) | ||
{ | ||
return page.WaitForUrlPathAsync($"/persons/{personId}/edit-induction/check-answers"); | ||
} | ||
|
||
public static Task AssertInductionStatusSelected(this IPage page, InductionStatus status) | ||
{ | ||
var radioButton = page.Locator($"input[type='radio'][value='{status.ToString()}']"); | ||
return radioButton.Locator("xpath=following-sibling::label").IsCheckedAsync(); | ||
} | ||
|
||
public static Task SelectStatusAsync(this IPage page, InductionStatus status) | ||
{ | ||
var radioButton = page.Locator($"input[type='radio'][value='{status.ToString()}']"); | ||
return radioButton.Locator("xpath=following-sibling::label").ClickAsync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ortUi.EndToEndTests/ChangeRequestTests.cs → ...dTests/JourneyTests/ChangeRequestTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tem.SupportUi.EndToEndTests/IndexTests.cs → ....EndToEndTests/JourneyTests/IndexTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...dSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/JourneyTests/InductionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
namespace TeachingRecordSystem.SupportUi.EndToEndTests.JourneyTests; | ||
|
||
public class InductionTests : TestBase | ||
{ | ||
public InductionTests(HostFixture hostFixture) | ||
: base(hostFixture) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task EditInduction() | ||
{ | ||
var setStartDate = new DateOnly(2021, 1, 1); | ||
var person = await TestData.CreatePersonAsync( | ||
personBuilder => personBuilder | ||
.WithQts() | ||
.WithInductionStatus(inductionBuilder => inductionBuilder | ||
.WithStatus(InductionStatus.RequiredToComplete) | ||
)); | ||
var personId = person.ContactId; | ||
|
||
await using var context = await HostFixture.CreateBrowserContext(); | ||
var page = await context.NewPageAsync(); | ||
|
||
await page.GoToPersonInductionPageAsync(personId); | ||
await page.ClickEditInductionStatusPageAsync(); | ||
|
||
await page.AssertOnEditInductionStatusPageAsync(person.PersonId); | ||
|
||
await page.SelectStatusAsync(InductionStatus.Failed); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionStartDatePageAsync(person.PersonId); | ||
await page.FillDateInputAsync(setStartDate); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionCompletedDatePageAsync(person.PersonId); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionChangeReasonPageAsync(person.PersonId); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionCheckYourAnswersPageAsync(person.PersonId); | ||
} | ||
|
||
[Fact] | ||
public async Task EditInduction_NavigateBack() | ||
{ | ||
var inductionStatusToSelect = InductionStatus.Failed; | ||
var setStartDate = new DateOnly(2021, 1, 1); | ||
var person = await TestData.CreatePersonAsync( | ||
personBuilder => personBuilder | ||
.WithQts() | ||
.WithInductionStatus(inductionBuilder => inductionBuilder | ||
.WithStatus(InductionStatus.RequiredToComplete) | ||
)); | ||
var personId = person.ContactId; | ||
|
||
await using var context = await HostFixture.CreateBrowserContext(); | ||
var page = await context.NewPageAsync(); | ||
|
||
await page.GoToPersonInductionPageAsync(personId); | ||
await page.ClickEditInductionStatusPageAsync(); | ||
|
||
await page.AssertOnEditInductionStatusPageAsync(person.PersonId); | ||
|
||
await page.SelectStatusAsync(inductionStatusToSelect); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionStartDatePageAsync(person.PersonId); | ||
await page.FillDateInputAsync(setStartDate); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionCompletedDatePageAsync(person.PersonId); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionChangeReasonPageAsync(person.PersonId); | ||
await page.ClickContinueButtonAsync(); | ||
|
||
await page.AssertOnEditInductionCheckYourAnswersPageAsync(person.PersonId); | ||
await page.ClickBackLink(); | ||
|
||
await page.AssertOnEditInductionChangeReasonPageAsync(person.PersonId); | ||
await page.ClickBackLink(); | ||
|
||
await page.AssertOnEditInductionCompletedDatePageAsync(person.PersonId); | ||
await page.ClickBackLink(); | ||
|
||
await page.AssertOnEditInductionStartDatePageAsync(person.PersonId); | ||
await page.ClickBackLink(); | ||
|
||
await page.AssertOnEditInductionStatusPageAsync(person.PersonId); | ||
await page.AssertInductionStatusSelected(inductionStatusToSelect); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...em.SupportUi.EndToEndTests/PersonTests.cs → ...EndToEndTests/JourneyTests/PersonTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...stem.SupportUi.EndToEndTests/UserTests.cs → ...i.EndToEndTests/JourneyTests/UserTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation logic to be added to
person
? Not sure I can add it to theValidateInductionData
method because that's being used for updating the cpd induction data which I guess might have dates prior to 7th may 1999?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could put a
staticDateOnly EarliestInductionStartDate
onPerson
; we don't have a great way of sharing validation logic with Razor Pages currently.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done - I might get in trouble for this though because that error string is supposed to say 7th May not 7 May. I propose to deal with that if it's mentioned and not before
The method ValidateInductionData - is that intended to be only for the API? I know this FE is updating the DB directly but I expect I'll call a validate method before I update the record from the last page of the wizard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have
UiDefaults.DateOnlyDisplayFormat
to use for date formatting.