diff --git a/tests/page-objects/default/enketo/common-enketo.wdio.page.js b/tests/page-objects/default/enketo/common-enketo.wdio.page.js index 69143ec53bb..10560eaa89e 100644 --- a/tests/page-objects/default/enketo/common-enketo.wdio.page.js +++ b/tests/page-objects/default/enketo/common-enketo.wdio.page.js @@ -28,16 +28,16 @@ const getCorrectFieldsetSection = async (section) => { }; const isElementDisplayed = async (type, text) => { - return await getCurrentPageSection().$(`${type}*=${text}`).isDisplayed(); + return await (await getCurrentPageSection()).$(`${type}*=${text}`).isDisplayed(); }; const selectRadioButton = async (question, value) => { - await radioButtonElement(question, value).click(); + await (await radioButtonElement(question, value)).click(); }; const selectCheckBox = async (question, value) => { const page = await getCurrentPageSection(); - const checkbox = await getCorrectFieldsetSection(page) + const checkbox = await (await getCorrectFieldsetSection(page)) .$(`legend*=${question}`) .nextElement() .$(`label*=${value}`); @@ -45,7 +45,7 @@ const selectCheckBox = async (question, value) => { }; const setValue = async (typeSelector, question, value) => { - const element = await getCurrentPageSection() + const element = await (await getCurrentPageSection()) .$(`label*=${question}`) .$(typeSelector); await element.setValue(value); @@ -64,7 +64,7 @@ const setTextareaValue = async (question, value) => { }; const addFileInputValue = async (question, value, { repeatIndex = 0 } = {}) => { - const element = await getCurrentPageSection() + const element = await (await getCurrentPageSection()) .$$(`label*=${question}`)[repeatIndex] .$('input[type=file]'); await element.addValue(value); @@ -102,7 +102,7 @@ const uploadForm = async (formName, saveDoc = true) => { }; const getValue = async (typeSelector, question) => { - return await getCurrentPageSection() + return await (await getCurrentPageSection()) .$(`label*=${question}`) .$(typeSelector) .getValue(); @@ -118,7 +118,7 @@ const getTextareaValue = async (question) => { const isRequiredMessageDisplayed = async (question) => { await formTitle().click(); - const requiredMsg = (await getCurrentPageSection()) + const requiredMsg = await (await getCurrentPageSection()) .$(`label*=${question}`) .$('.or-required-msg.active'); return await requiredMsg.isDisplayed(); @@ -126,7 +126,7 @@ const isRequiredMessageDisplayed = async (question) => { const isConstraintMessageDisplayed = async (question) => { await formTitle().click(); - const requiredMsg = (await getCurrentPageSection()) + const requiredMsg = await (await getCurrentPageSection()) .$(`label*=${question}`) .$('.or-constraint-msg.active'); return await requiredMsg.isDisplayed(); @@ -138,7 +138,7 @@ const addRepeatSection = async () => { }; const drawShapeOnCanvas = async (question) => { - const canvas = await getCurrentPageSection() + const canvas = await (await getCurrentPageSection()) .$(`label*=${question}`) .$('canvas'); await canvas.waitForDisplayed(); diff --git a/tests/utils/config-temp/.eslintrc b/tests/utils/config-temp/.eslintrc new file mode 100644 index 00000000000..79216c71d20 --- /dev/null +++ b/tests/utils/config-temp/.eslintrc @@ -0,0 +1 @@ +{"env":{"node":true,"es6":true},"parserOptions":{"ecmaVersion":6},"root":true} \ No newline at end of file diff --git a/tests/utils/config-temp/app_settings.json b/tests/utils/config-temp/app_settings.json new file mode 100644 index 00000000000..91e55d58e78 --- /dev/null +++ b/tests/utils/config-temp/app_settings.json @@ -0,0 +1,13 @@ +{ + "forms": {}, + "schedules": [], + "contact_summary": "var ContactSummary = {}; !function(e,t){if('object'==typeof exports&&'object'==typeof module)module.exports=t();else if('function'==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)('object'==typeof exports?exports:e)[r]=n[r]}}(ContactSummary,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&'object'==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,'default',{enumerable:!0,value:e}),2&t&&'string'!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,'a',t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p='',n(n.s=0)}([function(e,t,n){var r=n(1),o=n(2);e.exports=o(r,contact,reports)},function(e,t){e.exports={cards:[],fields:[],context:{nbr_reports:reports.length}}},function(e,t){function n(e){return e?Array.isArray(e)?e:[e]:[]}function r(e,t){switch(typeof e){case'undefined':return!0;case'function':return e(t);default:return e}}function o(e,t,n){if(r(e.appliesIf,n)){var o='function'==typeof e.fields?e.fields(n):e.fields.filter((function(e){return r(e.appliesIf,n)})).map((function(e){var t={};return i(e,t,'label'),i(e,t,'value'),i(e,t,'translate'),i(e,t,'filter'),i(e,t,'width'),i(e,t,'icon'),e.context&&(t.context={},i(e.context,t.context,'count'),i(e.context,t.context,'total')),t}));return e.modifyContext&&e.modifyContext(t,n),{label:e.label,fields:o}}function i(e,t,r){switch(typeof e[r]){case'undefined':return;case'function':t[r]=e[r](n);break;default:t[r]=e[r]}}}e.exports=function(e,t,r){var i=e.fields||[],f=e.context||{},u=e.cards||[],c=t&&('contact'===t.type?t.contact_type:t.type),l={cards:[],fields:i.filter((function(e){var t=n(e.appliesToType),r=t.filter((function(e){return e&&'!'===e.charAt(0)}));if((0===t.length||t.includes(c)||r.length>0&&!r.includes('!'+c))&&(!e.appliesIf||e.appliesIf()))return delete e.appliesToType,delete e.appliesIf,!0}))};return u.forEach((function(e){var t,i,u,a,p=n(e.appliesToType);if(p.includes('report')&&p.length>1)throw new Error('You cannot set appliesToType to an array which includes the type \\'report\\' and another type.');if(p.includes('report'))for(t=0;t0)return;(u=o(e,f))&&l.cards.push(u)}})),l.context=f,l}}])})); return ContactSummary;", + "tasks": { + "rules": "!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){'undefined'!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:'Module'}),Object.defineProperty(e,'__esModule',{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&'object'==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,'default',{enumerable:!0,value:e}),2&t&&'string'!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,'a',t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p='',n(n.s=1)}([function(e,t){e.exports=function(e){var t={};!function e(t,n){var r=Object.keys(t);for(var o in r){var a=r[o];switch(typeof t[a]){case'object':e(t[a],n);break;case'function':t[a]=t[a].bind(n)}}}(e,t),t.definition=function e(t){var n=Object.assign({},t),r=Object.keys(n);for(var o in r){var a=r[o];if(Array.isArray(n[a])){n[a]=n[a].slice(0);for(var i=0;i