public void Evidence_POST_RemoveFile() { WebAppTest(client => { // prep this test by adding a file to remove var cloudName = System.Guid.NewGuid().ToString(); var detail = NewBsgDetail("form123"); detail.Evidence.Files.Add(new EvidenceFile { Name = "UploadedFile.pdf", CloudName = cloudName }); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); // now remove it var response = client.Get(BsgActions.Evidence(detail.Id)) .Form <EvidenceFile>(1) .SubmitName(BsgButtons.RemoveFile, client); ExecutorStub.Executed <RemoveEvidenceFile>(0).ShouldBeEquivalentTo(new RemoveEvidenceFile { FormId = detail.Id, CloudName = cloudName, }); response.ActionResultOf <RedirectResult>().Url.Should().Be(BsgActions.Evidence(detail.Id)); }); }
public void ExistingChildren_POST_CanAddRemoveChildren() { WebAppTest(client => { var response = client.Get(BsgActions.ExistingChildren("form123")); response.Doc.FindAll(".existing-child").Count.Should().Be(1); response = response .Form <ExistingChildren>(1).SubmitName(BsgButtons.AddChild, client, r => r.SetExpectedResponse(HttpStatusCode.OK)) .Form <ExistingChildren>(1).SubmitName(BsgButtons.AddChild, client, r => r.SetExpectedResponse(HttpStatusCode.OK)); response.Doc.FindAll(".existing-child").Count.Should().Be(3); response = response.Form <ExistingChildren>(1) .SetText(m => m.Children[0].FirstName, "child 0") .SetText(m => m.Children[1].FirstName, "child 1") .SetText(m => m.Children[2].FirstName, "child 2") .SubmitNameValue(BsgButtons.RemoveChild, "1", client, r => r.SetExpectedResponse(HttpStatusCode.OK)); response.Doc.FindAll(".existing-child").Count.Should().Be(2); var form = response.Form <ExistingChildren>(1); form.GetText(m => m.Children[0].FirstName).Should().Be("child 0"); form.GetText(m => m.Children[1].FirstName).Should().Be("child 2"); }); }
public void Declaration_POST_CompletesForm() { WebAppTest(client => { // the declaration form is now dependent on a completed ApplicantDetails, so... var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); ExecutorStub.SetupCommand(It.IsAny<AddDeclaration>(), new NextSection { Type = NextType.Complete }); var response = client.Get(BsgActions.Declaration(detail.Id)).Form<Declaration>(1) .SelectConfirm(m => m.AgreedToLegalStatement, true) .Submit(client); ExecutorStub.Executed<AddDeclaration>(0).ShouldBeEquivalentTo(new AddDeclaration { FormId = "form123", Declaration = new Declaration { AgreedToLegalStatement = true, }, }); response.ActionResultOf<RedirectResult>().Url.Should().Be(BsgActions.Complete()); }); }
public void PaymentDetails_POST_StoresData() { WebAppTest(client => { var response = client.Get(BsgActions.PaymentDetails("form123")).Form <PaymentDetails>(1) .SelectYes(m => m.HasBankAccount) .SetText(m => m.NameOfAccountHolder, "test name") .SetText(m => m.NameOfBank, "test bank") .SetText(m => m.SortCode, "01-02-03") .SetText(m => m.AccountNumber, "01234567") .SetText(m => m.RollNumber, "roll/number") .Submit(client); ExecutorStub.Executed <AddPaymentDetails>(0).ShouldBeEquivalentTo(new AddPaymentDetails { FormId = "form123", PaymentDetails = new PaymentDetails { HasBankAccount = true, NameOfAccountHolder = "test name", NameOfBank = "test bank", SortCode = "01-02-03", AccountNumber = "01234567", RollNumber = "roll/number", }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void PartnerDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.PartnerDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.PartnerDetails }); var form = response.Doc.Form <RelationDetails>(1); form.GetText(m => m.Title).Should().Be(detail.PartnerDetails.Title); form.Get(m => m.RelationshipToApplicant).Length.Should().Be(0, "Should not ask partner's relationship"); form.GetText(m => m.Address.Line1).Should().Be(detail.PartnerDetails.Address.Line1); form.Get(m => m.InheritAddress).Length.Should().Be(1, "option to inherit address should be visible"); form.WhenCheckedShows(m => m.InheritAddress, "inherited-address"); form.WhenUncheckedShows(m => m.InheritAddress, "new-address"); }); }
public void Ineligible_GET() { WebAppTest(client => { var response = client.Get(BsgActions.Ineligible("form")); response.Text.ToLower().Should().Contain("you don't seem to qualify"); }); }
public void BeforeYouApply_GET() { WebAppTest(client => { var response = client.Get(BsgActions.BeforeYouApply()); response.Text.ToLower().Should().Contain("before you apply"); }); }
public void Complete_GET() { WebAppTest(client => { var response = client.Get(BsgActions.Complete()); response.Text.ToLower().Should().Contain("received"); }); }
public void UKVerify_GET() { WebAppTest(client => { var response = client.Get(BsgActions.UKVerify("form123")); response.Text.ToLower().Should().Contain("confirm who you are"); }); }
public void ExpectedChildren_DoesNotAskForCount_WhenNotMoreThanOneChild() { WebAppTest(client => { var response = client.Get(BsgActions.ExpectedChildren("form")); var form = response.Form <ExpectedChildren>(1); form.RadioShows(m => m.IsMoreThan1BabyExpected, true, "baby-count"); }); }
public void PaymentDetails_DoesNotAskForDetails_WhenHasNoBankAccount() { WebAppTest(client => { var response = client.Get(BsgActions.PaymentDetails("form")); var form = response.Form <PaymentDetails>(1); form.RadioShows(m => m.HasBankAccount, false, "no-ba"); }); }
public void PaymentDetails_AsksForDetails_OnlyWhenHasBankAccount() { WebAppTest(client => { var response = client.Get(BsgActions.PaymentDetails("form")); var form = response.Form <PaymentDetails>(1); form.RadioShows(m => m.HasBankAccount, true, "ba-details"); }); }
public void ExpectedChildren_DoesNotAskForDetails_WhenNoBabyDue() { WebAppTest(client => { var response = client.Get(BsgActions.ExpectedChildren("form")); var form = response.Form <ExpectedChildren>(1); form.RadioShows(m => m.IsBabyExpected, true, "due-details"); }); }
public void IncludingGuardianDetails() { App.GoTo(BsgActions.BeforeYouApply()); App.VerifyCanSeeText("Before You Apply"); App.Submit(); FillInConsent(); App.Submit(); App.VerifyCanSeeText("confirm who you are"); App.Submit(); var dob = DateTime.Now.Date.AddYears(-18); FillInApplicantDetails(dob, previouslyLookedAfter: false, fullTimeEducation: true); App.Submit(); var expectancyDate = DateTime.UtcNow.Date.AddDays(100); FillInExpectedChildren(expectancyDate); App.Submit(); App.VerifyCanSeeText("in the household"); FillInNoExistingChildren(); App.ClickButton(""); App.VerifyCanSeeText("guardian's benefits"); FillInGuardianBenefits(); App.Submit(); App.VerifyCanSeeText("guardian's partner's benefits"); FillInGuardianPartnerBenefits(); App.Submit(); var guardianDob = DateTime.Now.Date.AddYears(-39); FillInGuardianDetails(guardianDob); App.Submit(); var guardianPartnerDob = DateTime.Now.Date.AddYears(-38); FillInGuardianPartnerDetails(guardianPartnerDob); App.Submit(); Db(r => { var doc = r.Query <BestStartGrant>().ToList().Single(); VerifyGuardianBenefits(doc); VerifyGuardianPartnerBenefits(doc); VerifyGuardianDetails(doc, guardianDob); VerifyGuardianPartnerDetails(doc, guardianPartnerDob); }); }
public void ApplicantBenefits_POST_ErrorsAreDisplayed() { WebAppTest(client => { ExecutorStub.SetupCommand <AddApplicantBenefits, NextSection>((cmd, def) => { throw new DomainException("simulated logic error"); }); var response = client.Get(BsgActions.ApplicantBenefits("form123")).Form <Benefits>(1) .SubmitName("", client, r => r.SetExpectedResponse(HttpStatusCode.OK)); response.Doc.Find(".validation-summary-errors").Should().NotBeNull(); }); }
public void Declaration_GET() { WebAppTest(client => { // the declaration form is now dependent on a completed ApplicantDetails, so... var detail = NewBsgDetail("form123"); // with default age ... ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); var response = client.Get(BsgActions.Declaration(detail.Id)); response.Text.ToLower().Should().Contain("the information you've given"); }); }
public void Declaration_GET_HandlesMissingSections() { WebAppTest(client => { var detail = new BsgDetail { Id = "form123" }; ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); var response = client.Get(BsgActions.Declaration(detail.Id)); response.HttpStatusCode.Should().Be(HttpStatusCode.OK); }); }
public void DeclarationU16_GET() { WebAppTest(client => { // the declaration form is now dependent on a completed ApplicantDetails, so... var detail = NewBsgDetail("form123"); // then ensure under 16... detail.ApplicantDetails.DateOfBirth = System.DateTime.Now.AddYears(-15); ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); var response = client.Get(BsgActions.Declaration(detail.Id)); response.Text.ToLower().Should().Contain("you are under the age of 16"); }); }
public void Declaration_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny<FindBsgSection>(), detail); var response = client.Get(BsgActions.Declaration(detail.Id)); ExecutorStub.Executed<FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.Declaration }); response.Doc.Form<Declaration>(1).GetConfirm(m => m.AgreedToLegalStatement).Should().Be(detail.Declaration.AgreedToLegalStatement); }); }
public void ExistingChildren_GET_WhenNoExistingChildren_PrePopulatesOneChild() { WebAppTest(client => { var detail = NewBsgDetail("form123"); detail.ExistingChildren.Children = new List <ExistingChild>(); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ExistingChildren(detail.Id)); response.Doc.FindAll(".existing-child").Count.Should().Be(1, "should have at least one child pre-populated (albeit hidden)"); }); }
public void NextSection_RedirectToNextSection() { WebAppTest(client => { ExecutorStub.SetupCommand(It.IsAny <AddApplicantDetails>(), new NextSection { Type = NextType.Section, Id = "form123", Section = Sections.ExistingChildren }); var response = client.Get(BsgActions.ApplicantDetails("form123")).Form <ApplicantDetails>(1).Submit(client); response.ActionResultOf <RedirectResult>().Url.Should().Be(BsgActions.ExistingChildren("form123")); }); }
public void ExistingChildren_POST_StoresData() { WebAppTest(client => { var response = client.Get(BsgActions.ExistingChildren("form123")).Form <ExistingChildren>(1) .SelectYes(m => m.AnyExistingChildren) .SetText(m => m.Children[0].FirstName, "child 0 first name") .SetText(m => m.Children[0].Surname, "child 0 surname") .SetDate(m => m.Children[0].DateOfBirth, "03", "04", "2005") .SetText(m => m.Children[0].Relationship, Relationship.KinshipCarer.ToString()) .SelectYes(m => m.Children[0].ChildBenefit) .SubmitName(BsgButtons.AddChild, client, r => r.SetExpectedResponse(HttpStatusCode.OK)).Form <ExistingChildren>(1) // add a second child .SetText(m => m.Children[1].FirstName, "child 1 first name") .SetText(m => m.Children[1].Surname, "child 1 surname") .SetDate(m => m.Children[1].DateOfBirth, "02", "03", "2004") .SetText(m => m.Children[1].Relationship, Relationship.Parent.ToString()) // leave child benefit as null/empty .SubmitName("", client); ExecutorStub.Executed <AddExistingChildren>(0).ShouldBeEquivalentTo(new AddExistingChildren { FormId = "form123", ExistingChildren = new ExistingChildren { AnyExistingChildren = true, Children = new List <ExistingChild>() { new ExistingChild { FirstName = "child 0 first name", Surname = "child 0 surname", DateOfBirth = new DateTime(2005, 04, 03), Relationship = Relationship.KinshipCarer, ChildBenefit = true, }, new ExistingChild { FirstName = "child 1 first name", Surname = "child 1 surname", DateOfBirth = new DateTime(2004, 03, 02), Relationship = Relationship.Parent, ChildBenefit = null, }, }, }, }); response.ActionResultOf <RedirectResult>().Url.Should().NotBeNullOrWhiteSpace(); }); }
public void ExistingChildren_GET_WhenExactlyOneChild_NoRemoveButtonIsShown() { WebAppTest(client => { var detail = NewBsgDetail("form123", 1); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ExistingChildren(detail.Id)); var form = response.Form <ExistingChildren>(1); form.RadioShows(m => m.AnyExistingChildren, true, "children-details"); response.Doc.FindAll("button[name=RemoveChild]").Count.Should().Be(0, "no remove child button when there's only 1 child (select 'no' instead)"); }); }
public void ExistingChildren_AsksForReason_OnlyWhenNoChildBenefit() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ExistingChildren(detail.Id)); var form = response.Form <ExistingChildren>(1); form.RadioShows(m => m.Children[0].ChildBenefit, false, "child0-reason"); form.RadioShows(m => m.Children[1].ChildBenefit, false, "child1-reason"); }); }
public void ExistingChildren_AsksChildDetails_OnlyWhenSelectedYesToChildren() { WebAppTest(client => { var detail = NewBsgDetail("form123", 2); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ExistingChildren(detail.Id)); var form = response.Form <ExistingChildren>(1); form.RadioShows(m => m.AnyExistingChildren, true, "children-details"); response.Doc.FindAll("button[name=RemoveChild]").Count.Should().Be(2, "should have 2 remove buttons"); }); }
public void GuardianPartnerDetails_GET_PopulatesExistingAddressDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.GuardianPartnerDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.GuardianPartnerDetails }); response.Doc.Form <RelationDetails>(1).GetText(m => m.Address.Line1).Should().Be(detail.GuardianPartnerDetails.Address.Line1); }); }
public void HealthProfessional_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.HealthProfessional(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.HealthProfessional }); response.Doc.Form <HealthProfessional>(1).GetText(m => m.Pin).Should().Be(detail.HealthProfessional.Pin); }); }
public void ApplicantBenefits_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ApplicantBenefits(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.ApplicantBenefits }); response.Doc.Form <Benefits>(1).GetConfirm(m => m.HasIncomeSupport).Should().Be(detail.ApplicantBenefits.HasIncomeSupport); }); }
public void ApplicantDetails_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ApplicantDetails(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.ApplicantDetails }); response.Doc.Form <ApplicantDetails>(1).GetText(m => m.FirstName).Should().Be(detail.ApplicantDetails.FirstName); }); }
public void ExpectedChildren_GET_PopulatesExistingDetails() { WebAppTest(client => { var detail = NewBsgDetail("form123"); ExecutorStub.SetupQuery(It.IsAny <FindBsgSection>(), detail); var response = client.Get(BsgActions.ExpectedChildren(detail.Id)); ExecutorStub.Executed <FindBsgSection>(0).ShouldBeEquivalentTo(new FindBsgSection { FormId = detail.Id, Section = Sections.ExpectedChildren }); response.Doc.Form <ExpectedChildren>(1).GetText(m => m.ExpectedBabyCount).Should().Be(detail.ExpectedChildren.ExpectedBabyCount.ToString()); }); }