How to write Gherkin scenarios when there are multiple validations for a given state - cucumber

I am new to cucumber - Gherkin world. I am trying to write a feature file. I am planning to test a web page that is static with lot of static content(lets say 100 sections) that I need to verify.
Ideally if I start writing based on my understanding of gherkin, it looks as below:
Scenario:test engagement page content
Given I am an user with >10000 balance
When I land on my engagement page
Then section1 should be displayed correctly
And section2 should be displayed correctly
And section3 should be displayed correctly
And section4 should be displayed correctly
--and so on -----
And section100 should be displayed correctly.
This definitely is looking ugly. How can I break this into multiple scenarios.
I am testing everything once I am on that page. I am not doing any activity on the page. Once I land, I just need to verify all sections.
Thanks in advance

There are a number of ways you can do this, but a Scenario Outline is likely your best option assuming the sections share elements and assertions.
Scenario Outline: Verify the display of all sections on the Engagement Page
Given I am a user with >10000 balance
When I land of Engagement Page
Then the header of <section> should read "<headerText>"
And the icon of <section> should be displayed
And the body of <section> should read "<bodyText>"
Examples:
| section | headerText | bodyText |
| Section 1 | This is Header #1 | This is Body #1 |
| Section 2 | Header Text of #2 | Body Text of #2 |
... etc
If the sections are unique in structure, you're faced with writing a scenario (or more, depending on your style - I don't personally like having multiple assertions in a single case) for each:
Say, for example, section1 has a header, icon, and body text, you would end up with the following three scenarios:
Scenario: Verify display of header in Section 1
Given I am a user with >10000 balance
When I land of Engagement Page
Then the header of Section 1 should read "text"
Scenario: Verify display of icon in Section 1
Given I am a user with >10000 balance
When I land of Engagement Page
Then the icon of Section 1 should be displayed
Scenario: Verify display of body text in Section 1
Given I am a user with >10000 balance
When I land of Engagement Page
Then the body of Section 1 should read "text"
And if you're fine with multiple assertions per test:
Scenario: Verify display of Section 1
Given I am a user with >10000 balance
When I land of Engagement Page
Then the header of Section 1 should read "text"
And the icon of Section 1 should be displayed
And the body of Section 1 should read "text"

Related

cognos report alternate two pages

enter image description hereVersion: cognos report 11.1.7fp2
Hi, I have two pages, page1 and page2 and I want them to alternate. Is that possible in cognos? I have a customer that wants me to print the report in pdf page1 [grant#123 details], then follow it immediately with page2 [grant#123 details] notary signature.
Alternate Pages Like This Idea:
page1 grant#123
$100
page2 grant #123
notary signature
page1 grant#777
$100
page2 grant #777
notary signature
Kindly, aree there any creative thoughts on how to ask cognos to alternate placement of two pages one after another? A render variable? I have tried pageset, page detail but it does not alternate the pages.
Create a data item that defines the type of data for billing and notary, etc. Try page set with grouping on that data item
https://www.ibm.com/docs/en/cognos-analytics/11.0.0?topic=layers-creating-page-breaks
VAI Jason, It has worked. I have an image attached. I have one data item CON_PROJ_NUM and a Page set2. On Monday morning I look forward to sharing this with my customer. Now Page1 Summary prints, then Page2 Draw Request Project#1, is followed immediately by the Page3 Notary signature page Project#1. And so on for eight projects! enter image description hereHe will be delighted! Thank you!
Structure Is This:
Page set1
Detail Pages
Plant Awards Header and Footer Page 1
Page set2
[]CON_PROJ_NUM data item
Detail Pages
Draw Request Page2
Notary Page3 enter image description here

Display pagination number on page title

Currently, I have an issue about display pagination title in Shopware, template use Twig, load pagination pages by ajax, multi languages use snippet.
Detail:
The pagination title that need to be displayed: Page "X". X is page number.
The site used multi languages site, ex: english (Page "X"), german (Seite "X") ...
For default url (ex: abc.com/category-name) or page = 1 (ex: abc.com/category-name/?p=1): Not display pagination title.
For other pages (page 2, 3, 4): Display Page 2 ...
Page items will be loaded by use ajax when click the page number.
So, I don't know what to do display the pagination title on page title with multi languages.
Can everyone help me to resolve this issue?
Thank everyone.
You can hook into this method:
ListingPaginationPlugin.onChangePage (see the source code in vendor/shopware/storefront/Resources/app/storefront/src/plugin/listing/listing-pagination.plugin.js)
And after calling the parent method, insert - for a proof of concept - code like this:
document.title = event.target.value;
This would simply show the page number in the title (but losing the original title)
I suggest you back-up the original title and just append the "Page X" / "Seite X" information to it according to your necessary logic.
Now you need the translated word for "Page" available in the Javascript code.
You could attach this as a data-attribute to the title tag in the according twig template and use the normal `|trans' filter. I am not sure if there is a better way to have translations available in Javascript code in Shopware, so I asked.

How can I grab part of MediaWiki page title?

In MediaWiki 1.26.2, how can I grab part of a page title to use it in a #ifexist statement?
I need to link to different but related articles in MediaWiki, alerting the user if a page exists or do not. For that I did the following:
I have a page named ARTICLE_NAME. Associated with it is a page named Notes:ARTICLE_NAME. "Notes:" is not a namespace, but a string as ARTICLE_NAME is. I cannot create a namespace for Notes due to policy restrictions.
In ARTICLE_NAME page, the following code goes to check if the notes exists:
{{#ifexist: Notes:{{PAGENAME}} | {{alert_box}} | }
So if ARTICLE_NAME has a related Notes:ARTICLE_NAME page a I get a nice custom alert box highlighting the fact and linking to it.
My problem begins when I try the inverse. In the Notes:ARTICLE_NAME page, I need the notes to display an alert box if there is a page named ARTICLE_NAME. The code
{{#ifexist: {{PAGENAME}} | {{alert_box}} | }
Does nothing because {{PAGENAME}} brings Notes:ARTICLE_NAME as expected.
How can I get whatever comes after the "Notes:", using that instead of {{PAGENAME}} to check it with the #ifexist code?
It works by combining #pos with #ifeq.
Example:
{{#ifeq:{{#pos:text1|text2}}| |text1 does not contain text2|text1 contains text2}}
So after mucking around I found a way: remove the Notes: from the pagename then put it against the #ifexist.
{{#replace: {{PAGENAME}}|Notes:|}}
This way it replaces the Notes: with nothing. I made that a magic word named ARTICLE_TITLE, so the code that goes to notes is this:
{{#ifexist: :{{ARTICLE_TITLE}} | {{Alert_box}} | }}

Is it possible to print ID properly straight from the browser?

I wanted to design a simple ID printing software for my company, where I would load a database of entries and generate HTML/php output using a Background image as template, and css/html positioned text for the details and image.
I plan to use it on my own browser, therefore i have full control over the browser print settings..
I actually tried to do a basic HTML page emulating the output and i just can't get it to print right on our Datacard ID Printer (prints directly to PVC ID cards) ..
though i've set the browser (firefox) margins to zero and the print settings to scale , it's either i get a small margin left and top side of the card, or the printer prints out 2 cards (the id spans through 2 or more pages)
Is there ever a way, perhaps the proper browser setting , or registry hack or something that can get my html page to print right on a standard ID size output?
Regards

Webrat verify content in iframe or frameset

I am using Cucumber + Webrat + Mechanize adapter and want to test contents of pages that are iframed or framed into the selected page.
In other words:
Scenario: View header on webpage
Given I visit a page containing a frameset
When there is a header frame
Then I should see login details in frame header
The problem is of course the last step: I need to navigate to the frame header and investigate it's contents. I can verify the frame tag is here
response_body.should have_selector "frame[src][name=header]"
This leaves me with two questions:
How to read the src attribute and navigate to that page
How to navigate back to the original page
This would answer the first part of the question
Then /^I should see login details in frame header$/ do
within 'frame[name=header]' do |frame|
frame_src = frame.dom.attributes["src"].value
visit frame_src
response_body.should contain "Log in with digital certificate"
response_body.should_not contain "Log out"
end
end
you don't actually have to do it that way. Because your browser is already loading the frames automatically, you simply need to tell selenium(and thus webrat) which frame you want to look at.
When /^I select the "(.*)" frame$/ do |name|
selenium.select_frame("name=#{name}")
end
try this in the step definition:
within_frame("headerid") do
assert page.has_content? "login details"
end

Resources