Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwlouse committed Aug 13, 2013
2 parents 3704b1b + 6a673ba commit 9312df2
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 12 deletions.
75 changes: 74 additions & 1 deletion selenium_tests/test_page_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from django.test import LiveServerTestCase
from nose.plugins.attrib import attr
from selenium import webdriver

import time

@attr('selenium')
class TestFePageProfile(LiveServerTestCase):
Expand All @@ -35,10 +35,83 @@ def setUp(self):

def tearDown(self):
self.driver.quit()
def login(self):
self.driver.get(self.live_server_url + '/login')
self.driver.implicitly_wait(1)
self.driver.find_element_by_xpath("//input[@type='password']").send_keys("1234")
self.driver.find_element_by_xpath("//input[@ng-model='username']").send_keys("admin")
self.driver.find_element_by_css_selector("input.btn.btn-primary").click()
time.sleep(1)
body = self.driver.find_element_by_tag_name('body')
self.assertIn('admin', body.text, "Login without success")

def test_change_user_description(self):
self.driver.get(self.live_server_url + '/')
self.login()
self.driver.find_element_by_link_text("admin").click()
time.sleep(1)
self.driver.find_element_by_xpath("//textarea[@ng-model='user.description']").send_keys("Dies ist die Userbeschreibung")
time.sleep(1)
body = self.driver.find_element_by_tag_name('body')
self.assertIn('Dies ist die Userbeschreibung', body.text, "Preview does not work")
self.driver.find_element_by_css_selector("input[type='submit']").click()
self.driver.find_elements_by_css_selector(".alert-success")
self.driver.find_element_by_css_selector("button.close").click()

def test_change_user_email(self):
self.login()
self.driver.get(self.live_server_url + '/profile/mail')
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").clear()
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("")
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("footrash-mail.com")
self.driver.find_element_by_xpath("(//input[@value='Speichern'])[1]").click()
self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert")))
self.driver.find_element_by_css_selector("button.close").click()
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("foo@trash-mail.com")

def test_change_user_name(self):
self.login()
self.driver.get(self.live_server_url + '/profile')
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").clear()
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("")
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("admin")
self.driver.find_element_by_xpath("(//input[@value='Speichern'])[1]").click()
self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert")))
self.driver.find_element_by_css_selector("button.close").click()
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("")
self.driver.find_element_by_xpath("(//input[@type='text'])[1]").send_keys("admin2")
self.driver.find_element_by_xpath("(//input[@value='Speichern'])[1]").click()
self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert-success")))

def test_change_password(self):
self.login()
self.driver.get(self.live_server_url + '/profile/password')
self.driver.find_element_by_xpath("(//input[@type='password'])[1]").clear()
self.driver.find_element_by_xpath("(//input[@type='password'])[2]").clear()
self.driver.find_element_by_xpath("(//input[@type='password'])[1]").send_keys("foobar")
self.driver.find_element_by_xpath("(//input[@type='password'])[2]").send_keys("foo")
self.driver.find_element_by_xpath("(//input[@value='Speichern'])[1]").click()
self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert")))
self.driver.find_element_by_css_selector("button.close").click()
self.driver.find_element_by_xpath("(//input[@type='password'])[1]").clear()
self.driver.find_element_by_xpath("(//input[@type='password'])[2]").clear()
self.driver.find_element_by_xpath("(//input[@type='password'])[1]").send_keys("foo")
self.driver.find_element_by_xpath("(//input[@type='password'])[2]").send_keys("foo")
self.driver.find_element_by_xpath("(//input[@value='Speichern'])[1]").click()
self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert-success")))
self.driver.find_element_by_css_selector("img[alt=\"Logout\"]").click()
self.driver.get(self.live_server_url + '/login')
self.driver.implicitly_wait(1)
self.driver.find_element_by_xpath("//input[@type='password']").send_keys("foo")
self.driver.find_element_by_xpath("//input[@ng-model='username']").send_keys("admin")
self.driver.find_element_by_css_selector("input.btn.btn-primary").click()
time.sleep(1)
body = self.driver.find_element_by_tag_name('body')
self.assertIn('admin', body.text, "Login without success")

# def test_delete_user(self):
# self.login()
# self.driver.get(self.live_server_url + '/profile/delete')
# self.driver.find_element_by_xpath("(//input[@value='Account löschen'])[1]").click()
# self.assertEqual(1, len(self.driver.find_elements_by_css_selector(".alert")))
#
3 changes: 1 addition & 2 deletions selenium_tests/test_page_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ def test_full_registration_process(self):
self.driver.find_element_by_css_selector("input[type=\"submit\"]").click()

self.assertEqual(0, len(self.driver.find_elements_by_css_selector(".alert")))
'''@todo: Registration is not completed thus mail problems in testing env'''
'''@todo: Ensure Activation code is invalidated'''

# time.sleep(20)
# self.driver.get("http://www.trash-mail.com")
# self.driver.find_element_by_name("mail").click()
Expand Down
1 change: 1 addition & 0 deletions static/css/message.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
}

button.close {
float: right;
padding: 0;
cursor: pointer;
background: transparent;
Expand Down
4 changes: 0 additions & 4 deletions static/js/findeco.messageCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ function FindecoMessageCtrl($scope, Backend, Message) {
$scope.closeMessage = function (index) {
$scope.service.messageList.splice(index, 1);
};

$scope.$on('$routeChangeSuccess', function () {
$scope.service.messageList= [];
});
}

FindecoMessageCtrl.$inject = ['$scope', 'Backend', 'Message'];
4 changes: 1 addition & 3 deletions static/js/findeco.userCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

'use strict';

function FindecoUserCtrl($scope, User, $routeParams, Message, Navigator) {
function FindecoUserCtrl($scope, User, $rootScope, $routeParams, Message, Navigator) {
$scope.user = User;
$scope.displayNameTmp = User.displayName;
$scope.followUser = User.markUser;
Expand Down Expand Up @@ -129,5 +129,3 @@ function FindecoUserCtrl($scope, User, $routeParams, Message, Navigator) {
}
});
}

FindecoUserCtrl.$inject = ['$scope', 'User', '$routeParams' , 'Message', 'Navigator'];
4 changes: 2 additions & 2 deletions static/partials/userRegistration.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ <h1> {{'_accountRegistrationFormTitle_'|i18n}} </h1>
<input type="text" placeholder="{{'_accountEmail_'|i18n}}" ng-model="mail"><br />
<input type="checkbox" ng-model="TOS">{{ '_accountReadTOSBeginning_'|i18n }}<a
href="/terms_of_use">{{ '_accountReadTOSLink_'|i18n }}</a>{{ '_accountReadTOSEnd_'|i18n }}</input>
<br/>
<br />
<input type="checkbox" ng-model="DPR">{{ '_accountReadDPRBeginning_'|i18n }}<a
href="/data_privacy">{{ '_accountReadDPRLink_'|i18n }}</a>{{ '_accountReadDPREnd_'|i18n }}</input><br/>
href="/data_privacy">{{ '_accountReadDPRLink_'|i18n }}</a>{{ '_accountReadDPREnd_'|i18n }}</input><br />
<input type="submit" value="{{'_accountRegistrationBtn_'|i18n}}">
</form>
</div>
Expand Down

0 comments on commit 9312df2

Please sign in to comment.