diff --git a/app/templates/app/generator.hbs b/app/templates/app/generator.hbs index 0c8d91f..8159c14 100644 --- a/app/templates/app/generator.hbs +++ b/app/templates/app/generator.hbs @@ -57,6 +57,7 @@ loading={{this.meshGenerating}} icon-start="download" {{on 'click' this.exportSTL}} + data-test-export-stl > {{t 'export_stl'}} diff --git a/package.json b/package.json index a60b42b..f34d0b7 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "generate:type_img": "misc/text_type/generate_logo.sh" }, "devDependencies": { + "@babel/core": "7", "@babel/eslint-parser": "^7.21.3", "@babel/plugin-proposal-decorators": "^7.21.0", "@ember/optional-features": "^2.0.0", @@ -38,6 +39,7 @@ "@ember/test-helpers": "^3.2.0", "@glimmer/component": "^1.1.2", "@glimmer/tracking": "^1.1.2", + "@glint/template": "1", "@onehilltech/ember-cli-google-analytics": "^1.5.0", "@percy/cli": "^1.27.3", "@percy/ember": "^4.2.0", @@ -83,6 +85,7 @@ "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-inline-content": "^0.4.1", "ember-cli-sass": "^10.0.1", + "ember-cli-script": "1.0.0", "ember-cli-sri": "^2.1.1", "ember-cli-terser": "^4.0.2", "ember-cli-typescript": "^4.1.0", diff --git a/tests/acceptance/navigation-test.ts b/tests/acceptance/navigation-test.ts index 05796a4..589c872 100644 --- a/tests/acceptance/navigation-test.ts +++ b/tests/acceptance/navigation-test.ts @@ -2,14 +2,12 @@ import { module, test } from 'qunit'; import { visit, currentURL, click } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import mockFontManager from 'text2stl/tests/helpers/mock-font-manager'; -import mockGtag from 'text2stl/tests/helpers/mock-gtag'; module('Acceptance | navigation', function (hooks) { setupApplicationTest(hooks); hooks.beforeEach(function () { mockFontManager(this.owner); - mockGtag(this.owner); }); test('visiting /', async function (assert) { diff --git a/tests/acceptance/visual-test.ts b/tests/acceptance/visual-test.ts index 2f5aaf8..6bdc713 100644 --- a/tests/acceptance/visual-test.ts +++ b/tests/acceptance/visual-test.ts @@ -1,12 +1,11 @@ /* eslint-disable no-await-in-loop */ import { module, test } from 'qunit'; -import { visit } from '@ember/test-helpers'; +import { visit, waitFor } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import testsSettings from './_tests-settings'; import percySnapshot from '@percy/ember'; import TextMakerSettings from 'text2stl/models/text-maker-settings'; import mockFontManager from 'text2stl/tests/helpers/mock-font-manager'; -import mockGtag from 'text2stl/tests/helpers/mock-gtag'; import waitCalciteReady from 'text2stl/tests/helpers/wait-calcite-ready'; module('Acceptance | visual', function (hooks) { @@ -14,7 +13,6 @@ module('Acceptance | visual', function (hooks) { hooks.beforeEach(function () { mockFontManager(this.owner); - mockGtag(this.owner); }); for (let testIdx = 0; testIdx < testsSettings.length; testIdx++) { @@ -24,10 +22,7 @@ module('Acceptance | visual', function (hooks) { // Load test settings through QP await visit(`/en-us/generator?modelSettings=${settingsQP}`); await waitCalciteReady(); - - await new Promise(function (resolve) { - setTimeout(resolve, 250); - }); + await waitFor('[data-test-export-stl]:not([loading])'); await percySnapshot(`visual test #${testIdx + 1}`); assert.true(true); }); diff --git a/tests/helpers/mock-gtag.ts b/tests/helpers/mock-gtag.ts deleted file mode 100644 index 475bc8e..0000000 --- a/tests/helpers/mock-gtag.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type Owner from '@ember/owner'; -import Service from '@ember/service'; - -export default function (owner: Owner) { - owner.register( - 'service:gtag', - class extends Service { - event() {} - }, - ); -} diff --git a/tests/integration/components/settings-form/handle-test.ts b/tests/integration/components/settings-form/handle-test.ts index 3e7cccb..2bf7685 100644 --- a/tests/integration/components/settings-form/handle-test.ts +++ b/tests/integration/components/settings-form/handle-test.ts @@ -1,6 +1,6 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; -import { render, click } from '@ember/test-helpers'; +import { render, click, waitFor } from '@ember/test-helpers'; import { hbs } from 'ember-cli-htmlbars'; import config from 'text2stl/config/environment'; const { @@ -29,6 +29,7 @@ module('Integration | Component | advanced-settings-form/handle', function (hook .doesNotExist('it does not render handle settings when handle-type is "none"'); await click('[data-test-handle-type-item] [data-test-value="hole"]'); + await waitFor('[data-test-handle-position]', { timeout: 1000 }); assert.dom('[data-test-handle-position]').exists('it show handle-position input'); assert.dom('[data-test-settings-handle-size]').exists('it show handle-size input'); diff --git a/tests/integration/components/settings-form/type-select-test.ts b/tests/integration/components/settings-form/type-select-test.ts index 230bd04..48999d6 100644 --- a/tests/integration/components/settings-form/type-select-test.ts +++ b/tests/integration/components/settings-form/type-select-test.ts @@ -44,7 +44,7 @@ module('Integration | Component | settings-form/select-type', function (hooks) { await click( `calcite-segmented-control-item[data-test-type="${ModelType.VerticalTextWithSupport}"]`, ); - await waitUntil(() => model.text === 'some multiline text'); + await waitUntil(() => model.text === 'some multiline text', { timeout: 1000 }); assert.strictEqual(model.text, 'some multiline text', 'text was updated'); }); }); diff --git a/tests/unit/controllers/app/generator-test.ts b/tests/unit/controllers/app/generator-test.ts index 0318ce4..f3965e6 100644 --- a/tests/unit/controllers/app/generator-test.ts +++ b/tests/unit/controllers/app/generator-test.ts @@ -4,8 +4,6 @@ import waitUntil from '@ember/test-helpers/wait-until'; import mockTextSettings from 'text2stl/tests/helpers/mock-text-maker-settings'; import { Font } from 'opentype.js'; import { Mesh } from 'three'; -import mockGtag from 'text2stl/tests/helpers/mock-gtag'; - import type { TextMakerParameters } from 'text2stl/services/text-maker'; import type { Variant } from 'text2stl/services/font-manager'; import type GeneratorController from 'text2stl/controllers/app/generator'; @@ -79,7 +77,6 @@ module('Unit | Controller | app/generator', function (hooks) { test('it generate a STL with mesh', async function (assert) { assert.expect(6); - mockGtag(this.owner); const controller = this.owner.lookup('controller:app/generator') as GeneratorController; const model = mockTextSettings({ diff --git a/yarn.lock b/yarn.lock index 7964730..23cacde 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,7 +28,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.2.tgz#6a12ced93455827037bfb5ed8492820d60fc32cc" integrity sha512-0S9TQMmDHlqAZ2ITT95irXKfxN9bncq8ZCoJhun3nHL/lLUxd2NKBJYoNGWH7S0hz6fRQwWlAWn/ILM0C70KZQ== -"@babel/core@^7.1.6", "@babel/core@^7.12.0", "@babel/core@^7.16.10", "@babel/core@^7.16.7", "@babel/core@^7.21.0", "@babel/core@^7.3.4": +"@babel/core@7", "@babel/core@^7.1.6", "@babel/core@^7.12.0", "@babel/core@^7.16.10", "@babel/core@^7.16.7", "@babel/core@^7.21.0", "@babel/core@^7.3.4": version "7.23.2" resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.2.tgz#ed10df0d580fff67c5f3ee70fd22e2e4c90a9f94" integrity sha512-n7s51eWdaWZ3vGT2tD4T7J6eJs3QoBXydv7vkUM06Bf1cbVD2Kc2UrkzhiQwobfV7NwOnQXYL7UBJ5VPU+RGoQ== @@ -1408,6 +1408,11 @@ dependencies: babel-plugin-debug-macros "^0.3.4" +"@glint/template@1": + version "1.2.1" + resolved "https://registry.npmjs.org/@glint/template/-/template-1.2.1.tgz#b17b2e490ad1826d45e7bec3b87149ca926600e3" + integrity sha512-rlYy/93fAhYjXmTchWcwCpPFMfrqBYEskzbDYawS2oz4DVwtf4fOITLKB0QddQMI7WUCjgXAiIGZqcNa/R4YeQ== + "@handlebars/parser@~2.0.0": version "2.0.0" resolved "https://registry.npmjs.org/@handlebars/parser/-/parser-2.0.0.tgz#5e8b7298f31ff8f7b260e6b7363c7e9ceed7d9c5" @@ -5400,6 +5405,14 @@ ember-cli-sass@^10.0.1: broccoli-sass-source-maps "^4.0.0" ember-cli-version-checker "^2.1.0" +ember-cli-script@1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/ember-cli-script/-/ember-cli-script-1.0.0.tgz#7868072bf27005685f89775e703b43b0d0762720" + integrity sha512-BPlpNik6YEsiSWCIpYJcEs7iVxavExMrVgkkPeLTUKTZwGf6fu0jjqmsdf7jCUupXzenl19XDWjBy7qXFrXfzQ== + dependencies: + ember-cli-babel "^7.26.10" + ember-cli-htmlbars "^5.7.2" + ember-cli-sri@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/ember-cli-sri/-/ember-cli-sri-2.1.1.tgz#971620934a4b9183cf7923cc03e178b83aa907fd"