02_login_test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. module.exports = {
  2. beforeEach : function (client) {
  3. client.url('http://localhost:8124/atompm').pause(300);
  4. },
  5. 'Signup user' : function (client) {
  6. client.execute(
  7. function() {
  8. UserManagement.validateCredentials('testuser', 'test');
  9. }, [], null
  10. );
  11. var user_exists = false;
  12. client.getText('div[id=div_login_error]', function (result) {
  13. user_exists = result.value.includes('login failed');
  14. });
  15. if (user_exists == false) {
  16. client.execute(
  17. function() {
  18. UserManagement.signup('testuser', 'test');
  19. }, [], null
  20. );
  21. }
  22. client.execute(
  23. function() {
  24. UserManagement.login('testuser');
  25. }, [], null
  26. );
  27. client.pause(500);
  28. client.getTitle(function(title) {
  29. this.assert.ok(title.includes("AToMPM - [Unnamed]"), "AToMPM is opened");
  30. });
  31. },
  32. after : function (client) {
  33. client.end();
  34. },
  35. };