//scroll to the bottom of the page
((JavascriptExecutor) driver).executeScript("window.scrollTo(0, document.body.scrollHeight)");
Note: Do not upgrade Firefox browser version later than 40 - not compatible with latest Selenium Firefox Driver
Regex for a booking number: ^Ocean #BK+[0-9]{8}
* Feature
* Background
* Scenario
* Given
* When
* Then
* And
* But
* *
* Scenario Outline
* Examples
\d - stands for digit, or [0-9]
\w - stands for word character, specifically [A-Za-z0-9_]. Note: underscores and digits are included but not hyphens.
\s - stands for white space character, specifically [\t\r\n]. That means a space, a tab, or a line break.
\b - stands for workd boundary, which is a lot like \s but actually means the opposite of \w. Anything that is not a word character is a word boundary.
-
- the plus modifier. Any number of times, at least once.
-
- the star modifier. Any number of times including zero.
? - the question mark modifier makes the preceding character optional. It means zero or one times.
ex./ @Given("I have (\d+) cucumbers? in my basket) will match 'I have 1 cucumber in my basket' OR 'I have 256 cucumbers in my basket'
^ and $ are anchor characters
In order to
As a
I was
Each scenario must make sense and be able to be executed independently of any other scenario.
--
- Failed - if a block of code raises an exception.
- Pending - a step definition that's halfway through being implemented. Throws PendingException
- Undefined - no step definition that matches a step
- Skipped
- Passed
a background section in a feature file allows you to specify a set of steps that are common to every scenario in a file.
The table is technically a List of Lists of strings: List<List>
These are used for repetative scenarios that follow the same pattern with a different set of data
Hierarchy
1. The OS environment variable CUCMBER_OPTIONS
2. The Java system property cucmber.options
3. The Java resource bundle cucmber.properties with a cucmber.options property
* Overrides are provided in a variable (or property) called cucumber.options or CUCUMBER_OPTIONS. Cucumber searches for this variable in the above order
* Cucumber will not continue to look for other overrides once it has found one
* Except for the plugin argument, values found in the override replace any values already set.
* The plugin argument is the only one which Cucmber provides a default - if no plugin is specified, then Cucmber will always use the progress plugin to output to STDOUT.
the --glue option tells Cucumber which package(s) our glue code is in, and if there are step definitions in them (or hooks), they get loaded. Cucumber treats the packages you specify as a root from which to scan for glue code.
- The Selenium sendKeys method doesn't result in a keyup or keydown event if you pass it a string, but it does if you pass it members of the Keys enumeration (https://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/Keys.html)
- Work Around: Convert integer amounts into a sequence of keystrokes (See page 241 in The Cucumber for Java Book)
--dry-run switch tells Cucumber to parse the file without executing it. It will tell you if your Gherkin is valid. --strict command-line option will return an exit code of 1 (to indicate an error) if there are any undefined or pending steps. Useful in CI to detect half built features that have been checked in or when you've refactored your step definitions and some of your steps no longer match.
Reusing browsers is ok (reduces speed) as long as you clear all cookies and browser cache