diff --git a/app/components/account-settings/general/select-language/index.ts b/app/components/account-settings/general/select-language/index.ts index 7d515adcd..7951f8a00 100644 --- a/app/components/account-settings/general/select-language/index.ts +++ b/app/components/account-settings/general/select-language/index.ts @@ -1,11 +1,14 @@ import Component from '@glimmer/component'; import { inject as service } from '@ember/service'; import { task } from 'ember-concurrency'; -import IntlService from 'ember-intl/services/intl'; import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; +import type IntlService from 'ember-intl/services/intl'; +import type Store from '@ember-data/store'; import ENV from 'irene/config/environment'; -import DatetimeService from 'irene/services/datetime'; +import parseError from 'irene/utils/parse-error'; +import type DatetimeService from 'irene/services/datetime'; const localeStrings = { en: 'English', @@ -18,12 +21,20 @@ export default class AccountSettingsGeneralSelectLanguageComponent extends Compo @service declare intl: IntlService; @service declare ajax: any; @service declare datetime: DatetimeService; + @service declare session: any; + @service declare store: Store; @service('notifications') declare notify: NotificationService; + @tracked userLangPref = 'en'; + + constructor(owner: unknown, args: object) { + super(owner, args); + + this.getUserLangPref.perform(); + } + get currentLocale() { - return this.allLocales.find( - ({ locale }) => locale === this.intl.locale.toString() - ); + return this.allLocales.find(({ locale }) => locale === this.userLangPref); } get allLocales() { @@ -35,10 +46,17 @@ export default class AccountSettingsGeneralSelectLanguageComponent extends Compo .filter((f) => Boolean(f.localeString)); } + @action + handleLocaleChange(selection: { locale: string; localeString: string }) { + this.setLocale.perform(selection); + } + setLocale = task(async (selection) => { const lang = selection.locale; - this.intl.locale = lang; + this.userLangPref = lang; + + this.intl.setLocale(lang); this.datetime.setLocale(lang); @@ -58,10 +76,17 @@ export default class AccountSettingsGeneralSelectLanguageComponent extends Compo } }); - @action - handleLocaleChange(selection: { locale: string; localeString: string }) { - this.setLocale.perform(selection); - } + getUserLangPref = task(async () => { + try { + const userId = this.session.data.authenticated.user_id; + + const user = await this.store.findRecord('user', userId); + + this.userLangPref = user.lang; + } catch (err) { + this.notify.error(parseError(err)); + } + }); } declare module '@glint/environment-ember-loose/registry' { diff --git a/app/components/notifications-page/messages/nf-am-newversn/index.hbs b/app/components/notifications-page/messages/nf-am-newversn/index.hbs index 5678c8199..911f3872d 100644 --- a/app/components/notifications-page/messages/nf-am-newversn/index.hbs +++ b/app/components/notifications-page/messages/nf-am-newversn/index.hbs @@ -1,5 +1,5 @@
-
+
{{t 'notificationModule.messages.nf-am-newversn' platform_display=@context.platform_display diff --git a/app/components/notifications-page/messages/nf-nsapprvd1/index.hbs b/app/components/notifications-page/messages/nf-nsapprvd1/index.hbs index 230a3a67a..66e4f4bba 100644 --- a/app/components/notifications-page/messages/nf-nsapprvd1/index.hbs +++ b/app/components/notifications-page/messages/nf-nsapprvd1/index.hbs @@ -1,4 +1,4 @@ - + {{t 'notificationModule.messages.nf-nsapprvd1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-nsapprvd2/index.hbs b/app/components/notifications-page/messages/nf-nsapprvd2/index.hbs index 5b66de324..689bf848e 100644 --- a/app/components/notifications-page/messages/nf-nsapprvd2/index.hbs +++ b/app/components/notifications-page/messages/nf-nsapprvd2/index.hbs @@ -1,5 +1,5 @@
-
+
{{t 'notificationModule.messages.nf-nsapprvd2' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-nsautoapprvd1/index.hbs b/app/components/notifications-page/messages/nf-nsautoapprvd1/index.hbs index 47eef7a2d..e9b004088 100644 --- a/app/components/notifications-page/messages/nf-nsautoapprvd1/index.hbs +++ b/app/components/notifications-page/messages/nf-nsautoapprvd1/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-nsautoapprvd1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-nsautoapprvd2/index.hbs b/app/components/notifications-page/messages/nf-nsautoapprvd2/index.hbs index 852a016c0..5b337cd27 100644 --- a/app/components/notifications-page/messages/nf-nsautoapprvd2/index.hbs +++ b/app/components/notifications-page/messages/nf-nsautoapprvd2/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-nsautoapprvd2' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-nsrejctd1/index.hbs b/app/components/notifications-page/messages/nf-nsrejctd1/index.hbs index 936eccd6a..a98ba9498 100644 --- a/app/components/notifications-page/messages/nf-nsrejctd1/index.hbs +++ b/app/components/notifications-page/messages/nf-nsrejctd1/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-nsrejctd1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-upldfailnprjdeny1/index.hbs b/app/components/notifications-page/messages/nf-upldfailnprjdeny1/index.hbs index a438d07dd..0ccd3690f 100644 --- a/app/components/notifications-page/messages/nf-upldfailnprjdeny1/index.hbs +++ b/app/components/notifications-page/messages/nf-upldfailnprjdeny1/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-upldfailnprjdeny1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-upldfailnscreatd1/index.hbs b/app/components/notifications-page/messages/nf-upldfailnscreatd1/index.hbs index 22d21b50c..0f7ec0baf 100644 --- a/app/components/notifications-page/messages/nf-upldfailnscreatd1/index.hbs +++ b/app/components/notifications-page/messages/nf-upldfailnscreatd1/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-upldfailnscreatd1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-upldfailnsunaprv1/index.hbs b/app/components/notifications-page/messages/nf-upldfailnsunaprv1/index.hbs index b57189425..f3302f82a 100644 --- a/app/components/notifications-page/messages/nf-upldfailnsunaprv1/index.hbs +++ b/app/components/notifications-page/messages/nf-upldfailnsunaprv1/index.hbs @@ -1,4 +1,4 @@ -
+
{{t 'notificationModule.messages.nf-upldfailnsunaprv1' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-upldfailpay2/index.hbs b/app/components/notifications-page/messages/nf-upldfailpay2/index.hbs index d04fdd3b5..3532324e0 100644 --- a/app/components/notifications-page/messages/nf-upldfailpay2/index.hbs +++ b/app/components/notifications-page/messages/nf-upldfailpay2/index.hbs @@ -1,4 +1,4 @@ - + {{t 'notificationModule.messages.nf-upldfailpay2' htmlSafe=true diff --git a/app/components/notifications-page/messages/nf-upldfailpayrq1/index.hbs b/app/components/notifications-page/messages/nf-upldfailpayrq1/index.hbs index 0a8b77eb5..7f4928209 100644 --- a/app/components/notifications-page/messages/nf-upldfailpayrq1/index.hbs +++ b/app/components/notifications-page/messages/nf-upldfailpayrq1/index.hbs @@ -1,4 +1,4 @@ - + {{t 'notificationModule.messages.nf-upldfailpayrq1' htmlSafe=true diff --git a/package-lock.json b/package-lock.json index 6713ec465..d9854d48a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -131,7 +131,7 @@ "ember-file-upload": "^8.1.1", "ember-g-recaptcha": "^1.3.0", "ember-inflector": "^4.0.2", - "ember-intl": "^6.1.1", + "ember-intl": "^7.0.7", "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^0.1.6", "ember-modal-dialog": "^4.1.3", @@ -1426,10 +1426,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.24.7", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "license": "MIT", "dependencies": { - "@babel/highlight": "^7.24.7", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -1437,26 +1440,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.25.4", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", + "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.25.2", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.0", - "@babel/helper-compilation-targets": "^7.25.2", - "@babel/helper-module-transforms": "^7.25.2", - "@babel/helpers": "^7.25.0", - "@babel/parser": "^7.25.0", - "@babel/template": "^7.25.0", - "@babel/traverse": "^7.25.2", - "@babel/types": "^7.25.2", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -1497,13 +1504,16 @@ } }, "node_modules/@babel/generator": { - "version": "7.25.6", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", "license": "MIT", "dependencies": { - "@babel/types": "^7.25.6", + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", - "jsesc": "^2.5.1" + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" @@ -1531,12 +1541,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.2", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.25.2", - "@babel/helper-validator-option": "^7.24.8", - "browserslist": "^4.23.1", + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, @@ -1604,24 +1616,27 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.24.7", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "license": "MIT", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.25.2", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.2" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1700,21 +1715,27 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.8", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.24.8", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "license": "MIT", "engines": { "node": ">=6.9.0" @@ -1733,34 +1754,25 @@ } }, "node_modules/@babel/helpers": { - "version": "7.25.6", - "license": "MIT", - "dependencies": { - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.24.7", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.25.6", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "license": "MIT", "dependencies": { - "@babel/types": "^7.25.6" + "@babel/types": "^7.26.3" }, "bin": { "parser": "bin/babel-parser.js" @@ -3268,26 +3280,30 @@ "license": "MIT" }, "node_modules/@babel/template": { - "version": "7.25.0", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.25.0", - "@babel/types": "^7.25.0" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.25.6", + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.6", - "@babel/parser": "^7.25.6", - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.6", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -3296,12 +3312,13 @@ } }, "node_modules/@babel/types": { - "version": "7.25.6", + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -7444,48 +7461,59 @@ } }, "node_modules/@formatjs/ecma402-abstract": { - "version": "2.0.0", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@formatjs/ecma402-abstract/-/ecma402-abstract-2.2.4.tgz", + "integrity": "sha512-lFyiQDVvSbQOpU+WFd//ILolGj4UgA/qXrKeZxdV14uKiAUiPAtX6XAn7WBCRi7Mx6I7EybM9E5yYn4BIpZWYg==", "license": "MIT", "dependencies": { - "@formatjs/intl-localematcher": "0.5.4", - "tslib": "^2.4.0" + "@formatjs/fast-memoize": "2.2.3", + "@formatjs/intl-localematcher": "0.5.8", + "tslib": "2" } }, "node_modules/@formatjs/fast-memoize": { - "version": "2.2.0", + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@formatjs/fast-memoize/-/fast-memoize-2.2.3.tgz", + "integrity": "sha512-3jeJ+HyOfu8osl3GNSL4vVHUuWFXR03Iz9jjgI7RwjG6ysu/Ymdr0JRCPHfF5yGbTE6JCrd63EpvX1/WybYRbA==", "license": "MIT", "dependencies": { - "tslib": "^2.4.0" + "tslib": "2" } }, "node_modules/@formatjs/icu-messageformat-parser": { - "version": "2.7.8", + "version": "2.9.4", + "resolved": "https://registry.npmjs.org/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.9.4.tgz", + "integrity": "sha512-Tbvp5a9IWuxUcpWNIW6GlMQYEc4rwNHR259uUFoKWNN1jM9obf9Ul0e+7r7MvFOBNcN+13K7NuKCKqQiAn1QEg==", "license": "MIT", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "@formatjs/icu-skeleton-parser": "1.8.2", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "@formatjs/icu-skeleton-parser": "1.8.8", + "tslib": "2" } }, "node_modules/@formatjs/icu-skeleton-parser": { - "version": "1.8.2", + "version": "1.8.8", + "resolved": "https://registry.npmjs.org/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.8.8.tgz", + "integrity": "sha512-vHwK3piXwamFcx5YQdCdJxUQ1WdTl6ANclt5xba5zLGDv5Bsur7qz8AD7BevaKxITwpgDeU0u8My3AIibW9ywA==", "license": "MIT", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "tslib": "2" } }, "node_modules/@formatjs/intl": { - "version": "2.10.4", + "version": "2.10.15", + "resolved": "https://registry.npmjs.org/@formatjs/intl/-/intl-2.10.15.tgz", + "integrity": "sha512-i6+xVqT+6KCz7nBfk4ybMXmbKO36tKvbMKtgFz9KV+8idYFyFbfwKooYk8kGjyA5+T5f1kEPQM5IDLXucTAQ9g==", "license": "MIT", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "@formatjs/fast-memoize": "2.2.0", - "@formatjs/icu-messageformat-parser": "2.7.8", - "@formatjs/intl-displaynames": "6.6.8", - "@formatjs/intl-listformat": "7.5.7", - "intl-messageformat": "10.5.14", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "@formatjs/fast-memoize": "2.2.3", + "@formatjs/icu-messageformat-parser": "2.9.4", + "@formatjs/intl-displaynames": "6.8.5", + "@formatjs/intl-listformat": "7.7.5", + "intl-messageformat": "10.7.7", + "tslib": "2" }, "peerDependencies": { "typescript": "^4.7 || 5" @@ -7497,28 +7525,34 @@ } }, "node_modules/@formatjs/intl-displaynames": { - "version": "6.6.8", + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/@formatjs/intl-displaynames/-/intl-displaynames-6.8.5.tgz", + "integrity": "sha512-85b+GdAKCsleS6cqVxf/Aw/uBd+20EM0wDpgaxzHo3RIR3bxF4xCJqH/Grbzx8CXurTgDDZHPdPdwJC+May41w==", "license": "MIT", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "@formatjs/intl-localematcher": "0.5.4", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "@formatjs/intl-localematcher": "0.5.8", + "tslib": "2" } }, "node_modules/@formatjs/intl-listformat": { - "version": "7.5.7", + "version": "7.7.5", + "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-7.7.5.tgz", + "integrity": "sha512-Wzes10SMNeYgnxYiKsda4rnHP3Q3II4XT2tZyOgnH5fWuHDtIkceuWlRQNsvrI3uiwP4hLqp2XdQTCsfkhXulg==", "license": "MIT", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "@formatjs/intl-localematcher": "0.5.4", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "@formatjs/intl-localematcher": "0.5.8", + "tslib": "2" } }, "node_modules/@formatjs/intl-localematcher": { - "version": "0.5.4", + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/@formatjs/intl-localematcher/-/intl-localematcher-0.5.8.tgz", + "integrity": "sha512-I+WDNWWJFZie+jkfkiK5Mp4hEDyRSEvmyfYadflOno/mmKJKcB17fEpEH0oJu/OWhhCJ8kJBDz2YMd/6cDl7Mg==", "license": "MIT", "dependencies": { - "tslib": "^2.4.0" + "tslib": "2" } }, "node_modules/@glimmer/component": { @@ -16935,6 +16969,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/better-path-resolve": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/better-path-resolve/-/better-path-resolve-1.0.0.tgz", + "integrity": "sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==", + "license": "MIT", + "dependencies": { + "is-windows": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/big.js": { "version": "5.2.2", "license": "MIT", @@ -19216,7 +19262,9 @@ } }, "node_modules/browserslist": { - "version": "4.23.3", + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "funding": [ { "type": "opencollective", @@ -19233,10 +19281,10 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001646", - "electron-to-chromium": "^1.5.4", + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", "node-releases": "^2.0.18", - "update-browserslist-db": "^1.1.0" + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" @@ -19521,7 +19569,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001660", + "version": "1.0.30001687", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", "funding": [ { "type": "opencollective", @@ -19863,9 +19913,11 @@ "license": "MIT" }, "node_modules/cldr-core": { - "version": "44.1.0", + "version": "45.0.0", + "resolved": "https://registry.npmjs.org/cldr-core/-/cldr-core-45.0.0.tgz", + "integrity": "sha512-gQVxy3gzOQpXiTRGmlKiRQFLYimrr1RgvqGKZCS61JgmdkeNm7+LZGx+Lhw5/AW0t8WMM/uZhf4CMva6LuUobQ==", "dev": true, - "license": "Unicode-DFS-2016" + "license": "Unicode-3.0" }, "node_modules/clean-base-url": { "version": "1.0.0", @@ -22071,9 +22123,10 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.23", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.23.tgz", - "integrity": "sha512-mBhODedOXg4v5QWwl21DjM5amzjmI1zw9EPrPK/5Wx7C8jt33bpZNrC7OhHUG3pxRtbLpr3W2dXT+Ph1SsfRZA==" + "version": "1.5.71", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.71.tgz", + "integrity": "sha512-dB68l59BI75W1BUGVTAEJy45CEVuEGy9qPVVQ8pnHyHMn36PLPPoE1mjLH+lo9rKulO3HC2OhbACI/8tCqJBcA==", + "license": "ISC" }, "node_modules/elliptic": { "version": "6.6.1", @@ -22391,7 +22444,9 @@ } }, "node_modules/ember-auto-import": { - "version": "2.7.4", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/ember-auto-import/-/ember-auto-import-2.10.0.tgz", + "integrity": "sha512-bcBFDYVTFHyqyq8BNvsj6UO3pE6Uqou/cNmee0WaqBgZ+1nQqFz0UE26usrtnFAT+YaFZSkqF2H36QW84k0/cg==", "license": "MIT", "dependencies": { "@babel/core": "^7.16.7", @@ -22417,11 +22472,13 @@ "fs-extra": "^10.0.0", "fs-tree-diff": "^2.0.0", "handlebars": "^4.3.1", + "is-subdir": "^1.2.0", "js-string-escape": "^1.0.1", "lodash": "^4.17.19", "mini-css-extract-plugin": "^2.5.2", "minimatch": "^3.0.0", "parse5": "^6.0.1", + "pkg-entry-points": "^1.1.0", "resolve": "^1.20.0", "resolve-package-path": "^4.0.3", "semver": "^7.3.4", @@ -34547,37 +34604,36 @@ } }, "node_modules/ember-intl": { - "version": "6.5.6", + "version": "7.0.7", + "resolved": "https://registry.npmjs.org/ember-intl/-/ember-intl-7.0.7.tgz", + "integrity": "sha512-K9KDkDIm49/qSLguO7OBOp3tB61GQws9DHfPKEdjSztHTbZvLD+uv2vT9ASRE0+xszYG7Q15UwUQqf6tRJGRxQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.24.0", - "@formatjs/icu-messageformat-parser": "^2.7.6", - "@formatjs/intl": "^2.10.0", + "@babel/core": "^7.25.8", + "@formatjs/icu-messageformat-parser": "^2.7.10", + "@formatjs/intl": "^2.10.8", "broccoli-caching-writer": "^3.0.3", "broccoli-funnel": "^3.0.8", "broccoli-merge-trees": "^4.2.0", "broccoli-source": "^3.0.1", - "broccoli-stew": "^3.0.0", "calculate-cache-key-for-tree": "^2.0.0", - "cldr-core": "^44.1.0", - "ember-auto-import": "^2.7.2", + "cldr-core": "^45.0.0", + "ember-auto-import": "^2.8.1", "ember-cli-babel": "^8.2.0", "ember-cli-typescript": "^5.3.0", "eventemitter3": "^5.0.1", "extend": "^3.0.2", - "fast-memoize": "^2.5.2", - "intl-messageformat": "^10.5.11", + "intl-messageformat": "^10.7.0", "js-yaml": "^4.1.0", - "json-stable-stringify": "^1.1.1", - "silent-error": "^1.1.1" + "json-stable-stringify": "^1.1.1" }, "engines": { - "node": "16.* || >= 18" + "node": "18.* || >= 20" }, "peerDependencies": { "@ember/test-helpers": "^2.9.4 || ^3.2.0 || ^4.0.0", - "typescript": "^4.8.0 || ^5.0.0" + "typescript": "^5.0.0" }, "peerDependenciesMeta": { "@ember/test-helpers": { @@ -43573,11 +43629,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-memoize": { - "version": "2.5.2", - "dev": true, - "license": "MIT" - }, "node_modules/fast-ordered-set": { "version": "1.0.3", "license": "ISC", @@ -46412,13 +46463,15 @@ } }, "node_modules/intl-messageformat": { - "version": "10.5.14", + "version": "10.7.7", + "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.7.tgz", + "integrity": "sha512-F134jIoeYMro/3I0h08D0Yt4N9o9pjddU/4IIxMMURqbAtI2wu70X8hvG1V48W49zXHXv3RKSF/po+0fDfsGjA==", "license": "BSD-3-Clause", "dependencies": { - "@formatjs/ecma402-abstract": "2.0.0", - "@formatjs/fast-memoize": "2.2.0", - "@formatjs/icu-messageformat-parser": "2.7.8", - "tslib": "^2.4.0" + "@formatjs/ecma402-abstract": "2.2.4", + "@formatjs/fast-memoize": "2.2.3", + "@formatjs/icu-messageformat-parser": "2.9.4", + "tslib": "2" } }, "node_modules/invariant": { @@ -46976,6 +47029,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-subdir": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-subdir/-/is-subdir-1.2.0.tgz", + "integrity": "sha512-2AT6j+gXe/1ueqbW6fLZJiIw3F8iXGJtt0yDrZaBhAZEG1raiTxKWU+IPqMCzQAXOUCKdA4UDMgacKH25XG2Cw==", + "license": "MIT", + "dependencies": { + "better-path-resolve": "1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/is-symbol": { "version": "1.0.4", "license": "MIT", @@ -47036,7 +47101,6 @@ }, "node_modules/is-windows": { "version": "1.0.2", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -47317,13 +47381,15 @@ } }, "node_modules/jsesc": { - "version": "2.5.2", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json-api-serializer": { @@ -68935,6 +69001,15 @@ "node": ">=10" } }, + "node_modules/pkg-entry-points": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pkg-entry-points/-/pkg-entry-points-1.1.1.tgz", + "integrity": "sha512-BhZa7iaPmB4b3vKIACoppyUoYn8/sFs17VJJtzrzPZvEnN2nqrgg911tdL65lA2m1ml6UI3iPeYbZQ4VXpn1mA==", + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/pkg-entry-points?sponsor=1" + } + }, "node_modules/pkg-up": { "version": "3.1.0", "dev": true, @@ -74310,13 +74385,6 @@ "dev": true, "license": "MIT" }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/to-object-path": { "version": "0.3.0", "dev": true, @@ -75004,7 +75072,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.0", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", "funding": [ { "type": "opencollective", @@ -75021,8 +75091,8 @@ ], "license": "MIT", "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" + "escalade": "^3.2.0", + "picocolors": "^1.1.0" }, "bin": { "update-browserslist-db": "cli.js" diff --git a/package.json b/package.json index d8b547ba1..ccc2014a5 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "ember-file-upload": "^8.1.1", "ember-g-recaptcha": "^1.3.0", "ember-inflector": "^4.0.2", - "ember-intl": "^6.1.1", + "ember-intl": "^7.0.7", "ember-load-initializers": "^2.1.2", "ember-maybe-import-regenerator": "^0.1.6", "ember-modal-dialog": "^4.1.3", diff --git a/tests/acceptance/organization/create-service-account-test.js b/tests/acceptance/organization/create-service-account-test.js index b732b5ec4..545369b43 100644 --- a/tests/acceptance/organization/create-service-account-test.js +++ b/tests/acceptance/organization/create-service-account-test.js @@ -15,10 +15,11 @@ import { t } from 'ember-intl/test-support'; import { underscore } from '@ember/string'; import Service from '@ember/service'; import dayjs from 'dayjs'; +import { faker } from '@faker-js/faker'; -import { setupRequiredEndpoints } from '../../helpers/acceptance-utils'; import styles from 'irene/components/ak-select/index.scss'; -import { faker } from '@faker-js/faker'; +import { setupRequiredEndpoints } from 'irene/tests/helpers/acceptance-utils'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; class IntegrationStub extends Service { async configure(user) { @@ -435,6 +436,8 @@ module('Acceptance | Create service account', function (hooks) { 'it creates service account', [{ duplicate: false }, { duplicate: true }], async function (assert, { duplicate }) { + assert.expect(duplicate ? 40 : 30); + // feature is enabled this.organization.update({ features: { @@ -771,14 +774,13 @@ module('Acceptance | Create service account', function (hooks) { (opt) => opt.value === this.createdServiceAccount.all_projects ); - assert.strictEqual( - find( - '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]' - ).innerHTML.trim(), - t('serviceAccountModule.selectedProjectAccess', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]', + message: t('serviceAccountModule.selectedProjectAccess', { projectAccess: t(projectAccess?.label), - }) - ); + }), + }); if (this.createdServiceAccount.all_projects) { assert diff --git a/tests/integration/components/ak-pagination-test.js b/tests/integration/components/ak-pagination-test.js index ffd0db416..6ee49c5fc 100644 --- a/tests/integration/components/ak-pagination-test.js +++ b/tests/integration/components/ak-pagination-test.js @@ -14,7 +14,7 @@ const selectOptions = [ module('Integration | Component | ak-pagination', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.setProperties({ diff --git a/tests/integration/components/analysis-risk/tag-test.js b/tests/integration/components/analysis-risk/tag-test.js index 20143c0c1..7f83f4639 100644 --- a/tests/integration/components/analysis-risk/tag-test.js +++ b/tests/integration/components/analysis-risk/tag-test.js @@ -18,7 +18,7 @@ const getRiskStatusObj = ( module('Integration | Component | analysis-risk/tag', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test.each( 'it renders risk tag for different computedRisk correctly', diff --git a/tests/integration/components/analysis-risk/text-test.js b/tests/integration/components/analysis-risk/text-test.js index a273ce50e..2c948dee3 100644 --- a/tests/integration/components/analysis-risk/text-test.js +++ b/tests/integration/components/analysis-risk/text-test.js @@ -11,7 +11,7 @@ import { riskText } from 'irene/helpers/risk-text'; module('Integration | Component | analysis-risk/text', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test.each( 'it renders risk text for different risk correctly', diff --git a/tests/integration/components/app-monitoring/details-test.js b/tests/integration/components/app-monitoring/details-test.js index 2a62d40d0..4a5be2756 100644 --- a/tests/integration/components/app-monitoring/details-test.js +++ b/tests/integration/components/app-monitoring/details-test.js @@ -10,7 +10,7 @@ import styles from 'irene/components/app-monitoring/details/index.scss'; module('Integration | Component | app-monitoring/details', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/app-monitoring/settings-test.js b/tests/integration/components/app-monitoring/settings-test.js index 993c79ac8..d640be9f6 100644 --- a/tests/integration/components/app-monitoring/settings-test.js +++ b/tests/integration/components/app-monitoring/settings-test.js @@ -21,7 +21,7 @@ class OrganizationStub extends Service { module('Integration | Component | app-monitoring-settings', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:organization', OrganizationStub); diff --git a/tests/integration/components/app-monitoring/table/application-test.js b/tests/integration/components/app-monitoring/table/application-test.js index 30cbba043..f4e3701a2 100644 --- a/tests/integration/components/app-monitoring/table/application-test.js +++ b/tests/integration/components/app-monitoring/table/application-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('It renders with the right amApp names ', async function (assert) { this.server.get('/v2/files/:id', (schema, req) => { diff --git a/tests/integration/components/app-monitoring/table/index-test.js b/tests/integration/components/app-monitoring/table/index-test.js index 7a4847852..c54b7cf3e 100644 --- a/tests/integration/components/app-monitoring/table/index-test.js +++ b/tests/integration/components/app-monitoring/table/index-test.js @@ -16,7 +16,7 @@ class OrganizationStub extends Service { module('Integration | Component | app-monitoring/table', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/app-monitoring/table/last-scanned-test.js b/tests/integration/components/app-monitoring/table/last-scanned-test.js index 6a5697e4a..284c30794 100644 --- a/tests/integration/components/app-monitoring/table/last-scanned-test.js +++ b/tests/integration/components/app-monitoring/table/last-scanned-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders the correct row version', async function (assert) { // Server mocks diff --git a/tests/integration/components/app-monitoring/table/platform-test.js b/tests/integration/components/app-monitoring/table/platform-test.js index 766f154f3..fcd4de5e4 100644 --- a/tests/integration/components/app-monitoring/table/platform-test.js +++ b/tests/integration/components/app-monitoring/table/platform-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('It renders with the right icon in the platform column', async function (assert) { // Server mocks diff --git a/tests/integration/components/app-monitoring/table/status-test.js b/tests/integration/components/app-monitoring/table/status-test.js index 871393d8f..d7a475eca 100644 --- a/tests/integration/components/app-monitoring/table/status-test.js +++ b/tests/integration/components/app-monitoring/table/status-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/app-monitoring/table/store-version-test.js b/tests/integration/components/app-monitoring/table/store-version-test.js index 8038e41a1..370691268 100644 --- a/tests/integration/components/app-monitoring/table/store-version-test.js +++ b/tests/integration/components/app-monitoring/table/store-version-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/app-monitoring/version-table/actions-test.js b/tests/integration/components/app-monitoring/version-table/actions-test.js index b79934e97..efd3cfda7 100644 --- a/tests/integration/components/app-monitoring/version-table/actions-test.js +++ b/tests/integration/components/app-monitoring/version-table/actions-test.js @@ -47,7 +47,7 @@ module( function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/app-monitoring/version-table/date-found-test.js b/tests/integration/components/app-monitoring/version-table/date-found-test.js index d6f35879e..43d65ad07 100644 --- a/tests/integration/components/app-monitoring/version-table/date-found-test.js +++ b/tests/integration/components/app-monitoring/version-table/date-found-test.js @@ -14,7 +14,7 @@ module( function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); test('it renders', async function (assert) { diff --git a/tests/integration/components/app-monitoring/version-table/index-test.js b/tests/integration/components/app-monitoring/version-table/index-test.js index 90e484367..ac1acafa0 100644 --- a/tests/integration/components/app-monitoring/version-table/index-test.js +++ b/tests/integration/components/app-monitoring/version-table/index-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/app-monitoring/version-table/scan-status-test.js b/tests/integration/components/app-monitoring/version-table/scan-status-test.js index 0d6fa8da2..51aec3320 100644 --- a/tests/integration/components/app-monitoring/version-table/scan-status-test.js +++ b/tests/integration/components/app-monitoring/version-table/scan-status-test.js @@ -11,7 +11,7 @@ module( function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); test.each( diff --git a/tests/integration/components/app-monitoring/version-table/store-version-test.js b/tests/integration/components/app-monitoring/version-table/store-version-test.js index 2aeb28b36..24d100d9e 100644 --- a/tests/integration/components/app-monitoring/version-table/store-version-test.js +++ b/tests/integration/components/app-monitoring/version-table/store-version-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); test('it renders', async function (assert) { diff --git a/tests/integration/components/appknox-wrapper-test.js b/tests/integration/components/appknox-wrapper-test.js index 78678fcdd..9f091bbad 100644 --- a/tests/integration/components/appknox-wrapper-test.js +++ b/tests/integration/components/appknox-wrapper-test.js @@ -112,7 +112,7 @@ const lowerMenuItems = [ module('Integration | Component | appknox-wrapper', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupBrowserFakes(hooks, { window: true, localStorage: true }); hooks.beforeEach(async function () { diff --git a/tests/integration/components/appknox-wrapper/onboarding-guide-test.js b/tests/integration/components/appknox-wrapper/onboarding-guide-test.js index 3f3e570df..bed21abb3 100644 --- a/tests/integration/components/appknox-wrapper/onboarding-guide-test.js +++ b/tests/integration/components/appknox-wrapper/onboarding-guide-test.js @@ -20,7 +20,7 @@ class IntegrationStub extends Service { module('Integration | Component | Onboarding Guide', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:integration', IntegrationStub); @@ -47,42 +47,28 @@ module('Integration | Component | Onboarding Guide', function (hooks) { const categories = findAll('[data-test-onboarding-guide-category]'); - assert - .dom(categories[0]) - .containsText(this.intl.t('onboardingGuideModule.VA')); + assert.dom(categories[0]).containsText(t('onboardingGuideModule.VA')); - assert.dom(categories[1]).containsText(this.intl.t('SBOM')); - assert.dom(categories[2]).containsText(this.intl.t('appMonitoring')); + assert.dom(categories[1]).containsText(t('SBOM')); + assert.dom(categories[2]).containsText(t('appMonitoring')); assert.dom('[data-test-onboarding-guide-list-item]').exists({ count: 7 }); const guides = findAll('[data-test-onboarding-guide-list-item]'); - assert - .dom(guides[0]) - .containsText(this.intl.t('onboardingGuideModule.initiateVA')); + assert.dom(guides[0]).containsText(t('onboardingGuideModule.initiateVA')); - assert - .dom(guides[1]) - .containsText(this.intl.t('onboardingGuideModule.viewReports')); + assert.dom(guides[1]).containsText(t('onboardingGuideModule.viewReports')); - assert.dom(guides[2]).containsText(this.intl.t('inviteUsers')); + assert.dom(guides[2]).containsText(t('inviteUsers')); - assert - .dom(guides[3]) - .containsText(this.intl.t('onboardingGuideModule.createTeams')); + assert.dom(guides[3]).containsText(t('onboardingGuideModule.createTeams')); - assert - .dom(guides[4]) - .containsText(this.intl.t('onboardingGuideModule.uploadAccess')); + assert.dom(guides[4]).containsText(t('onboardingGuideModule.uploadAccess')); - assert - .dom(guides[5]) - .containsText(this.intl.t('onboardingGuideModule.generateSBOM')); + assert.dom(guides[5]).containsText(t('onboardingGuideModule.generateSBOM')); - assert - .dom(guides[6]) - .containsText(this.intl.t('onboardingGuideModule.detectDrift')); + assert.dom(guides[6]).containsText(t('onboardingGuideModule.detectDrift')); assert.dom('[data-test-onboarding-guide-iframe="va-guide"]').exists(); }); diff --git a/tests/integration/components/attachment-detail-test.js b/tests/integration/components/attachment-detail-test.js index a4258dfa1..b7ed89b0b 100644 --- a/tests/integration/components/attachment-detail-test.js +++ b/tests/integration/components/attachment-detail-test.js @@ -17,7 +17,7 @@ class WindowStub extends Service { module('Integration | Component | attachment-detail', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/confirm-box-test.js b/tests/integration/components/confirm-box-test.js index cca2bce9a..ce50df884 100644 --- a/tests/integration/components/confirm-box-test.js +++ b/tests/integration/components/confirm-box-test.js @@ -6,7 +6,7 @@ import { hbs } from 'ember-cli-htmlbars'; module('Integration | Component | confirm-box', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders confirm-box', async function (assert) { this.setProperties({ diff --git a/tests/integration/components/dynamicscan-automation-upselling-feature-test.js b/tests/integration/components/dynamicscan-automation-upselling-feature-test.js index d3334915d..e078ba3ee 100644 --- a/tests/integration/components/dynamicscan-automation-upselling-feature-test.js +++ b/tests/integration/components/dynamicscan-automation-upselling-feature-test.js @@ -8,7 +8,7 @@ import { setupBrowserFakes } from 'ember-browser-services/test-support'; module('Integration | Component | file-chart-abc', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); setupBrowserFakes(hooks, { window: true, localStorage: true }); diff --git a/tests/integration/components/file-chart-test.js b/tests/integration/components/file-chart-test.js index 9a36d1873..40d6868e5 100644 --- a/tests/integration/components/file-chart-test.js +++ b/tests/integration/components/file-chart-test.js @@ -36,7 +36,7 @@ const RISK_VALUES = [ module('Integration | Component | file-chart', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-compare/compare-list-test.js b/tests/integration/components/file-compare/compare-list-test.js index 6e7032d78..72f1172b3 100644 --- a/tests/integration/components/file-compare/compare-list-test.js +++ b/tests/integration/components/file-compare/compare-list-test.js @@ -7,7 +7,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; module('Integration | Component | file-compare/compare-list', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-compare/header-test.js b/tests/integration/components/file-compare/header-test.js index e50d1963c..598e660a5 100644 --- a/tests/integration/components/file-compare/header-test.js +++ b/tests/integration/components/file-compare/header-test.js @@ -7,7 +7,7 @@ import { hbs } from 'ember-cli-htmlbars'; module('Integration | Component | file-compare/header', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-compare/index-test.js b/tests/integration/components/file-compare/index-test.js index a06a8a310..c1b32df92 100644 --- a/tests/integration/components/file-compare/index-test.js +++ b/tests/integration/components/file-compare/index-test.js @@ -11,7 +11,7 @@ import { module('Integration | Component | file-compare', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-compare/table-test.js b/tests/integration/components/file-compare/table-test.js index 4eb75f676..f65ec905b 100644 --- a/tests/integration/components/file-compare/table-test.js +++ b/tests/integration/components/file-compare/table-test.js @@ -23,7 +23,7 @@ const riskTypes = [ module('Integration | Component | file-compare/table', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-compare/vulnerability-details-test.js b/tests/integration/components/file-compare/vulnerability-details-test.js index edec86495..6efb22852 100644 --- a/tests/integration/components/file-compare/vulnerability-details-test.js +++ b/tests/integration/components/file-compare/vulnerability-details-test.js @@ -84,7 +84,7 @@ module( 'Integration | Component | file-compare/vulnerability-details', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-details/dynamic-scan/action/drawer-test.js b/tests/integration/components/file-details/dynamic-scan/action/drawer-test.js index 889828531..ddb0bca0c 100644 --- a/tests/integration/components/file-details/dynamic-scan/action/drawer-test.js +++ b/tests/integration/components/file-details/dynamic-scan/action/drawer-test.js @@ -16,7 +16,6 @@ import Service from '@ember/service'; import { Response } from 'miragejs'; import { selectChoose } from 'ember-power-select/test-support'; import { faker } from '@faker-js/faker'; -import { capitalize } from '@ember/string'; import ENUMS from 'irene/enums'; import { dsManualDevicePref } from 'irene/helpers/ds-manual-device-pref'; @@ -80,7 +79,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); @@ -622,7 +621,7 @@ module( assert.strictEqual( notify.infoMsg, - `${t('proxyTurned')} ${capitalize(t('ON'))}` + `${t('proxyTurned')} ${t('on').toUpperCase()}` ); }); @@ -795,7 +794,7 @@ module( assert.dom(deviceElem).containsText(`${deviceModel.device_identifier}`); - assert.dom(deviceElem).containsText(`${deviceTypeLabel}`); + assert.dom(deviceElem).containsText(t(deviceTypeLabel)); assert .dom(deviceElem) diff --git a/tests/integration/components/file-details/dynamic-scan/manual-test.js b/tests/integration/components/file-details/dynamic-scan/manual-test.js index a3c0a2e60..6ca63b872 100644 --- a/tests/integration/components/file-details/dynamic-scan/manual-test.js +++ b/tests/integration/components/file-details/dynamic-scan/manual-test.js @@ -12,6 +12,7 @@ import { faker } from '@faker-js/faker'; import ENUMS from 'irene/enums'; import { deviceType } from 'irene/helpers/device-type'; import styles from 'irene/components/ak-select/index.scss'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; const classes = { dropdown: styles['ak-select-dropdown'], @@ -67,7 +68,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks @@ -299,6 +300,8 @@ module( assert, { withApiProxySetting, withApiScan, withAutomatedDynamicScan } ) { + assert.expect(); + this.file.dynamicStatus = ENUMS.DYNAMIC_STATUS.NONE; this.file.isDynamicDone = false; this.file.isActive = true; @@ -380,7 +383,7 @@ module( type: t('modalCard.dynamicScan.osVersion'), value: `${this.file.project.get('platformDisplay')} ${ this.file.minOsVersion - } t:modalCard.dynamicScan.orAbove:()`, + } ${t('modalCard.dynamicScan.orAbove')}`, }, this.file.supportedCpuArchitectures && { type: t('modalCard.dynamicScan.processorArchitecture'), @@ -437,7 +440,7 @@ module( .dom( `[data-test-projectPreference-deviceTypeSelect] .${classes.trigger}` ) - .hasText(`t:${deviceType([this.devicePreference.device_type])}:()`); + .hasText(t(deviceType([this.devicePreference.device_type]))); assert .dom( @@ -482,11 +485,11 @@ module( ) .exists(); - assert - .dom( - '[data-test-fileDetails-dynamicScanDrawerOld-apiSettingScanDescription]' - ) - .hasText(t('modalCard.dynamicScan.apiScanDescription')); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-fileDetails-dynamicScanDrawerOld-apiSettingScanDescription]', + message: t('modalCard.dynamicScan.apiScanDescription'), + }); assert .dom('[data-test-apiFilter-title]') @@ -615,6 +618,8 @@ module( ); test('test add & delete of api filter endpoint', async function (assert) { + assert.expect(29); + this.file.dynamicStatus = ENUMS.DYNAMIC_STATUS.NONE; this.file.isDynamicDone = false; this.file.isActive = true; @@ -681,11 +686,11 @@ module( ) .exists(); - assert - .dom( - '[data-test-fileDetails-dynamicScanDrawerOld-apiSettingScanDescription]' - ) - .hasText(t('modalCard.dynamicScan.apiScanDescription')); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-fileDetails-dynamicScanDrawerOld-apiSettingScanDescription]', + message: t('modalCard.dynamicScan.apiScanDescription'), + }); assert .dom('[data-test-apiFilter-title]') @@ -724,7 +729,7 @@ module( assert.strictEqual( notify.errorMsg, - 'https://api.example.com t:invalidURL:()' + `https://api.example.com ${t('invalidURL')}` ); await fillIn('[data-test-apiFilter-apiEndpointInput]', 'api.example.com'); diff --git a/tests/integration/components/file-details/dynamic-scan/status-chip-test.js b/tests/integration/components/file-details/dynamic-scan/status-chip-test.js index d84419094..d31cc8791 100644 --- a/tests/integration/components/file-details/dynamic-scan/status-chip-test.js +++ b/tests/integration/components/file-details/dynamic-scan/status-chip-test.js @@ -40,7 +40,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); // TODO: Unskip when full DAST feature is ready. test.skip( diff --git a/tests/integration/components/file-details/key-insights-test.js b/tests/integration/components/file-details/key-insights-test.js index 545e3c65f..2298efe97 100644 --- a/tests/integration/components/file-details/key-insights-test.js +++ b/tests/integration/components/file-details/key-insights-test.js @@ -12,6 +12,8 @@ import { getFileComparisonCategories, } from 'irene/utils/compare-files'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; + class NotificationsStub extends Service { errorMsg = null; successMsg = null; @@ -27,7 +29,7 @@ class NotificationsStub extends Service { module('Integration | Component | file-details/key-insights', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); @@ -84,6 +86,8 @@ module('Integration | Component | file-details/key-insights', function (hooks) { 'it renders file-details/key-insights', [true, false], async function (assert, unknownAnalysisStatus) { + assert.expect(unknownAnalysisStatus ? 13 : 11); + this.server.get('/profiles/:id/unknown_analysis_status', (_, req) => { return { id: req.params.id, status: unknownAnalysisStatus }; }); @@ -107,14 +111,19 @@ module('Integration | Component | file-details/key-insights', function (hooks) { const previousFile = await this.file.previousFile; - assert.dom('[data-test-fileDetailKeyInsights-description]').hasText( - `${t('keyInsightDesc.part1')} ${t('fileID')} - ${previousFile.id} ${t( - 'keyInsightDesc.part2', - { - uploadedOn: dayjs(previousFile.createdOn).format('DD MMM YYYY'), - } - )}` - ); + assert + .dom('[data-test-fileDetailKeyInsights-description]') + .containsText( + `${t('keyInsightDesc.part1')} ${t('fileID')} - ${previousFile.id}` + ); + + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-fileDetailKeyInsights-description]', + message: t('keyInsightDesc.part2', { + uploadedOn: dayjs(previousFile.createdOn).format('DD MMM YYYY'), + }), + doIncludesCheck: true, + }); const comparison = getFileComparisonCategories( compareFiles(this.file, previousFile) diff --git a/tests/integration/components/file-details/scan-actions-test.js b/tests/integration/components/file-details/scan-actions-test.js index 81d064949..5596a3ff8 100644 --- a/tests/integration/components/file-details/scan-actions-test.js +++ b/tests/integration/components/file-details/scan-actions-test.js @@ -8,7 +8,7 @@ import { module, test } from 'qunit'; module('Integration | Component | file-details/scan-actions', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/scan-actions/api-scan-test.js b/tests/integration/components/file-details/scan-actions/api-scan-test.js index a7e6e9e81..1e6d61476 100644 --- a/tests/integration/components/file-details/scan-actions/api-scan-test.js +++ b/tests/integration/components/file-details/scan-actions/api-scan-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/scan-actions/dynamic-scan-test.js b/tests/integration/components/file-details/scan-actions/dynamic-scan-test.js index 100555e56..37bcaf84a 100644 --- a/tests/integration/components/file-details/scan-actions/dynamic-scan-test.js +++ b/tests/integration/components/file-details/scan-actions/dynamic-scan-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/scan-actions/manual-scan-test.js b/tests/integration/components/file-details/scan-actions/manual-scan-test.js index 676b615be..2f1da184d 100644 --- a/tests/integration/components/file-details/scan-actions/manual-scan-test.js +++ b/tests/integration/components/file-details/scan-actions/manual-scan-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/scan-actions/static-scan-test.js b/tests/integration/components/file-details/scan-actions/static-scan-test.js index 512e33f80..6ffdc8c66 100644 --- a/tests/integration/components/file-details/scan-actions/static-scan-test.js +++ b/tests/integration/components/file-details/scan-actions/static-scan-test.js @@ -15,7 +15,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/severity-level-test.js b/tests/integration/components/file-details/severity-level-test.js index cfbaf51ac..c0373ddad 100644 --- a/tests/integration/components/file-details/severity-level-test.js +++ b/tests/integration/components/file-details/severity-level-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/static-scan-test.js b/tests/integration/components/file-details/static-scan-test.js index f362c4f42..d912cd567 100644 --- a/tests/integration/components/file-details/static-scan-test.js +++ b/tests/integration/components/file-details/static-scan-test.js @@ -27,7 +27,7 @@ class NotificationsStub extends Service { module('Integration | Component | file-details/static-scan', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/summary-test.js b/tests/integration/components/file-details/summary-test.js index 0e1bb6376..4f5724eac 100644 --- a/tests/integration/components/file-details/summary-test.js +++ b/tests/integration/components/file-details/summary-test.js @@ -25,7 +25,7 @@ class NotificationsStub extends Service { module('Integration | Component | file-details/summary', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/vulnerability-analysis-details/code-box-test.js b/tests/integration/components/file-details/vulnerability-analysis-details/code-box-test.js index 5b7a5cc02..ab338f16a 100644 --- a/tests/integration/components/file-details/vulnerability-analysis-details/code-box-test.js +++ b/tests/integration/components/file-details/vulnerability-analysis-details/code-box-test.js @@ -8,7 +8,7 @@ module( 'Integration | Component | vulnerability-analysis-details/finding-code-box', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const description1 = "\n Connection: keep-alive\n Content-Length: '0'\n Date: Mon, 15 Jul 2024 19:29:23 GMT\n Server: AppleHttpServer/b866cf47a603\n X-Apple-Edge-Response-Time: '0'\n X-Apple-Filtered-At-Edge: 'true'\n X-Apple-Request-UUID: 554eb993-6fe7-4364-adf6-56117e77af73\n access-control-expose-headers: X-Apple-Request-UUID,Via\n "; diff --git a/tests/integration/components/file-details/vulnerability-analysis-details/edit-analysis-button-test.js b/tests/integration/components/file-details/vulnerability-analysis-details/edit-analysis-button-test.js index 3baba4f69..e7c5c0a31 100644 --- a/tests/integration/components/file-details/vulnerability-analysis-details/edit-analysis-button-test.js +++ b/tests/integration/components/file-details/vulnerability-analysis-details/edit-analysis-button-test.js @@ -51,7 +51,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/vulnerability-analysis-details/index-test.js b/tests/integration/components/file-details/vulnerability-analysis-details/index-test.js index 6b69c1749..342329e8b 100644 --- a/tests/integration/components/file-details/vulnerability-analysis-details/index-test.js +++ b/tests/integration/components/file-details/vulnerability-analysis-details/index-test.js @@ -52,7 +52,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/file-details/vulnerability-analysis-test.js b/tests/integration/components/file-details/vulnerability-analysis-test.js index 65848e1b2..428b443d6 100644 --- a/tests/integration/components/file-details/vulnerability-analysis-test.js +++ b/tests/integration/components/file-details/vulnerability-analysis-test.js @@ -13,6 +13,7 @@ import Service from '@ember/service'; import ENUMS from 'irene/enums'; import { analysisRiskStatus } from 'irene/helpers/analysis-risk-status'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; class NotificationsStub extends Service { errorMsg = null; @@ -44,7 +45,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); @@ -363,6 +364,8 @@ module( }); test('it renders emtpy file-details/vulnerability-analysis', async function (assert) { + assert.expect(8); + this.file.analyses = []; this.server.get('/v2/projects/:id', (schema, req) => { @@ -399,12 +402,15 @@ module( .dom('[data-test-vulnerability-analysis-emptyTitle]') .hasText(t('fileVulnerabilityEmpty.title')); - assert - .dom('[data-test-vulnerability-analysis-emptyDesc1]') - .hasText(t('fileVulnerabilityEmpty.description')); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-vulnerability-analysis-emptyDesc1]', + message: t('fileVulnerabilityEmpty.description'), + }); }); test('it shows emtpy ui when no test case for selected vulnerability type is there', async function (assert) { + assert.expect(14); + this.vulnerabilities.forEach((v) => { const t = ENUMS.VULNERABILITY_TYPE; @@ -467,9 +473,10 @@ module( .dom('[data-test-vulnerability-analysis-emptyTitle]') .hasText(t('fileVulnerabilityEmpty.title')); - assert - .dom('[data-test-vulnerability-analysis-emptyDesc1]') - .hasText(t('fileVulnerabilityEmpty.description')); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-vulnerability-analysis-emptyDesc1]', + message: t('fileVulnerabilityEmpty.description'), + }); }); } ); diff --git a/tests/integration/components/file-list-test.js b/tests/integration/components/file-list-test.js index 692ce2ee9..05b85acf0 100644 --- a/tests/integration/components/file-list-test.js +++ b/tests/integration/components/file-list-test.js @@ -7,7 +7,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; module('Integration | Component | file-list', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file-overview-test.js b/tests/integration/components/file-overview-test.js index 72a3b7149..3ca3380bd 100644 --- a/tests/integration/components/file-overview-test.js +++ b/tests/integration/components/file-overview-test.js @@ -9,7 +9,7 @@ module( 'Integration | Component | file-compare/file-overview', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(async function () { diff --git a/tests/integration/components/file/report-btn-test.js b/tests/integration/components/file/report-btn-test.js index 6badde42e..319c92211 100644 --- a/tests/integration/components/file/report-btn-test.js +++ b/tests/integration/components/file/report-btn-test.js @@ -8,7 +8,7 @@ import { module, test } from 'qunit'; module('Integration | Component | file/report-btn', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/file/report-drawer/index-test.js b/tests/integration/components/file/report-drawer/index-test.js index 12d89a44b..c090d97d4 100644 --- a/tests/integration/components/file/report-drawer/index-test.js +++ b/tests/integration/components/file/report-drawer/index-test.js @@ -42,7 +42,7 @@ const fileReportGroups = [ module('Integration | Component | file/report-drawer', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:realtime', RealtimeStub); diff --git a/tests/integration/components/file/report-drawer/sbom-reports/index-test.js b/tests/integration/components/file/report-drawer/sbom-reports/index-test.js index 9c52a470c..314893a7f 100644 --- a/tests/integration/components/file/report-drawer/sbom-reports/index-test.js +++ b/tests/integration/components/file/report-drawer/sbom-reports/index-test.js @@ -21,7 +21,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:organization', OrganizationStub); diff --git a/tests/integration/components/file/report-drawer/sbom-reports/sample-test.js b/tests/integration/components/file/report-drawer/sbom-reports/sample-test.js index fa9c63d11..4f53dbeb5 100644 --- a/tests/integration/components/file/report-drawer/sbom-reports/sample-test.js +++ b/tests/integration/components/file/report-drawer/sbom-reports/sample-test.js @@ -41,7 +41,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/file/report-drawer/va-reports/index-test.js b/tests/integration/components/file/report-drawer/va-reports/index-test.js index c9aa19e33..413bc2390 100644 --- a/tests/integration/components/file/report-drawer/va-reports/index-test.js +++ b/tests/integration/components/file/report-drawer/va-reports/index-test.js @@ -26,7 +26,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); @@ -318,25 +318,28 @@ module( const currentReport = reportItems[0]; const summaryReports = reportItems.slice(1, reportItems.length - 1); + const summaryReportTypes = reportTypes.slice(1, reportTypes.length - 1); const previousReport = reportItems[reportItems.length - 1]; assert .dom(currentReport) .exists() - .hasText(new RegExp(t('fileReport.detailedReport'))) + .containsText(t('fileReport.detailedReport', { reportType: 'pdf' })) .containsText(this.file.project.get('pdfPassword')); assert .dom(previousReport) .exists() - .hasText(new RegExp(t('fileReport.previousReport'))) + .containsText(t('fileReport.previousReport', { reportType: 'pdf' })) .containsText(this.file.project.get('pdfPassword')); - summaryReports.forEach((report) => { + summaryReports.forEach((report, idx) => { + const type = summaryReportTypes[idx]; + assert .dom(report) .exists() - .hasText(new RegExp(t('fileReport.summaryReport'))) + .containsText(t('fileReport.summaryReport', { reportType: type })) .hasText(new RegExp(t('fileReport.noPasswordRequired'))); }); }); diff --git a/tests/integration/components/file/report-drawer/va-reports/report-item-test.js b/tests/integration/components/file/report-drawer/va-reports/report-item-test.js index 5ad3f278d..2d78c0e96 100644 --- a/tests/integration/components/file/report-drawer/va-reports/report-item-test.js +++ b/tests/integration/components/file/report-drawer/va-reports/report-item-test.js @@ -40,7 +40,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/github-account-test.js b/tests/integration/components/github-account-test.js index 48d842283..6d17e4b26 100644 --- a/tests/integration/components/github-account-test.js +++ b/tests/integration/components/github-account-test.js @@ -30,7 +30,7 @@ class NotificationsStub extends Service { module('Integration | Component | github-account', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/invite-member-test.js b/tests/integration/components/invite-member-test.js index 5d884be62..7fef57eca 100644 --- a/tests/integration/components/invite-member-test.js +++ b/tests/integration/components/invite-member-test.js @@ -28,7 +28,7 @@ class RealtimeStub extends Service { module('Integration | Component | invite-member', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:realtime', RealtimeStub); diff --git a/tests/integration/components/jira-account-test.js b/tests/integration/components/jira-account-test.js index 66e3cc1b3..3742be51d 100644 --- a/tests/integration/components/jira-account-test.js +++ b/tests/integration/components/jira-account-test.js @@ -30,7 +30,7 @@ class NotificationsStub extends Service { module('Integration | Component | jira-account', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/notifications-dropdown-test.js b/tests/integration/components/notifications-dropdown-test.js index 810f6f5c2..de63895a4 100644 --- a/tests/integration/components/notifications-dropdown-test.js +++ b/tests/integration/components/notifications-dropdown-test.js @@ -11,7 +11,7 @@ import { NotificationMap } from 'irene/components/notifications-page/notificatio module('Integration | Component | notifications-dropdown', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { class NotificationMesaageTest extends Component {} diff --git a/tests/integration/components/notifications-dropdown/header-test.js b/tests/integration/components/notifications-dropdown/header-test.js index df34a0099..8a287e9e9 100644 --- a/tests/integration/components/notifications-dropdown/header-test.js +++ b/tests/integration/components/notifications-dropdown/header-test.js @@ -11,7 +11,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); class AkNotificationsServiceStub extends Service { get notifications() { diff --git a/tests/integration/components/notifications-page-test.js b/tests/integration/components/notifications-page-test.js index e082275b4..ec3857266 100644 --- a/tests/integration/components/notifications-page-test.js +++ b/tests/integration/components/notifications-page-test.js @@ -11,7 +11,7 @@ import { NotificationMap } from 'irene/components/notifications-page/notificatio module('Integration | Component | notifications-page', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { class NotificationMesaageTest extends Component {} diff --git a/tests/integration/components/notifications-page/bell-icon-test.js b/tests/integration/components/notifications-page/bell-icon-test.js index ed2ab63eb..592de3644 100644 --- a/tests/integration/components/notifications-page/bell-icon-test.js +++ b/tests/integration/components/notifications-page/bell-icon-test.js @@ -10,7 +10,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it should render bell icon and should open dropdown on click', async function (assert) { await render(hbs``); diff --git a/tests/integration/components/notifications-page/header-test.js b/tests/integration/components/notifications-page/header-test.js index d65b6977a..0328a1c6e 100644 --- a/tests/integration/components/notifications-page/header-test.js +++ b/tests/integration/components/notifications-page/header-test.js @@ -9,7 +9,7 @@ import { hbs } from 'ember-cli-htmlbars'; module('Integration | Component | notifications-page/header', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); class AkNotificationsServiceStub extends Service { get notifications() { diff --git a/tests/integration/components/notifications-page/message-test.js b/tests/integration/components/notifications-page/message-test.js index 12177ce96..7cc91baf0 100644 --- a/tests/integration/components/notifications-page/message-test.js +++ b/tests/integration/components/notifications-page/message-test.js @@ -13,7 +13,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it should render error component for non registered messageCode', async function (assert) { this.notification = this.server.create('nf-in-app-notification', { diff --git a/tests/integration/components/notifications-page/messages/nf-am-newversn-test.js b/tests/integration/components/notifications-page/messages/nf-am-newversn-test.js index c0b24ce0c..9403f2350 100644 --- a/tests/integration/components/notifications-page/messages/nf-am-newversn-test.js +++ b/tests/integration/components/notifications-page/messages/nf-am-newversn-test.js @@ -4,16 +4,20 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NfAmNewversnContext } from 'irene/components/notifications-page/messages/nf-am-newversn/context'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-am-newversn', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_AM_NEWVERSN', @@ -29,17 +33,25 @@ module( version_scanned: '1.0.0', }), }); + this.context = this.notification.context; - await render(hbs``); - assert.dom().containsText( - t('notificationModule.messages.nf-am-newversn', { + + await render(hbs` + + `); + + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-newversn-primary-message]', + message: t('notificationModule.messages.nf-am-newversn', { platform_display: 'android', app_name: 'mfva', package_name: 'com.mfva.test', version_unscanned: '1.0.1', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-apistcmpltd1-test.js b/tests/integration/components/notifications-page/messages/nf-apistcmpltd1-test.js index 8436290db..4324c1acc 100644 --- a/tests/integration/components/notifications-page/messages/nf-apistcmpltd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-apistcmpltd1-test.js @@ -5,17 +5,20 @@ import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-apistcmpltd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_APISTCMPLTD1'].context; test('it renders', async function (assert) { + assert.expect(7); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_APISTCMPLTD1', @@ -38,18 +41,21 @@ module( this.context = this.notification.context; - await render(hbs``); - assert - .dom('[data-test-nf-apistcmpltd1-primary-message]') - .exists() - .containsText( - t('notificationModule.messages.nf-apistcmpltd1', { - platform_display: 'android', - file_name: 'mfva', - package_name: 'com.mfva.test', - }) - ); + await render(hbs` + + `); + + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-apistcmpltd1-primary-message]', + message: t('notificationModule.messages.nf-apistcmpltd1', { + platform_display: 'android', + file_name: 'mfva', + package_name: 'com.mfva.test', + }), + }); assert .dom('[data-test-nf-apistcmpltd1-version]') @@ -57,6 +63,7 @@ module( .containsText( `${t('versionLowercase')}: 1.0.1 | ${t('versionCode')}: 23434` ); + assert .dom('[data-test-nf-apistcmpltd1-risk-count]') .exists() diff --git a/tests/integration/components/notifications-page/messages/nf-dastcmpltd1-test.js b/tests/integration/components/notifications-page/messages/nf-dastcmpltd1-test.js index 81bcab205..84f5dfba6 100644 --- a/tests/integration/components/notifications-page/messages/nf-dastcmpltd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-dastcmpltd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-dastcmpltd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_DASTCMPLTD1'].context; test('it renders', async function (assert) { + assert.expect(7); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_DASTCMPLTD1', @@ -38,19 +42,21 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert - .dom('[data-test-nf-dastcmpltd1-primary-message]') - .exists() - .containsText( - t('notificationModule.messages.nf-dastcmpltd1', { - platform_display: 'android', - file_name: 'mfva', - package_name: 'com.mfva.test', - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-dastcmpltd1-primary-message]', + message: t('notificationModule.messages.nf-dastcmpltd1', { + platform_display: 'android', + file_name: 'mfva', + package_name: 'com.mfva.test', + }), + }); assert .dom('[data-test-nf-dastcmpltd1-version]') @@ -58,6 +64,7 @@ module( .containsText( `${t('versionLowercase')}: 1.0.1 | ${t('versionCode')}: 93434` ); + assert .dom('[data-test-nf-dastcmpltd1-risk-count]') .exists() diff --git a/tests/integration/components/notifications-page/messages/nf-nsapprvd1-test.js b/tests/integration/components/notifications-page/messages/nf-nsapprvd1-test.js index 6d78c9679..45e137175 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsapprvd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsapprvd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsapprvd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSAPPRVD1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSAPPRVD1', @@ -31,11 +35,18 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); + + this.intl = this.owner.lookup('service:intl'); - assert.dom().containsText( - t('notificationModule.messages.nf-nsapprvd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsapprvd1-primary-message]', + message: t('notificationModule.messages.nf-nsapprvd1', { platform_display: 'android', namespace_value: 'com.mfva.test', namespace_created_on: this.intl.formatDate( @@ -43,8 +54,8 @@ module( { month: 'long', year: 'numeric', day: 'numeric' } ), moderator_username: 'appknox_user', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-nsapprvd2-test.js b/tests/integration/components/notifications-page/messages/nf-nsapprvd2-test.js index 06416b3bd..3c7e34183 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsapprvd2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsapprvd2-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsapprvd2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSAPPRVD2'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSAPPRVD2', @@ -31,18 +35,23 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-nsapprvd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsapprvd2-primary-message]', + message: t('notificationModule.messages.nf-nsapprvd2', { platform_display: 'android', namespace_value: 'com.mfva.test', namespace_created_on: this.context.namespace_created_on, requester_username: 'appknox_request_user', moderator_username: 'appknox_user', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-nsautoapprvd1-test.js b/tests/integration/components/notifications-page/messages/nf-nsautoapprvd1-test.js index 2fdfe73c2..3dad28e32 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsautoapprvd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsautoapprvd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsautoapprvd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSAUTOAPPRVD1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSAUTOAPPRVD1', @@ -30,15 +34,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().hasText( - t('notificationModule.messages.nf-nsautoapprvd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsautoapprvd1-primary-message]', + message: t('notificationModule.messages.nf-nsautoapprvd1', { platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-nsautoapprvd2-test.js b/tests/integration/components/notifications-page/messages/nf-nsautoapprvd2-test.js index 8265a520d..698e5fc4d 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsautoapprvd2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsautoapprvd2-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsautoapprvd2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSAUTOAPPRVD2'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSAPPRVD1', @@ -31,16 +35,21 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().hasText( - t('notificationModule.messages.nf-nsautoapprvd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsautoapprvd2-primary-message]', + message: t('notificationModule.messages.nf-nsautoapprvd2', { platform_display: 'android', namespace_value: 'com.mfva.test', requester_username: 'appknox_user', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-nsrejctd1-test.js b/tests/integration/components/notifications-page/messages/nf-nsrejctd1-test.js index ee9fd5ec5..aab16214f 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsrejctd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsrejctd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsrejctd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSREJCTD1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSREJCTD1', @@ -31,19 +35,26 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); + + this.intl = this.owner.lookup('service:intl'); - assert.dom().containsText( - t('notificationModule.messages.nf-nsrejctd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsrejctd1-primary-message]', + message: t('notificationModule.messages.nf-nsrejctd1', { platform_display: 'android', namespace_value: 'com.mfva.test', namespace_created_on: this.intl.formatDate( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-nsrejctd2-test.js b/tests/integration/components/notifications-page/messages/nf-nsrejctd2-test.js index 1217893cd..6d4a10613 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsrejctd2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsrejctd2-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsrejctd2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSREJCTD2'].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSREJCTD2', @@ -32,20 +36,22 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert - .dom('[data-test-nf-nsrejctd2-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-nsrejctd2', { - platform_display: 'android', - namespace_value: 'com.mfva.test', - requester_username: 'appknox_requester', - moderator_username: 'appknox_moderator', - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nsrejctd2-primary-message]', + message: t('notificationModule.messages.nf-nsrejctd2', { + platform_display: 'android', + namespace_value: 'com.mfva.test', + requester_username: 'appknox_requester', + moderator_username: 'appknox_moderator', + }), + }); assert .dom('[data-test-nf-nsrejctd2-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-nsreqstd1-test.js b/tests/integration/components/notifications-page/messages/nf-nsreqstd1-test.js index fa154fe63..421a6091a 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsreqstd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsreqstd1-test.js @@ -4,14 +4,16 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsreqstd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSREQSTD1'].context; @@ -39,6 +41,8 @@ module( }); test('it should show approved state if namespace is approved and you if approver is current user', async function (assert) { + assert.expect(4); + const organization = this.server.schema.organizations.first(); const currentUser = this.server.schema.currentUsers.first(); const user = this.server.schema.users.find(currentUser.id); @@ -81,20 +85,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -105,6 +114,8 @@ module( }); test('it should show approved state if namespace is approved', async function (assert) { + assert.expect(4); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -145,20 +156,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -169,6 +185,8 @@ module( }); test('it should show rejected state if namespace is rejected', async function (assert) { + assert.expect(4); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSREQSTD1', @@ -184,20 +202,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') @@ -207,6 +230,8 @@ module( }); test('it should show approve and reject for unmoderated namespace', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -241,20 +266,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approve-button]').exists(); @@ -267,6 +297,8 @@ module( }); test('it should approve namespace when approve is clicked for unmoderated namespace', async function (assert) { + assert.expect(11); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -301,20 +333,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -329,13 +366,14 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -346,6 +384,8 @@ module( }); test('it should reject namespace when reject is clicked for unmoderated namespace', async function (assert) { + assert.expect(11); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -380,20 +420,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -408,13 +453,14 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-nsreqstd2-test.js b/tests/integration/components/notifications-page/messages/nf-nsreqstd2-test.js index 561eadbfa..69817c18c 100644 --- a/tests/integration/components/notifications-page/messages/nf-nsreqstd2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-nsreqstd2-test.js @@ -4,14 +4,16 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-nsreqstd2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_NSREQSTD2'].context; @@ -34,11 +36,17 @@ module( email: user.email, isActive: true, }); + const orgService = this.owner.lookup('service:organization'); + await orgService.load(); + + this.intl = this.owner.lookup('service:intl'); }); test('it should show approved state if namespace is approved and you if approver is current user', async function (assert) { + assert.expect(4); + const organization = this.server.schema.organizations.first(); const currentUser = this.server.schema.currentUsers.first(); const user = this.server.schema.users.find(currentUser.id); @@ -82,15 +90,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -99,18 +112,21 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { moderaterName: 'You', }) ); + assert.dom('[data-test-namespaceMessage-approved-icon]').exists(); }); test('it should show approved state if namespace is approved', async function (assert) { + assert.expect(4); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -152,15 +168,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -169,18 +190,21 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { moderaterName: 'appknox_approver', }) ); + assert.dom('[data-test-namespaceMessage-approved-icon]').exists(); }); test('it should show rejected state if namespace is rejected', async function (assert) { + assert.expect(4); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_NSREQSTD2', @@ -197,15 +221,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -214,8 +243,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') @@ -225,6 +254,8 @@ module( }); test('it should show approve and reject for unmoderated namespace', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -260,15 +291,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -277,8 +313,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approve-button]').exists(); @@ -291,6 +327,8 @@ module( }); test('it should approve namespace when approve is clicked for unmoderated namespace', async function (assert) { + assert.expect(11); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -326,15 +364,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -343,8 +386,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -359,8 +402,9 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -369,18 +413,21 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { moderaterName: 'You', }) ); + assert.dom('[data-test-namespaceMessage-approved-icon]').exists(); }); test('it should reject namespace when reject is clicked for unmoderated namespace', async function (assert) { + assert.expect(11); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -416,15 +463,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -433,8 +485,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -449,8 +501,9 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -459,8 +512,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-sastcmpltd1-test.js b/tests/integration/components/notifications-page/messages/nf-sastcmpltd1-test.js index 569dbd66d..ec682f052 100644 --- a/tests/integration/components/notifications-page/messages/nf-sastcmpltd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-sastcmpltd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-sastcmpltd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_SASTCMPLTD1'].context; test('it renders', async function (assert) { + assert.expect(7); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_DASTCMPLTD1', @@ -38,19 +42,21 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert - .dom('[data-test-nf-sastcmpltd1-primary-message]') - .exists() - .containsText( - t('notificationModule.messages.nf-sastcmpltd1', { - platform_display: 'android', - file_name: 'mfva', - package_name: 'com.mfva.test', - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-sastcmpltd1-primary-message]', + message: t('notificationModule.messages.nf-sastcmpltd1', { + platform_display: 'android', + file_name: 'mfva', + package_name: 'com.mfva.test', + }), + }); assert .dom('[data-test-nf-sastcmpltd1-version]') @@ -58,6 +64,7 @@ module( .containsText( `${t('versionLowercase')}: 1.0.1 | ${t('versionCode')}: 63434` ); + assert .dom('[data-test-nf-sastcmpltd1-risk-count]') .exists() diff --git a/tests/integration/components/notifications-page/messages/nf-sbomcmpltd-test.js b/tests/integration/components/notifications-page/messages/nf-sbomcmpltd-test.js index 29143fe64..2b586ba16 100644 --- a/tests/integration/components/notifications-page/messages/nf-sbomcmpltd-test.js +++ b/tests/integration/components/notifications-page/messages/nf-sbomcmpltd-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-sbomcmpltd', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_SBOMCMPLTD'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(9); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -39,35 +43,41 @@ module( this.context = this.notification.context; await render( - hbs`` + hbs`` ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-sbomcmpltd-primary-message]', + message: t('notificationModule.messages.nf-sbomcmpltd.prefix'), + doIncludesCheck: true, + }); + assert .dom('[data-test-nf-sbomcmpltd-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-sbomcmpltd.prefix') - .concat(` ${t('fileID')} ${this.context.file_id} `) - .concat( - t('notificationModule.messages.nf-sbomcmpltd.suffix', { - platform_display: this.context.platform_display, - file_name: this.context.file_name, - package_name: this.context.package_name, - }) - ) - ); + .containsText(`${t('fileID')} ${this.context.file_id}`); + + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-sbomcmpltd-primary-message]', + message: t('notificationModule.messages.nf-sbomcmpltd.suffix', { + platform_display: this.context.platform_display, + file_name: this.context.file_name, + package_name: this.context.package_name, + }), + doIncludesCheck: true, + }); assert .dom('[data-test-nf-sbomcmpltd-summaryTitle]') .hasText(`${t('summary')}:`); - assert.dom('[data-test-nf-sbomcmpltd-summaryValue]').hasText( - t('notificationModule.messages.nf-sbomcmpltd.summary', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-sbomcmpltd-summaryValue]', + message: t('notificationModule.messages.nf-sbomcmpltd.summary', { total_components: this.context.components_count, vulnerable_components: this.context.vulnerable_components_count, outdated_components: this.context.components_with_updates_count, - }) - ); + }), + }); assert .dom('[data-test-nf-sbomcmpltd-version]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd1-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd1-test.js index fe376e936..b3af16eb4 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd1-test.js @@ -4,14 +4,16 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-nsreqstd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_STR_URL_NSREQSTD1'].context; @@ -39,6 +41,8 @@ module( }); test('it should show approved state if namespace is approved and you if approver is current user', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const currentUser = this.server.schema.currentUsers.first(); const user = this.server.schema.users.find(currentUser.id); @@ -82,20 +86,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -112,6 +121,8 @@ module( }); test('it should show approved state if namespace is approved', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -153,20 +164,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -183,6 +199,8 @@ module( }); test('it should show rejected state if namespace is rejected', async function (assert) { + assert.expect(6); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_STR_URL_NSREQSTD1', @@ -199,20 +217,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') @@ -227,6 +250,8 @@ module( }); test('it should show approve and reject for unmoderated namespace', async function (assert) { + assert.expect(8); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -262,20 +287,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approve-button]').exists(); @@ -293,6 +323,8 @@ module( }); test('it should approve namespace when approve is clicked for unmoderated namespace', async function (assert) { + assert.expect(13); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -328,20 +360,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -361,23 +398,27 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { moderaterName: 'You', }) ); + assert.dom('[data-test-namespaceMessage-approved-icon]').exists(); }); test('it should reject namespace when reject is clicked for unmoderated namespace', async function (assert) { + assert.expect(13); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -413,20 +454,25 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -446,13 +492,14 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd1', { requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd2-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd2-test.js index 1490b1169..fb4f5fa1d 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-nsreqstd2-test.js @@ -4,19 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { click, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-nsreqstd2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_STR_URL_NSREQSTD2'].context; hooks.beforeEach(async function () { const organization = this.server.create('organization', {}); + const currentUser = this.server.create('current-user', { organization: organization, }); @@ -24,6 +27,7 @@ module( this.server.create('organization-me', { id: currentUser.id, }); + const user = this.server.create('user', { id: currentUser.id, }); @@ -34,11 +38,17 @@ module( email: user.email, isActive: true, }); + const orgService = this.owner.lookup('service:organization'); + await orgService.load(); + + this.intl = this.owner.lookup('service:intl'); }); test('it should show approved state if namespace is approved and you if approver is current user', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const currentUser = this.server.schema.currentUsers.first(); const user = this.server.schema.users.find(currentUser.id); @@ -83,15 +93,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -100,8 +115,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -118,6 +133,8 @@ module( }); test('it should show approved state if namespace is approved', async function (assert) { + assert.expect(6); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -160,15 +177,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -177,8 +199,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -195,6 +217,8 @@ module( }); test('it should show rejected state if namespace is rejected', async function (assert) { + assert.expect(6); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_STR_URL_NSREQSTD2', @@ -212,15 +236,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -229,8 +258,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') @@ -245,6 +274,8 @@ module( }); test('it should show approve and reject for unmoderated namespace', async function (assert) { + assert.expect(8); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -281,15 +312,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -298,8 +334,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approve-button]').exists(); @@ -317,6 +353,8 @@ module( }); test('it should approve namespace when approve is clicked for unmoderated namespace', async function (assert) { + assert.expect(13); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -353,15 +391,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -370,8 +413,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -391,8 +434,9 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -401,8 +445,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert.dom('[data-test-namespaceMessage-approved-message]').hasText( t('notificationModule.namespaceMessage.approved', { @@ -413,6 +457,8 @@ module( }); test('it should reject namespace when reject is clicked for unmoderated namespace', async function (assert) { + assert.expect(13); + const organization = this.server.schema.organizations.first(); const org_user_requestedby = this.server.create('organization-user', { @@ -449,15 +495,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); assert .dom('[data-test-namespaceMessage-title]') .hasText(t('approvalRequest')); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -466,8 +517,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-viewNamespacelink]') @@ -487,8 +538,9 @@ module( assert.dom('[data-test-namespaceMessage-approve-button]').doesNotExist(); assert.dom('[data-test-namespaceMessage-reject-button]').doesNotExist(); - assert.dom('[data-test-namespaceMessage-primary-message]').hasText( - t('notificationModule.messages.nf-str-url-nsreqstd2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-namespaceMessage-primary-message]', + message: t('notificationModule.messages.nf-str-url-nsreqstd2', { current_requester_username: 'appknox_requester', platform_display: 'android', namespace_value: 'com.mfva.test', @@ -497,8 +549,8 @@ module( this.context.namespace_created_on, { month: 'long', year: 'numeric', day: 'numeric' } ), - }) - ); + }), + }); assert .dom('[data-test-namespaceMessage-rejected-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny1-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny1-test.js index 73ad2190b..b628b4429 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny1-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailnprjdeny1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILNPRJDENY1'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -35,15 +39,13 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailnprjdeny1-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upldfailnprjdeny1', { - package_name: this.context.package_name, - store_name: t('googlePlayStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailnprjdeny1-primary-message]', + message: t('notificationModule.messages.nf-str-url-upldfailnprjdeny1', { + package_name: this.context.package_name, + store_name: t('googlePlayStore'), + }), + }); assert .dom('[data-test-nf-str-url-upldfailnprjdeny1-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny2-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny2-test.js index 369e8dc34..94c9217c5 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnprjdeny2-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailnprjdeny2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILNPRJDENY2'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(7); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -38,20 +42,18 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailnprjdeny2-primary-message]') - .exists() - .hasText( - t( - 'notificationModule.messages.nf-str-url-upldfailnprjdeny2.primary', - { - platform_display: this.context.platform_display, - package_name: this.context.package_name, - requester_username: this.context.requester_username, - requester_role: this.context.requester_role, - } - ) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailnprjdeny2-primary-message]', + message: t( + 'notificationModule.messages.nf-str-url-upldfailnprjdeny2.primary', + { + platform_display: this.context.platform_display, + package_name: this.context.package_name, + requester_username: this.context.requester_username, + requester_role: this.context.requester_role, + } + ), + }); assert .dom('[data-test-nf-str-url-upldfailnprjdeny2-secodary-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnscreatd1-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnscreatd1-test.js index cb745f56e..6b0190fc1 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnscreatd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnscreatd1-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailnscreatd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILNSCREATD1'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -35,14 +39,12 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailnscreatd1-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upldfailnscreatd1', { - store_name: t('googlePlayStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailnscreatd1-primary-message]', + message: t('notificationModule.messages.nf-str-url-upldfailnscreatd1', { + store_name: t('googlePlayStore'), + }), + }); assert .dom('[data-test-nf-str-url-upldfailnscreatd1-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnsunaprv1-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnsunaprv1-test.js index 73ff69498..d3995fe70 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnsunaprv1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailnsunaprv1-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailnsunaprv1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILNSUNAPRV1'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -35,14 +39,12 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailnsunaprv1-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upldfailnsunaprv1', { - store_name: t('googlePlayStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailnsunaprv1-primary-message]', + message: t('notificationModule.messages.nf-str-url-upldfailnsunaprv1', { + store_name: t('googlePlayStore'), + }), + }); assert .dom('[data-test-nf-str-url-upldfailnsunaprv1-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpay2-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpay2-test.js index e1681c6fc..207a2221d 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpay2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpay2-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailpay2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILPAY2'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -34,16 +38,14 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailpay2-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upldfailpay2', { - package_name: this.context.package_name, - requester_username: this.context.requester_username, - store_name: t('googlePlayStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailpay2-primary-message]', + message: t('notificationModule.messages.nf-str-url-upldfailpay2', { + package_name: this.context.package_name, + requester_username: this.context.requester_username, + store_name: t('googlePlayStore'), + }), + }); assert .dom('[data-test-nf-str-url-upldfailpay2-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpayrq1-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpayrq1-test.js index 68ab674ac..8023274c2 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpayrq1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upldfailpayrq1-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upldfailpayrq1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLDFAILPAYRQ1'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(3); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -33,14 +37,12 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upldfailpayrq1-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upldfailpayrq1', { - store_name: t('googlePlayStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upldfailpayrq1-primary-message]', + message: t('notificationModule.messages.nf-str-url-upldfailpayrq1', { + store_name: t('googlePlayStore'), + }), + }); assert .dom('[data-test-nf-str-url-upldfailpayrq1-link]') diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-upload-success-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-upload-success-test.js index 8ce237cb5..1dc78fb90 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-upload-success-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-upload-success-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-upload-success', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_UPLOAD_SUCCESS'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(8); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -37,19 +41,25 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-upload-success-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-upload-success.prefix', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-upload-success-primary-message]', + message: t( + 'notificationModule.messages.nf-str-url-upload-success.prefix', + { platform_display: this.context.platform_display, package_name: this.context.package_name, store_name: t('googlePlayStore'), - }) - .concat(` ${t('fileID')} ${this.context.file_id} `) - .concat( - t('notificationModule.messages.nf-str-url-upload-success.suffix') - ) + } + ), + doIncludesCheck: true, + }); + + assert + .dom('[data-test-nf-str-url-upload-success-primary-message]') + .exists() + .containsText(`${t('fileID')} ${this.context.file_id}`) + .containsText( + t('notificationModule.messages.nf-str-url-upload-success.suffix') ); assert diff --git a/tests/integration/components/notifications-page/messages/nf-str-url-vldtn-err-test.js b/tests/integration/components/notifications-page/messages/nf-str-url-vldtn-err-test.js index 20dd1fe01..3ea5a93d6 100644 --- a/tests/integration/components/notifications-page/messages/nf-str-url-vldtn-err-test.js +++ b/tests/integration/components/notifications-page/messages/nf-str-url-vldtn-err-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-str-url-vldtn-err', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_STR_URL_VLDTN_ERR'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(7); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -32,14 +36,12 @@ module( hbs`` ); - assert - .dom('[data-test-nf-str-url-vldtn-err-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-str-url-vldtn-err', { - store_name: t('appleAppStore'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-str-url-vldtn-err-primary-message]', + message: t('notificationModule.messages.nf-str-url-vldtn-err', { + store_name: t('appleAppStore'), + }), + }); assert .dom('[data-test-nf-str-url-vldtn-err-errorLabel]') diff --git a/tests/integration/components/notifications-page/messages/nf-systm-file-upload-success-test.js b/tests/integration/components/notifications-page/messages/nf-systm-file-upload-success-test.js index 3bbbaaf80..d01bdae15 100644 --- a/tests/integration/components/notifications-page/messages/nf-systm-file-upload-success-test.js +++ b/tests/integration/components/notifications-page/messages/nf-systm-file-upload-success-test.js @@ -4,19 +4,23 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-systm-file-upload-success', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const messageCode = 'NF_SYSTM_FILE_UPLOAD_SUCCESS'; const ContextClass = NotificationMap[messageCode].context; test('it renders', async function (assert) { + assert.expect(6); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode, @@ -36,20 +40,24 @@ module( hbs`` ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-systm-file-upload-success-primary-message]', + message: t( + 'notificationModule.messages.nf-systm-file-upload-success.prefix', + { + platform_display: this.context.platform_display, + package_name: this.context.package_name, + } + ), + doIncludesCheck: true, + }); + assert .dom('[data-test-nf-systm-file-upload-success-primary-message]') .exists() - .hasText( - t('notificationModule.messages.nf-systm-file-upload-success.prefix', { - platform_display: this.context.platform_display, - package_name: this.context.package_name, - }) - .concat(` ${t('fileID')} ${this.context.file_id} `) - .concat( - t( - 'notificationModule.messages.nf-systm-file-upload-success.suffix' - ) - ) + .containsText(`${t('fileID')} ${this.context.file_id}`) + .containsText( + t('notificationModule.messages.nf-systm-file-upload-success.suffix') ); assert diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny1-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny1-test.js index 63de574e2..e45fb09c0 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailnprjdeny1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILNPRJDENY1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILNSCREATD1', @@ -28,15 +32,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-upldfailnprjdeny1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-nfUpldfailnprjdeny1-primary-message]', + message: t('notificationModule.messages.nf-upldfailnprjdeny1', { platform_display: 'android', package_name: 'com.mfva.test', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny2-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny2-test.js index a729f0665..4dee0b7d5 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailnprjdeny2-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailnprjdeny2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILNPRJDENY2'].context; test('it renders', async function (assert) { + assert.expect(5); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILNPRJDENY2', @@ -31,20 +35,22 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert - .dom('[data-test-nf-upldfailnprjdeny2-primary-message]') - .exists() - .hasText( - t('notificationModule.messages.nf-upldfailnprjdeny2.primary', { - platform_display: 'android', - package_name: 'com.mfva.test', - requester_username: 'appknox_requester', - requester_role: 'member', - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-upldfailnprjdeny2-primary-message]', + message: t('notificationModule.messages.nf-upldfailnprjdeny2.primary', { + platform_display: 'android', + package_name: 'com.mfva.test', + requester_username: 'appknox_requester', + requester_role: 'member', + }), + }); assert .dom('[data-test-nf-upldfailnprjdeny2-secodary-message]') diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailnscreatd1-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailnscreatd1-test.js index 2b1844932..434461135 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailnscreatd1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailnscreatd1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailnscreatd1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILNSCREATD1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILNSCREATD1', @@ -28,15 +32,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-upldfailnscreatd1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-upldfailnscreatd1-primary-message]', + message: t('notificationModule.messages.nf-upldfailnscreatd1', { platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailnsunaprv1-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailnsunaprv1-test.js index 61f851fc5..48ea4c840 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailnsunaprv1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailnsunaprv1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailnsunaprv1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILNSUNAPRV1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILNSUNAPRV1', @@ -28,15 +32,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-upldfailnsunaprv1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-upldfailnsunaprv1-primary-message]', + message: t('notificationModule.messages.nf-upldfailnsunaprv1', { platform_display: 'android', namespace_value: 'com.mfva.test', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailpay2-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailpay2-test.js index 2a2396df1..14e47dfb6 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailpay2-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailpay2-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailpay2', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILPAY2'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILPAY2', @@ -27,15 +31,20 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-upldfailpay2', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-upldfailpay2-primary-message]', + message: t('notificationModule.messages.nf-upldfailpay2', { package_name: 'com.mfva.test', requester_username: 'appknox_user', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/notifications-page/messages/nf-upldfailpayrq1-test.js b/tests/integration/components/notifications-page/messages/nf-upldfailpayrq1-test.js index 611ad956e..4e29bcd19 100644 --- a/tests/integration/components/notifications-page/messages/nf-upldfailpayrq1-test.js +++ b/tests/integration/components/notifications-page/messages/nf-upldfailpayrq1-test.js @@ -4,18 +4,22 @@ import { setupIntl, t } from 'ember-intl/test-support'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; + import { NotificationMap } from 'irene/components/notifications-page/notification_map'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; module( 'Integration | Component | notifications-page/messages/nf-upldfailpayrq1', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); const ContextClass = NotificationMap['NF_UPLDFAILPAYRQ1'].context; test('it renders', async function (assert) { + assert.expect(1); + this.notification = this.server.create('nf-in-app-notification', { hasRead: true, messageCode: 'NF_UPLDFAILPAYRQ1', @@ -26,14 +30,19 @@ module( this.context = this.notification.context; - await render(hbs``); + await render(hbs` + + `); - assert.dom().containsText( - t('notificationModule.messages.nf-upldfailpayrq1', { + compareInnerHTMLWithIntlTranslation(assert, { + selector: '[data-test-nf-upldfailpayrq1-primary-message]', + message: t('notificationModule.messages.nf-upldfailpayrq1', { package_name: 'com.mfva.test', - }) - ); + }), + }); }); } ); diff --git a/tests/integration/components/organization-archive-test.js b/tests/integration/components/organization-archive-test.js index 89db30351..e4a4d1e0c 100644 --- a/tests/integration/components/organization-archive-test.js +++ b/tests/integration/components/organization-archive-test.js @@ -55,7 +55,7 @@ class WindowStub extends Service { module('Integration | Component | organization-archive', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-details-test.js b/tests/integration/components/organization-details-test.js index e3a0a8e66..6d97a68e7 100644 --- a/tests/integration/components/organization-details-test.js +++ b/tests/integration/components/organization-details-test.js @@ -18,7 +18,7 @@ class RouterStub extends Service { module('Integration | Component | organization-details', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-email-domain-test.js b/tests/integration/components/organization-email-domain-test.js index 86e54e0ad..316c4367f 100644 --- a/tests/integration/components/organization-email-domain-test.js +++ b/tests/integration/components/organization-email-domain-test.js @@ -23,7 +23,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-email-domain', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); diff --git a/tests/integration/components/organization-invitation-list-test.js b/tests/integration/components/organization-invitation-list-test.js index c7d30eb77..16dfbbcd3 100644 --- a/tests/integration/components/organization-invitation-list-test.js +++ b/tests/integration/components/organization-invitation-list-test.js @@ -26,7 +26,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-member/invite-user-test.js b/tests/integration/components/organization-member/invite-user-test.js index aba47c00f..87d9f298c 100644 --- a/tests/integration/components/organization-member/invite-user-test.js +++ b/tests/integration/components/organization-member/invite-user-test.js @@ -25,7 +25,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders invite-user', async function (assert) { await render(hbs``); diff --git a/tests/integration/components/organization-member/list-test.js b/tests/integration/components/organization-member/list-test.js index b86f9e4c4..1c08e1cc0 100644 --- a/tests/integration/components/organization-member/list-test.js +++ b/tests/integration/components/organization-member/list-test.js @@ -25,7 +25,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-member/list', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-member/list/add-to-team-test.js b/tests/integration/components/organization-member/list/add-to-team-test.js index a7456d0a1..c8d8c1ab7 100644 --- a/tests/integration/components/organization-member/list/add-to-team-test.js +++ b/tests/integration/components/organization-member/list/add-to-team-test.js @@ -30,7 +30,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-member/list/member-details-test.js b/tests/integration/components/organization-member/list/member-details-test.js index 7f891bcfd..b8b224400 100644 --- a/tests/integration/components/organization-member/list/member-details-test.js +++ b/tests/integration/components/organization-member/list/member-details-test.js @@ -34,7 +34,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-member/list/member-details/change-activity-status-test.js b/tests/integration/components/organization-member/list/member-details/change-activity-status-test.js index 631ecbef9..7f46a7271 100644 --- a/tests/integration/components/organization-member/list/member-details/change-activity-status-test.js +++ b/tests/integration/components/organization-member/list/member-details/change-activity-status-test.js @@ -23,7 +23,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/organization-member/list/member-drawer-test.js b/tests/integration/components/organization-member/list/member-drawer-test.js index fd0db4639..ea5e5e47f 100644 --- a/tests/integration/components/organization-member/list/member-drawer-test.js +++ b/tests/integration/components/organization-member/list/member-drawer-test.js @@ -11,7 +11,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-mfa-test.js b/tests/integration/components/organization-mfa-test.js index 315d2315c..d96da0a05 100644 --- a/tests/integration/components/organization-mfa-test.js +++ b/tests/integration/components/organization-mfa-test.js @@ -23,7 +23,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-mfa', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-name-header-test.js b/tests/integration/components/organization-name-header-test.js index 8b041fd66..652f47397 100644 --- a/tests/integration/components/organization-name-header-test.js +++ b/tests/integration/components/organization-name-header-test.js @@ -23,7 +23,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-name-header', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-namespace-test.js b/tests/integration/components/organization-namespace-test.js index bdb866665..61e0cdbf3 100644 --- a/tests/integration/components/organization-namespace-test.js +++ b/tests/integration/components/organization-namespace-test.js @@ -31,7 +31,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-namespace', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const organization = this.server.create('organization', {}); diff --git a/tests/integration/components/organization-team/add-team-member-test.js b/tests/integration/components/organization-team/add-team-member-test.js index 754c6aecd..6cd5c3a74 100644 --- a/tests/integration/components/organization-team/add-team-member-test.js +++ b/tests/integration/components/organization-team/add-team-member-test.js @@ -33,7 +33,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/add-team-project-test.js b/tests/integration/components/organization-team/add-team-project-test.js index 6c0518063..76a438ac9 100644 --- a/tests/integration/components/organization-team/add-team-project-test.js +++ b/tests/integration/components/organization-team/add-team-project-test.js @@ -41,7 +41,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/details-test.js b/tests/integration/components/organization-team/details-test.js index f3cc821ed..95595ea17 100644 --- a/tests/integration/components/organization-team/details-test.js +++ b/tests/integration/components/organization-team/details-test.js @@ -33,7 +33,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-team/details', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/index-test.js b/tests/integration/components/organization-team/index-test.js index ca8c3baef..13bbae288 100644 --- a/tests/integration/components/organization-team/index-test.js +++ b/tests/integration/components/organization-team/index-test.js @@ -22,7 +22,7 @@ class NotificationsStub extends Service { module('Integration | Component | organization-team', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/invitation-list.js b/tests/integration/components/organization-team/invitation-list.js index 969557270..1bd19f9c0 100644 --- a/tests/integration/components/organization-team/invitation-list.js +++ b/tests/integration/components/organization-team/invitation-list.js @@ -26,7 +26,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/member-list-test.js b/tests/integration/components/organization-team/member-list-test.js index b6c8b175d..ea3f72ab1 100644 --- a/tests/integration/components/organization-team/member-list-test.js +++ b/tests/integration/components/organization-team/member-list-test.js @@ -34,7 +34,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization-team/project-list-test.js b/tests/integration/components/organization-team/project-list-test.js index 6e51f90e0..52a2967ff 100644 --- a/tests/integration/components/organization-team/project-list-test.js +++ b/tests/integration/components/organization-team/project-list-test.js @@ -34,7 +34,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/organization/service-account/details-test.js b/tests/integration/components/organization/service-account/details-test.js index bca168a76..1b79c7e61 100644 --- a/tests/integration/components/organization/service-account/details-test.js +++ b/tests/integration/components/organization/service-account/details-test.js @@ -7,6 +7,8 @@ import { module, test } from 'qunit'; import Service from '@ember/service'; import dayjs from 'dayjs'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; + class NotificationsStub extends Service { errorMsg = null; successMsg = null; @@ -56,7 +58,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); @@ -77,6 +79,8 @@ module( }); test('it renders', async function (assert) { + assert.expect(43); + this.server.get('/service_accounts/:id/service_account_projects', () => { return { count: 0, next: null, previous: null, results: [] }; }); @@ -254,15 +258,13 @@ module( (opt) => opt.value === this.serviceAccount.allProjects ); - assert - .dom( - '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]' - ) - .hasText( - t('serviceAccountModule.selectedProjectAccess', { - projectAccess: selectedProjectAccess?.label, - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]', + message: t('serviceAccountModule.selectedProjectAccess', { + projectAccess: selectedProjectAccess?.label, + }), + }); if (this.serviceAccount.allProjects) { assert diff --git a/tests/integration/components/organization/service-account/section/access-token-test.js b/tests/integration/components/organization/service-account/section/access-token-test.js index deea040c2..d4ac7befb 100644 --- a/tests/integration/components/organization/service-account/section/access-token-test.js +++ b/tests/integration/components/organization/service-account/section/access-token-test.js @@ -32,7 +32,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/organization/service-account/section/account-overview-test.js b/tests/integration/components/organization/service-account/section/account-overview-test.js index 27d7843d9..36b817972 100644 --- a/tests/integration/components/organization/service-account/section/account-overview-test.js +++ b/tests/integration/components/organization/service-account/section/account-overview-test.js @@ -26,7 +26,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/organization/service-account/section/select-project-test.js b/tests/integration/components/organization/service-account/section/select-project-test.js index 07a973aea..2ddaeb16f 100644 --- a/tests/integration/components/organization/service-account/section/select-project-test.js +++ b/tests/integration/components/organization/service-account/section/select-project-test.js @@ -9,6 +9,7 @@ import Service from '@ember/service'; import { selectChoose } from 'ember-power-select/test-support'; import styles from 'irene/components/ak-select/index.scss'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; class NotificationsStub extends Service { errorMsg = null; @@ -37,7 +38,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); @@ -77,6 +78,8 @@ module( { allProjects: false, hasProjects: false }, ], async function (assert, { allProjects, hasProjects }) { + assert.expect(allProjects ? 7 : !allProjects && hasProjects ? 13 : 12); + this.serviceAccount.allProjects = allProjects; this.server.get( @@ -127,15 +130,13 @@ module( (opt) => opt.value === this.serviceAccount.allProjects ); - assert - .dom( - '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]' - ) - .hasText( - t('serviceAccountModule.selectedProjectAccess', { - projectAccess: selectedProjectAccess?.label, - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]', + message: t('serviceAccountModule.selectedProjectAccess', { + projectAccess: selectedProjectAccess?.label, + }), + }); if (allProjects) { assert @@ -239,6 +240,8 @@ module( 'it should update project access type', [false, true], async function (assert, fail) { + assert.expect(fail ? 20 : 17); + this.server.get( '/service_accounts/:id/service_account_projects', () => { @@ -287,15 +290,13 @@ module( (opt) => opt.value === this.serviceAccount.allProjects ); - assert - .dom( - '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]' - ) - .hasText( - t('serviceAccountModule.selectedProjectAccess', { - projectAccess: selectedProjectAccess?.label, - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]', + message: t('serviceAccountModule.selectedProjectAccess', { + projectAccess: selectedProjectAccess?.label, + }), + }); assert.dom('[data-test-serviceAccountSection-footer]').doesNotExist(); @@ -366,15 +367,13 @@ module( t('serviceAccountModule.editSuccessMsg') ); - assert - .dom( - '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]' - ) - .hasText( - t('serviceAccountModule.selectedProjectAccess', { - projectAccess: optionToSelect?.label, - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccountSection-selectProject-selectedProjectAccess]', + message: t('serviceAccountModule.selectedProjectAccess', { + projectAccess: optionToSelect?.label, + }), + }); assert .dom('[data-test-serviceAccountSection-selectProject-actionBtn]') @@ -569,6 +568,8 @@ module( 'it should remove project from service account', [false, true], async function (assert, fail) { + assert.expect(fail ? 19 : 16); + this.serviceAccount.updateValues({ all_projects: false, }); @@ -657,13 +658,13 @@ module( this.serviceAccountProjects[0].id ); - assert - .dom('[data-test-serviceAccount-confirmDrawer-removeConfirmText]') - .hasText( - t('serviceAccountModule.removeProjectConfirmText', { - projectName: serviceAccountProject.project.get('packageName'), - }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: + '[data-test-serviceAccount-confirmDrawer-removeConfirmText]', + message: t('serviceAccountModule.removeProjectConfirmText', { + projectName: serviceAccountProject.project.get('packageName'), + }), + }); assert .dom('[data-test-serviceAccount-confirmDrawer-confirmBtn]') diff --git a/tests/integration/components/organization/service-account/section/select-scope-test.js b/tests/integration/components/organization/service-account/section/select-scope-test.js index 21b011ceb..8a4e31c82 100644 --- a/tests/integration/components/organization/service-account/section/select-scope-test.js +++ b/tests/integration/components/organization/service-account/section/select-scope-test.js @@ -51,7 +51,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); diff --git a/tests/integration/components/partner/client-info/component-test.js b/tests/integration/components/partner/client-info/component-test.js index c12e0b424..d8c09c43f 100644 --- a/tests/integration/components/partner/client-info/component-test.js +++ b/tests/integration/components/partner/client-info/component-test.js @@ -20,7 +20,7 @@ function serializer(payload) { module('Integration | Component | partner/client-info', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 1); diff --git a/tests/integration/components/partner/client-plan/component-test.js b/tests/integration/components/partner/client-plan/component-test.js index bc6b85aad..bf8f55d59 100644 --- a/tests/integration/components/partner/client-plan/component-test.js +++ b/tests/integration/components/partner/client-plan/component-test.js @@ -20,7 +20,7 @@ function serializer(payload) { module('Integration | Component | partner/client-plan', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); @@ -55,7 +55,7 @@ module('Integration | Component | partner/client-plan', function (hooks) { assert .dom('strong[data-test-projects-left]') .hasText( - `${clientPlan.projectsLimit} t:pluralApps:("itemCount":${clientPlan.projectsLimit})` + `${clientPlan.projectsLimit} ${t('pluralApps', { itemCount: clientPlan.projectsLimit })}` ); assert .dom('span[data-test-plan-expiry]') @@ -95,7 +95,7 @@ module('Integration | Component | partner/client-plan', function (hooks) { assert .dom('strong[data-test-projects-left]') .hasText( - `${clientPlan.projectsLimit} t:pluralApps:("itemCount":${clientPlan.projectsLimit})` + `${clientPlan.projectsLimit} ${t('pluralApps', { itemCount: clientPlan.projectsLimit })}` ); assert .dom('span[data-test-plan-expiry]') @@ -133,7 +133,7 @@ module('Integration | Component | partner/client-plan', function (hooks) { assert .dom('strong[data-test-scans-left]') .hasText( - `${clientPlan.scansLeft} t:pluralScans:("itemCount":${clientPlan.scansLeft})` + `${clientPlan.scansLeft} ${t('pluralScans', { itemCount: clientPlan.scansLeft })}` ); assert.dom('div[data-test-plan-status]').hasText( `${clientPlan.scansLeft} ${t('pluralScans', { diff --git a/tests/integration/components/partner/client-project-list-test.js b/tests/integration/components/partner/client-project-list-test.js index 187a514fb..a07b54786 100644 --- a/tests/integration/components/partner/client-project-list-test.js +++ b/tests/integration/components/partner/client-project-list-test.js @@ -51,7 +51,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); diff --git a/tests/integration/components/partner/client-project-list/item-test.js b/tests/integration/components/partner/client-project-list/item-test.js index f90bcb0ca..93a6c522b 100644 --- a/tests/integration/components/partner/client-project-list/item-test.js +++ b/tests/integration/components/partner/client-project-list/item-test.js @@ -11,7 +11,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it should show project details', async function (assert) { this.set('project', this.server.create('partner/partnerclient-project')); diff --git a/tests/integration/components/partner/client-report-download-test.js b/tests/integration/components/partner/client-report-download-test.js index 0479968d4..3687766bc 100644 --- a/tests/integration/components/partner/client-report-download-test.js +++ b/tests/integration/components/partner/client-report-download-test.js @@ -47,7 +47,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/partner/client-report-download/report-password-test.js b/tests/integration/components/partner/client-report-download/report-password-test.js index 6aae7c328..12c126815 100644 --- a/tests/integration/components/partner/client-report-download/report-password-test.js +++ b/tests/integration/components/partner/client-report-download/report-password-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.create('organization'); diff --git a/tests/integration/components/partner/client-report-summary-test.js b/tests/integration/components/partner/client-report-summary-test.js index 2b6c83531..ef4e38a60 100644 --- a/tests/integration/components/partner/client-report-summary-test.js +++ b/tests/integration/components/partner/client-report-summary-test.js @@ -13,7 +13,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.create('organization'); diff --git a/tests/integration/components/partner/client-uploads-list/component-test.js b/tests/integration/components/partner/client-uploads-list/component-test.js index 7e1a1f692..308fe35db 100644 --- a/tests/integration/components/partner/client-uploads-list/component-test.js +++ b/tests/integration/components/partner/client-uploads-list/component-test.js @@ -42,7 +42,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); diff --git a/tests/integration/components/partner/client-uploads-stat-chart-test.js b/tests/integration/components/partner/client-uploads-stat-chart-test.js index 75d739df7..5b57dfbef 100644 --- a/tests/integration/components/partner/client-uploads-stat-chart-test.js +++ b/tests/integration/components/partner/client-uploads-stat-chart-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); @@ -71,11 +71,7 @@ module( await this.owner.lookup('service:partner').load(); await render(hbs``); - const filterOptions = [ - { buttonSelectorText: 'day', intlVariable: '' }, - { buttonSelectorText: 'week', intlVariable: '' }, - { buttonSelectorText: 'month', intlVariable: '' }, - ]; + const filterOptions = ['day', 'week', 'month']; assert.strictEqual( this.element.querySelectorAll( @@ -86,9 +82,7 @@ module( ); filterOptions.forEach((option, seq) => { - assert - .dom(`[data-test-chart='filter-btns-${seq}']`) - .hasText(`t:${option.buttonSelectorText}:(${option.intlVariable})`); + assert.dom(`[data-test-chart='filter-btns-${seq}']`).hasText(t(option)); }); assert diff --git a/tests/integration/components/partner/credit-transfer/credit-transfer-confirm-test.js b/tests/integration/components/partner/credit-transfer/credit-transfer-confirm-test.js index d4ed80d54..b0a60c9da 100644 --- a/tests/integration/components/partner/credit-transfer/credit-transfer-confirm-test.js +++ b/tests/integration/components/partner/credit-transfer/credit-transfer-confirm-test.js @@ -10,7 +10,7 @@ module( 'Integration | Component | partner/credit-transfer/credit-transfer-confirm', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders partner credits section', async function (assert) { this.set('partnerPlan', { scansLeft: 26 }); @@ -33,7 +33,7 @@ module( assert .dom(`[data-test-partner-current-credits-value]`) .hasText( - `${this.partnerPlan.scansLeft} t:pluralScans:("itemCount":${this.partnerPlan.scansLeft})` + `${this.partnerPlan.scansLeft} ${t('pluralScans', { itemCount: this.partnerPlan.scansLeft })}` ); assert @@ -42,7 +42,7 @@ module( assert .dom(`[data-test-partner-remaining-credits-value]`) .hasText( - `${this.remainingCredits} t:pluralScans:("itemCount":${this.remainingCredits})` + `${this.remainingCredits} ${t('pluralScans', { itemCount: this.remainingCredits })}` ); }); @@ -72,14 +72,14 @@ module( assert .dom(`[data-test-client-current-credits-value]`) .hasText( - `${this.clientPlan.scansLeft} t:pluralScans:("itemCount":${this.clientPlan.scansLeft})` + `${this.clientPlan.scansLeft} ${t('pluralScans', { itemCount: this.clientPlan.scansLeft })}` ); assert.dom(`[data-test-new-credits-key]`).hasText(`${t('newCredits')}:`); assert .dom(`[data-test-new-credits-value]`) .hasText( - `${this.transferCount} t:pluralScans:("itemCount":${this.transferCount})` + `${this.transferCount} ${t('pluralScans', { itemCount: this.transferCount })}` ); }); diff --git a/tests/integration/components/partner/credit-transfer/credit-transfer-input-test.js b/tests/integration/components/partner/credit-transfer/credit-transfer-input-test.js index 13246c561..a42564e26 100644 --- a/tests/integration/components/partner/credit-transfer/credit-transfer-input-test.js +++ b/tests/integration/components/partner/credit-transfer/credit-transfer-input-test.js @@ -11,7 +11,7 @@ module( 'Integration | Component | partner/credit-transfer/credit-transfer-input', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders', async function (assert) { this.set('partnerPlan', { @@ -34,7 +34,7 @@ module( assert .dom(`[data-test-transferable-credits]`) .hasText( - `${this.partnerPlan.scansLeft} t:pluralScans:("itemCount":${this.partnerPlan.scansLeft})` + `${this.partnerPlan.scansLeft} ${t('pluralScans', { itemCount: this.partnerPlan.scansLeft })}` ); assert.dom(`[data-test-client-title]`).hasText(this.clientName); assert diff --git a/tests/integration/components/partner/credit-transfer/index-test.js b/tests/integration/components/partner/credit-transfer/index-test.js index 7b075516c..da0623a19 100644 --- a/tests/integration/components/partner/credit-transfer/index-test.js +++ b/tests/integration/components/partner/credit-transfer/index-test.js @@ -17,7 +17,7 @@ function serializer(payload) { module('Integration | Component | partner/credit-transfer', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); diff --git a/tests/integration/components/partner/export-stats-test.js b/tests/integration/components/partner/export-stats-test.js index ad9fb9e7f..07f08c62e 100644 --- a/tests/integration/components/partner/export-stats-test.js +++ b/tests/integration/components/partner/export-stats-test.js @@ -17,7 +17,7 @@ class NotificationsStub extends Service { module('Integration | Component | partner/export-stats', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); @@ -33,7 +33,9 @@ module('Integration | Component | partner/export-stats', function (hooks) { `[data-test-date-range-icon]` ).className; assert.ok(iconElementClass, 'calendar'); - assert.dom(`[data-test-date-range]`).hasText(t('fromDate:() - t:toDate')); + assert + .dom(`[data-test-date-range]`) + .hasText(`${t('fromDate')} - ${t('toDate')}`); assert.dom(`[data-test-export-btn]`).hasText(t('exportCSV')); }); diff --git a/tests/integration/components/partner/invitation-list-test.js b/tests/integration/components/partner/invitation-list-test.js index 47f79db12..e673d349f 100644 --- a/tests/integration/components/partner/invitation-list-test.js +++ b/tests/integration/components/partner/invitation-list-test.js @@ -55,7 +55,7 @@ function registrationRequestSerializer(data, many = false) { module('Integration | Component | partner/invitation-list', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks, 'en'); + setupIntl(hooks, 'en', 'en'); hooks.beforeEach(function () { this.owner.register('service:organization', OrganizationStub); diff --git a/tests/integration/components/partner/invite-client-test.js b/tests/integration/components/partner/invite-client-test.js index f4ee118c4..4b69d29fa 100644 --- a/tests/integration/components/partner/invite-client-test.js +++ b/tests/integration/components/partner/invite-client-test.js @@ -19,7 +19,7 @@ class RealtimeStub extends Service { module('Integration | Component | partner/invite-client', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks, 'en'); + setupIntl(hooks, 'en', 'en'); hooks.beforeEach(function () { this.owner.register('service:organization', OrganizationStub); diff --git a/tests/integration/components/partner/partner-plan-test.js b/tests/integration/components/partner/partner-plan-test.js index 593325b93..26570286c 100644 --- a/tests/integration/components/partner/partner-plan-test.js +++ b/tests/integration/components/partner/partner-plan-test.js @@ -18,7 +18,7 @@ function serializer(payload) { module('Integration | Component | partner/partner-plan', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.server.createList('organization', 2); diff --git a/tests/integration/components/partner/registration-request-pending-list-test.js b/tests/integration/components/partner/registration-request-pending-list-test.js index 5c60cac9f..73baa08f1 100644 --- a/tests/integration/components/partner/registration-request-pending-list-test.js +++ b/tests/integration/components/partner/registration-request-pending-list-test.js @@ -36,7 +36,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks, 'en'); + setupIntl(hooks, 'en', 'en'); hooks.beforeEach(function () { this.owner.register('service:organization', OrganizationStub); diff --git a/tests/integration/components/partner/registration-request-pending-test.js b/tests/integration/components/partner/registration-request-pending-test.js index b2993e89f..cd7cca19c 100644 --- a/tests/integration/components/partner/registration-request-pending-test.js +++ b/tests/integration/components/partner/registration-request-pending-test.js @@ -14,7 +14,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks, 'en'); + setupIntl(hooks, 'en', 'en'); test('it renders email', async function (assert) { this.set('request', { diff --git a/tests/integration/components/project-list-test.js b/tests/integration/components/project-list-test.js index 133a4ee13..03f89d807 100644 --- a/tests/integration/components/project-list-test.js +++ b/tests/integration/components/project-list-test.js @@ -24,7 +24,7 @@ class OrganizationStub extends Service { module('Integration | Component | project list', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { const store = this.owner.lookup('service:store'); @@ -214,10 +214,10 @@ module('Integration | Component | project list', function (hooks) { test.each( 'it renders with correct sortBy selected', [ - [() => `${t('dateUpdated')} ${t('mostRecent')}`, 0], - [() => `${t('dateUpdated')} ${t('leastRecent')}`, 1], - [() => `${t('dateCreated')} ${t('mostRecent')}`, 2], - [() => `${t('dateCreated')} ${t('leastRecent')}`, 3], + [() => `${t('dateUpdated')}${t('mostRecent')}`, 0], + [() => `${t('dateUpdated')}${t('leastRecent')}`, 1], + [() => `${t('dateCreated')}${t('mostRecent')}`, 2], + [() => `${t('dateCreated')}${t('leastRecent')}`, 3], [() => `${t('packageName')} (Z -> A)`, 4], [() => `${t('packageName')} (A -> Z)`, 5], ], diff --git a/tests/integration/components/project-settings/analysis-settings/regulatory-preference-test.js b/tests/integration/components/project-settings/analysis-settings/regulatory-preference-test.js index 99759f886..12721f975 100644 --- a/tests/integration/components/project-settings/analysis-settings/regulatory-preference-test.js +++ b/tests/integration/components/project-settings/analysis-settings/regulatory-preference-test.js @@ -12,7 +12,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Store service diff --git a/tests/integration/components/project-settings/analysis-settings/report-preference-test.js b/tests/integration/components/project-settings/analysis-settings/report-preference-test.js index 6bb1caa45..cb1e65d57 100644 --- a/tests/integration/components/project-settings/analysis-settings/report-preference-test.js +++ b/tests/integration/components/project-settings/analysis-settings/report-preference-test.js @@ -20,7 +20,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.project = this.server.create('project', { diff --git a/tests/integration/components/project-settings/analysis-settings/vulnerability-list/index-test.js b/tests/integration/components/project-settings/analysis-settings/vulnerability-list/index-test.js index 510b233e3..d4443ddf1 100644 --- a/tests/integration/components/project-settings/analysis-settings/vulnerability-list/index-test.js +++ b/tests/integration/components/project-settings/analysis-settings/vulnerability-list/index-test.js @@ -202,7 +202,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server Mocks diff --git a/tests/integration/components/project-settings/dast-scenario-toggle-test.js b/tests/integration/components/project-settings/dast-scenario-toggle-test.js index 1957995c6..e239e080a 100644 --- a/tests/integration/components/project-settings/dast-scenario-toggle-test.js +++ b/tests/integration/components/project-settings/dast-scenario-toggle-test.js @@ -25,7 +25,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/project-settings/general-settings/add-project-collaborator-test.js b/tests/integration/components/project-settings/general-settings/add-project-collaborator-test.js index 89d2bd63f..37c27f4b0 100644 --- a/tests/integration/components/project-settings/general-settings/add-project-collaborator-test.js +++ b/tests/integration/components/project-settings/general-settings/add-project-collaborator-test.js @@ -16,7 +16,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/project-settings/general-settings/add-project-team-test.js b/tests/integration/components/project-settings/general-settings/add-project-team-test.js index 48f978582..1fe49d3c4 100644 --- a/tests/integration/components/project-settings/general-settings/add-project-team-test.js +++ b/tests/integration/components/project-settings/general-settings/add-project-team-test.js @@ -16,7 +16,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/project-settings/general-settings/collaborators-table-test.js b/tests/integration/components/project-settings/general-settings/collaborators-table-test.js index d519aa578..34eaa7912 100644 --- a/tests/integration/components/project-settings/general-settings/collaborators-table-test.js +++ b/tests/integration/components/project-settings/general-settings/collaborators-table-test.js @@ -29,7 +29,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/project-settings/general-settings/device-preferences-automated-dast-test.js b/tests/integration/components/project-settings/general-settings/device-preferences-automated-dast-test.js index 3dd2c6dab..149843df5 100644 --- a/tests/integration/components/project-settings/general-settings/device-preferences-automated-dast-test.js +++ b/tests/integration/components/project-settings/general-settings/device-preferences-automated-dast-test.js @@ -20,7 +20,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { await this.owner.lookup('service:organization').load(); diff --git a/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js b/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js index b9bf37d16..2a84282f6 100644 --- a/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js +++ b/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/index-test.js @@ -34,7 +34,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/scenario-test.js b/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/scenario-test.js index ffb306356..6383e7630 100644 --- a/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/scenario-test.js +++ b/tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/scenario-test.js @@ -1,5 +1,6 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; + import { click, fillIn, @@ -10,12 +11,15 @@ import { waitFor, waitUntil, } from '@ember/test-helpers'; + import { hbs } from 'ember-cli-htmlbars'; import { setupMirage } from 'ember-cli-mirage/test-support'; import { setupIntl, t } from 'ember-intl/test-support'; import Service from '@ember/service'; import { Response } from 'miragejs'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; + class NotificationsStub extends Service { errorMsg = null; successMsg = null; @@ -79,7 +83,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks @@ -214,6 +218,8 @@ module( }); test('it renders', async function (assert) { + assert.expect(8); + this.server.get( '/v2/projects/:projectId/scan_parameter_groups', function (schema, request) { @@ -266,10 +272,10 @@ module( .exists() .containsText(t('dastAutomation.automationScenarios')); - assert - .dom(selectors.scenariosListDesc) - .exists() - .containsText(t('dastAutomation.scenarioListDesc')); + compareInnerHTMLWithIntlTranslation(assert, { + selector: selectors.scenariosListDesc, + message: t('dastAutomation.scenarioListDesc'), + }); assert .dom(selectors.addScenarioBtn) diff --git a/tests/integration/components/project-settings/general-settings/github-project-test.js b/tests/integration/components/project-settings/general-settings/github-project-test.js index 6bbdf6280..b7217802e 100644 --- a/tests/integration/components/project-settings/general-settings/github-project-test.js +++ b/tests/integration/components/project-settings/general-settings/github-project-test.js @@ -43,7 +43,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/project-settings/general-settings/jira-project-test.js b/tests/integration/components/project-settings/general-settings/jira-project-test.js index 1b329e347..8ef3b0c8a 100644 --- a/tests/integration/components/project-settings/general-settings/jira-project-test.js +++ b/tests/integration/components/project-settings/general-settings/jira-project-test.js @@ -27,7 +27,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); diff --git a/tests/integration/components/project-settings/general-settings/project-team-table-test.js b/tests/integration/components/project-settings/general-settings/project-team-table-test.js index e4ed72a02..d642b641c 100644 --- a/tests/integration/components/project-settings/general-settings/project-team-table-test.js +++ b/tests/integration/components/project-settings/general-settings/project-team-table-test.js @@ -29,7 +29,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { // Server mocks diff --git a/tests/integration/components/project-settings/general-settings/proxy-settings-test.js b/tests/integration/components/project-settings/general-settings/proxy-settings-test.js index e4ec4d3c2..44dd30191 100644 --- a/tests/integration/components/project-settings/general-settings/proxy-settings-test.js +++ b/tests/integration/components/project-settings/general-settings/proxy-settings-test.js @@ -6,7 +6,6 @@ import { click, fillIn, render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { faker } from '@faker-js/faker'; import Service from '@ember/service'; -import { capitalize } from '@ember/string'; class NotificationsStub extends Service { errorMsg = null; @@ -31,7 +30,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.get('/profiles/:id/proxy_settings', (schema, req) => { @@ -232,7 +231,7 @@ module( const notify = this.owner.lookup('service:notifications'); assert.strictEqual( notify.successMsg, - `${t('proxyTurned')}${capitalize(t('ON'))}` + `${t('proxyTurned')}${t('on').toUpperCase()}` ); assert.dom(toggleSelector).exists().isChecked(); @@ -240,7 +239,7 @@ module( assert.strictEqual( notify.successMsg, - `${t('proxyTurned')}${capitalize(t('OFF'))}` + `${t('proxyTurned')}${t('off').toUpperCase()}` ); assert.dom(toggleSelector).exists().isNotChecked(); }); diff --git a/tests/integration/components/project-settings/header-test.js b/tests/integration/components/project-settings/header-test.js index a2b4d892b..1a20f62c4 100644 --- a/tests/integration/components/project-settings/header-test.js +++ b/tests/integration/components/project-settings/header-test.js @@ -8,7 +8,7 @@ import { setupIntl, t } from 'ember-intl/test-support'; module('Integration | Component | project-settings/header', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test.each( 'it renders', diff --git a/tests/integration/components/project-settings/view-scenario/add-parameter-form-test.js b/tests/integration/components/project-settings/view-scenario/add-parameter-form-test.js index dcab4a633..42e6eeb6f 100644 --- a/tests/integration/components/project-settings/view-scenario/add-parameter-form-test.js +++ b/tests/integration/components/project-settings/view-scenario/add-parameter-form-test.js @@ -7,6 +7,8 @@ import { setupIntl, t } from 'ember-intl/test-support'; import Service from '@ember/service'; import { Response } from 'miragejs'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; + class NotificationsStub extends Service { errorMsg = null; successMsg = null; @@ -44,7 +46,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:notifications', NotificationsStub); @@ -176,6 +178,8 @@ module( }); test('it shows parameter name errors in inputType textfield helper if thrown', async function (assert) { + assert.expect(4); + const duplicateNameError = 'Name already exists'; this.server.post( @@ -212,11 +216,10 @@ module( await triggerEvent(selectors.inputTypeErrorTooltip, 'mouseenter'); - assert - .dom(selectors.dupInputTypeErrorText) - .containsText( - t('dastAutomation.paramTypeDupText', { type: this.inputType }) - ); + compareInnerHTMLWithIntlTranslation(assert, { + selector: selectors.dupInputTypeErrorText, + message: t('dastAutomation.paramTypeDupText', { type: this.inputType }), + }); }); test('it clears input type and value textfields onClear button click', async function (assert) { diff --git a/tests/integration/components/project-settings/view-scenario/details-column-header-test.js b/tests/integration/components/project-settings/view-scenario/details-column-header-test.js index a906ba11f..779512635 100644 --- a/tests/integration/components/project-settings/view-scenario/details-column-header-test.js +++ b/tests/integration/components/project-settings/view-scenario/details-column-header-test.js @@ -4,6 +4,8 @@ import { render, triggerEvent } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { setupIntl, t } from 'ember-intl/test-support'; +import { compareInnerHTMLWithIntlTranslation } from 'irene/tests/test-utils'; + const selectors = { inputTypeColumnHeaderTooltip: '[data-test-projectSettings-scenarioDetails-inputTypeColumnHeader-tooltip]', @@ -21,9 +23,11 @@ module( 'Integration | Component | project-settings/view-scenario/details-column-header', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test('it renders', async function (assert) { + assert.expect(6); + await render(hbs` `); diff --git a/tests/integration/components/upload-app/index-test.js b/tests/integration/components/upload-app/index-test.js index d613a3a2f..ffe57024b 100644 --- a/tests/integration/components/upload-app/index-test.js +++ b/tests/integration/components/upload-app/index-test.js @@ -36,7 +36,7 @@ class ConfigurationStub extends Service { module('Integration | Component | upload-app', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/upload-app/status/details-test.js b/tests/integration/components/upload-app/status/details-test.js index 50b40264c..a51bbbe61 100644 --- a/tests/integration/components/upload-app/status/details-test.js +++ b/tests/integration/components/upload-app/status/details-test.js @@ -12,7 +12,7 @@ import dayjs from 'dayjs'; module('Integration | Component | upload-app/status/details', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/upload-app/status/index-test.js b/tests/integration/components/upload-app/status/index-test.js index a0a07cf30..8ed797f09 100644 --- a/tests/integration/components/upload-app/status/index-test.js +++ b/tests/integration/components/upload-app/status/index-test.js @@ -29,7 +29,7 @@ class ConfigurationStub extends Service { module('Integration | Component | upload-app/status', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/upload-app/via-link-test.js b/tests/integration/components/upload-app/via-link-test.js index 5efc80303..29339077b 100644 --- a/tests/integration/components/upload-app/via-link-test.js +++ b/tests/integration/components/upload-app/via-link-test.js @@ -23,7 +23,7 @@ class NotificationsStub extends Service { module('Integration | Component | upload-app/via-link', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/upload-app/via-system-test.js b/tests/integration/components/upload-app/via-system-test.js index d7f514182..bf41598b0 100644 --- a/tests/integration/components/upload-app/via-system-test.js +++ b/tests/integration/components/upload-app/via-system-test.js @@ -28,7 +28,7 @@ class RollbarStub extends Service { module('Integration | Component | upload-app/via-system', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.server.createList('organization', 1); diff --git a/tests/integration/components/user-login/index-test.js b/tests/integration/components/user-login/index-test.js index 7910352ad..bdc7033a4 100644 --- a/tests/integration/components/user-login/index-test.js +++ b/tests/integration/components/user-login/index-test.js @@ -37,7 +37,7 @@ class SessionStub extends Service { module('Integration | Component | user-login', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(function () { this.owner.register('service:session', SessionStub); diff --git a/tests/integration/components/user-login/recover-password-test.js b/tests/integration/components/user-login/recover-password-test.js index d8cae6311..719adb95a 100644 --- a/tests/integration/components/user-login/recover-password-test.js +++ b/tests/integration/components/user-login/recover-password-test.js @@ -17,7 +17,7 @@ module( function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.owner.register('service:rollbar', LoggerStub); diff --git a/tests/integration/components/via-login-page-test.js b/tests/integration/components/via-login-page-test.js index 79a50ddfa..6222bbd96 100644 --- a/tests/integration/components/via-login-page-test.js +++ b/tests/integration/components/via-login-page-test.js @@ -21,7 +21,7 @@ class NotificationsStub extends Service { module('Integration | Component | via-login-page', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); test('it renders', async function (assert) { diff --git a/tests/integration/components/via-org-invite-test.js b/tests/integration/components/via-org-invite-test.js index 58558b9ac..5dee7ce19 100644 --- a/tests/integration/components/via-org-invite-test.js +++ b/tests/integration/components/via-org-invite-test.js @@ -23,7 +23,7 @@ module( 'Integration | Component | user-registration/via-org-invite', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(function () { diff --git a/tests/integration/components/via-partner-invite-test.js b/tests/integration/components/via-partner-invite-test.js index 9447924a6..bdb4b4f1d 100644 --- a/tests/integration/components/via-partner-invite-test.js +++ b/tests/integration/components/via-partner-invite-test.js @@ -23,7 +23,7 @@ module( 'Integration | Component | user-registration/via-partner-invite', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); setupMirage(hooks); hooks.beforeEach(function () { diff --git a/tests/integration/helpers/am-monitoring-text-test.js b/tests/integration/helpers/am-monitoring-text-test.js index 03f813432..80e6fdc0e 100644 --- a/tests/integration/helpers/am-monitoring-text-test.js +++ b/tests/integration/helpers/am-monitoring-text-test.js @@ -6,7 +6,7 @@ import { setupIntl, t } from 'ember-intl/test-support'; module('Integration | Helper | am-monitoring-text', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.store = this.owner.lookup('service:store'); diff --git a/tests/integration/helpers/am-status-text-test.js b/tests/integration/helpers/am-status-text-test.js index 9a65268ff..5cbd6d2d5 100644 --- a/tests/integration/helpers/am-status-text-test.js +++ b/tests/integration/helpers/am-status-text-test.js @@ -8,7 +8,7 @@ import { setupMirage } from 'ember-cli-mirage/test-support'; module('Integration | Helper | am-status-text', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); hooks.beforeEach(async function () { this.store = this.owner.lookup('service:store'); diff --git a/tests/integration/helpers/store-name-for-url-test.js b/tests/integration/helpers/store-name-for-url-test.js index 73d6ee18a..3b3a938cc 100644 --- a/tests/integration/helpers/store-name-for-url-test.js +++ b/tests/integration/helpers/store-name-for-url-test.js @@ -6,7 +6,7 @@ import { setupIntl, t } from 'ember-intl/test-support'; module('Integration | Helper | store-name-for-url', function (hooks) { setupRenderingTest(hooks); - setupIntl(hooks); + setupIntl(hooks, 'en'); test.each( 'it renders', diff --git a/tests/test-utils.js b/tests/test-utils.js index 4920798f7..273799a23 100644 --- a/tests/test-utils.js +++ b/tests/test-utils.js @@ -1,4 +1,5 @@ import { underscore } from '@ember/string'; +import { find } from '@ember/test-helpers'; function _serialize_object(payload) { return Object.keys(payload.attrs).reduce((acc, curr) => { @@ -33,3 +34,19 @@ export function objectifyEncodedReqBody(reqBody = '') { return paramsObject; } + +export const compareInnerHTMLWithIntlTranslation = ( + assert, + { element, selector, message, doIncludesCheck } +) => { + const innerHTML = + element?.innerHTML || find(selector.trim()).innerHTML.trim(); + + const assertMessage = `Element HTML: "${innerHTML}" <=====> Compared HTML: "${message}"`; + + if (doIncludesCheck) { + assert.true(innerHTML.includes(message), assertMessage); + } else { + assert.strictEqual(innerHTML, message, assertMessage); + } +}; diff --git a/translations/en.json b/translations/en.json index 8a9a39069..f83177e6f 100644 --- a/translations/en.json +++ b/translations/en.json @@ -109,7 +109,7 @@ }, "appMonitoringModule": { "locatedIn": "Located In", - "initiateUploadComingSoon": " App Store integration will be released soon. For now, please upload the app binary.", + "initiateUploadComingSoon": "App Store integration will be released soon. For now, please upload the app binary.", "lastUploadAttemptText": "Upload was last attempted on", "retryUpload": "Retry Upload", "checkDetails": "Check Details", @@ -298,9 +298,9 @@ "scenarioAdded": "Scenario added", "enterScenarioName": "Enter scenario name", "automationScenarios": "Automation Scenarios", - "scenarioListDesc": " Create multiple scenarios and configure them with the necessary settings for utilization in the automation of Dynamic Application Security Testing (DAST)", + "scenarioListDesc": "Create multiple scenarios and configure them with the necessary settings for utilization in the automation of Dynamic Application Security Testing (DAST)", "deleteDefaultScenarioInfo": "You cannot delete a default scenario.", - "inputTypeColumnHeaderInfo": "Example values for Input Type are
Username, Password or Email ID etc...", + "inputTypeColumnHeaderInfo": "Example values for Input Type are
Username, Password or Email ID etc...", "paramTypeDupText": "Input type - \"{type}\" already exists. Kindly use a different input type.", "inputValue": "Input Value", "inputType": "Input Type", diff --git a/translations/ja.json b/translations/ja.json index e459b3842..8fd2dfc9c 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -109,7 +109,7 @@ }, "appMonitoringModule": { "locatedIn": "Located In", - "initiateUploadComingSoon": " App Store integration will be released soon. For now, please upload the app binary.", + "initiateUploadComingSoon": "App Store integration will be released soon. For now, please upload the app binary.", "lastUploadAttemptText": "Upload was last attempted on", "retryUpload": "Retry Upload", "checkDetails": "Check Details", @@ -300,7 +300,7 @@ "automationScenarios": "Automation Scenarios", "scenarioListDesc": "Create multiple scenarios and configure them with the necessary settings for utilization in the automation of Dynamic Application Security Testing (DAST)", "deleteDefaultScenarioInfo": "You cannot delete a default scenario.", - "inputTypeColumnHeaderInfo": "Example values for Input Type are
Username, Password or Email ID etc...", + "inputTypeColumnHeaderInfo": "Example values for Input Type are
Username, Password or Email ID etc...", "paramTypeDupText": "Input type - \"{type}\" already exists. Kindly use a different input type.", "inputValue": "Input Value", "inputType": "Input Type", diff --git a/types/global.d.ts b/types/global.d.ts index c772fa38e..5fc763513 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -5,6 +5,7 @@ import type EmberConcurrencyRegistry from 'ember-concurrency/template-registry'; import type EmberPowerSelectRegistry from 'ember-power-select/template-registry'; import type EmberBasicDropdownRegistry from 'ember-basic-dropdown/template-registry'; import type EmberTableRegistry from 'ember-table/template-registry'; +import type EmberIntlRegistry from 'ember-intl/template-registry'; import type AkSvgRegistry from 'ak-svg'; // Types for compiled templates @@ -21,7 +22,8 @@ declare module '@glint/environment-ember-loose/registry' { EmberTableRegistry, EmberConcurrencyRegistry, EmberPowerSelectRegistry, - EmberBasicDropdownRegistry { + EmberBasicDropdownRegistry, + EmberIntlRegistry { element: HelperLike<{ Args: { Positional: [tagName: string] }; Return: ComponentLike<{ @@ -54,17 +56,6 @@ declare module '@glint/environment-ember-loose/registry' { Return: string; }>; - t: HelperLike<{ - Args: { - Positional: [string]; - Named: { - [key: string]: unknown; - htmlSafe?: boolean; - }; - }; - Return: string; - }>; - eq: HelperLike<{ Args: { Positional: [string | number, string | number];