mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-02-16 08:24:50 +00:00
REFACTOR: Use the new format for acceptance tests. (#52)
This commit is contained in:
parent
f4cce75b3a
commit
ac90815bdc
@ -1,8 +1,9 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Chat Integration", {
|
||||
loggedIn: true,
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
pretend(server) {
|
||||
acceptance("Chat Integration", function (needs) {
|
||||
needs.user();
|
||||
|
||||
needs.pretender((server) => {
|
||||
const response = (object) => {
|
||||
return [200, { "Content-Type": "text/html; charset=utf-8" }, object];
|
||||
};
|
||||
@ -82,13 +83,15 @@ acceptance("Chat Integration", {
|
||||
server.get("/groups/search.json", () => {
|
||||
return jsonResponse([]);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
test("Rules load successfully", async (assert) => {
|
||||
await visit("/admin/plugins/chat");
|
||||
|
||||
assert.ok(exists("#admin-plugin-chat table"), "it shows the table of rules");
|
||||
assert.ok(
|
||||
exists("#admin-plugin-chat table"),
|
||||
"it shows the table of rules"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find("#admin-plugin-chat table tr td").eq(0).text().trim(),
|
||||
@ -168,7 +171,10 @@ test("Create rule works", async (assert) => {
|
||||
|
||||
await click(".channel-footer button:first");
|
||||
|
||||
assert.ok(exists("#chat-integration-edit-rule_modal"), "modal opens on edit");
|
||||
assert.ok(
|
||||
exists("#chat-integration-edit-rule_modal"),
|
||||
"modal opens on edit"
|
||||
);
|
||||
assert.ok(find("#save-rule").prop("disabled") === false, "save is enabled");
|
||||
|
||||
await click("#save-rule");
|
||||
@ -186,7 +192,10 @@ test("Edit rule works", async (assert) => {
|
||||
|
||||
await click(".edit:first");
|
||||
|
||||
assert.ok(exists("#chat-integration-edit-rule_modal"), "modal opens on edit");
|
||||
assert.ok(
|
||||
exists("#chat-integration-edit-rule_modal"),
|
||||
"modal opens on edit"
|
||||
);
|
||||
assert.ok(
|
||||
find("#save-rule").prop("disabled") === false,
|
||||
"it enables the save button"
|
||||
@ -225,7 +234,10 @@ test("Test channel works", async (assert) => {
|
||||
await click(".btn-chat-test");
|
||||
|
||||
assert.ok(exists("#chat_integration_test_modal"), "it displays the modal");
|
||||
assert.ok(find("#send-test").prop("disabled"), "it disables the send button");
|
||||
assert.ok(
|
||||
find("#send-test").prop("disabled"),
|
||||
"it disables the send button"
|
||||
);
|
||||
|
||||
await fillIn("#choose-topic-title", "9318");
|
||||
await click("#chat_integration_test_modal .radio:first");
|
||||
@ -241,5 +253,9 @@ test("Test channel works", async (assert) => {
|
||||
exists("#chat_integration_test_modal"),
|
||||
"modal doesn't close on send"
|
||||
);
|
||||
assert.ok(exists("#modal-alert.alert-success"), "success message displayed");
|
||||
assert.ok(
|
||||
exists("#modal-alert.alert-success"),
|
||||
"success message displayed"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user