DEV: Clean up skipped tests (#15747)

Many of the tests work now that other, general fixes have been made.
I've deleted some that seem to have lost functionality.
This commit is contained in:
Robin Ward 2022-01-31 15:31:13 -05:00 committed by GitHub
parent 18116433ee
commit e3c5a40432
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 128 additions and 122 deletions

View File

@ -1,6 +1,8 @@
let cdn, baseUrl, baseUri, baseUriMatcher;
let S3BaseUrl, S3CDN;
let snapshot;
export default function getURL(url) {
if (baseUri === undefined) {
setPrefix($('meta[name="discourse-base-uri"]').attr("content") || "");
@ -59,15 +61,43 @@ export function setPrefix(configBaseUri) {
baseUriMatcher = new RegExp(`^${baseUri}(/|$)`);
}
export function setupURL(configCdn, configBaseUrl, configBaseUri) {
export function setupURL(configCdn, configBaseUrl, configBaseUri, opts) {
opts = opts || {};
cdn = configCdn;
baseUrl = configBaseUrl;
setPrefix(configBaseUri);
if (opts?.snapshot) {
snapshot = {
cdn,
baseUri,
baseUrl,
configBaseUrl,
baseUriMatcher,
};
}
}
export function setupS3CDN(configS3BaseUrl, configS3CDN) {
// In a test environment we might change these values and, after tests, want to restore them.
export function restoreBaseUri() {
if (snapshot) {
cdn = snapshot.cdn;
baseUri = snapshot.baseUri;
baseUrl = snapshot.baseUrl;
baseUriMatcher = snapshot.baseUriMatcher;
S3BaseUrl = snapshot.S3BaseUrl;
S3CDN = snapshot.S3CDN;
}
}
export function setupS3CDN(configS3BaseUrl, configS3CDN, opts) {
S3BaseUrl = configS3BaseUrl;
S3CDN = configS3CDN;
if (opts?.snapshot) {
snapshot = snapshot || {};
snapshot.S3BaseUrl = S3BaseUrl;
snapshot.S3CDN = S3CDN;
}
}
// We can use this to identify when navigating on the same host but outside of the

View File

@ -8,7 +8,7 @@ import {
import { click, fillIn, visit } from "@ember/test-helpers";
import I18n from "I18n";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { skip } from "qunit";
import { test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic";
import { cloneJSON } from "discourse-common/lib/object";
@ -104,7 +104,7 @@ acceptance("Bookmarking", function (needs) {
server.get("/t/280.json", () => helper.response(topicResponse));
});
skip("Bookmarks modal opening", async function (assert) {
test("Bookmarks modal opening", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
assert.ok(
@ -113,7 +113,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Bookmarks modal selecting reminder type", async function (assert) {
test("Bookmarks modal selecting reminder type", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
@ -133,7 +133,7 @@ acceptance("Bookmarking", function (needs) {
await click("#save-bookmark");
});
skip("Saving a bookmark with a reminder", async function (assert) {
test("Saving a bookmark with a reminder", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await fillIn("input#bookmark-name", "Check this out later");
@ -151,7 +151,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Opening the options panel and remembering the option", async function (assert) {
test("Opening the options panel and remembering the option", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click(".bookmark-options-button");
@ -174,7 +174,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Saving a bookmark with no reminder or name", async function (assert) {
test("Saving a bookmark with no reminder or name", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click("#save-bookmark");
@ -191,7 +191,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Deleting a bookmark with a reminder", async function (assert) {
test("Deleting a bookmark with a reminder", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click("#tap_tile_tomorrow");
@ -221,7 +221,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Cancelling saving a bookmark", async function (assert) {
test("Cancelling saving a bookmark", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal();
await click(".d-modal-cancel");
@ -231,7 +231,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Editing a bookmark", async function (assert) {
test("Editing a bookmark", async function (assert) {
await visit("/t/internationalization-localization/280");
let now = moment.tz(loggedInUser().resolvedTimezone(loggedInUser()));
let tomorrow = now.add(1, "day").format("YYYY-MM-DD");
@ -257,7 +257,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Using a post date for the reminder date", async function (assert) {
test("Using a post date for the reminder date", async function (assert) {
await visit("/t/internationalization-localization/280");
let postDate = moment.tz(
"2036-01-15",
@ -286,7 +286,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Cannot use the post date for a reminder when the post date is in the past", async function (assert) {
test("Cannot use the post date for a reminder when the post date is in the past", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal(2);
assert.notOk(
@ -295,7 +295,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("The topic level bookmark button deletes all bookmarks if several posts on the topic are bookmarked", async function (assert) {
test("The topic level bookmark button deletes all bookmarks if several posts on the topic are bookmarked", async function (assert) {
const yesButton = "a.btn-primary";
const noButton = "a.btn-default";
@ -341,7 +341,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("The topic level bookmark button opens the edit modal if only the first post on the topic is bookmarked", async function (assert) {
test("The topic level bookmark button opens the edit modal if only the first post on the topic is bookmarked", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal(1);
await click("#save-bookmark");
@ -360,7 +360,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Creating and editing a topic level bookmark", async function (assert) {
test("Creating and editing a topic level bookmark", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-button-bookmark");
@ -432,7 +432,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("Deleting a topic_level bookmark with a reminder", async function (assert) {
test("Deleting a topic_level bookmark with a reminder", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-button-bookmark");
await click("#save-bookmark");
@ -467,7 +467,7 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("The topic level bookmark button opens the edit modal if only one post in the post stream is bookmarked", async function (assert) {
test("The topic level bookmark button opens the edit modal if only one post in the post stream is bookmarked", async function (assert) {
await visit("/t/internationalization-localization/280");
await openBookmarkModal(2);
await click("#save-bookmark");
@ -486,12 +486,12 @@ acceptance("Bookmarking", function (needs) {
);
});
skip("The topic level bookmark button shows an icon with a clock if there is a bookmark with a reminder on the first post", async function (assert) {
test("The topic level bookmark button shows an icon with a clock if there is a bookmark with a reminder on the first post", async function (assert) {
const postNumber = 1;
await testTopicLevelBookmarkButtonIcon(assert, postNumber);
});
skip("The topic level bookmark button shows an icon with a clock if there is a bookmark with a reminder on the second post", async function (assert) {
test("The topic level bookmark button shows an icon with a clock if there is a bookmark with a reminder on the second post", async function (assert) {
const postNumber = 2;
await testTopicLevelBookmarkButtonIcon(assert, postNumber);
});

View File

@ -13,7 +13,7 @@ import { Promise } from "rsvp";
import { _clearSnapshots } from "select-kit/components/composer-actions";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import sinon from "sinon";
import { skip, test } from "qunit";
import { test } from "qunit";
import { toggleCheckDraftPopup } from "discourse/controllers/composer";
acceptance("Composer Actions", function (needs) {
@ -35,7 +35,7 @@ acceptance("Composer Actions", function (needs) {
assert.ok(queryAll(".d-editor-input").val(), "this is the reply");
});
skip("replying to post", async function (assert) {
test("replying to post", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -76,7 +76,7 @@ acceptance("Composer Actions", function (needs) {
);
});
skip("replying to post - reply_to_topic", async function (assert) {
test("replying to post - reply_to_topic", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -103,7 +103,7 @@ acceptance("Composer Actions", function (needs) {
);
});
skip("replying to post - toggle_whisper", async function (assert) {
test("replying to post - toggle_whisper", async function (assert) {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
@ -405,7 +405,7 @@ acceptance("Composer Actions", function (needs) {
);
});
skip("replying to post as TL3 user", async function (assert) {
test("replying to post as TL3 user", async function (assert) {
const composerActions = selectKit(".composer-actions");
updateCurrentUser({ moderator: false, admin: false, trust_level: 3 });

View File

@ -1,7 +1,6 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import I18n from "I18n";
import { skip, test } from "qunit";
import { test } from "qunit";
acceptance("Composer - Edit conflict", function (needs) {
needs.user();
@ -14,24 +13,6 @@ acceptance("Composer - Edit conflict", function (needs) {
});
});
skip("Edit a post that causes an edit conflict", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".topic-post:nth-of-type(1) button.show-more-actions");
await click(".topic-post:nth-of-type(1) button.edit");
await fillIn(".d-editor-input", "this will 409");
await click("#reply-control button.create");
assert.strictEqual(
queryAll("#reply-control button.create").text().trim(),
I18n.t("composer.overwrite_edit"),
"it shows the overwrite button"
);
assert.ok(
queryAll("#draft-status .d-icon-user-edit"),
"error icon should be there"
);
await click(".modal .btn-primary");
});
test("Should not send originalText when posting a new reply", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".topic-post:nth-of-type(1) button.reply");

View File

@ -17,7 +17,7 @@ import {
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "I18n";
import { skip, test } from "qunit";
import { test } from "qunit";
import { Promise } from "rsvp";
import sinon from "sinon";
@ -43,7 +43,7 @@ acceptance("Composer", function (needs) {
});
});
skip("Tests the Composer controls", async function (assert) {
test("Tests the Composer controls", async function (assert) {
await visit("/");
assert.ok(exists("#create-topic"), "the create button is visible");
@ -58,13 +58,13 @@ acceptance("Composer", function (needs) {
"body errors are hidden by default"
);
await click("a.toggle-preview");
await click(".toggle-preview");
assert.ok(
!exists(".d-editor-preview:visible"),
"clicking the toggle hides the preview"
);
await click("a.toggle-preview");
await click(".toggle-preview");
assert.ok(
exists(".d-editor-preview:visible"),
"clicking the toggle shows the preview again"
@ -116,9 +116,9 @@ acceptance("Composer", function (needs) {
);
await click("#reply-control a.cancel");
assert.ok(exists(".bootbox.modal"), "it pops up a confirmation dialog");
assert.ok(exists(".d-modal"), "it pops up a confirmation dialog");
await click(".modal-footer a:nth-of-type(2)");
await click(".modal-footer .discard-draft");
assert.ok(!exists(".bootbox.modal"), "the confirmation can be cancelled");
});
@ -234,7 +234,7 @@ acceptance("Composer", function (needs) {
);
});
skip("Posting on a different topic", async function (assert) {
test("Posting on a different topic", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .btn.create");
await fillIn(
@ -386,24 +386,6 @@ acceptance("Composer", function (needs) {
assert.strictEqual(count(".topic-post.staged"), 0);
});
skip("Editing a post can rollback to old content", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".topic-post:nth-of-type(1) button.show-more-actions");
await click(".topic-post:nth-of-type(1) button.edit");
await fillIn(".d-editor-input", "this will 409");
await fillIn("#reply-title", "This is the new text for the title");
await click("#reply-control button.create");
assert.ok(!exists(".topic-post.staged"));
assert.strictEqual(
query(".topic-post .cooked").innerText,
"Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?"
);
await click(".bootbox.modal .btn-primary");
});
test("Composer can switch between edits", async function (assert) {
await visit("/t/this-is-a-test-topic/9");
@ -686,7 +668,7 @@ acceptance("Composer", function (needs) {
}
});
skip("Can switch states without abandon popup", async function (assert) {
test("Can switch states without abandon popup", async function (assert) {
try {
toggleCheckDraftPopup(true);
@ -834,7 +816,7 @@ acceptance("Composer", function (needs) {
);
});
skip("Shows duplicate_link notice", async function (assert) {
test("Shows duplicate_link notice", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#topic-footer-buttons .create");

View File

@ -1,5 +1,6 @@
import {
acceptance,
chromeTest,
count,
exists,
query,
@ -16,7 +17,7 @@ import {
} from "@ember/test-helpers";
import I18n from "I18n";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { skip, test } from "qunit";
import { test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
import topicFixtures from "discourse/tests/fixtures/topic";
import { cloneJSON } from "discourse-common/lib/object";
@ -354,59 +355,69 @@ acceptance("Topic featured links", function (needs) {
assert.ok(!exists(".gap"), "it hides gap");
});
// quote related skip tests were chromeTest before
chromeTest(
"Quoting a quote keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".quote-button .insert-quote");
skip("Quoting a quote keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".quote-button .insert-quote");
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
}
);
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
});
chromeTest(
"Quoting a quote of a different topic keeps the original topic title",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_9 blockquote");
await click(".quote-button .insert-quote");
skip("Quoting a quote of a different topic keeps the original topic title", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_9 blockquote");
await click(".quote-button .insert-quote");
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf(
'quote="A new topic with a link to another topic, post:3, topic:62"'
) !== -1
);
}
);
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf(
'quote="A new topic with a link to another topic, post:3, topic:62"'
) !== -1
);
});
chromeTest(
"Quoting a quote with the Reply button keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".reply");
skip("Quoting a quote with the Reply button keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".reply");
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
});
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
}
);
// Using J/K on Firefox clean the text selection, so this won't work there
skip("Quoting a quote with replyAsNewTopic keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await triggerKeyEvent(document, "keypress", "j".charCodeAt(0));
await triggerKeyEvent(document, "keypress", "t".charCodeAt(0));
chromeTest(
"Quoting a quote with replyAsNewTopic keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await triggerKeyEvent(document, "keypress", "j".charCodeAt(0));
await triggerKeyEvent(document, "keypress", "t".charCodeAt(0));
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
});
assert.ok(
queryAll(".d-editor-input")
.val()
.indexOf('quote="codinghorror said, post:3, topic:280"') !== -1
);
}
);
test("Quoting by selecting text can mark the quote as full", async function (assert) {
await visit("/t/internationalization-localization/280");

View File

@ -21,6 +21,7 @@ import { _clearSnapshots } from "select-kit/components/composer-actions";
import { clearHTMLCache } from "discourse/helpers/custom-html";
import createStore from "discourse/tests/helpers/create-store";
import deprecated from "discourse-common/lib/deprecated";
import { restoreBaseUri } from "discourse-common/lib/get-url";
import { flushMap } from "discourse/services/store";
import { initSearchData } from "discourse/widgets/search-menu";
import { resetPostMenuExtraButtons } from "discourse/widgets/post-menu";
@ -177,6 +178,7 @@ function testCleanup(container, app) {
if (!LEGACY_ENV) {
clearPresenceCallbacks();
}
restoreBaseUri();
}
export function discourseModule(name, options) {

View File

@ -269,11 +269,11 @@ function setupTestsCommon(application, container, config) {
const cdn = setupData ? setupData.cdn : null;
const baseUri = setupData ? setupData.baseUri : "";
setupURL(cdn, "http://localhost:3000", baseUri);
setupURL(cdn, "http://localhost:3000", baseUri, { snapshot: true });
if (setupData && setupData.s3BaseUrl) {
setupS3CDN(setupData.s3BaseUrl, setupData.s3Cdn);
setupS3CDN(setupData.s3BaseUrl, setupData.s3Cdn, { snapshot: true });
} else {
setupS3CDN(null, null);
setupS3CDN(null, null, { snapshot: true });
}
server = pretender;