clean up rubocop alerts

approved
(Bruce Becker) #1

clean up rubocop alerts

From 5ae3643c9559b6107ba7248c2376af98c6e6ce51 Mon Sep 17 00:00:00 2001
From: Bruce Becker <brucellino@gmail.com>
Date: Sun, 7 Oct 2018 10:28:27 +0200
Subject: [PATCH] clean up rubocop alerts


diff --git a/tests/cucumber/features/step_definitions/stepdefs.rb b/tests/cucumber/features/step_definitions/stepdefs.rb
index e6eae47..155361b 100644
--- a/tests/cucumber/features/step_definitions/stepdefs.rb
+++ b/tests/cucumber/features/step_definitions/stepdefs.rb
@@ -1,6 +1,6 @@
-require "watir"
+require 'watir'
 require 'watir-performance'
-require "rspec/expectations"
+require 'rspec/expectations'
 require 'cucumber/rspec/doubles'
 require 'json'
 
@@ -8,7 +8,9 @@ Watir.default_timeout = 10
 
 Given('I am a test user') do
   @username = ENV['USER_NAME']
+  expect(@username).to be
   @password = ENV['USER_PASSWORD']
+  expect(@password).to be
 end
 
 Given('I am on the main page') do
@@ -18,55 +20,65 @@ Given('I am on the main page') do
   # expect(load_secs).to < 300
 end
 
-Given("I visit the main page") do
+Given('I visit the main page') do
   @browser.goto 'https://community.egi.eu/'
-  expect(@browser.title).to match( /EGI Foundation/ )
+  expect(@browser.title).to match(/EGI Foundation/)
 end
 
-When("I look for the login button") do
+When('I look for the login button') do
   @login_button = @browser.button(visible_text: /log in/i)
 end
 
-Then("it is present") do
-  expect(@login_button).to  exist
+Then('it is present') do
+  expect(@login_button).to exist
   expect(@login_button.text).to match(/log in/i)
 end
 
-Given("I click on the login button") do
+Given('I click on the login button') do
   @login_button = @browser.button(visible_text: /log in/i)
   @login_button.click
 end
 
-Then("I am taken to EGI AAI") do
+Then('I am taken to EGI AAI') do
   @browser.window(title: /identity provider/i).use
 end
 
-Then("I choose SSO") do
+Then('I choose SSO') do
   @browser.text_field(placeholder: /Search/).wait_until(&:present?)
   @browser.div(id: 'loader').wait_while(&:present?)
   @browser.text_field(placeholder: /Search/).set 'EGI SSO'
-  @egi_sso = @browser.link(text: 'EGI SSO', style: /display: block;/).wait_until_present
+  @egi_sso = @browser
+             .link(text: 'EGI SSO',
+                   style: /display: block;/)
+             .wait_until_present
   expect(@egi_sso).to be_present
   @egi_sso.click
 end
 
-Then("I add my credentials") do
-  pending # Write code here that turns the phrase above into concrete actions
+Then('I add my credentials') do
+  @browser.window(title: 'EGI SSO Identity Provider').use
+  expect(@browser.text_field(id: 'username')).to exist
+  expect(@browser.text_field(id: 'password')).to exist
+  @browser.text_field(id: 'username', name: 'j_username').set @username.to_s
+  @browser.text_field(id: 'password').set @password.to_s
+  @browser.button(visible_text: /login/i).click
 end
 
-Then("I am asked to release my attributes") do
-  pending # Write code here that turns the phrase above into concrete actions
+Then('I am asked to release my attributes') do
+  @browser.window(title: 'Information Release').use
+  expect(@browser.span(class: 'service_name')).to exist
+  expect(@browser.span(class: 'service_name').text).to
+  match(/EGI AAI Service Provider Proxy/)
 end
 
-Then("I am taken back to the main forum") do
+Then('I am taken back to the main forum') do
   pending # Write code here that turns the phrase above into concrete actions
 end
 
-Then("I can see my profile information") do
+Then('I can see my profile information') do
   pending # Write code here that turns the phrase above into concrete actions
 end
 
-
-After do
-  @browser.close
-end
+# After do
+#   @browser.close
+# end

GitHub