Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* jshint expr: true */
- /*************************************************
- @test: TS_LOG_002_badAttemptsLoginProcess
- @author: Anastasiia Oskilko
- @date: 2017-08-04
- @Description: Testing the Login process with bad attempts
- *************************************************/
- var urlWebSite = "https://preprod.guardtek.net/#!/authentication/signin";
- var usernameBox = "#username";
- var passwordBox = "#password";
- var submitButton = "button[type='submit']";
- var logoutButton = "#ctl00_m_CmdLogout";
- /* This user's login is correct & password is wrong */
- var testedValidUsername = "j.tribbiani";
- var testedInvalidPassword = "trackforce1234";
- var loginLogic = require('path/to/my/function');
- /* This user is an officer who can login without certificate */
- var testedValidPassword = "trackforce123";
- module.exports = {
- tags: ['loginpreprodguardtek'],
- /* Trying to login with an invalid password for 5 time should raise an error saying "Invalid username or password" in an alert box */
- 'TC_LOG_008_loginInvalidDataFirstAttempt#1' : function(client) {
- loginLogic.run(client, urlWebSite, usernameBox, passwordBox, testedValidUsername, testedInvalidPassword);
- },
- 'TC_LOG_008_loginInvalidDataFirstAttempt#2' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedInvalidPassword).pause(500)
- .click(submitButton)
- .expect.element(".alert").to.be.visible.after(1000);
- client.expect.element(".alert > div > span").to.contain.text("Invalid username or password");
- },
- 'TC_LOG_008_loginInvalidDataFirstAttempt#3' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedInvalidPassword).pause(500)
- .click(submitButton)
- .expect.element(".alert").to.be.visible.after(1000);
- client.expect.element(".alert > div > span").to.contain.text("Invalid username or password");
- },
- 'TC_LOG_008_loginInvalidDataFirstAttempt#4' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedInvalidPassword).pause(500)
- .click(submitButton)
- .expect.element(".alert").to.be.visible.after(1000);
- client.expect.element(".alert > div > span").to.contain.text("Invalid username or password");
- },
- 'TC_LOG_008_loginInvalidDataFirstAttempt#5' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedInvalidPassword).pause(500)
- .click(submitButton)
- .expect.element(".alert").to.be.visible.after(1000);
- client.expect.element(".alert > div > span").to.contain.text("Invalid username or password");
- },
- 'TC_LOG_004_loginValidData#1' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedValidPassword).pause(500)
- .click(submitButton)
- .expect.element(".alert").to.be.visible.after(1000);
- client.expect.element(".alert > div > span").to.contain.text("Too Many bad login attempt, please retry later");
- },
- 'TC_LOG_014_waitingForThirtySeconds' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .pause(30000);
- },
- 'TC_LOG_004_loginValidData#2' : function(client) {
- client
- .url(urlWebSite)
- .waitForElementVisible("body", 2000)
- .clearValue(usernameBox)
- .expect.element(usernameBox).text.to.equal('');
- client.setValue(usernameBox, testedValidUsername).pause(500)
- .clearValue(passwordBox)
- .expect.element(passwordBox).text.to.equal('');
- client.setValue(passwordBox, testedValidPassword).pause(500)
- .click(submitButton)
- .waitForElementVisible("#topheader", 2000)
- .expect.element(".main-nav").to.be.visible;
- }
- 'TC_LOG_008_loginInvalidDataFirstAttempt#1': function(client) {
- client
- .url(urlWebSite)
- .url().Maxpower()
- .end();
- }
- };
Add Comment
Please, Sign In to add comment