mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-23 05:15:45 -04:00
TESTS: Sign in tests
This commit is contained in:
parent
c5b5db48cf
commit
bf16ff275a
6 changed files with 61 additions and 23 deletions
test
2
test/javascripts/fixtures/session_fixtures.js
Normal file
2
test/javascripts/fixtures/session_fixtures.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
/*jshint maxlen:10000000 */
|
||||
Discourse.URL_FIXTURES["/session"] = [ { error: "Incorrect username, email or password" } ];
|
|
@ -1,11 +1,7 @@
|
|||
integration("Header as Staff", {
|
||||
user: { username: 'test',
|
||||
staff: true,
|
||||
site_flagged_posts_count: 1 }
|
||||
});
|
||||
integration("Header (Anonymous)");
|
||||
|
||||
test("header", function() {
|
||||
expect(20);
|
||||
expect(14);
|
||||
|
||||
visit("/");
|
||||
andThen(function() {
|
||||
|
@ -26,31 +22,14 @@ test("header", function() {
|
|||
ok(exists(".logo-small"), "it shows the small logo when `showExtraInfo` is enabled");
|
||||
});
|
||||
|
||||
// Notifications
|
||||
click("#user-notifications");
|
||||
andThen(function() {
|
||||
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(function() {
|
||||
ok(exists('#site-map-dropdown'), "is rendered after user opens it");
|
||||
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");
|
||||
ok(exists("#site-map-dropdown .faq-link"), "it shows the faq link");
|
||||
ok(exists("#site-map-dropdown .category-links"), "has categories correctly bound");
|
||||
});
|
||||
|
||||
// User dropdown
|
||||
click("#current-user");
|
||||
andThen(function() {
|
||||
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");
|
||||
});
|
||||
|
||||
// Search
|
||||
click("#search-button");
|
||||
andThen(function() {
|
34
test/javascripts/integration/header-test-staff.js.es6
Normal file
34
test/javascripts/integration/header-test-staff.js.es6
Normal file
|
@ -0,0 +1,34 @@
|
|||
integration("Header (Staff)", {
|
||||
user: { username: 'test',
|
||||
staff: true,
|
||||
site_flagged_posts_count: 1 }
|
||||
});
|
||||
|
||||
test("header", function() {
|
||||
expect(6);
|
||||
|
||||
visit("/");
|
||||
|
||||
// Notifications
|
||||
click("#user-notifications");
|
||||
andThen(function() {
|
||||
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(function() {
|
||||
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(function() {
|
||||
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");
|
||||
});
|
||||
|
||||
});
|
17
test/javascripts/integration/sign-in-test.js.es6
Normal file
17
test/javascripts/integration/sign-in-test.js.es6
Normal file
|
@ -0,0 +1,17 @@
|
|||
integration("Signing In");
|
||||
|
||||
test("sign in with incorrect credentials", function() {
|
||||
visit("/");
|
||||
click("header .login-button");
|
||||
andThen(function() {
|
||||
ok(exists('.login-modal'), "it shows the login modal");
|
||||
});
|
||||
fillIn('#login-account-name', 'eviltrout');
|
||||
fillIn('#login-account-password', 'where da plankton at?');
|
||||
|
||||
// The fixture is set to invalid login
|
||||
click('.modal-footer .btn-primary');
|
||||
andThen(function() {
|
||||
// ok(exists('#modal-alert:visible', 'it displays the login error'));
|
||||
});
|
||||
});
|
|
@ -115,6 +115,9 @@ QUnit.testStart(function(ctx) {
|
|||
QUnit.testDone(function() {
|
||||
Ember.run.debounce = origDebounce;
|
||||
window.sandbox.restore();
|
||||
|
||||
// Destroy any modals
|
||||
$('.modal-backdrop').remove();
|
||||
});
|
||||
|
||||
// Load ES6 tests
|
||||
|
|
|
@ -2,3 +2,6 @@
|
|||
*= require desktop
|
||||
*= require_tree .
|
||||
*/
|
||||
.modal-backdrop {
|
||||
display: none;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue