lapis_lazuli 0.8.6 → 0.8.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffa7e2ecdd4425b9e6dc9c72e0c7b65b85c16d7b
4
- data.tar.gz: 18dc0914961262a3aab445ca47bf47daeb71404d
3
+ metadata.gz: a2e4e2af2a1c7bfdc78749417bf12dda8ab66e68
4
+ data.tar.gz: b0c2279d8aad2dcf751fd5b547310a6cc8a0a13e
5
5
  SHA512:
6
- metadata.gz: 6b0ee2931ba55684dfc41b52f8a92c1ab1ae9f95d409201a9fcf064c9bff58a9644ed86bfbe98b0072306d474e5f374fc79d1b56c6fb87abadb6cfdf096825ea
7
- data.tar.gz: 76eacec4dde636c2410845c54a62ab83c9281299f7ce0d2d4d77d39f5557ab80eabebc33c0a25663d99d1d08b2c76cddba8fb4331952fed198a6a11b15ad8a07
6
+ metadata.gz: abb8ec4d9bbcd5ae8b46bec6d6903026c409b12587b8453fd96eb02f89eb3118c8d75f35e16b2f7ddc245a2f5132cf224a2d411bc70a0418b2fd58cd37310bc5
7
+ data.tar.gz: 39c87dddd985f2dd703863db7f98f35a49a32d872b9767fc21018059da53128f09def8f994e9d1ceb7fb80f87dcfaca8ead49eef7a21d95fb7874b1574f1827c
@@ -1,11 +1,17 @@
1
1
  @example @p
2
2
  Feature: Example Feature
3
- When I want to learn how to make test cases
4
- As a user of the test automation tool
5
- I want to run and adjust the tests below
3
+ When I want to learn how to make test cases
4
+ As a user of the test automation tool
5
+ I want to run and adjust the tests below
6
6
 
7
- @example01
8
- Scenario: example01 - Google Search
9
- Given I navigate to Google in english
10
- And I search for "spriteCloud"
11
- Then I see "www.spriteCloud.com" on the page
7
+ @example01
8
+ Scenario: example01 - Google Search
9
+ Given the user navigates to Google in english
10
+ When the user searches for "spriteCloud"
11
+ Then text "www.spriteCloud.com" should display
12
+
13
+ @example02
14
+ Scenario: example02 - Going to a search result
15
+ Given the user has searched for "spriteCloud" on Google in english
16
+ When the user clicks on link "spritecloud.com"
17
+ Then text "Test your software, not your reputation" should display
@@ -3,19 +3,35 @@
3
3
  # Generated by LapisLazuli, version <%= config[:lapis_lazuli][:version] %>
4
4
  # Author: "<%= config[:user] %>" <<%= config[:email] %>>
5
5
 
6
- Given(/^I navigate to (.*) in (.*)$/) do |site,language|
6
+ # interactions_steps.rb is used to interact with elements on the page.
7
+
8
+ Given(/^the user navigates to (.*?) in (.*?)$/) do |site, language|
9
+ # Combine the configuration depth with dots
7
10
  config_name = "#{site.downcase}.#{language.downcase}"
8
- if has_env?(config_name)
9
- url = env(config_name)
10
- browser.goto url
11
- else
12
- error(:env => config_name)
13
- end
11
+ # Get the value of the configuration (see /config/config.yml)
12
+ url = env(config_name)
13
+ # Go to the URL
14
+ browser.goto url
14
15
  end
15
16
 
16
- Given(/^I search for "(.*?)"$/) do |query|
17
+ Given(/^the user searches for "(.*?)"$/) do |query|
18
+ # Get the input element
17
19
  searchbox = browser.find(:text_field => {:name => "q"})
20
+ # Make sure the input field is empty
18
21
  searchbox.clear rescue log.debug "Could not clear searchbox"
22
+ # Fill in the query
19
23
  searchbox.send_keys(query)
24
+ # Press enter to submit the search
20
25
  searchbox.send_keys(:enter)
21
26
  end
27
+
28
+ When(/^the user clicks on link "(.*?)"$/) do |url|
29
+ # Search for the element that includes the expected text
30
+ browser.wait(
31
+ :like => {
32
+ :element => :a,
33
+ :attribute => :href,
34
+ :include => url
35
+ }
36
+ ).click
37
+ end
@@ -0,0 +1,14 @@
1
+ ################################################################################
2
+ # Copyright <%= config[:year] %> spriteCloud B.V. All rights reserved.
3
+ # Generated by LapisLazuli, version <%= config[:lapis_lazuli][:version] %>
4
+ # Author: "<%= config[:user] %>" <<%= config[:email] %>>
5
+
6
+ # precondition_steps.rb is used to define steps that contain multiple steps to come to a certain start of a scenrario.
7
+ # For example: "Given the user is logged in" will contain all steps done before logging in
8
+
9
+ Given(/^the user has searched for "(.*?)" on (.*?) in (.*)$/) do |query, site, language|
10
+ # Run step to go to page
11
+ step "the user navigates to #{site} in #{language}"
12
+ # Run step to search
13
+ step "the user searches for \"#{query}\""
14
+ end
@@ -3,7 +3,9 @@
3
3
  # Generated by LapisLazuli, version <%= config[:lapis_lazuli][:version] %>
4
4
  # Author: "<%= config[:user] %>" <<%= config[:email] %>>
5
5
 
6
- Then(/I see "([^"]*)" on the page/) do |string|
6
+ # validation_steps.rb is used to confirm that certain elements are displayed on the page.
7
+
8
+ Then(/text "([^"]*)" should display/) do |string|
7
9
  # Note: The following is *really* slow, as it'll apply the regex to all
8
10
  # elements in the page, one after the other. Of course, if any element
9
11
  # includes the regex, all its parent elements also will, so you have
@@ -18,4 +20,4 @@ Then(/I see "([^"]*)" on the page/) do |string|
18
20
 
19
21
  # There's a shortcut for that in find/wait:
20
22
  browser.wait(:html => /#{string}/i)
21
- end
23
+ end
@@ -6,5 +6,5 @@
6
6
  # All rights reserved.
7
7
  #
8
8
  module LapisLazuli
9
- VERSION = "0.8.6"
9
+ VERSION = "0.8.7"
10
10
  end
@@ -43,13 +43,18 @@ module WorldModule
43
43
  if not @config.nil?
44
44
  return
45
45
  end
46
-
46
+
47
47
  if Config.config_file.nil?
48
48
  raise "No configuration file provided, set LapisLazuli::WorldModule::Config.config_file"
49
49
  end
50
50
 
51
51
  load_config(Config.config_file)
52
-
52
+ # In case there was no config file found an empty @config needs to be set to prevent infinite looping.
53
+ if @config.nil?
54
+ warn 'Unable to find a configuration file, defaulting to empty config.yml.'
55
+ @config = {}
56
+ end
57
+
53
58
  @metadata = Runtime.instance.set_if(self, :metadata) do
54
59
  log.debug "Creating metadata storage"
55
60
  Storage.new("metadata")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lapis_lazuli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onno Steenbergen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-07-20 00:00:00.000000000 Z
14
+ date: 2016-08-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -223,6 +223,7 @@ files:
223
223
  - lib/lapis_lazuli/generators/cucumber/template/config/cucumber.yml
224
224
  - lib/lapis_lazuli/generators/cucumber/template/features/example.feature
225
225
  - lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/interaction_steps.rb
226
+ - lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/precondition_steps.rb
226
227
  - lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/validation_steps.rb
227
228
  - lib/lapis_lazuli/generators/cucumber/template/features/support/env.rb
228
229
  - lib/lapis_lazuli/generic/assertions.rb