Am new to cucumber. I am running two feature files. While running it shows an error. If am running the first tag only it runs fine - testing

#CucumberOptions(features = { "src\\test\\java\\com\\Features\\" }, glue = { "stepDefinitions" }, plugin = {
"pretty", "json:target/cucumber.json" }, tags = { "#Login","#baseCheck"}, monochrome = true)
Please help me solve this issue.
Error : None of the features at [src\test\java\com\Features\] matched the filters: [#Login, #baseCheck]

For this scenario Runner checks for feature which contains two tags "Login" and "baseCheck", however in your case one feature file contains tag as "Login" and other feature file contains tag as "baseCheck". Hence it treats as no feature exist with two tags and shows error as 'No feature' exist.
One quick fix is you have to add tags in testrunner as tags= {"#login,#basecheck"}

you specified each tag name in double quote, try this tag={ "#Login,#baseCheck"}

Yes, We need to define Cucumber setting as below.
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/test/resources"},
glue={"classpath:gradle/cucumber"},
format= {"pretty","html:test-outout"},
tags = {"#SmokeTests,#RegressionTest"}
)
public class TestRunner {
}

You can also used tags like this = { "#Login","#baseCheck"},
just write #baseCheck below Feature: and above Scenario: otherwise it will take tag as feature and throw exception "None of the features at [src\test\java\com\Features] matched the filters: [#Login, #baseCheck]"
For example:-
Feature: My Feature File
#baseCheck
Scenario: My scenerio
Given first
Then second
Then Third

Related

Docusaurus: How can I have multiple versions of different docs in the docs directory?

I'm working with Docusaurus to create a documentation site for 3 different education courses - all within the docs folder.
So I'm looking for a way to have the version be different across folders in there, or figure out what the best strategy for this is.
Right now, in my docusaurus.config.js I have:
module.exports = {
presets: [
'#docusaurus/preset-classic',
docs: {
lastVersion: 'current',
versions: {
current: {
label: '1.0.0',
path: '1.0.0',
},
},
},
],
};
But I'm not sure how to keep track of 3 different versions across 3 different docs all within the same site.
Swizzle the navbar via wrapping
yarn run swizzle #docusaurus/theme-classic NavbarItem/DocsVersionDropdownNavbarItem -- --wrap
Modify the swizzled component like so:
src/theme/NavbarItem/DocsVersionDropdownNavbarItem.js:
import React from "react";
import DocsVersionDropdownNavbarItem from '#theme-original/NavbarItem/DocsVersionDropdownNavbarItem';
import { useLocation } from '#docusaurus/router';
export default function DocsVersionDropdownNavbarItemWrapper(props) {
const { docsPluginId, className, type } = props
const { pathname } = useLocation()
/* (Custom) check if docsPluginId contains pathname
Given that the docsPluginId is 'charge-controller' and the routeBasePath is 'charge-controller', we can check against the current URI (pathname).
If the pathname contains the docsPluginId, we want to show the version dropdown. Otherwise, we don't want to show it.
This gives us one, global, context-aware version dropdown that works with multi-instance setups.
You want to declare a version dropdown for each plugin in your navbarItems config property for this to work well.
const doesPathnameContainDocsPluginId = pathname.includes(docsPluginId)
if (!doesPathnameContainDocsPluginId) {
return null
}
return <DocsVersionDropdownNavbarItem {...props} />;
}
For this to work, you need to have your documentation (based on products) split up using multi-instances: (https://docusaurus.io/docs/docs-multi-instance#docs-navbar-items)
Note that the preset docsPlugin ID always is "default".
You can try to use
import {
useActivePluginAndVersion,
} from '#docusaurus/plugin-content-docs/client';
const version = activePluginAndVersion.activeVersion.name; // use label instead of name if issues arise.
instead to get the current docsPluginId, name or label.
This would be the more "robust" solution I think. That said, we do use the solution I provided above as-is and it works fine for now.

Spartacus Configurable Product Integration: Custom Normalizer nested data being overridden

I am trying to implement a custom normalizer to the configurable product feature module. I have to include a custom field in the Attributes datatype. Currently only the OccConfigurationVariantNormalizer is available, which is quite high level form a data's point of view.
My problem occurs with the execution order of the normalizers. The default normalizer ist this: https://github.com/SAP/spartacus/blob/develop/feature-libs/product-configurator/rulebased/occ/variant/converters/occ-configurator-variant-normalizer.ts which is being called after my custom normalizer. Hence, the convertGroup() function is overriding my custom attribute field.
Here is my implementation:
#Injectable({
providedIn: 'root'
})
export class CustomConfiguratorNormalizerService extends OccConfiguratorVariantNormalizer{
convertAttribute(sourceAttribute: CustomOccAttribute, attributeList: CustomAttribute[]): void{
super.convertAttribute(sourceAttribute, attributeList);
attributeList[attributeList.length - 1].customField = sourceAttribute.customField;
}
}
Extending the original Normalizer seemed like the most promising solution for the time being, and is working quite like intended. So the customField ist being present at this point in time of execution.
Afterwards the OccConfiguratorVariantNormalizer kicks in, which is defining a new Attribute array in convertGroup(), erasing my custom attribute:
convertGroup([...]) {
const attributes: Configurator.Attribute[] = [];
if (source.attributes) {
source.attributes.forEach((sourceAttribute) =>
this.convertAttribute(sourceAttribute, attributes)
);
}
[...]
};
convertAttribute(
sourceAttribute: OccConfigurator.Attribute,
attributeList: Configurator.Attribute[]
): void {
const attribute: Configurator.Attribute = {
name: sourceAttribute.name,
label: sourceAttribute.langDepName,
required: sourceAttribute.required,
uiType: this.convertAttributeType(sourceAttribute.type),
values: [],
groupId: this.getGroupId(sourceAttribute.key, sourceAttribute.name),
userInput: sourceAttribute.formattedValue,
maxlength:
sourceAttribute.maxlength + (sourceAttribute.negativeAllowed ? 1 : 0),
numDecimalPlaces: sourceAttribute.numberScale,
negativeAllowed: sourceAttribute.negativeAllowed,
numTotalLength: sourceAttribute.typeLength,
selectedSingleValue: null,
images: [],
hasConflicts: sourceAttribute?.conflicts?.length > 0 ? true : false,
};
[...]
};
If my custom normalizer was the only one I could imagine it would work, which is why I tried to inject it like this:
{
provide: VARIANT_CONFIGURATOR_NORMALIZER,
useClass: CustomConfiguratorNormalizerService,
multi: false,
}
Throwing me Error: Multi-providers mixed with single providers.
Also, using the documentation from https://sap.github.io/spartacus-docs/connecting-to-other-systems/ I cannot get it to work without extending the original Normalizer, since target will always be undefined, which probably would not be the case if my custom normalizer came in second.
I feel like this https://github.com/SAP/spartacus/issues/9046 could be related.
Any help very much appreciated :)
I was able to solve this myself. Following the reference structure for spartacus applications at https://sap.github.io/spartacus-docs/reference-app-structure/ the problem disappeared.
My best guess is that it has to do with the import order of the modules. In my current working version I import the FeaturesModule last, which seems to solve the problem.

IE 11 "Expected Identifier" error on spread operator found in AJV code

In my Angular 6 app, I'm getting a console error in IE 11 as "Script1010: "Expected Identifier". No issues with evergreen browsers.
The error occurs at the first "." in the spread operator function, identified in the bundled js file is:
function(e,t,n){"use strict";function 1(...e){if(e.length>1)
{e[0]=e[0].slice(0,-1);const t=e.length-1;for(let n=1;n<t;++n)e[n]=e[n].slice(1,-1);return e[t]=e[t].slice(1),e.join("")}
Searching on keywords around this line of code, I've identified that it comes from the ajv.min.js file, specifically, perhaps within this code section from the file:
44: [function(e, r, t) {
var a;
a = this,
function(e) {
"use strict";
function C() {
for (var e = arguments.length, r = Array(e), t = 0; t < e; t++) r[t] = arguments[t];
if (1 < r.length) {
r[0] = r[0].slice(0, -1);
for (var a = r.length - 1, s = 1; s < a; ++s) r[s] = r[s].slice(1, -1);
return r[a] = r[a].slice(1), r.join("")
}
return r[0]
}
Apparently, the spread operator is not being transpiled into something IE11 can digest and the browser chokes on the first period in the (...e) function argument with an "Expected Identifier" error.
Any suggestions for workarounds or specific polyfills to fix the issue?
IE browser not support the Spread syntax and Rest parameter, to get the same result, you could refer to the following methods:
Method 1:
Using JavaScript methods (such as: foreach or array method) to loop through the parameter or array items, instead of using Spread syntax or Rest Parameter. More details information, please check the following links:
Spread Operator equivalent in IE - Javascript
ES6 spread syntax IE not supported
Alternatives of spread syntax
Method 2:
using #babel/polyfill and the babel-plugin-transform-object-rest-spread polyfills. Try to use the following command to install the polyfill:
npm install --save #babel/polyfill
npm install --save-dev babel-plugin-transform-object-rest-spread
Besides, since IE browser not support ES 6 syntax, please check your polyfills.ts file, and uncomment the related package for IE browser.
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
The issue here was with punycode.js. Forcing punycode.js to version 1.4.1 fixes the issue. Our version of ajv was causing a later version of punycode.js to load and that version contains ES6 code that trips up IE.

Django generic Views with templates

I've added a new template to my project (thing_listings.html) and I've added the views;
from django.views import generic
from .models import Things
class IndexView(generic.ListView):
template_name = 'home/index.html'
def get_queryset(self):
return Things.objects.all()
**class ThingView(generic.ListView):
template_name = 'home/thing_listings.html'
def get_queryset(self):
return Things.objects.all()**
class DetailView(generic.DetailView):
model = Labs
template_name = 'home/detail.html'
and the URl's;
from django.conf.urls import url
from . import views
app_name = 'home'
urlpatterns = [
# /home/
url(r'^$', views.IndexView.as_view(), name = 'index'),
**# /thingview/
url(r'^$', views.ThingView.as_view(), name='thingview'),**
# /home/"details"/
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
]
At the moment the site runs fine, except when I click on the thing_listings link I just get directed to index instead of what thing view is supposed to direct me to. Please help, I'm not sure where I've gone wrong.
Ive used the href: {% url 'home:thingview' %}
I've found the solution if anyone else is having the same issue.
All you should need to do is add the path to your regular expression eg:
url(r'^servicesview/$', views.ServicesView.as_view(), name='services'),
I've repeated the process multiple times to make sure it works.

I am having trouble with web2py routes.example.py

Hi I would like to ask a question about routes.example.py
My app is called "HelloWorld"
If I use following URL
http://127.0.0.1:8000/helloWorld/default/index
The user is guided to the main page.
I am trying to figure out handling errors.
For example If I have a following URL
http://127.0.0.1:8000/helloWorld/default/index11
I have to handle the error.
Based on my research, I know that I need to work on "routes.example.py"
The following is my work in routes.example.py
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
from fileutils import abspath
from languages import read_possible_languages
possible_languages = read_possible_languages(abspath('applications', app))
routers = {
app: dict(
default_language = possible_languages['default'][0],
languages = [lang for lang in possible_languages
if lang != 'default']
)
}
*** above part is given by the web2py***
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
default_application = "HelloWorld"
default_controller = "default"
default_function = "index"
routes_onerror = [
('HelloWorld/400', '/HelloWorld/default/login'),
('HelloWorld/*', '/HelloWorld/static/fail.html'),
('*/404', '/HelloWorld/static/cantfind.html'),
('*/*', '/HelloWorld/error/index')
]
I define the default application, default controller and default fuction
Bases on these, I define the error cases in routes_onerror...
Can you tell me that what I am missing?