Comments (6)
And don't miss the existing WIP in #53 :)
You're welcome to squash commits on that branch to base your work on. When doing so please retain commit credit for existing progress 😄
It's fine to start over too! Thanks for picking this up 😁
from behat-screenshot.
@xurizaemon
I liked your suggestion and was thinking about supporting this. But I do not have the bandwidth to support this. A PR is always welcomed!
Please note that there is a purge
option available to purge all screenshots after every run.
The timestamp prefix was added to order screenshots by creation time.
from behat-screenshot.
@xurizaemon I work with @tannguyen04 on this and the priority for this issue has changed a bit. We will be addressing this in a week or two.
from behat-screenshot.
Here is a suggested spec for providing configurable file names for screenshots.
Token format
{name[_qualifier[:format]}
, where
{
and}
denote the start and end of a tokenname
is the name of the tokenqualifier
is an optional qualifier for the token. Must be separated from the name by an underscore.format
is an optional format for the token. Must be separated from the qualifier by a colon.
The reasoning behind using {}
as delimiters instead of @
is to make it easier to identify the token end delimiter in
the string.
Supported tokens
Using http://example.com/mypath/subpath?myquery=1+2+3&another[]=4#somefragment
in URL examples.
Token | Substituted with | Example value(s) |
---|---|---|
{ext} |
The extension of the file captured | html or png |
{fail_prefix} |
The value of fail_prefix from configuration | failed_ , error_ (do include the _ suffix, if required) |
{url} |
Full URL | http_example_com_mypath_subpath__query__myquery_1_plus_2_plus_3_and_another1_4__fragment__somefragment |
{url_origin} |
Scheme with domain | http_example_com |
{url_relative} |
Path + query + fragment | mypath_subpath__query__myquery_1_plus_2_plus_3_and_another1_4__fragment__somefragment |
{url_domain} |
Domain | example_com |
{url_path} |
Path | mypath_subpath |
{url_query} |
Query | myquery_1_plus_2_plus_3_and_another1_4 |
{url_fragment} |
Fragment | somefragment |
{feature_file} |
The filename of the .feature file currently being executed, without extension |
my_example.feature -> my_example |
{step_line} |
Step line number | 1 , 10 , 100 |
{step_line:%03d} |
Step line number with leading zeros. Modifiers are from sprintf() . |
001 , 010 , 100 |
{step_name} |
Step name without Given/When/Then and lower-cased. |
i_am_on_the_test_page |
{datetime} |
Current date and time. defaults to Ymd_His format. |
20010310_171618 |
{datetime:u} |
Current date and time as microtime. Modifiers are from date() . |
1697490961192498 |
Based on the above, the current format can be expressed as:
{datetime:u}.{fail_prefix}{feature_file}.feature_{step_line}.{ext}
resulting in filenames like:
1697490961192498.login.feature_14.png
- success
1697490961192498.failed_login.feature_14.png
- failed
Config changes
extensions:
DrevOps\BehatScreenshotExtension:
dir: %paths.base%/screenshots
fail: true
purge: false
# New config option.
filenamePattern: {datetime:u}.{fail_prefix}{feature_file}.feature_{step_line}.{ext}
Success vs failed patterns
Although adding an ability to provide different file name patterns for successful and failed screenshots is not a part of this issue, it is worth specifying how it would look like in config:
extensions:
DrevOps\BehatScreenshotExtension:
dir: %paths.base%/screenshots
fail: true
purge: false
# New config option.
filenamePattern: {datetime:u}.{feature_file}.feature_{step_line}.{ext}
filenamePatternFailed: {datetime:u}.{fail_prefix}{feature_file}.feature_{step_line}.{ext}
from behat-screenshot.
@tannguyen04
When working on this, please note that this implementation should work well with #28.
from behat-screenshot.
@tannguyen04 came across the config for this in a repo today and wondered how it had progressed. Did you get anywhere? Can I help in any way?
from behat-screenshot.
Related Issues (20)
- Exception thrown if Selenium Driver's session has not been started
- Compatibility with Drupal 9 HOT 1
- Record scenario screenshots for every step HOT 3
- Configurable (templated) filenames for captures HOT 1
- Make initialisation consistent for Selenium and non-Selenium drivers HOT 1
- Move to the DrevOps namespace HOT 1
- Use with headless browsers HOT 3
- Video record of test with chrome HOT 1
- Update repo structure to https://github.com/AlexSkrypnyk/scaffold HOT 1
- Install Docker Compose in CircleCI tasks HOT 1
- Selenium fails to connect (local and CircleCI) HOT 1
- Dependency Dashboard
- Unable to upgrade to the latest Selenium Docker container HOT 2
- Update step definition "language" to be consistent with Gherkin standards
- symfony 7, drop unsupported symfony HOT 1
- Move CI to GHA
- Update to Scaffold 0.12.1
- Update to 1.3.0 incompatible with drupal/drupal-extension requirements for symfony/http-client HOT 1
- Update readme and behat.yml.dist to contain new options added in #37
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from behat-screenshot.