diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml index 5d16d5110..88d6ad21a 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml @@ -1,7 +1,24 @@ @page "/mqs/add/provider" @model TeachingRecordSystem.SupportUi.Pages.Mqs.AddMq.ProviderModel +@addTagHelper *, Joonasw.AspNetCore.SecurityHeaders @{ - ViewBag.Title = "Training Provider"; + ViewBag.Title = "Training provider"; +} + +@section Styles { + +} + +@section Scripts { + + } @section BeforeContent { @@ -9,22 +26,18 @@ } Add a mandatory qualification - @Model.PersonName -

@ViewBag.Title

- - @if (Model.MqEstablishments is not null) + + Training provider + + @foreach (var establishment in Model.MqEstablishments!) { - @foreach (var establishment in Model.MqEstablishments) - { - - @establishment.dfeta_name - - } + @establishment.dfeta_name } - +
Continue diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml.cs b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml.cs index 7745a2a8f..971ce90d5 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/Provider.cshtml.cs @@ -28,7 +28,7 @@ public ProviderModel( public string? PersonName { get; set; } [BindProperty] - [Display(Name = "Training Provider")] + [Display(Name = "Training provider")] public string? MqEstablishmentValue { get; set; } public dfeta_mqestablishment[]? MqEstablishments { get; set; } diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/EditMq/Provider/Index.cshtml b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/EditMq/Provider/Index.cshtml index afad0f32c..85d69ac8c 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/EditMq/Provider/Index.cshtml +++ b/TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/EditMq/Provider/Index.cshtml @@ -1,7 +1,24 @@ @page "/mqs/{qualificationId}/provider/{handler?}" @model TeachingRecordSystem.SupportUi.Pages.Mqs.EditMq.Provider.IndexModel +@addTagHelper *, Joonasw.AspNetCore.SecurityHeaders @{ - ViewBag.Title = "Training Provider"; + ViewBag.Title = "Training provider"; +} + +@section Styles { + +} + +@section Scripts { + + } @section BeforeContent { @@ -9,22 +26,18 @@ } Change a mandatory qualification - @Model.PersonName -

@ViewBag.Title

- - @if (Model.MqEstablishments is not null) + + Training provider + + @foreach (var establishment in Model.MqEstablishments!) { - @foreach (var establishment in Model.MqEstablishments) - { - - @establishment.dfeta_name - - } + @establishment.dfeta_name } - +
Continue diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/MqTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/MqTests.cs index b098d5d0d..c160b8d26 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/MqTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.EndToEndTests/MqTests.cs @@ -31,8 +31,9 @@ public async Task AddMq() await page.AssertOnAddMqProviderPage(); - await page.CheckAsync($"label:text-is('{mqEstablishment.dfeta_name}')"); + await page.FillAsync($"label:text-is('Training provider')", mqEstablishment.dfeta_name); + await page.FocusAsync("button:text-is('Continue')"); await page.ClickContinueButton(); await page.AssertOnAddMqSpecialismPage(); @@ -84,10 +85,9 @@ public async Task EditMqProvider() await page.AssertOnEditMqProviderPage(qualificationId); - await page.IsCheckedAsync($"label:text-is('{oldMqEstablishment.dfeta_name}')"); - - await page.CheckAsync($"label:text-is('{newMqEstablishment.dfeta_name}')"); + await page.FillAsync($"label:text-is('Training provider')", newMqEstablishment.dfeta_name); + await page.FocusAsync("button:text-is('Continue')"); await page.ClickContinueButton(); await page.AssertOnEditMqProviderConfirmPage(qualificationId); diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/AddMq/ProviderTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/AddMq/ProviderTests.cs index 8aedca294..b17670001 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/AddMq/ProviderTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/AddMq/ProviderTests.cs @@ -1,3 +1,4 @@ +using AngleSharp.Html.Dom; using FormFlow; using TeachingRecordSystem.SupportUi.Pages.Mqs.AddMq; @@ -62,11 +63,9 @@ public async Task Get_ValidRequestWithPopulatedDataInJourneyState_PopulatesModel // Assert var doc = await response.GetDocument(); - var providerList = doc.GetElementByTestId("provider-list"); - var radioButtons = providerList!.GetElementsByTagName("input"); - var selectedProvider = radioButtons.SingleOrDefault(r => r.HasAttribute("checked")); + var selectedProvider = doc.GetElementById("MqEstablishmentValue") as IHtmlSelectElement; Assert.NotNull(selectedProvider); - Assert.Equal(mqEstablishmentValue, selectedProvider.GetAttribute("value")); + Assert.Equal(mqEstablishmentValue, selectedProvider.Value); } [Fact] diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/EditMq/Provider/IndexTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/EditMq/Provider/IndexTests.cs index a9644009c..436182c86 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/EditMq/Provider/IndexTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.SupportUi.Tests/PageTests/Mqs/EditMq/Provider/IndexTests.cs @@ -1,3 +1,4 @@ +using AngleSharp.Html.Dom; using FormFlow; using TeachingRecordSystem.Core.Dqt.Models; using TeachingRecordSystem.SupportUi.Pages.Mqs.EditMq.Provider; @@ -46,11 +47,9 @@ public async Task Get_ValidRequestWithUninitializedJourneyState_PopulatesModelFr Assert.Equal(StatusCodes.Status200OK, (int)response.StatusCode); var doc = await response.GetDocument(); - var providerList = doc.GetElementByTestId("provider-list"); - var radioButtons = providerList!.GetElementsByTagName("input"); - var selectedProvider = radioButtons.SingleOrDefault(r => r.HasAttribute("checked")); + var selectedProvider = doc.GetElementById("MqEstablishmentValue") as IHtmlSelectElement; Assert.NotNull(selectedProvider); - Assert.Equal(databaseMqEstablishmentValue, selectedProvider.GetAttribute("value")); + Assert.Equal(databaseMqEstablishmentValue, selectedProvider.Value); } [Fact] @@ -81,11 +80,9 @@ public async Task Get_ValidRequestWithInitializedJourneyState_PopulatesModelFrom Assert.Equal(StatusCodes.Status200OK, (int)response.StatusCode); var doc = await response.GetDocument(); - var providerList = doc.GetElementByTestId("provider-list"); - var radioButtons = providerList!.GetElementsByTagName("input"); - var selectedProvider = radioButtons.SingleOrDefault(r => r.HasAttribute("checked")); + var selectedProvider = doc.GetElementById("MqEstablishmentValue") as IHtmlSelectElement; Assert.NotNull(selectedProvider); - Assert.Equal(journeyMqEstablishmentValue, selectedProvider.GetAttribute("value")); + Assert.Equal(journeyMqEstablishmentValue, selectedProvider.Value); } [Fact]