Unable to utilise the steps of feature file 1 to another feature file 2 in Pytest-bdd - pytest-bdd

I have two feature files in features folder
features
login.feature
dashboard.feature
#feature1
feature: testing a new page
scenario: I want to test login screen
Given User is in home page
Then clicked on login button
#feature2
#login
scenario: I want to test dashboard screen
Given user in dashboard page
Then clicked on login button
I maintained the code in 2 separate step_defs
stepdefs
test_homepage.py
test_loginpage.py
Can I reuse the step of feature #1 in feature #2

Direct answer to your question is no, it is not possible to use steps from one feature in a different feature if the steps are implemented in different folders.
However there are different work arounds as mentioned by Rahul. In addition to those, you can also create a utils folder as in any other framework and you can add methods which will perform all the actions in the util folder and then call the method in both the steps. This will help in reducing the code duplication.

You can do 1 of two things here
Use conftest file to keep all your common functions that you want to reuse across the step definitions.
2.Call the method into other step definitions by importing the class/method.

Related

How do I publish just 1 HTML file in author instance of aem server?

I want to create a simple HTML file
/content/1.html
in the author instance in the aem server and publish it. How should I publish it - either through the UI or command-line is fine?
Two options for easier, to handle from browser itself,
1) Go to tree activation page and select the page path which you want to activate and click on the Activate button use the check boxes ( Only Modified, Only Activated, Ignore Deactivated) according to your need,
2) Go to crx/de console select the page that you want to activate under the content node. use the right side Replication Tab Replicate button to replicate the node.
Note that when using this node level replicate action you need to
activate all the child/individual nodes that are required to your page
content.
There are several other ways of doing replication by code, CURL, etc. as which one to use depends on your comfort levels.
package manager Image
Simplest ways are already mentioned above but i am mentioning one more way .
check it out if you are more comfortable with it.
You can replicate it or publish your file using Package manager.
1.Goto http://localhost:4502/crx/packmgr
2.Goto your package[/content/1.html] and edit it.
3.Save it and choose the replicate option under the more tab.
In the page side kick, you click on properties then "activate"

Practical way to use DocPad for a site with multiple landing pages

I would like to use DocPad together with its built-in server.
For a website with a single landing page I have set up the structure as recommended on DocPad website: all page sources go into the src/documents, static files into src/files and layouts for the page sources into src/layouts. Then docpad run will generate the resulting site in the out directory and launch a web server using which I can inspect the current state in my browser.
Now, I would like to do the same with multiple landing pages. That means, I plan to deploy files to one site, http://site-one.org and other files to another site http://site-two.org. I am doing this by deploying web pages to two distinct directories /public/site-one/ and /public/site-two/ at my web hoster.
What is the most practical way to accomplish this with DocPad?
These are the things I have tried so far -- they both work (sort of), but neither is very elegant:
Let page sources go into src/documents/site-one and src/documents/site-two and static files into src/files/site-one and src/files/site-two. This renders the entire site properly and it can be uploaded easily. However, the entire DocPad infrastructure with live-reload and the built-in server no longer works (since the built-in server root directory points to out/ instead of out/site-[one|two]/ as it should).
Have two separate DocPad-installations with duplicate docpad.coffee files, duplicate plugins and partially duplicate src/* trees and then upload the resulting out tree to the corresponding sub-directory on the server.
Update: When using option 1, instead of using DocPad built-in live-reload feature it's possible to use one's own web server, point it to out/site-one on one port and out/site-two on another port and then use the grunt live-reload feature which is part of grunt-contrib-watch, where grunt is available as a plugin here. It requires adding a single line of code to the template file, see this link, and to configure the plugin, see this link.
Update 2: A possible solution would involve the ability to set a custom directory for the server. By default it is set to the out directory. While that can be changed, it is not possible to specify separate directories for the generate action and the watch action. However, I have not found such an option in the configuration files.
Turns out that this is much easier than I thought. DocPad has a scarcely documented feature called "environments". This allows to customize several of the regular configuration variables, making it easy to pick the desired landing page on the command line.
This blog post on multiple languages demonstrates exactly how to customize both the document and the output paths in different environments. Applied to my original problem it becomes:
docpadConfig = {
...
environments:
site-one:
documentsPaths: ['documents_site-one']
outPath: 'out_site-one'
site-two:
documentsPaths: ['documents_site-two']
outPath: 'out_site-two'
...
}
Then it is as simple as
docpad [generate|run|...] --env [site-one|site-two|...]
to run regular commands like generate etc. for one of the landing pages by picking the proper custom environment.

AB testing in Test and Target

Using Adobe Test and Target, I know I can setup mboxes and push various pieces of content into them for testing purposes. But how do I test two seperate versions of a homepage against one another? Is this something that can be test in test and target?
Do I just make one big mbox that holds the whole homepage?
You can create an mBox that 'redirects' to the versions of your homepage. You can do this by setting up separate experiences, and splitting your campaign based on a traffic split, or via some other metric.
For example, you can simply have one mbox that has two offers pointed to it. The first "offer" could simply do a default content - which would be your control.
The second "offer/experience" could simply be a java-script redirect to your alternative homepage.
You can then add multiple experiences/offers all posted to the same box that do similar tings to have a ABCD type of test.
I would avoid putting too much code in an mbox, as its loaded dynamically and can have performance impacts. I think a simple redirect to a static HTML page is a better way to go.

SharePoint2010 Feature activation does not act the same if manually or powershell script

I have a SharePoint solution, containing 3 Features. One feature is Site scoped, and two are Web scoped.
The site feature contains different lists, 2 workflows and content types. Two of them are quasi similar, one is called CTTaskAchat, and the other one is called CTTaskAccord
The two web features contains lists definitions, lists instance and event Receiver.
When i deploy the solution with my powershell script and that I enable the feature with the powershell script, almost everything works pretty fine. The problem is that i can't find my content type CTTaskAccord nowhere. And I don't understand why i can't find it whereas i can find the CTTaskAchat content type.
If i deploy the solution with my powershell script, but that I activate the feature manually (i.e. through the Site Settings menu) the content type does appear.
So if you have any idea of where I could find my solution.
For your information, I would love to delete all the site collection and create a new one, but it's an update of the solution, so it's not possible.
EDIT : I've just noticed that some other points of the feature don't get activate (i have a list which doesn't exists with powershell but exists when i activate the feature manually)
You able to find the content type inside : Site Actions -> Galleries -> Site Content Types.
when you activated the site feature just check the feature is activated properly.

Multiple Entry Points in GWT

I'm getting into Google Web Toolkit, and am a little confused about the Entry Points in GWT. Google's docs say:
If you have multiple EntryPoints (the interface that defines onModuleLoad()) within a module, they will all be called in sequence as soon as that module (and the outer document) is ready.
If you are loading multiple GWT modules within the same page, each module's EntryPoint will be called as soon as both that module and the outer document is ready. Two modules' EntryPoints are not guaranteed to fire at the same time, or in the same order in which their selection scripts were specified in the host page.
So does each page in your website need an Entry Point defined for it?
Do you only really NEED an entry point when you have javascript generated based on your Java classes?
Are you able to combine multiple auto-generated-js definitions into a single *.gwt.xml file?
EDIT: Link to quoted source: http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html
Thanks!
The most straightforward way to make a GWT app is to have a single page for the entire application, and a single top-level module (defined in a .gwt.xml file). Each module has a single EntryPoint class. Then all of your different "pages" are sub-sections of the same page, ideally using GWT's history mechanism to keep track of state changes that in a non-AJAX web app would be new pages. So if you set things up this way you'll need one EntryPoint for your whole app.
The bit of the docs that you quoted (link?) discuss what I think is an advanced use case, where you've got more than one module that you're loading on a single page.
there is one options, U can create maven project with sub projects, means U can create multi entrypoint,
each entry point have own html. See more details