From 5a453ffc39edffdd343a3f8f596f8068ce787ecf Mon Sep 17 00:00:00 2001 From: Kica Ronald Okello Date: Tue, 18 Apr 2023 14:55:16 +0300 Subject: [PATCH] Add test cases --- test/app-forms.spec.js | 7 ++ test/collateral/forms/app/mother_name.xml | 44 ++++++++++++ .../forms/contact/household-create.xml | 67 +++++++++++++++++++ test/contact-forms.spec.js | 7 ++ 4 files changed, 125 insertions(+) create mode 100644 test/collateral/forms/app/mother_name.xml create mode 100644 test/collateral/forms/contact/household-create.xml diff --git a/test/app-forms.spec.js b/test/app-forms.spec.js index dff1f445..475e403d 100644 --- a/test/app-forms.spec.js +++ b/test/app-forms.spec.js @@ -276,4 +276,11 @@ describe('forms that have caused bugs', () => { const bikramDate = await harness.page.evaluate(() => window.$$('[data-itext-id="/pregnancy/summary/r_pregnancy_details:label"]').text()); expect(bikramDate).to.include('महिनावारी भएको अन्तिम मिति : १५ कारà¥'); }); + it('should log error thrown during filling an app form', async () => { + try { + await harness.fillForm('mother_name', ['Jane"s']); + } catch(error) { + expect(error.message).to.contain('Error encountered while filling form'); + } + }); }); diff --git a/test/collateral/forms/app/mother_name.xml b/test/collateral/forms/app/mother_name.xml new file mode 100644 index 00000000..f45bde5d --- /dev/null +++ b/test/collateral/forms/app/mother_name.xml @@ -0,0 +1,44 @@ + + + + Add household + + + + + Whose baby is it ? + + + Baby mother + + + Baby mother + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/collateral/forms/contact/household-create.xml b/test/collateral/forms/contact/household-create.xml new file mode 100644 index 00000000..7e55f178 --- /dev/null +++ b/test/collateral/forms/contact/household-create.xml @@ -0,0 +1,67 @@ + + + + Add household + + + + + Please include both names + + + Enter a valid name consisting of only letters starting with a capital letter + + + Names + + + Household Head + + + Household Head + + + + + Osabibwa oteekewo amannya gombi + + + Yingizaamu erinnya ettuufu nga likolebwa nnukuta zokka ate nga litandisa nnukuta nnene + + + Amannya + + + Akulira amaka + + + Akulira amaka + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/contact-forms.spec.js b/test/contact-forms.spec.js index 10a61bb1..74846128 100644 --- a/test/contact-forms.spec.js +++ b/test/contact-forms.spec.js @@ -188,4 +188,11 @@ describe('contact forms', () => { reported_date: now.valueOf() }); }); + it('should log error thrown during filling a contact form', async () => { + try { + await harness.fillContactCreateForm('household', ['Peter"s']); + } catch(error) { + expect(error.message).to.contain('Error encountered while filling form'); + } + }); });