Add acceptance JS tests for group membership button.

This commit is contained in:
Guo Xiang Tan 2017-01-06 11:56:10 +08:00
parent a4e7657bbf
commit 389e1d0bd5
4 changed files with 28 additions and 7 deletions

View File

@ -41,10 +41,6 @@ export default Ember.Component.extend({
this.set('updatingMembership', true);
const model = this.get('model');
if (!!(this.currentUser)) {
}
model.addMembers(this.currentUser.get('username')).then(() => {
model.set('is_group_user', true);
}).catch(popupAjaxError).finally(() => {

View File

@ -111,7 +111,7 @@ const Group = RestModel.extend({
@observes("visible", "canEveryoneMention")
_updateAllowMembershipRequests() {
if (!this.get('visible') || !this.get('canEveryoneMention')) {
this.set('allow_membership_requests', false);
this.set ('allow_membership_requests', false);
}
},

View File

@ -7,8 +7,26 @@ test("Browsing Groups", () => {
andThen(() => {
equal(count('.groups-table-row'), 2, 'it displays visible groups');
equal(find('.group-index-join').length, 1, 'it show button to join group');
equal(find('.group-index-request').length, 1, 'it show button to request for group membership');
equal(find('.group-index-join').length, 1, 'it shows button to join group');
equal(find('.group-index-request').length, 1, 'it shows button to request for group membership');
});
click('.group-index-join');
andThen(() => {
ok(exists('.modal.login-modal'), 'it shows the login modal');
});
click('.login-modal .close');
andThen(() => {
ok(invisible('.modal.login-modal'), 'it closes the login modal');
});
click('.group-index-request');
andThen(() => {
ok(exists('.modal.login-modal'), 'it shows the login modal');
});
click("a[href='/groups/discourse/members']");
@ -16,6 +34,12 @@ test("Browsing Groups", () => {
andThen(() => {
equal(find('.group-info-name').text().trim(), 'Awesome Team', "it displays the group page");
});
click('.group-index-join');
andThen(() => {
ok(exists('.modal.login-modal'), 'it shows the login modal');
});
});
test("Viewing Group", () => {

View File

@ -8,6 +8,7 @@ export default {
"user_count":8,
"alias_level":0,
"visible":true,
"public":true,
"flair_url": 'fa-adjust',
"is_group_owner":true
}