github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/app/tests/acceptance/user-profile-test.js (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>.
     9  //
    10  // https://documize.com
    11  
    12  import { test } from 'qunit';
    13  import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance';
    14  
    15  moduleForAcceptance('Acceptance | user profile');
    16  
    17  test('visiting /profile', function (assert) {
    18  	authenticateUser();
    19  	visit('/profile');
    20  
    21  	andThen(function () {
    22  		assert.equal(currentURL(), '/profile');
    23  		assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
    24  		assert.equal(find('#lastname').val(), 'Zinyando', 'Lastname input displays correct value');
    25  		assert.equal(find('#email').val(), 'brizdigital@gmail.com', 'Email input displays correct value');
    26  	});
    27  });
    28  
    29  test('changing user details and email ', function (assert) {
    30  	authenticateUser();
    31  	visit('/profile');
    32  
    33  	andThen(function () {
    34  		assert.equal(currentURL(), '/profile');
    35  		assert.equal(find('.content .name').text().trim(), 'Lennex Zinyando', 'Profile name displayed');
    36  		assert.equal(find('#firstname').val(), 'Lennex', 'Firstaname input displays correct value');
    37  		assert.equal(find('#lastname').val(), 'Zinyando', 'Lastname input displays correct value');
    38  		assert.equal(find('#email').val(), 'brizdigital@gmail.com', 'Email input displays correct value');
    39  	});
    40  
    41  	fillIn('#firstname', 'Test');
    42  	fillIn('#lastname', 'User');
    43  	fillIn('#email', 'test.user@domain.com');
    44  	click('.button-blue');
    45  
    46  	andThen(function () {
    47  		assert.equal(currentURL(), '/s/VzMuyEw_3WqiafcG/my-project');
    48  		assert.equal(find('.content .name').text().trim(), 'Test User', 'Profile name displayed');
    49  	});
    50  });