Test scenarios with the Glimmer Post Stream enabled and disabled

This commit is contained in:
Sérgio Saquetim 2025-04-29 20:47:41 -03:00
parent cc5da6c7a6
commit 7750918f6d
No known key found for this signature in database
GPG Key ID: B4E3D7F11E793062
2 changed files with 54 additions and 40 deletions

View File

@ -15,6 +15,10 @@ describe "About page", type: :system do
SiteSetting.show_who_marked_solved = true
end
%w[enabled disabled].each do |value|
before { SiteSetting.glimmer_post_stream_mode = value }
context "when glimmer_post_stream_mode=#{value}" do
it "accepts post as solution and shows in OP" do
sign_in(accepter)
@ -34,3 +38,5 @@ describe "About page", type: :system do
expect(topic_page.find("blockquote")).to have_content("The answer is 42")
end
end
end
end

View File

@ -8,7 +8,13 @@ import pretender, {
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { postStreamWithAcceptedAnswerExcerpt } from "../helpers/discourse-solved-helpers";
acceptance("Discourse Solved Plugin", function (needs) {
["enabled", "disabled"].forEach((postStreamMode) => {
acceptance(
`Discourse Solved Plugin (glimmer_post_stream_mode = ${postStreamMode})`,
function (needs) {
needs.settings({
glimmer_post_stream_mode: postStreamMode,
});
needs.user();
test("A topic with an accepted answer shows an excerpt of the answer, if provided", async function (assert) {
@ -42,4 +48,6 @@ acceptance("Discourse Solved Plugin", function (needs) {
assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
assert.dom(".topic-statuses .solved").exists("shows the right icon");
});
}
);
});