Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Simplest way to define page objects. Bonus, tremendously fast tests.
##Example
Page definition looks like this
# sign_up_page.yml
sign_up: ".home"
user_name: ".user"
password: ".password"
age: ".age"
male: "radio.male"
female: "radio.female"
submit: "[name='submit']"
# profile_page.yml
profile_page:
user_name: ".user"
password: ".password"
age: ".age"
gender: ".gender"
Test steps looks like this
# set textbox, radiobox, checkbox in one shot
sign_up.set_fields {:user_name=> "hi",:password=>"bla",:male=>true,:age=>10}
sign_up.submit.click
# assert multiple fields
profile_page.should_match_fields {:user_name=> "hi",:male=>true,:age=>10}
# check for state of elements
sign_up.should_have_enabled ['user_name','password','male','age']
sign_up.should_have_disabled ['user_name']
or like this
on sign_up do
user_name.set "hi"
password.set "bla"
submit.click
end
We will be able element whose locators are dynamic
products_page: ".products"
product: ".product[name='%s']"
details_row: ".row:nth-of-type(%s)"
cost: ".cost"
products_page.product("candy").details_row(1).cost.should have_text "Rs.10"
products_page.product("tyres").details_row(2).cost.should have_text "Rs.20"
In your project Gemfile add
gem 'pageify'
###Cucumber
# features/support/env.rb
require 'pageify'
require 'pageify/capybara'
require "capybara"
require 'capybara/rspec'
require 'capybara/dsl'
require 'capybara/session'
require 'selenium-webdriver'
include Capybara::DSL
#define your capybara driver ... and
pageify("features/pages")
set_session(page)
Place all the page definitions under "features/pages"
Sometimes, your page definition may get quite long. In other cases, you may also have the exact same HTML component (say a product listing) that can be repeated in multiple places (e.g. list, search, etc). In these cases, you can use sections to split your page into multiple files that can be reused.
The syntax for this is as follows:
# sections/_product.yml
product: '.product'
name: '.name'
price: '.price'
# product_list.yml
product_list: '.product_list'
:section/product
# search_results.yml
search_results: '.search_results'
:section/product
Unlike other similar tools, irrespective of the depth of the hierarchy, only a single find is fired to the browser, which is considered to be the costliest call in any test execution.
FAQs
Unknown package
We found that pageify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.