Separate file for element locators in BDD+Cucumber+watir framework - cucumber

I am using BDD+cucumber+watir framework to automate a website. Folder structure is like this.
Is it possible to maintain all the element Ids(locators)of a page in one file and call it in step definition.

I cannot see the structuring picture but You can either use the PageFactory model structuring for pure POM. If you are used to BDD and want to maintain most part of its features. You can as well store all the element ids to a file called cucumber.yml. You can find the page object gem https://github.com/cheezy/page-object
Create a file called cucumber.yml in your project directory and have all the locators stored in it as like:
LoginPage
emailtextfield: email_text_field_id
You can load this pageelements.yml file using the YAML loader and call this element locator in the stepdefinition like LoginPage[emailtextfield]
Similarly you can categorize this for all the pages, different yml files. This would be a keydriver approach.

Related

Azure Media Services: Provide custom file names for the asset files

I'm encoding a video file using the built-in adaptive streaming transform. Once the file is successfully processed, an asset container is created with the below files:
Is it possible to provide custom file names at the time a job is created? It seems that the default behavior is to take a certain number of characters from the original file name and prepend them in the above file names. If possible, I'd like to configure this behavior.
P.S. I'm using the .NET SDK.
You can create a custom transform to output file names differently. On https://learn.microsoft.com/en-us/rest/api/media/transforms/createorupdate#definitions search for the Mp4Format section. In that you can specify the filenamePattern with certain macros like {Bitrate} and {Codec}.
See https://learn.microsoft.com/en-us/azure/media-services/latest/custom-preset-cli-howto for an example custom transform and the process by which to create it in Media Services.
I use the macros on my jobs, they work ok. I have a process that takes 3 videos (an intro section, the actual content, and the outro section) and encodes them as one single video. The issue I have with the macros is that it uses the file name of the first video in the inputs. So it ends up using the file name of the intro video which is a generic name. They need to have a way where we can have a little more control.
I suppose I could copy/rename the intro video to a desired name before I encode and it would pick it up, but that seems to be a little bit of overkill.
The Macros are good, but they could use some enhancements I think.

How to load only changed portion of YAML file in Ruamel

I am using ruamel.yaml library to load and process YAML file.
The YAML file can get updated after I have called
yaml.load(yaml_file_path)
So, I need to call load() on the same YAML file multiple times.
Is there a way/optimization parameter to pass to loader to load only the new entries in the YAML file?
There is no such facility currently built into ruamel.yaml.
If a file consists of multiple YAML documents, you can optimize the loading, by splitting the file on the document marker (---). This is fairly trivial and then you can load a single document from start to finish.
If you only want to reload parts of a document things get more difficult. If there are anchors and aliases involved, there is no easy way to do this as you may need a (non-updated) anchor definition in an updated part that needs an alias. If there are no such aliases, and you know the structure of your file, and have a way to determine what got updated, you can do partial loads and update your data structure. You would need to do some parsing of the YAML document, but if you only use a subset of YAML possibilities, this is often possible.
E.g. if you know that you only have simple scalar keys at the root level mapping of a YAML document, you can parse the document and extract non-indented strings that are followed by the value indicator. Any such string that is not in your "old" data structure is a new key and its value should be parsed (i.e. the YAML document content until the next non-indented string).
The above is far less trivial to do for any added data that is not added at the root level (whether mapping or sequence).
Since there is no indication within the YAML specification of the complexity of a YAML docment (i.e. whether it includes anchors, alias, tags etc), any of this is less easy to built in ruamel.yaml itself.
Without specific information on the format of your YAML document, and what can get updated, specific implementation details cannot be given. I assume however that you will not update and write out the loaded data, if that is so, make sure to use
yaml = YAML(typ='safe')
when possible as this will get you much faster loading times than the default round-trip loader provides.

Alfresco node-browser.get.js webscript

At this location in this jar file alfresco-remote-api-5.0.d.jar\alfresco\templates\webscripts\org\alfresco\slingshot\node-browser\ there is a webscript. But this webscript consist to 2 files (node-browser.get.desc.xml and node-browser.get.json.ftl ) There isn't the node-browser.get.js file.
I want to know what is done in this fil. I want to select categories and include certains aspects (i have added to categories) in the selection.
Thank you.
Javascript file is not mandatory while creating webscript.
Below is the URL of source file which is getting called on your specified webscript.
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V5.0.d/root/projects/remote-api/source/java/org/alfresco/slingshot/web/scripts/NodeBrowserScript.java
Below is context file for java file.
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V5.0.d/root/projects/remote-api/config/alfresco/web-scripts-application-context.xml
check bean with webscript.org.alfresco.slingshot.node-browser.node-browser.get
Id.
you need to change in that if you want to customize it.
Usually a webscript is made of 3 parts:
a description file (in your case node-browser.get.desc.xml) which
uses a description language to define many aspects of the
webscript, like security, transaction management and so on
a Server-Side Javascript js file that consists of the business logic that is performed by
the script. In your case you don't have the node-browser.get.js file
because this happens to be a Java backed webscript, that is a
webscript whose business logic is written in Java and not in
Server-Side Javascript.
a Freemarker Template file, node-browser.get.json.ftl, which contains
the presentation logic (view) that has to show the results of the invocation.
In order to achieve what you're looking for about selecting categories and include certains aspects, you'd better learn more about how webscripts work and moreover how to configure/customize Alfresco's interface.
You'd better look at these tutorials in order to get more info.

How can I implement a shared library in Node.js?

I'm looking for something similar conceptually to a Windows DLL. As a concrete example, suppose I have a function encrypt that I would like to share across several unrelated projects. If I want to change the implementation ideally I can do so once and every project has access to the new implementation. Is there a mechanism for doing this in Node.js?
Have a look at this document especially the section "Writing a Library"
If you are writing a program that is intended to be used by others,
then the most important thing to specify in your package.json file is
the main module. This is the module that is the entry point to your
program.
and
If you have a lot of JavaScript code, then the custom is to put it in
the ./lib folder in your project.
Specify a main module in your package.json file. This is the module
that your users will load when they do require('your-library'). This
module should ideally expose all of the functionality in your library.
If you want your users to be able to load sub-modules from the "guts"
of your library, then they'll need to specify the full path to them.
That is a lot of work to document! It's better and more future-proof
to simply specify a main module, and then, if necessary, have ways to
dynamically load what they need.
For example, you might have a flip library that is a collection of
widget objects, defined by files in the flip/lib/widgets/*.js files.
Rather than having your users do require('flip/lib/widgets/blerg.js')
to get the blerg widget, it's better to have something like:
require('flip').loadWidget('blerg').

When generating SubSonic DAL, is it possible to have .gen.cs in the generated filenames?

When generating my DAL files with SubSonic, I'd like the names of the files to be .gen.cs. The main reason for this is that the files are partial classes, and I would like to add some additional implementation details into another source file for the table called .cs. This is somewhat the standard pattern for generated source files , and I'm wondering if its possible with SubSonic? I'm using SubSonic 2.2.
I thought you might be able to do this by using a set of custom templates, but the CS_ClassTemplate.aspx (or VB_ClassTemplate.aspx) doesn't control the file name of the class.
I don't think this is possible.
As an alternative, you can do what I do. I have a "generated" directory, such as \database\generated and then I put my partial classes at \database\custom. As long as the namespaces of the files in the two different directories match (like .database or whatever), then it works fine. By using two different directories, it's easier to find your custom files without looking at the generated ones.

Resources