lapis_lazuli 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lapis_lazuli/generators/cucumber/template/features/example.feature +14 -8
- data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/interaction_steps.rb +24 -8
- data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/precondition_steps.rb +14 -0
- data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/validation_steps.rb +4 -2
- data/lib/lapis_lazuli/version.rb +1 -1
- data/lib/lapis_lazuli/world/config.rb +7 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2e4e2af2a1c7bfdc78749417bf12dda8ab66e68
|
4
|
+
data.tar.gz: b0c2279d8aad2dcf751fd5b547310a6cc8a0a13e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abb8ec4d9bbcd5ae8b46bec6d6903026c409b12587b8453fd96eb02f89eb3118c8d75f35e16b2f7ddc245a2f5132cf224a2d411bc70a0418b2fd58cd37310bc5
|
7
|
+
data.tar.gz: 39c87dddd985f2dd703863db7f98f35a49a32d872b9767fc21018059da53128f09def8f994e9d1ceb7fb80f87dcfaca8ead49eef7a21d95fb7874b1574f1827c
|
@@ -1,11 +1,17 @@
|
|
1
1
|
@example @p
|
2
2
|
Feature: Example Feature
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/interaction_steps.rb
CHANGED
@@ -3,19 +3,35 @@
|
|
3
3
|
# Generated by LapisLazuli, version <%= config[:lapis_lazuli][:version] %>
|
4
4
|
# Author: "<%= config[:user] %>" <<%= config[:email] %>>
|
5
5
|
|
6
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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(/^
|
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
|
data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/precondition_steps.rb
ADDED
@@ -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
|
data/lib/lapis_lazuli/generators/cucumber/template/features/step_definitions/validation_steps.rb
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
# Generated by LapisLazuli, version <%= config[:lapis_lazuli][:version] %>
|
4
4
|
# Author: "<%= config[:user] %>" <<%= config[:email] %>>
|
5
5
|
|
6
|
-
|
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
|
data/lib/lapis_lazuli/version.rb
CHANGED
@@ -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.
|
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-
|
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
|