diff --git a/test/helpers/content.helper.js b/test/helpers/content.helper.js index 21f6f37ead..df5af23236 100644 --- a/test/helpers/content.helper.js +++ b/test/helpers/content.helper.js @@ -1,4 +1,6 @@ require('./globals.helper'); +import {readdirSync} from 'fs'; +import {resolve} from 'path'; import i18n from '../../common/script/src/i18n'; require('coffee-script'); @@ -15,4 +17,15 @@ global.expectValidTranslationString = (attribute) => { expect(translatedString).to.not.be.empty; expect(translatedString).to.not.eql(STRING_ERROR_MSG); expect(translatedString).to.not.match(STRING_DOES_NOT_EXIST_MSG); -} +}; + +global.runTestsInDirectory = (directory) => { + const CONTENT_TEST_PATH = './test/content/'; + let directoryPath = `${CONTENT_TEST_PATH}${directory}`; + let files = readdirSync(directoryPath); + + files.forEach((file) => { + let filePath = resolve(`${directoryPath}/${file}`); + require(filePath); + }); +};