Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into decisions_Cypress_Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FahadDarw committed Jun 19, 2024
2 parents 931b182 + ad2f97c commit 8355eae
Show file tree
Hide file tree
Showing 53 changed files with 1,721 additions and 862 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ jobs:
deploy-image:
name: Deploy
needs: [ set-env ]
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v2.1.0
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build-push-deploy.yml@v2.2.0
with:
docker-image-name: 'a2bint-app'
docker-build-file-name: './Dockerfile'
environment: ${{ needs.set-env.outputs.environment }}
annotate-release: ${{ needs.set-env.outputs.environment == 'dev' }}
secrets:
azure-acr-credentials: ${{ secrets.ACR_CREDENTIALS }}
azure-acr-name: ${{ secrets.ACR_NAME }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class AcademyConversionProject
public int Id { get; set; }
public int? Urn { get; set; }
public int? FormAMatProjectId { get; set; }
public Guid? SchoolSharePointId { get; set; }
public Guid? ApplicationSharePointId { get; set; }
public bool? IsFormAMat { get; set; }
public DateTime CreatedOn { get; set; }
public string SchoolName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public async Task SubmitThroughTheWizard(AdvisoryBoardDecision request)
{
await SetDecisionToAndContinue(request.Decision.GetValueOrDefault());
await SetDecisionByAndContinue(request.DecisionMadeBy.GetValueOrDefault());
await SetDecisionMakerName("Tester");
await SetIsConditionalAndContinue(request.ApprovedConditionsSet.GetValueOrDefault(), request.ApprovedConditionsDetails);
await SetDecisionMakerName("Tester");
await SetDecisionDateAndContinue(request.AdvisoryBoardDecisionDate.GetValueOrDefault(DateTime.MinValue));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public async Task InitializeAsync()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Approved);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await _wizard.SetDecisionMakerName("Tester");

Document.Url.Should().EndWith("any-conditions");
}
Expand Down Expand Up @@ -60,15 +59,15 @@ public async Task Submit_yes_should_redirect_to_decision_date()
{
await _wizard.SetIsConditionalAndContinue(true, "Reasons");

Document.Url.Should().EndWith("/decision/decision-date");
Document.Url.Should().EndWith("/decision/decision-maker");
}

[Fact]
public async Task Submit_no_should_redirect_to_decision_date()
{
await _wizard.SetIsConditionalAndContinue(false, default);

Document.Url.Should().EndWith("/decision/decision-date");
Document.Url.Should().EndWith("/decision/decision-maker");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ public async Task Should_pass_on_the_obl_parameter_when_changing_declined_reason
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Other, "other"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);
await NavigateAsync("Change", 3);
await NavigateAsync("Change", 1);

PageHeading.Should().Be("Why was this project declined?");
Document.Url.Should().Contain("obl=");
Expand All @@ -132,10 +132,10 @@ public async Task Should_pass_on_the_obl_parameter_when_changing_deferred_reason
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Deferred);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.DirectorGeneral);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeferredReasonsAndContinue(Tuple.Create(AdvisoryBoardDeferredReason.Other, "other"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);
await NavigateAsync("Change", 3);
await NavigateAsync("Change", 1);

PageHeading.Should().Be("Why was this project deferred?");
Document.Url.Should().Contain("obl=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public async Task Should_go_back_to_any_conditions_for_the_accepted_journey()

await NavigateAsync("Back");

PageHeading.Should().Be("Were any conditions set?");
PageHeading.Should().Be("Decision maker's name");
}

[Fact]
Expand All @@ -127,14 +127,14 @@ public async Task Should_go_back_to_declined_reasons_for_the_declined_journey()
await wizard.StartFor(project.Id);
await wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await wizard.SetDecisionMakerName("Tester");
await wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Finance, "Finance reasons"));
await wizard.SetDecisionMakerName("Tester");

PageHeading.Should().Be("Date of decision");

await NavigateAsync("Back");

PageHeading.Should().Be("Why was this project declined?");
PageHeading.Should().Be("Decision maker's name");
}

[Fact]
Expand All @@ -151,8 +151,8 @@ public async Task Should_display_the_correct_journey_in_the_required_message_whe
await wizard.StartFor(project.Id);
await wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await wizard.SetDecisionMakerName("Tester");
await wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Performance, "performance reasons"));
await wizard.SetDecisionMakerName("Tester");

PageHeading.Should().Be("Date of decision");

Expand All @@ -175,7 +175,7 @@ private async Task ProgressToDecisionDateStep(AcademyConversionProject project)
await wizard.StartFor(project.Id);
await wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Approved);
await wizard.SetDecisionByAndContinue(DecisionMadeBy.OtherRegionalDirector);
await wizard.SetDecisionMakerName("Tester");
await wizard.SetIsConditionalAndContinue(false, "Something");
await wizard.SetDecisionMakerName("Tester");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public async Task InitializeAsync()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.RegionalDirectorForRegion);
await _wizard.SetDecisionMakerName("Tester");

Document.Url.Should().EndWith("/decision/declined-reason");
}
Expand Down Expand Up @@ -70,7 +69,7 @@ public async Task Should_continue_to_the_decline_date_page_on_submit()
{
await _wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Other, "other reasons"));

PageHeading.Should().Be("Date of decision");
PageHeading.Should().Be("Decision maker's name");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public async Task Should_display_declined_for_declined_projects()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.DirectorGeneral);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Finance, "Finance reason"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);

Document.QuerySelector("#decision")!.TextContent.Trim().Should().Be("Declined");
Expand All @@ -152,12 +152,12 @@ public async Task Should_show_the_selected_decline_reasons_and_details()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Finance, "Finance detail"),
Tuple.Create(AdvisoryBoardDeclinedReasons.ChoiceOfTrust, "Choice of trust detail"));
Tuple.Create(AdvisoryBoardDeclinedReasons.ChoiceOfTrust, "Choice of trust detail"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);

string declineReasonSummary = Document.QuerySelector("#decline-reasons")!.TextContent;
string declineReasonSummary = Document.QuerySelector("#reasons")!.TextContent;

declineReasonSummary.Should().Contain("Finance:", "finance reason was selected");
declineReasonSummary.Should().Contain("Finance detail", "Finance reason detail was provided");
Expand All @@ -175,15 +175,15 @@ public async Task Should_show_the_selected_deferred_reasons_and_details()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Deferred);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeferredReasonsAndContinue(
Tuple.Create(AdvisoryBoardDeferredReason.PerformanceConcerns, "Performance detail"),
Tuple.Create(AdvisoryBoardDeferredReason.Other, "Other detail"),
Tuple.Create(AdvisoryBoardDeferredReason.AdditionalInformationNeeded, "additional info"),
Tuple.Create(AdvisoryBoardDeferredReason.AwaitingNextOfstedReport, "Ofsted"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);

string declineReasonSummary = Document.QuerySelector("#deferred-reasons")!.TextContent;
string declineReasonSummary = Document.QuerySelector("#reasons")!.TextContent;

declineReasonSummary.Should().Contain("Additional information needed:");
declineReasonSummary.Should().Contain("additional info");
Expand All @@ -201,8 +201,8 @@ public async Task Should_not_display_conditions_details_for_declined_projects()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.OtherRegionalDirector);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeclinedReasonsAndContinue(Tuple.Create(AdvisoryBoardDeclinedReasons.Finance, "finance reasons"));
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);

string summaryContent = Document.QuerySelector(".govuk-summary-list")!.TextContent;
Expand Down Expand Up @@ -242,8 +242,9 @@ public async Task Should_go_back_to_choose_and_back_link_to_summary(int changeLi

[Theory]
[InlineData(0, "Record the decision", "Who made this decision?")]
[InlineData(1, "Who made this decision?", "Decision maker's name")]
[InlineData(3, "Were any conditions set?", "Date of decision")]
[InlineData(1, "Who made this decision?", "Were any conditions set?")]
[InlineData(2, "Decision maker's name", "Date of decision")]
[InlineData(3, "Were any conditions set?", "Decision maker's name")]
[InlineData(4, "Date of decision", "Check your answers before recording this decision")]
public async Task Should_go_back_to_choose_and_submit_back_to_summary(int changeLinkIndex, string changePageTitle, string nextPageTitle)
{
Expand Down Expand Up @@ -276,19 +277,19 @@ public async Task Should_store_the_reasons_in_the_expected_order()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.Minister);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDeclinedReasonsAndContinue(
Tuple.Create(AdvisoryBoardDeclinedReasons.ChoiceOfTrust, "trust"),
Tuple.Create(AdvisoryBoardDeclinedReasons.Other, "other"),
Tuple.Create(AdvisoryBoardDeclinedReasons.Finance, "finance"),
Tuple.Create(AdvisoryBoardDeclinedReasons.Governance, "governance"),
Tuple.Create(AdvisoryBoardDeclinedReasons.Performance, "performance")
);
await _wizard.SetDecisionMakerName("Tester");
await _wizard.SetDecisionDateAndContinue(DateTime.Today);

PageHeading.Should().Be("Check your answers before recording this decision");

string reasonSummary = Document.QuerySelector<IHtmlElement>("#decline-reasons")!.TextContent;
string reasonSummary = Document.QuerySelector<IHtmlElement>("#reasons")!.TextContent;

int financePosition = reasonSummary.IndexOf("Finance:", StringComparison.InvariantCultureIgnoreCase);
int performancePosition = reasonSummary.IndexOf("Performance:", StringComparison.InvariantCultureIgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public async Task Should_redirect_to_decline_reasons_if_project_declined()
await wizard.StartFor(project.Id);
await wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Declined);
await wizard.SetDecisionByAndContinue(DecisionMadeBy.RegionalDirectorForRegion);
await wizard.SetDecisionMakerName("Tester");

Document.Url.Should().EndWith("/decision/declined-reason", "reason should be the second question in the declined journey");
Document.QuerySelector<IHtmlHeadingElement>(".govuk-fieldset__heading")!.TextContent.Trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public async Task InitializeAsync()
await _wizard.StartFor(_project.Id);
await _wizard.SetDecisionToAndContinue(AdvisoryBoardDecisions.Deferred);
await _wizard.SetDecisionByAndContinue(DecisionMadeBy.RegionalDirectorForRegion);
await _wizard.SetDecisionMakerName("Tester");

Document.Url.Should().EndWith("/decision/why-deferred");
}
Expand Down Expand Up @@ -70,7 +69,7 @@ public async Task Should_continue_to_the_deferred_date_page_on_submit()
await _wizard.SetDeferredReasonsAndContinue(Tuple.Create(AdvisoryBoardDeferredReason.Other, "other reasons"));

Document.QuerySelector<IHtmlElement>("h1")!.Text().Should()
.Be("Date of decision");
.Be("Decision maker's name");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public async Task Should_redirect_to_record_decision()
{
await OpenAndConfirmPathAsync($"/task-list/{_project.Id}/record-a-decision");

await NavigateAsync("Record a decision", 1);
await NavigateAsync("Record a decision", 0);

Document.Url.Should().Contain($"/task-list/{_project.Id}/decision/record-decision");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Dfe.PrepareConversions.Configuration
{
public class SharePointOptions
{
public bool Enabled { get; set; }
public string Url { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Dfe.PrepareConversions.Models;

public class CheckBoxItem
{
public string Title { get; set; }
public string HintText { get; set; }
public string CheckBoxId { get; set; }
}
15 changes: 15 additions & 0 deletions Dfe.PrepareConversions/Dfe.PrepareConversions/Models/Links.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using DocumentFormat.OpenXml.InkML;
using System;
using System.Collections.Generic;

Expand All @@ -9,6 +10,9 @@ public static class Links
private static string _transfersUrl;
public static string TransfersUrl => _transfersUrl;

private static bool _isApplicationDocumentsEnabled;
public static bool IsApplicationDocumentsEnabled => _isApplicationDocumentsEnabled;

private static LinkItem AddLinkItem(string page, string backText = "Back")
{
LinkItem item = new() { Page = page, BackText = backText };
Expand All @@ -19,6 +23,10 @@ public static void InitializeTransfersUrl(string transfersUrl)
{
_transfersUrl = transfersUrl;
}

public static void InializeProjectDocumentsEnabled(bool isApplicationDocumentsEnabled) {
_isApplicationDocumentsEnabled = isApplicationDocumentsEnabled;
}
public static LinkItem ByPage(string page)
{
return _links.Find(x => string.Equals(page, x.Page, StringComparison.InvariantCultureIgnoreCase));
Expand Down Expand Up @@ -64,6 +72,11 @@ public static class ProjectNotes
public static readonly LinkItem NewNote = AddLinkItem(page: "/ProjectNotes/NewNote");
}

public static class ApplicationDocuments
{
public static readonly LinkItem Index = AddLinkItem(page: "/ApplicationDocuments/Index");
}

public static class TaskList
{
public static readonly LinkItem Index = AddLinkItem(backText: "Back", page: "/TaskList/Index");
Expand Down Expand Up @@ -204,6 +217,8 @@ public static class Decision
{
public static readonly LinkItem RecordDecision = AddLinkItem(backText: "Back", page: "/TaskList/Decision/RecordDecision");
public static readonly LinkItem WhoDecided = AddLinkItem(backText: "Back", page: "/TaskList/Decision/WhoDecided");
public static readonly LinkItem DAOPrecursor = AddLinkItem(backText: "Back", page: "/TaskList/Decision/DAOPrecursor");
public static readonly LinkItem DAOBeforeYouStart = AddLinkItem(backText: "Back", page: "/TaskList/Decision/DAOBeforeYouStart");
public static readonly LinkItem DeclineReason = AddLinkItem(backText: "Back", page: "/TaskList/Decision/DeclineReason");
public static readonly LinkItem AnyConditions = AddLinkItem(backText: "Back", page: "/TaskList/Decision/AnyConditions");
public static readonly LinkItem DecisionDate = AddLinkItem(backText: "Back", page: "/TaskList/Decision/DecisionDate");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@page "/application-documents/{id:int}"
@using Dfe.PrepareConversions.Data.Models
@using Dfe.PrepareConversions.TagHelpers
@model Dfe.PrepareConversions.Pages.ApplicationDocuments.IndexModel
@{
ViewData["Title"] = "Application documents";
}

@section BeforeMain
{
<a asp-page="@Model.ReturnPage" asp-route-id="@Model.ReturnId" class="govuk-back-link">@Links.ProjectList.Index.BackText</a>
}

<partial name="Shared/_ProjectHeader" model="Model.Project" />
<h2 class="govuk-heading-l govuk-!-margin-bottom govuk-!-font-size-36">Application documents</h2>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body" if="Model.Project.ApplicationSharePointId.HasValue">
<a href="@Model.ApplicationLevelDocumentsFolder" class="govuk-link" rel="noreferrer noopener" target="_blank">Application level documents folder (opens in new tab)</a>
</p>
<p class="govuk-body" if="!Model.Project.ApplicationSharePointId.HasValue">
Application level documents are unavailable
</p>
<p class="govuk-body" if="Model.Project.SchoolSharePointId.HasValue">
<a href="@Model.SchoolLevelDocumentsFolder" class="govuk-link" rel="noreferrer noopener" target="_blank">School level documents folder (opens in new tab)</a>
</p>
<p class="govuk-body" if="!Model.Project.SchoolSharePointId.HasValue">
School level documents are unavailable
</p>
</div>

</div>
Loading

0 comments on commit 8355eae

Please sign in to comment.