A platform for community discussion. Free, open, simple.
FIX: flaky admin_customize_themes_spec (#32169)
Krzysztof Kotlarek601fecde064c
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js b/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.jsindex 4229d3fdb7e..21721e2f3e0 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js@@ -312,10 +312,12 @@ export default class AdminCustomizeThemesShowController extends Controller {@actionupdateLocale(value) {+ this.set("model.loadingTranslations", true);this.set("model.locale", value);- ajax(this.getTranslationsUrl).then(({ translations }) =>- this.set("model.translations", translations)- );+ ajax(this.getTranslationsUrl).then(({ translations }) => {+ this.set("model.translations", translations);+ this.set("model.loadingTranslations", false);+ });}@actiondiff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjsindex 5ce5d5a7139..af5b3f1b4a7 100644--- a/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-show.gjs@@ -1,6 +1,7 @@import { fn, hash } from "@ember/helper";import { LinkTo } from "@ember/routing";import RouteTemplate from "ember-route-template";+import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import DButton from "discourse/components/d-button";import PluginOutlet from "discourse/components/plugin-outlet";import TextField from "discourse/components/text-field";@@ -541,18 +542,22 @@ export default RouteTemplate(class="translation-selector"/></div>- <section- class="form-horizontal theme settings translations control-unit"+ <ConditionalLoadingSpinner+ @condition={{@controller.model.loadingTranslations}}>-- {{#each @controller.translations as |translation|}}- <ThemeTranslation- @translation={{translation}}- @model={{@controller.model}}- class="theme-translation"- />- {{/each}}- </section>+ <section+ class="form-horizontal theme settings translations control-unit"+ >++ {{#each @controller.translations as |translation|}}+ <ThemeTranslation+ @translation={{translation}}+ @model={{@controller.model}}+ class="theme-translation"+ />+ {{/each}}+ </section>+ </ConditionalLoadingSpinner></div>{{/if}}diff --git a/spec/system/admin_customize_themes_spec.rb b/spec/system/admin_customize_themes_spec.rbindex a57202ed2fe..ba96e4bea18 100644--- a/spec/system/admin_customize_themes_spec.rb+++ b/spec/system/admin_customize_themes_spec.rb@@ -87,7 +87,7 @@ describe "Admin Customize Themes", type: :system doexpect(theme_translations_settings_editor.get_input_value).to have_content("Hello World")end- xit "should allow admin to edit and save the theme translations from other languages" do+ it "should allow admin to edit and save the theme translations from other languages" dotheme.set_field(target: :translations,name: "en",@@ -109,6 +109,8 @@ describe "Admin Customize Themes", type: :system dotheme_translations_picker = PageObjects::Components::SelectKit.new(".translation-selector")theme_translations_picker.select_row_by_value("fr")+ expect(page).to have_css(".translations")+expect(theme_translations_settings_editor.get_input_value).to have_content("Bonjour!")theme_translations_settings_editor.fill_in("Hello World in French")