GithubHelp home page GithubHelp logo

cheezy / page_navigation Goto Github PK

View Code? Open in Web Editor NEW
10.0 7.0 7.0 31 KB

Provides basic navigation through a collection of items that use the PageObject pattern.

License: MIT License

Ruby 100.00%

page_navigation's Introduction

PageNavigation

TODO: Write a gem description

Installation

Add this line to your application's Gemfile:

gem 'page_navigation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install page_navigation

Usage

TODO: Write usage instructions here

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

page_navigation's People

Contributors

cheezy avatar dingusj1 avatar sciros avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

page_navigation's Issues

Starting continue_navigation_to method from the next page from current

At the moment continue_navigation_to starting navigation from current page.
For instance:

PageObject::PageFactory.routes = {default: [[Page1, :method1], [Page2, :method2, "data"], [Page3, :method3]]} 

And if I use that route:

navigate_to(Page2).method2 "other_data"
continue_navigation_to(Page3).method3

The test start from Page2 and rerun method2 with "data" that I don't want to use in this case.

Maybe it would be better if continue_navigation_to method will start from the next page from current? So I won't lose "other_data"
Or if I do a mistake, please point it to me.

pass parameters through navigate_all

It should be useful to have opportunity to pass parameters to navigate_all like:

navigate_all(:using => :select_route, {:option_name =>'option1', :address => 'some address'})

env.rb
PageObject::PageFactory.routes = {
...
:select_route=> [[HomePage, :goto],
[HomePage, :select, :option_name ],
[OrderPage, :add_address, :address],
[OrderPage, :submit_order]]
}

Feature Request: Skip page

I'm finding when using the navigational features sometimes I just want to change one method on one page. The current methods supporting doing something extra on a given page then picking up where you left off, but in effect I'd like to replace the given method called on a page without having to define a new route.

For instance

PageObject::PageFactory.routes = {
  :default => [[HomePage, :adopt_a_puppy],
                    [DetailPage, :add_to_cart],
                    [ShoppingCartPage, :add_to_cart],
                    [CheckoutPage, :complete_order]]
}

It'd be swell if when I'm using the route I could do something like

navigate_to(ShoppingCartPage).some_other_method_that_completes_navigation
continue_navigation_to(CheckoutPage)

Instead of having to define an alternate route for any page which might have a lot of ways to "complete"

visit page can not be included in route

I would be great to be able to visit page from route.
Something like:

PageObject::PageFactory.routes = {
:default => [[LoginPage, :visit],
[LoginPage, :login]
}

NoMethodError: undefined method `[]' for nil:NilClass for navigate_all

Hello!
I'm receiving NoMethodError: undefined method `[]' for nil:NilClass error for:

Given(/^the app is added to Favourites$/) do
navigate_all
end

env.rb:

require 'rspec-expectations'
require 'page-object'
require 'page-object/page_factory'
require 'fig_newton'
require 'require_all'
require 'watir-webdriver'
require 'data_magic'
require 'page_navigation'
require_relative 'helper'
require_rel 'pages'

include WebApp
include DataMagic
include Helper
include PageNavigation

World(PageObject::PageFactory)

PageObject::PageFactory.routes = {
:default => [[LoginPage, :login_to_system_if_needed],
[BrowseAppsPage, :myapps_operations, false]]]
}


It seems, that in routes.rb file @routes variable looses it's value and becomes Nil. So if to change:

def routes
  @routes
  puts '!!!!!!!!!!!!!!'
  puts @routes
end

def routes=(routes)
  raise("You must provide a :default route") unless routes[:default]
  @routes = routes
  puts '@@@@@@@@@@@@@@'
  puts @routes
end

I get =>

C:\Ruby\bin\ruby.exe -EUTF-8 -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Ruby/bin/cucumber C:/HOME/Ruby/test/features/sanity/test/test.feature --format Teamcity::Cucumber::Formatter --expand --color -r features
Testing started at 7:34 PM ...
@@@@@@@@@@@@@@
{:default=>[[LoginPage, :login_to_system_if_needed], [BrowseAppsPage, :myapps_operations], [MyAppsPage, :add_to_favourites]]}
Tags: @@Amo, @@resource_myapps
!!!!!!!!!!!!!!

NoMethodError: undefined method `[]' for nil:NilClass


So I've corrected it by changing @routes variable in routes.rb to $routes but I don't think that it's a good idea.

Cannot use page navigation with two different defined profiles

When using page navigation with both a PageObject defined profile and a ScreenObject defined profile (TE3270 Gem) page navigation doesn't differentiate between the two of them, and will throw a NilClass error for whichever one was defined second.

For example, in the step definitions, I had a
"navigate_to(TE3270Screen).do_something"
call in the first step definition.

In the second, I had a:
"navigate_to(PageObject).do_something
continue_navigation"
call.

The second call in the second step definition was overwhelmed, not recognizing that there were two different navigations.

Why use DataMagic as the YML loader?

Hey @cheezy,

Would you be open to a PR which switches page_navigation to use FigNewton, or YMLReader directly. By using DataMagic we take on Faker as a dependency which adds unnecessary weight.

Best,
Justin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.