step definition regex wtih cucumber-protractor framework - protractor

Is there any way in that framework to use a regex for including steps that are similar.
Example:
the user logs in
a user logs in
the user can log in
In java, I used to be able to do:
Given(^(?:the|a) use (?:can log|logs) in$)
And this would recognize all the 3 steps above. It seems like the protractor-cucumber framework doesn't recognize those regex. Any idea?

I was using quotes around the step definition like:
When("the user enters correct credentials", async() {
and that doesn't support regex.
Changed it to
When(/^the user enters (correct|incorrect) credentials$/, async(word)=> {
And now I can use regex in the middle as I was hoping to.

Related

Using Regex to identify Entity on a Google Action Intent

I have this Intent on Google Actions with a couple of utterances:
and I'm using one of the default system types:
The Bank Account should always be 8 digits so I was thinking if I could use Regex on Google Actions to identify this exact entity when typed by the user.
If yes, how exactly?
Can I just create an utterance with Regex like this: \d{8}
Should I "highlight" as Parameter just like I did with the two given examples as well?
Thanks,
While this is not visible in the Actions Console, it is something that can be done if you download the project to a local environment using gactions.
You can create a new Type in under custom/types. You will use create RegularExpression Entities.
regularExpression:
entities:
# `bankNumber` is your parameter name. It can be custom.
bankNumber:
regularExpressions:
- \d{8} # In the `re2` syntax
Then you'll need to re-upload your project to the Actions Console with gactions push and gactions deploy preview.

Annotated User Expression [dialogFlow]

Just a quick question. I'm currently doing a project using dialogflow and in the past I've used that. Usually under "Training Phrases", there are 2 different annotations. One with "#" and the other with a huge " " " ". Now there isn't a choice for you to choose "#". Does anyone knows how to call out the entity directly?
For eg. # #sys.any:orderFood
As you can see at the bottom of https://dialogflow.com/docs/intents/training-phrases page, Template mode has been deprecated now (the one starting with # sign).
You have to use example mode only from now on.
If you want to use #sys.any:orderFood, simply write a keyword for that and annotate it with the correct entity. It will be same as using #sys.any:orderFood.
Hope it helps.

ActionMailerNext double dot or double full stop

I am using ActionMailerNext Standalone v3.2 in a console application. I populate the model from the database and send the email using email template with IEmailResult. But it replaces a dot with double dot at random places. If the email contains an url to an image say image.png, it appears as image..png. It sometimes happens with full stops at the end of the sentence as well. Has someone come across something like this before or is this something else?
I had to specify the MessageEncoding property in ActionMailerNext.Standalone.RazorMailerBase.MailAttributes which has solved the issue.

Can I enable / Disable an Azure Service Bus Topic using Powershell

I have spent a couple of hours search for a solution to disable my Azure Service Bus Topics using Powershell.
The background for this is we want to force a manual failover to our other region.
Obviously I could click in the Portal:
but I want to have a script to do this.
Here is my current attempt:
Any help would be great.
Assuming you're sure your $topic contains the full description, modify the status parameter in the array and then splat it back using the UpdateTopic method. I'm afraid I can't test this at present.
$topic.Status = "Disabled"
$topicdesc = $NamespaceManager.UpdateTopic($topic)
I don't think you'll need to set the entity type for the Status, nor do you require semi-colons after each line of code in your loop.
References
PowerShell Service Bus creation sample script (which this appears to be based off): https://blogs.msdn.microsoft.com/paolos/2014/12/02/how-to-create-service-bus-queues-topics-and-subscriptions-using-a-powershell-script/
UpdateTopic method: https://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.namespacemanager.updatetopic.aspx
Additional note: please don't screenshot the code - paste it in. I'd rather copy-and-paste than type things out.

how to verify text present in placeholder in selenium IDE

I want to verify the text present in placeholder. I have located the element and i am using Assert text command. I've entered the same string in value. On executing it is showing actual value did not match
Use assertAttribute or verifyAttribute command.
Example:
verifyAttribute | css=#search#placeholder | Sample String
Notes:
In the Target column of Selenium IDE, you need to provide the proper path of the element followed by an # sign
and then the name of the attribute. (placeholder in your case)
Using
verifyAttibute will still continue running the test case once an
error is detected while using assertAttribute doesn't.
You need to understand that assertText function can only check static text on your webpage.
You must be getting an error message.
This is perfectly normal.
What can help in this situation is using the assertAttribute or verifyAttribute functions.
Both these functions perform the same task; the former stops the test after receiving an error message in the text box while verifyValue just records the error in the log and runs the next commands.
While giving the target, either specify the XPath or refer by using the name=name#placeholder format.
You can find the name value by inspecting the box with a firefox addon called Firepath which runs with another firefox tool called Firebug. Install them if you don't already have.
Hope this helps!
Xpath contains() is the best way.
driver.find_element_by_xpath('//input[contains(#placeholder,"email")]')
Format : '//tag[contains(#attribute,"value")]'