efset_test_helper 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9a231449ad04f1761a9b12095b5b6b3d1ea6d128
4
+ data.tar.gz: 7ac083d3e4d01c5c7f2c2ebd3bc8db073af4deab
5
+ SHA512:
6
+ metadata.gz: 28fb86fa1af06a6bf908904788d3466a7e2662040723532c0ae02674e9a856531af729f53c2ccf4194c3f41c30041557e5eea942343d41a6adabd4bac1c56793
7
+ data.tar.gz: c57098b3620ddc9c7e652b9edff743a39cb4fc2d49444dc82a7801c93ec5cab3b2ffb46d93d626ca68fb8c7d52be7381ad1b1f541c1f441fb71991f91f45e8c2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in efset_test_helper.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # EfsetTestHelper
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'efset_test_helper'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install efset_test_helper
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "efset_test_helper"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'efset_test_helper/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "efset_test_helper"
8
+ spec.version = EfsetTestHelper::VERSION
9
+ spec.authors = ["Cinthya Villalobos"]
10
+ spec.email = ["cinthya.villalobos@ef.com"]
11
+
12
+ spec.summary = 'Useful modules for EFSET testing repos'
13
+ spec.description = 'Useful modules for EFSET testing repos'
14
+ spec.homepage = "https://github.com/ef-ice/efset_test_helper"
15
+
16
+ # # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # # delete this section to allow pushing this gem to any host.
18
+ # if spec.respond_to?(:metadata)
19
+ # spec.metadata['allowed_push_host'] = 'https://repo.fury.io'
20
+ # else
21
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ # end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|environments)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency 'test_utils', '0.2.1'
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.11"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ end
@@ -0,0 +1,5 @@
1
+ require "efset_test_helper/version"
2
+
3
+ module EfsetTestHelper
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,67 @@
1
+ module AthenaClientElements
2
+
3
+ #
4
+ # Main container
5
+ #
6
+
7
+ def athena_client_iframe
8
+ iframe(id: 'athena-client-iframe').iframe(class: 'eft-iframe')
9
+ end
10
+
11
+ #
12
+ # Page / Test Instructions
13
+ #
14
+
15
+ def skip_instructions
16
+ athena_client_iframe.button(text: 'Next').click
17
+ end
18
+
19
+ #
20
+ # Audio check / Audio play
21
+ #
22
+
23
+ def audio_check_title
24
+ athena_client_iframe.h4(text: 'Audio Check')
25
+ end
26
+
27
+ def play_icon
28
+ athena_client_iframe.span(class: 'btn-icon glyphicon glyphicon-play')
29
+ end
30
+
31
+ def audio_check_yes
32
+ athena_client_iframe.button(class: 'btn btn-primary', text: 'Yes')
33
+ end
34
+
35
+ #
36
+ # Next task
37
+ #
38
+
39
+ def continue_next_task
40
+ athena_client_iframe.button(id: 'nextButtonDiv')
41
+ end
42
+
43
+ def confirm_next_task
44
+ athena_client_iframe.button(id: 'confirm-next-task')
45
+ end
46
+
47
+ #
48
+ # Tasks
49
+ #
50
+
51
+ def task_instructions
52
+ athena_client_iframe.div(class: 'instructions')
53
+ end
54
+
55
+
56
+ #
57
+ # Tasks mobile
58
+ #
59
+
60
+ def reading_tab
61
+ athena_client_iframe.link(text: 'Reading')
62
+ end
63
+
64
+ def questions_tab
65
+ athena_client_iframe.link(text: 'Questions')
66
+ end
67
+ end
@@ -0,0 +1,70 @@
1
+ require_relative 'athena_client_elements'
2
+
3
+ module AthenaClientHelper
4
+
5
+ #
6
+ # Answer test
7
+ #
8
+
9
+ def complete_express
10
+ confirm_audio_check
11
+ select_radio(1)
12
+ 2.times {next_task}
13
+ end
14
+
15
+ def complete_express1604
16
+ select_radio(2)
17
+ continue_next_task.click
18
+ 15.times {next_task}
19
+ end
20
+
21
+ def complete_efset_reading
22
+ skip_instructions
23
+ select_radio(1)
24
+ 3.times {next_task}
25
+ end
26
+
27
+ def complete_efset_listening
28
+ skip_instructions
29
+ confirm_audio_check
30
+ select_radio(1)
31
+ next_task
32
+ 2.times do
33
+ confirm_audio_check
34
+ next_task
35
+ end
36
+ end
37
+
38
+ #
39
+ # Answer test helpers
40
+ #
41
+
42
+ def play_icon_visible?
43
+ play_icon.wait_until_present(15)
44
+ play_icon.visible?
45
+ end
46
+
47
+ def confirm_audio_check
48
+ audio_check_title.wait_until_present(15)
49
+ wait_until_visible(play_icon)
50
+ sleep 1
51
+ play_icon.click
52
+ sleep 1
53
+ audio_check_yes.when_present(15).click
54
+ end
55
+
56
+ # Goes to next task and confirms if there are pending answers
57
+ def next_task
58
+ continue_next_task.wait_until_present
59
+ scroll_to_element(continue_next_task)
60
+ continue_next_task.click
61
+ sleep 1
62
+ confirm_next_task.click
63
+ sleep 2
64
+ end
65
+
66
+ def select_radio(index)
67
+ wait_until_visible(task_instructions)
68
+ athena_client_iframe.radios[index].click
69
+ end
70
+ end
@@ -0,0 +1,36 @@
1
+ module EfsetWidgetHelper
2
+
3
+ def plugin_iframe
4
+ iframe
5
+ end
6
+
7
+ def fill_demographic
8
+ plugin_iframe.radio(id: 'field_gender_2').when_present(30).set
9
+ plugin_iframe.select_list(id: 'field_bd_year').select_value '1984'
10
+ plugin_iframe.select_list(id: 'field_country_code').select_value 'GB'
11
+ plugin_iframe.text_field(id: 'field_city').set 'London'
12
+ plugin_iframe.text_field(id: 'field_telephone').set '+ 44 7443375832'
13
+ plugin_iframe.select_list(id: 'field_reason').select_value 'I am an English teacher'
14
+ plugin_iframe.select_list(id: 'field_method').select_value 'I want to study abroad'
15
+ plugin_iframe.text_field(id: 'field_email').set 'qa_test@ef.com' if plugin_iframe.text_field(id: 'field_email').visible?
16
+ sleep 0.5
17
+ plugin_iframe.checkbox(id: 'field_subscribe').click
18
+ plugin_iframe.link(id: 'form-submit', :class => 'eft-button eft-button-black-white').click
19
+ end
20
+
21
+ def fixed_badge
22
+ plugin_iframe.span(id: 'fixed-badge', class: /eft-badge eft-img-center badge-fixed-.*/)
23
+ end
24
+
25
+ def combined_results_badge
26
+ plugin_iframe.span(id: 'combined-badge', class: /badge-combined-efset-.*/)
27
+ end
28
+
29
+ def certificate_badge
30
+ plugin_iframe.span(id: 'combined-badge', class: /badge-combined-efset-.*/)
31
+ end
32
+
33
+ def certificate_plus_badge
34
+ plugin_iframe.span(id: 'combined-badge', class: /badge-combined-efset-plus-.*/)
35
+ end
36
+ end
@@ -0,0 +1,81 @@
1
+ module TestPluginElements
2
+
3
+ #
4
+ # Main container
5
+ #
6
+
7
+ def test_plugin_iframe
8
+ iframe(id: 'athena-iframe')
9
+ end
10
+
11
+ def test_plugin_iframe_client
12
+ iframe(id: 'athena-client-iframe')
13
+ end
14
+
15
+ #
16
+ # Page / Test Instructions
17
+ #
18
+ def skip_instructions
19
+ begin
20
+ test_plugin_iframe.button(class: 'next-button').click
21
+ rescue Watir::Wait::TimeoutError
22
+ puts 'Could not select next. Trying again.'
23
+ driver.switch_to.test_plugin_iframe
24
+ driver.switch_to.test_plugin_iframe_client
25
+ button(css: '.next-button').wait_until_visible(10).click
26
+ end
27
+ end
28
+
29
+
30
+ def page_container_text
31
+ test_plugin_iframe.div(class: 'page-container').when_present(10).text
32
+ end
33
+
34
+ def click_start
35
+ test_plugin_iframe.a(id: 'start-btn').when_present(10).click
36
+ end
37
+
38
+ #
39
+ # Audio check / Audio play
40
+ #
41
+
42
+ def play_icon
43
+ test_plugin_iframe.div(class: 'audio-control-button audio-control-button--play')
44
+ end
45
+
46
+ def confirm_audio
47
+ test_plugin_iframe.button(text: 'Yes')
48
+ end
49
+
50
+ #
51
+ # Next task
52
+ #
53
+
54
+ def continue_next_task
55
+ test_plugin_iframe.button(class: 'next-button').click
56
+ end
57
+
58
+ def confirm_next_task
59
+ test_plugin_iframe.button(class: 'button--next-button button button--type-primary', text: 'Next').click
60
+ end
61
+
62
+ #
63
+ # Tasks
64
+ #
65
+
66
+ def task_instructions
67
+ test_plugin_iframe.div(class: 'instructions')
68
+ end
69
+
70
+ def select_radio(index)
71
+ # task_instructions.wait_until_present(10)
72
+ test_plugin_iframe.divs(class: 'options-selection__option__checkbox')[index].click
73
+ end
74
+
75
+ def select_dropdown(index)
76
+ task_instructions.wait_until_present(10)
77
+ test_plugin_iframe.sections(class: 'item item--dropdown')[0].button(class: 'dropdown__button').click
78
+ sleep 0.5
79
+ test_plugin_iframe.sections(class: 'item item--dropdown')[0].buttons(class: 'dropdown__option')[index].click
80
+ end
81
+ end
@@ -0,0 +1,73 @@
1
+ require_relative 'test_plugin_elements'
2
+ include TestPluginElements
3
+
4
+ module TestPluginHelper
5
+
6
+ #
7
+ # Answer test
8
+ #
9
+
10
+ def complete_express
11
+ confirm_audio_check
12
+ select_radio(1)
13
+ 2.times {next_task}
14
+ end
15
+
16
+ def complete_express1604
17
+ select_radio(2)
18
+ continue_next_task
19
+ 15.times {next_task}
20
+ end
21
+
22
+ def complete_efset_reading
23
+ skip_instructions
24
+ select_radio(1)
25
+ 3.times {next_task}
26
+ end
27
+
28
+ def complete_efset_listening
29
+ skip_instructions
30
+ 3.times do
31
+ confirm_audio_check
32
+ select_radio(1)
33
+ next_task
34
+ end
35
+ end
36
+
37
+ def complete_placement_reading
38
+ skip_instructions
39
+ select_dropdown(1)
40
+ 4.times {next_task}
41
+ end
42
+
43
+ def complete_placement_listening
44
+ skip_instructions
45
+ confirm_audio_check
46
+ select_dropdown(6)
47
+ next_task
48
+ 5.times do
49
+ confirm_audio_check
50
+ next_task
51
+ end
52
+ end
53
+
54
+ #
55
+ # Answer test helpers
56
+ #
57
+
58
+ def play_icon_visible?
59
+ play_icon.wait_until_present(15)
60
+ play_icon.visible?
61
+ end
62
+
63
+ def confirm_audio_check
64
+ play_icon.when_present(10).click
65
+ confirm_audio.click
66
+ end
67
+
68
+ def next_task
69
+ sleep 0.5
70
+ continue_next_task
71
+ confirm_next_task
72
+ end
73
+ end
@@ -0,0 +1,30 @@
1
+ require 'yaml'
2
+
3
+ module RunParameters
4
+
5
+ def test_env
6
+ ENV['TEST_ENV'] ||= 'qa'
7
+ end
8
+
9
+ def config_location
10
+ ENV['CONFIG_LOCATION'] ||= "#{Dir.pwd}/environments"
11
+ end
12
+
13
+ def load_test_config
14
+ config_file = "#{config_location}/#{test_env.downcase}.yml"
15
+ if File.file?(config_file)
16
+ YAML.load_file(config_file)
17
+ else
18
+ raise ArgumentError, "Environment file not found: #{test_env}"
19
+ end
20
+ end
21
+
22
+ def use_old_athena?
23
+ if ENV['USE_OLD_ATHENA'].nil? || ENV['USE_OLD_ATHENA'].empty?
24
+ false
25
+ else
26
+ athena = (ENV['USE_OLD_ATHENA'] ||= 'false').downcase
27
+ athena.to_str == 'true'
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module EfsetTestHelper
2
+ VERSION = "0.5.5"
3
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: efset_test_helper
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.5
5
+ platform: ruby
6
+ authors:
7
+ - Cinthya Villalobos
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: test_utils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Useful modules for EFSET testing repos
70
+ email:
71
+ - cinthya.villalobos@ef.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Gemfile
77
+ - README.md
78
+ - Rakefile
79
+ - bin/console
80
+ - bin/setup
81
+ - efset_test_helper.gemspec
82
+ - lib/efset_test_helper.rb
83
+ - lib/efset_test_helper/efset_apps/athena_client_elements.rb
84
+ - lib/efset_test_helper/efset_apps/athena_client_helper.rb
85
+ - lib/efset_test_helper/efset_apps/efset_widget_helper.rb
86
+ - lib/efset_test_helper/efset_apps/test_plugin_elements.rb
87
+ - lib/efset_test_helper/efset_apps/test_plugin_helper.rb
88
+ - lib/efset_test_helper/run_parameters.rb
89
+ - lib/efset_test_helper/version.rb
90
+ homepage: https://github.com/ef-ice/efset_test_helper
91
+ licenses: []
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.6.14
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: Useful modules for EFSET testing repos
113
+ test_files: []