mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Also rename the integration directory to be acceptance
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("About");
|
||||
|
||||
test("viewing", () => {
|
||||
visit("/about");
|
||||
andThen(() => {
|
||||
ok(exists('.about.admins .user-small'), 'has admins');
|
||||
ok(exists('.about.moderators .user-small'), 'has moderators');
|
||||
ok(exists('.about.stats tr td'), 'has stats');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Badges");
|
||||
|
||||
test("Visit Badge Pages", () => {
|
||||
visit("/badges");
|
||||
andThen(() => {
|
||||
ok(exists('.badges-listing tr'), "has a list of badges");
|
||||
});
|
||||
|
||||
visit("/badges/9/autobiographer");
|
||||
andThen(() => {
|
||||
ok(exists('.badges-listing tr'), "has the badge in the listing");
|
||||
ok(exists('.badge-user'), "has the list of users with that badge");
|
||||
});
|
||||
});
|
||||
@@ -1,47 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Create Account - User Fields", {
|
||||
site: {
|
||||
user_fields: [{"id":34,"name":"I've read the terms of service","field_type":"confirm","required":true},
|
||||
{"id":35,"name":"What is your pet's name?","field_type":"text","required":true},
|
||||
{"id":36,"name":"What's your dad like?","field_type":"text","required":false}]
|
||||
}
|
||||
});
|
||||
|
||||
test("create account with user fields", () => {
|
||||
visit("/");
|
||||
click("header .sign-up-button");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.create-account'), "it shows the create account modal");
|
||||
ok(exists('.user-field'), "it has at least one user field");
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled at first');
|
||||
});
|
||||
|
||||
fillIn('#new-account-name', 'Dr. Good Tuna');
|
||||
fillIn('#new-account-password', 'cool password bro');
|
||||
fillIn('#new-account-email', 'good.tuna@test.com');
|
||||
fillIn('#new-account-username', 'goodtuna');
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('#username-validation.good'), 'the username validation is good');
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'create account is still disabled due to lack of user fields');
|
||||
});
|
||||
|
||||
fillIn(".user-field input[type=text]:first", "Barky");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled because field is not checked');
|
||||
});
|
||||
|
||||
click(".user-field input[type=checkbox]");
|
||||
andThen(() => {
|
||||
not(exists('.modal-footer .btn-primary:disabled'), 'create account is enabled because field is not checked');
|
||||
});
|
||||
|
||||
click(".user-field input[type=checkbox]");
|
||||
andThen(() => {
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'unclicking the checkbox disables the submit');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Groups");
|
||||
|
||||
test("Browsing Groups", () => {
|
||||
visit("/groups/discourse");
|
||||
andThen(() => {
|
||||
ok(count('.user-stream .item') > 0, "it has stream items");
|
||||
});
|
||||
|
||||
visit("/groups/discourse/members");
|
||||
andThen(() => {
|
||||
ok(count('.group-members tr') > 0, "it lists group members");
|
||||
});
|
||||
});
|
||||
@@ -1,46 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Header (Anonymous)");
|
||||
|
||||
test("header", () => {
|
||||
visit("/");
|
||||
andThen(() => {
|
||||
ok(exists("header"), "is rendered");
|
||||
ok(exists(".logo-big"), "it renders the large logo by default");
|
||||
not(exists("#notifications-dropdown li"), "no notifications at first");
|
||||
not(exists('#site-map-dropdown'), "no site map by default");
|
||||
not(exists("#user-dropdown:visible"), "initially user dropdown is closed");
|
||||
not(exists("#search-dropdown:visible"), "initially search box is closed");
|
||||
});
|
||||
|
||||
// Logo changing
|
||||
andThen(() => {
|
||||
controllerFor('header').set("showExtraInfo", true);
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
ok(exists(".logo-small"), "it shows the small logo when `showExtraInfo` is enabled");
|
||||
});
|
||||
|
||||
// Site Map
|
||||
click("#site-map");
|
||||
andThen(() => {
|
||||
ok(exists('#site-map-dropdown'), "is rendered after user opens it");
|
||||
ok(exists("#site-map-dropdown .faq-link"), "it shows the faq link");
|
||||
ok(exists("#site-map-dropdown .category-links"), "has categories correctly bound");
|
||||
});
|
||||
|
||||
// Search
|
||||
click("#search-button");
|
||||
andThen(() => {
|
||||
ok(exists("#search-dropdown:visible"), "after clicking a button search box opens");
|
||||
not(exists("#search-dropdown .heading"), "initially, immediately after opening, search box is empty");
|
||||
});
|
||||
|
||||
// Perform Search
|
||||
// TODO how do I fix the fixture to be a POST instead of a GET @eviltrout
|
||||
// fillIn("#search-term", "hello");
|
||||
// andThen(() => {
|
||||
// ok(exists("#search-dropdown .heading"), "when user completes a search, search box shows search results");
|
||||
// equal(find("#search-dropdown .results a:first").attr("href"), "/t/hello-bar-integration-issues/17638", "there is a search result");
|
||||
// });
|
||||
});
|
||||
@@ -1,33 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Header (Staff)", {
|
||||
user: { username: 'test',
|
||||
staff: true,
|
||||
site_flagged_posts_count: 1 }
|
||||
});
|
||||
|
||||
test("header", () => {
|
||||
visit("/");
|
||||
|
||||
// Notifications
|
||||
click("#user-notifications");
|
||||
andThen(() => {
|
||||
var $items = $("#notifications-dropdown li");
|
||||
ok(exists($items), "is lazily populated after user opens it");
|
||||
ok($items.first().hasClass("read"), "correctly binds items' 'read' class");
|
||||
});
|
||||
|
||||
// Site Map
|
||||
click("#site-map");
|
||||
andThen(() => {
|
||||
ok(exists("#site-map-dropdown .admin-link"), "it has the admin link");
|
||||
ok(exists("#site-map-dropdown .flagged-posts.badge-notification"), "it displays flag notifications");
|
||||
});
|
||||
|
||||
// User dropdown
|
||||
click("#current-user");
|
||||
andThen(() => {
|
||||
ok(exists("#user-dropdown:visible"), "is lazily rendered after user opens it");
|
||||
ok(exists("#user-dropdown .user-dropdown-links"), "has showing / hiding user-dropdown links correctly bound");
|
||||
});
|
||||
});
|
||||
@@ -1,44 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Login Required", {
|
||||
settings: {
|
||||
login_required: true
|
||||
}
|
||||
});
|
||||
|
||||
test("redirect", () => {
|
||||
visit('/latest');
|
||||
andThen(() => {
|
||||
equal(currentPath(), "login", "it redirects them to login");
|
||||
});
|
||||
|
||||
click('#site-logo');
|
||||
andThen(() => {
|
||||
equal(currentPath(), "login", "clicking the logo keeps them on login");
|
||||
});
|
||||
|
||||
click('header .login-button');
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "they can still access the login modal");
|
||||
});
|
||||
|
||||
click('.modal-header .close');
|
||||
andThen(() => {
|
||||
ok(invisible('.login-modal'), "it closes the login modal");
|
||||
});
|
||||
|
||||
click('#search-button');
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "clicking search opens the login modal");
|
||||
});
|
||||
|
||||
click('.modal-header .close');
|
||||
andThen(() => {
|
||||
ok(invisible('.login-modal'), "it closes the login modal");
|
||||
});
|
||||
|
||||
click('#site-map');
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "site map opens the login modal");
|
||||
});
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Modal");
|
||||
|
||||
test("modal", () => {
|
||||
visit('/');
|
||||
|
||||
andThen(() => {
|
||||
ok(find('#discourse-modal:visible').length === 0, 'there is no modal at first');
|
||||
});
|
||||
|
||||
click('.login-button');
|
||||
andThen(() => {
|
||||
ok(find('#discourse-modal:visible').length === 1, 'modal should appear');
|
||||
});
|
||||
|
||||
click('.modal-outer-container');
|
||||
andThen(() => {
|
||||
ok(find('#discourse-modal:visible').length === 0, 'modal should disappear when you click outside');
|
||||
});
|
||||
|
||||
click('.login-button');
|
||||
andThen(() => {
|
||||
ok(find('#discourse-modal:visible').length === 1, 'modal should reappear');
|
||||
});
|
||||
|
||||
keyEvent('#main-outlet', 'keydown', 27);
|
||||
andThen(() => {
|
||||
ok(find('#discourse-modal:visible').length === 0, 'ESC should close the modal');
|
||||
});
|
||||
});
|
||||
@@ -1,59 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Signing In");
|
||||
|
||||
test("sign in", () => {
|
||||
visit("/");
|
||||
click("header .login-button");
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "it shows the login modal");
|
||||
});
|
||||
|
||||
// Test invalid password first
|
||||
fillIn('#login-account-name', 'eviltrout');
|
||||
fillIn('#login-account-password', 'incorrect');
|
||||
click('.modal-footer .btn-primary');
|
||||
andThen(() => {
|
||||
ok(exists('#modal-alert:visible', 'it displays the login error'));
|
||||
not(exists('.modal-footer .btn-primary:disabled'), "enables the login button");
|
||||
});
|
||||
|
||||
// Use the correct password
|
||||
fillIn('#login-account-password', 'correct');
|
||||
click('.modal-footer .btn-primary');
|
||||
andThen(() => {
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), "disables the login button");
|
||||
});
|
||||
});
|
||||
|
||||
test("create account", () => {
|
||||
visit("/");
|
||||
click("header .sign-up-button");
|
||||
|
||||
andThen(() => {
|
||||
ok(exists('.create-account'), "it shows the create account modal");
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'create account is disabled at first');
|
||||
});
|
||||
|
||||
fillIn('#new-account-name', 'Dr. Good Tuna');
|
||||
fillIn('#new-account-password', 'cool password bro');
|
||||
|
||||
// Check username
|
||||
fillIn('#new-account-email', 'good.tuna@test.com');
|
||||
fillIn('#new-account-username', 'taken');
|
||||
andThen(() => {
|
||||
ok(exists('#username-validation.bad'), 'the username validation is bad');
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), 'create account is still disabled');
|
||||
});
|
||||
|
||||
fillIn('#new-account-username', 'goodtuna');
|
||||
andThen(() => {
|
||||
ok(exists('#username-validation.good'), 'the username validation is good');
|
||||
not(exists('.modal-footer .btn-primary:disabled'), 'create account is enabled');
|
||||
});
|
||||
|
||||
click('.modal-footer .btn-primary');
|
||||
andThen(() => {
|
||||
ok(exists('.modal-footer .btn-primary:disabled'), "create account is disabled");
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,29 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Static");
|
||||
|
||||
test("Static Pages", () => {
|
||||
visit("/faq");
|
||||
andThen(() => {
|
||||
ok(exists(".body-page"), "The content is present");
|
||||
});
|
||||
|
||||
visit("/guidelines");
|
||||
andThen(() => {
|
||||
ok(exists(".body-page"), "The content is present");
|
||||
});
|
||||
|
||||
visit("/tos");
|
||||
andThen(() => {
|
||||
ok(exists(".body-page"), "The content is present");
|
||||
});
|
||||
|
||||
visit("/privacy");
|
||||
andThen(() => {
|
||||
ok(exists(".body-page"), "The content is present");
|
||||
});
|
||||
|
||||
visit("/login");
|
||||
andThen(() => {
|
||||
equal(currentPath(), "discovery.latest", "it redirects them to latest unless `login_required`");
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Topic Discovery");
|
||||
|
||||
test("Visit Discovery Pages", () => {
|
||||
visit("/");
|
||||
andThen(() => {
|
||||
ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
ok(exists('.topic-list .topic-list-item'), "has topics");
|
||||
});
|
||||
|
||||
visit("/c/bug");
|
||||
andThen(() => {
|
||||
ok(exists(".topic-list"), "The list of topics was rendered");
|
||||
ok(exists('.topic-list .topic-list-item'), "has topics");
|
||||
ok($('body.category-bug').length, "has a custom css class for the category id on the body");
|
||||
});
|
||||
|
||||
visit("/categories");
|
||||
andThen(() => {
|
||||
ok($('body.category-bug').length === 0, "removes the custom category class");
|
||||
|
||||
ok(exists('.category'), "has a list of categories");
|
||||
ok($('body.categories-list').length, "has a custom class to indicate categories");
|
||||
});
|
||||
|
||||
visit("/top");
|
||||
andThen(() => {
|
||||
ok($('body.categories-list').length === 0, "removes the `categories-list` class");
|
||||
ok(exists('.topic-list .topic-list-item'), "has topics");
|
||||
});
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("View Topic");
|
||||
|
||||
test("Enter a Topic", () => {
|
||||
visit("/t/internationalization-localization/280");
|
||||
andThen(() => {
|
||||
ok(exists("#topic"), "The topic was rendered");
|
||||
ok(exists("#topic .post-cloak"), "The topic has cloaked posts");
|
||||
});
|
||||
});
|
||||
|
||||
test("Enter without an id", () => {
|
||||
visit("/t/internationalization-localization");
|
||||
andThen(() => {
|
||||
ok(exists("#topic"), "The topic was rendered");
|
||||
});
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("Unknown");
|
||||
|
||||
test("Unknown URL", () => {
|
||||
expect(1);
|
||||
visit("/url-that-doesn't-exist");
|
||||
andThen(() => {
|
||||
ok(exists(".page-not-found"), "The not found content is present");
|
||||
});
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("User Card");
|
||||
|
||||
test("card", () => {
|
||||
visit('/');
|
||||
|
||||
ok(invisible('#user-card'), 'user card is invisible by default');
|
||||
click('a[data-user-card=eviltrout]:first');
|
||||
|
||||
andThen(() => {
|
||||
ok(visible('#user-card'), 'card should appear');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("User");
|
||||
|
||||
function hasStream() {
|
||||
andThen(() => {
|
||||
ok(exists('.user-main .about'), 'it has the about section');
|
||||
ok(count('.user-stream .item') > 0, 'it has stream items');
|
||||
});
|
||||
}
|
||||
|
||||
function hasTopicList() {
|
||||
andThen(() => {
|
||||
equal(count('.user-stream .item'), 0, "has no stream displayed");
|
||||
ok(count('.topic-list tr') > 0, 'it has a topic list');
|
||||
});
|
||||
}
|
||||
|
||||
test("Filters", () => {
|
||||
expect(14);
|
||||
|
||||
visit("/users/eviltrout");
|
||||
hasStream();
|
||||
|
||||
visit("/users/eviltrout/activity/topics");
|
||||
hasTopicList();
|
||||
|
||||
visit("/users/eviltrout/activity/posts");
|
||||
hasStream();
|
||||
|
||||
visit("/users/eviltrout/activity/replies");
|
||||
hasStream();
|
||||
|
||||
visit("/users/eviltrout/activity/likes-given");
|
||||
hasStream();
|
||||
|
||||
visit("/users/eviltrout/activity/likes-received");
|
||||
hasStream();
|
||||
|
||||
visit("/users/eviltrout/activity/edits");
|
||||
hasStream();
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
import { acceptance } from "helpers/qunit-helpers";
|
||||
acceptance("User Directory");
|
||||
|
||||
test("Visit Page", function() {
|
||||
visit("/users");
|
||||
andThen(() => {
|
||||
ok(exists('.directory table tr'), "has a list of users");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user