Guest User

Untitled

a guest
Dec 4th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. Scenario: As an admin I should be able to go to reports
  2.  
  3. Given Admin is in dashboard page
  4. When Admin goes to Income reports
  5. Then Admin should be able to click Download excel
  6.  
  7. Scenario: As an admin I should be able to log out
  8.  
  9. Given Admin goes back to dashboard page
  10. When Admin clicks the logout button
  11. Then Admin is now on login page
  12.  
  13. let chai = require('chai');
  14. let chaiAsPromised= require('chai-as-promised');
  15. chai.use(chaiAsPromised);
  16. let expect = chai.expect;
  17.  
  18. const { Before, After } = require('cucumber');
  19.  
  20. var { setDefaultTimeout } = require('cucumber');
  21. setDefaultTimeout(60 * 1200);
  22.  
  23.  
  24. Given( 'Admin is in dashboard page', function () {
  25. LoginPage.click_dashboard_button();
  26. } );
  27.  
  28. When( 'Admin goes to Income reports', function () {
  29. navPage.click_reports_dropdown();
  30. browser.sleep(1000);
  31. navPage.click_incomeReports();
  32. } );
  33.  
  34. Then( 'Admin should be able to click Download excel', function () {
  35. incomeReportsPage.click_downloadExcelButton();
  36. browser.sleep(3000);
  37. } );
  38.  
  39. Given( 'Admin go backs to dashboard page', function ( ) {
  40. LoginPage.click_dashboard_button();
  41. });
  42.  
  43. When( 'Admin clicks the logout button', function () {
  44. LoginPage.click_logout_button();
  45. });
  46.  
  47. Then( 'Admin is now on login page', function () {
  48. browser.driver.getTitle().then( function ( value ) {
  49. expect( value ).to.equal( "NAGM | Log in" );
  50. });
  51. });
  52.  
  53. exports.init = function init() {
  54. browser.waitForAngularEnabled( false );
  55. }
  56.  
  57. exports.get_url = function get_url() {
  58. browser.get( "http://nagm.test.createit.pl/login" );
  59.  
  60. }
  61.  
  62. exports.input_username = function input_username() {
  63.  
  64. usernameTextbox.clear();
  65. usernameTextbox.sendKeys("admin@nagm.ct");
  66. }
  67.  
  68. exports.input_password = function input_password() {
  69.  
  70. passwordTextbox.clear();
  71. passwordTextbox.sendKeys("password");
  72. }
  73.  
  74. exports.click_login_button = function click_login_button() {
  75. loginButton.click();
  76. }
  77.  
  78. exports.click_logout_button = function click_logout_button() {
  79. logoutButton.click();
  80. }
  81.  
  82. exports.click_dashboard_button = function click_dashboard_button() {
  83. dashboardMenu.click();
  84. }
  85.  
  86. Before (function (){
  87. browser.manage().window().maximize();
  88. loginPage.init();
  89. loginPage.get_url();
  90. loginPage.input_username();
  91. loginPage.input_password();
  92. loginPage.click_login_button();
  93.  
  94. });
Add Comment
Please, Sign In to add comment