From 23c9ac37991f4788d57c421312d6ef70a8fff77f Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Thu, 25 Jul 2024 14:35:15 -0700 Subject: [PATCH 1/2] created user-guide-link page object and updated integration test to use it --- .../integration/components/user-guide-link-test.js | 13 ++++++------- .../tests/pages/components/user-guide-link.js | 12 ++++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 packages/frontend/tests/pages/components/user-guide-link.js diff --git a/packages/frontend/tests/integration/components/user-guide-link-test.js b/packages/frontend/tests/integration/components/user-guide-link-test.js index 780d62011f..9c3897c220 100644 --- a/packages/frontend/tests/integration/components/user-guide-link-test.js +++ b/packages/frontend/tests/integration/components/user-guide-link-test.js @@ -3,6 +3,7 @@ import { setupRenderingTest } from 'frontend/tests/helpers'; import { render } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import { setLocale, setupIntl } from 'ember-intl/test-support'; +import { component } from 'frontend/tests/pages/components/user-guide-link'; module('Integration | Component | user-guide-link', function (hooks) { setupRenderingTest(hooks); @@ -11,16 +12,14 @@ module('Integration | Component | user-guide-link', function (hooks) { test('it renders', async function (assert) { await render(hbs``); - assert.dom('[data-test-user-guide-link]').exists(); - assert.dom('[data-test-user-guide-link-icon]').exists(); - assert.dom('[data-test-user-guide-link-icon]').hasText('Ilios User Guide'); + assert.ok(component); + assert.ok(component.icon); + assert.strictEqual(component.icon.title, 'Ilios User Guide'); await setLocale('es'); - - assert.dom('[data-test-user-guide-link-icon]').hasText('Ilios Guía de usuario'); + assert.strictEqual(component.icon.title, 'Ilios Guía de usuario'); await setLocale('fr'); - - assert.dom('[data-test-user-guide-link-icon]').hasText("Ilios Guide d'utilisation"); + assert.strictEqual(component.icon.title, "Ilios Guide d'utilisation"); }); }); diff --git a/packages/frontend/tests/pages/components/user-guide-link.js b/packages/frontend/tests/pages/components/user-guide-link.js new file mode 100644 index 0000000000..0ad281ac67 --- /dev/null +++ b/packages/frontend/tests/pages/components/user-guide-link.js @@ -0,0 +1,12 @@ +import { create, text } from 'ember-cli-page-object'; + +const definition = { + scope: '[data-test-user-guide-link]', + icon: { + scope: '[data-test-user-guide-link-icon]', + title: text('title'), + }, +}; + +export default definition; +export const component = create(definition); From fe6e9a5f4543611e0811745fe4400f17e8b6c309 Mon Sep 17 00:00:00 2001 From: Michael Chadwick Date: Thu, 25 Jul 2024 14:39:00 -0700 Subject: [PATCH 2/2] use ember-intl to get title instead of hardcoding --- .../tests/integration/components/user-guide-link-test.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/frontend/tests/integration/components/user-guide-link-test.js b/packages/frontend/tests/integration/components/user-guide-link-test.js index 9c3897c220..e3fc131978 100644 --- a/packages/frontend/tests/integration/components/user-guide-link-test.js +++ b/packages/frontend/tests/integration/components/user-guide-link-test.js @@ -10,16 +10,18 @@ module('Integration | Component | user-guide-link', function (hooks) { setupIntl(hooks, 'en-us'); test('it renders', async function (assert) { + this.intl = this.owner.lookup('service:intl'); + await render(hbs``); assert.ok(component); assert.ok(component.icon); - assert.strictEqual(component.icon.title, 'Ilios User Guide'); + assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide')); await setLocale('es'); - assert.strictEqual(component.icon.title, 'Ilios Guía de usuario'); + assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide')); await setLocale('fr'); - assert.strictEqual(component.icon.title, "Ilios Guide d'utilisation"); + assert.strictEqual(component.icon.title, this.intl.t('general.iliosUserGuide')); }); });