how (where) to define a feature step in Behat/Mink - yii

I'm experiencing problems with defining my own steps for BDD features in Behat and Mink setup in Yii framework.
I've successefully installed Behat with Mink extension following the instructions from MinkExtension-example.
After all that, I have the following structure of my folders inside myapp/private_html/ (some deeply nested folders were omitted):
├───bin
├───commands
│ └───shell
├───components
├───config
├───controllers
├───features
│ ├───bootstrap
│ └───php54_bootstrap
├───models
├───tests
├───vendor
│ ├───behat
│ │ ├───behat
│ │ │ ├───bin
│ │ │ ├───features
│ │ │ │ ├───annotations
│ │ │ │ ├───bootstrap
│ │ │ │ └───closures
└───views
A feature provided as an example in the above mentioned link MinkExtension-example works without a problem. But when I define my own step like
Scenario: presence of menu items
Given I am on "/"
Then I should see the following: "Home, About, Contact"
I get
1 scenario (1 undefined)
2 steps (1 passed, 1 undefined)
0m2.288s
with a suggestion
You can implement step definitions for undefined steps with these snippets:
/**
* #Then /^I should see the following: "([^"]*)"$/
*/
public function iShouldSeeTheFollowing($arg1)
{
throw new PendingException();
}
And the question is: where should I put this code? I've tried to put it in
myapp\private_html\features\bootstrap\FeatureContext.php
as well as in
myapp\private_html\vendor\behat\behat\features\bootstrap\FeatureContext.php
but the step remains undefined.
So, where are the steps supposed to be defined?

You never have to change vendor's code (I suppose you are using composer). Is not your code.
You code must to be added to features\bootstrap\FeatureContext.php.
Maybe the problem is that your FeatureContext class dont extends MinkContext but BehatContext. Y'll find a comment in FeatureContext's file. Change parent class of FeatureContext from BehatContext to MinkContext.
Finally, to see all sentences that your context can see, run "./bin/behat -dl". If you run this command before change Context, you can see that behat has few sentences.

if u want to see the predefined steps and functions by behat mink.
vendor/bin/behat -dl
you will see the steps u can use for ur site.
Now theres already a step you can use
Scenario: presence of menu items
Given I am on "/"
Then I should see "Home, About, Contact"
Theres nothing like "Then I should see following".

Related

how to use zrender with vue-echarts to register clicks on bar chart

I'm aware there is a similar question that was asked on here, but this is more specific to vue-echarts. On vue-echarts github page, they state that since version 4.1.0 Vue-Echarts supports ZRender events via zr: prefixed events. I can't really find documentation on how to implement this in vue and am not sure how to go about this. I want to register clicks when a user clicks not only on the bar, but also when they click in the space around the bar.
The following code below only registers clicks when a user clicks directly on the bar.
<v-chart :options="chartOptionsBar"
theme="infographic"
#click="selectBar"
:autoresize="true"
ref="chart">
</v-chart>
The linked post give the following solution for plain js, but i'm not sure how to transform this into something that vue understands. getZr() seemingly does not work with vue.
myChart.getZr().on('click', params => {
var pointInPixel = [params.offsetX, params.offsetY];
var pointInGrid = myChart.convertFromPixel('grid', pointInPixel);
var category = myChart.getModel().get('xAxis')[0].data[pointInGrid[0]]
console.log(category);
});
I tried npm installing zrender but also get the when trying to initialize a zrender object :
./node_modules/zrender/lib/vml/graphic.js
Module not found: Error: Can't resolve '../graphic/text/parse' in '/node_modules/zrender/lib/vml'
This was a bug, but supposedly was fixed, so I'm not sure if this affects the solution as well. Any help would be appreciated! I currently using vue-echarts v5.0.0, zrender v5.0.3.
Figured out the answer of my question by digging into vue-echarts code
Looking at the following commit, to use zrender events with vue-echarts format it the following way:
<v-chart :options="chartOptionsBar"
theme="infographic"
#click="selectBar"
#zr:click="outsideBarClick"
:autoresize="true"
ref="chart">
</v-chart>
and in the methods :
outsideBarClick: function(params) {
console.log(params)
}
Change the import line in ./node_modules/zrender/lib/vml/graphic.js
from:
import * as textContain from '../graphic/text/parse';
to:
import * as textContain from '../graphic/Text';

typo3 Bootstrap Package Subnavigation Left

I create a site based on Typo3 9.5.12 / Bootstrap Package 11.0.2.
The page tree looks like
Root > Sub1 > Sub1Sub1
Root > Sub1 > Sub1Sub2
Root > Sub1 > Sub1Sub3
Root > Sub2
Root > Sub3
I want to create a subnavigation menu for Sub1 so I create a page Root > Sub1 > Nav and I select Subnavigation Left.
I expected the navigation menu on this page to display Sub1Sub1, Sub1Sub2 and Sub1Sub3.
Instead, it displays the whole page tree.
I tried this in the official introduction package and the Subnavigation Left page display the list of pages of the current level in most cases.
How does Subnavigation Left (and Subnavigation Right, for that matter) decide the entry point of the menu? Can this be configured?
you could use another menuprocessor to define your additional menu in typoscript:
page {
10 = FLUIDTEMPLATE
10 {
:
dataProcessing {
:
50 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
50 {
levels = 2
entryLevel = 2
expandAll = 1
includeSpacer = 1
as = menuLevel3
}
}
}
}
This creates a menu structure for level 3 and level 4 pages you can use in your FLUID templates.
Make the configuration as you need it.
levels = how many levels should there in the menu data
entryLevel = starting level, as the first two levels are included in your main menu you can start at level 2
expandAll = include all sublevels (1) or just the active page tree (0), only important with further page levels
includeSpacer = whether spacer pages are included in the data
as = the name of your FLUID variable

How to enable backend layout selection for users

I create a site based on Typo3 9.5.12 / Bootstrap Package 11.0.2.
I need to enable my editors to select a backend layout for new pages (!).
So far I did not find a way to do so. Setting Page TSConfig for the editors group like so gives me the following result:
page.TCEFORM {
pages {
abstract.disabled = 1
backend_layout.disabled = 0
backend_layout_next_level.disabled = 0
}
}
Abstract field is disabled as expected.
Backend Layout cannot be selected. What can I do?
Have you granted access to these fields in the BE-Group definition?

Why is "require UIExplorerBlock" and "require UIExplorerPage" required for some Components?

In react-native for components such as ToolbarAndroid, Switch, ProcessBar, ToastAndroid, ListView, etc. the following is required and I have not been able to find an explanation why this is necessary:
var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');
and respectively
<UIExplorerPage>
<UIExplorerBlock>
..
</UIExplorerBlock>
</UIExplorerPage>
Those components are part of the UI Explorer sample application. They are using them to keep the sample code DRY.
You should not be using the UIExplorer* components in your own code.

Sharepoint 2010 GlobalNavigationNodes

Good day, I am looking for solution to make custom top navigation menu.
I got site collection and 3-4 nested sites. Builtin top navigation menu shows link like this:
| SiteCollectionLink | NestedSite1 | NestedSite2 | etc.
when i use:
myWeb = SPContext.Current.Web.Site.RootWeb;
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(myWeb);
SPNavigationNodeCollection nodeColl = publishingWeb.Navigation.GlobalNavigationNodes;
foreach (SPNavigationNode node in nodeColl)
{
//node processing
}
i got only NestedSite1 and NestedSite2 as nodes with no main node as it's not in there.
So i wonder how can i take first node?
(builtin navigation menu sohws it as well)
Found out myself, if anyone futher will face it, try this:
SPContext.Current.Site.RootWeb