timeout Exception even when element is already clicked - opentest

I am trying to click one button Sign In but even after button is clicked I am getting timeout exception.
I have verified the code and verified that I am using right locator.
description: CAP Demo
Navigate to the GitHub website, find the React repo using the
search functionality and go to the repo's homepage
actors:
- actor: WEB
segments:
- segment: 1
actions:
- description: Navigate to the GitHub homepage
action: org.getopentest.selenium.NavigateTo
args:
url: http://192.168.200.98:8780/CAFPortal/#/login
- description: Enter Login id
action: org.getopentest.selenium.SendKeys
args:
locator: {xpath: "//*[#id='login']/app-root/app-caf-login/div/div/div[2]/form/div[1]/input"}
text: ksood
sendEnter: true
- description: Enter password
action: org.getopentest.selenium.SendKeys
args:
locator: {xpath: "//*[#id='login']/app-root/app-caf-login/div/div/div[2]/form/div[2]/input"}
text: Acs#2018
sendEnter: true
- description: Pause for 60 second
action: org.getopentest.selenium.ActionsPause
args:
durationMs: 60000
- description: Display a greeting dialog box in the browser
action: org.getopentest.selenium.ExecuteScript
args:
script:
var message = "Hello World!";
alert(message);
- description: Click on sign in
action: org.getopentest.selenium.Click
args:
locator: {xpath: "//*[#id='login']/app-root/app-caf-login/div/div/div[2]/form/div[3]/div/div/button"}
Just want the last testcase to pass

You don't need the sendEnter: true argument with any of the SendKeys actions. When you pass sendEnter: true , the action will "press" the enter key after sending the keys to the textbox element. So basically, in the test you showed, the first action will input the username and then press enter, thus trying to log in without a password, which will of course fail.
The other problem is that you are using the ActionsPause keyword incorrectly (more info here). If you want to introduce a delay in your test, you can use the $delay() API, but you very rarely need to do this with OpenTest, since synchronization is built-in, meaning all test actions that perform some work on a UI element know how to wait for that element to be available before doing the work.

Related

How can I make an optional email settings in my Jelastic manifest and return the value to the user?

Let's say I have a Jelastic manifest where, in the settings section, I ask the user for an email address (to setup some service). Because the user using Jelastic already is logged on Jelastic with an email, it might make sense to propose to the user that she uses that email. It saves her typing during the manifest setup. So, ideally, what I would like to do is this:
settings:
fields:
- name: email
caption: Email
type: string
default: ${user.email}
Then, in the manifest success text, I would like to display it, along with other credentials for the deployed services in the installed Jelastic environment:
success:
text: |
**Email**: ${settings.email}
The email is typically used as a username in a service deployed on the new Jelastic environment and in the success text it would be displayed near the corresponding password.
This above is all nice, but it doesn't work. Indeed, I cannot use the ${user.email} in the default field for the email settings.
Currently, the only viable way I've found to make it work is as follows:
settings:
fields:
- name: useJelasticEmailAsEmail
type: toggle
caption: Use Jelastic Email
value: true
hidden: false
showIf:
false:
name: email
caption: email
type: string
required: true
Then, I can use it to install a service like so:
onInstall:
- script: 'return { result: 0, email: ${settings.useJelasticEmailAsEmail} ? "${user.email}" : "${settings.email}" };'
- install:
jps: my-service-manifest.yml
settings:
username: ${response.email}
However, after installation of my-service-manifest.yml, I have no access to the actually used email anymore, therefore I cannot use the ${response.email} in my success text, except maybe if my-service-manifest.yml returned the email somehow (possibly with a return statement?).
The thing is, I may have many services to install like that, but only one requires the email. Additionally, it might be that for some reason that service requiring the email must be installed first. In such a case, with the above solution, I'd need to propagate the email through all services in order to get it out to the success text. The email would be consumed by the first service and somehow returned to the next. The next service does not need the email, but must propagate it, therefore it should take it as settings argument and return it to the next service, and so on. This is not very nice to have a manifest taking arguments it doesn't need, therefore that solution is probably not the right one.
I find that very complicated for a very simple problem. There must be something easier to do, right? Can someone give me a hint?
I'd need a solution for a manifest where I have many of such optional parameters. Currently, I have an issue with the email and also with secrets. In my use-cases, it makes sense that these secrets be provided by me directly in the settings or that they be automatically generated with e.g. ${fn.password(20)}. For some installations I need to set them myself, for some other installations I need to let them be automatically generated.
So, the working solution I have found goes as follows, assuming I have 2 optional parameters:
in the settings section of my jps manifest, I do
settings:
fields:
- name: useOptionalParam1
type: toggle
caption: Use optional param1
value: true
hidden: false
showIf:
false:
name: param1
caption: Param1
type: string
required: true
- name: useOptionalParam2
type: toggle
caption: Use optional param2
value: true
hidden: false
showIf:
false:
name: param2
caption: Param2
type: string
required: true
define values for those params in the globals section (for the email, this is not necessary, because it is defined as user.email):
globals:
OPTIONAL_PARAM1: ${fn.password(20)}
OPTIONAL_PARAM2: ${fn.password(20)}
define an action like this:
actions:
getOptionalParams:
- script: 'return { result: 0, param1: ${settings.useOptionalParam1} ? "${globals.OPTIONAL_PARAM1}" : "${settings.param1}", param2: ${settings.useOptionalParam2} ? "${globals.OPTIONAL_PARAM2}" : "${settings.param2}" };'
call the action wherever necessary; for example, before the success text:
# settings, globals, nodes sections
[...]
onInstall:
- myVariousInstalls
- getOptionalParams
success:
text: |
**PARAM1**: ${response.param1}
**PARAM2**: ${response.param2}
Note the last call to getOptionalParams at the very end of the onInstall section. It is there to provide the response object to the success section. Interestingly, that works fine. The getOptionalParams action can also be called anywhere in the myVariousInstalls action. It must be called before an operation, for example like this:
actions:
[...]
myVariousInstalls:
- getOptionalParams
- install:
jps: path/to/manifest
settings:
param1: ${response.param1}
In so doing, I solve my initial problem.

Rasa - I want same reply for every kind of conversation start

I have few intents.
But what I want is, at the start of conversation not matter what is being asked I want to always give welcome message.
I tried few things to achieve this but didn't work.
rule: rule-3
conversation_start: true
steps:
intent: product_price
action: utter_greet
For example in my story if at any other places for same intent I want different action.
But for same intent at the start of conversation I want greet message.
But then when I implement above technique it says contradicting rule and story.
Please note - user can start conversation literally by anything (and thus I can't have intent for each and everything) and I always want to greet with welcome message.
How do I do this?
I have resolved this using slots.
For every intent I have these story:
stories:
- story: -story-1
steps:
- slot_was_set:
- start_conv: false
- intent: greet
- action: action_greet
- story: -story-2
steps:
- slot_was_set:
- start_conv: false
- intent: goodbye
- action: action_greet
- story: -story-3
steps:
- slot_was_set:
- start_conv: false
- intent: product_price
- action: action_greet
Now every real story always starts with this:
story: onroad_price greet1
steps:
slot_was_set:
start_conv: true
intent: onroad_price
action: action_onroad_price_query
intent: assert_yes
action: action_onroad_price_answer
story: onroad_price greet2
steps:
slot_was_set:
start_conv: true
intent: onroad_price
action: action_onroad_price_query
intent: assert_no
action: utter_more_help
I think your are searching it too far.
Normally you just set your start intent in the interface that your client is talking to, so that on the moment your client connects it will see the welcome message.
After he can ask any question he wants and hit any intent needed.

Timeout error for element already clicked

I am getting below exception even when my element has already been clicked and i am navigated to next page.
Caused by: org.openqa.selenium.TimeoutException: Expected condition
failed: waiting for element to be clicked: [[ChromeDriver: chrome on
XP (56f040029c23126b0087ff1dfa82369e)] -> xpath:
//*[#id='login']/app-root/app-caf-login/div/div/div[2]/form/div[3]/div/div/button]
(tried for 10 second(s) with 500 milliseconds interval)
Verifying XPAth but since element is already clicked them not sure why error is coming.
Description: Click the Sign In Button
action: org.getopentest.selenium.Click
args:
locator: { xpath: "//*[#id='login']/app-root/app-caf-login/div/div/div[2]/form/div[3]/div/div/button" }
Description: Pause for 60 second
action: org.getopentest.selenium.ActionsPause
args:
durationMs: "60000"
Expected : no error should be there
As described in this answer make sure you don't use the sendEnter: true argument with any of the SendKeys actions. When you pass sendEnter: true , the action will "press" the enter key after sending the keys to the textbox element. So basically, in the test you showed, the first action will input the username and then press enter, thus trying to log in without a password, which will of course fail.
Also, you are using the ActionsPause keyword incorrectly (more info here). If you want to introduce a delay in your test, you can use the $delay() API, but you very rarely need to do this with OpenTest, since synchronization is built-in, meaning all test actions that perform some work on a UI element know how to wait for that element to be available before doing the work.

Zapier CLI Trigger - How to use defined sample data when no results returned during setup

I am trying to prototype a trigger using the Zapier CLI and I am running to an issue with the 'Pull In Samples' section when setting up the trigger in the UI.
This tries to pull in a live sample of data to use, however the documentation states that if no results are returned it will use the sample data that is configured for the trigger.
In most cases there will be no live data and so ideally would actually prefer the sample data to be used in the first instance, however my trigger does not seem to ever use the sample and I have not been able to find a concrete example of a 'no results' response.
The API I am using returns XML so I am manipulating the result into JSON which works fine if there is data.
If there are no results so far I have tried returning '[]', but that just hangs and if I check the zapier http logs it's looping http requests until I cancel the sample check.
Returning '[{}]' returns an error that I need an 'id' field.
The definition I am using is:
module.exports = {
key: 'getsmsinbound',
noun: 'GetSMSInbound',
display: {
label: 'Get Inbound SMS',
description: 'Check for inbound SMS'
},
operation: {
inputFields: [
{ key: 'number', required: true, type: 'string', helpText: 'Enter the inbound number' },
{ key: 'keyword', required: false, type: 'string', helpText: 'Optional if you have configured a keyword and you wish to check for specific keyword messages.' },
],
perform: getsmsinbound,
sample: {
id: 1,
originator: '+447980123456',
destination: '+447781484146',
keyword: '',
date: '2009-07-08',
time: '10:38:55',
body: 'hello world',
network: 'Orange'
}
}
};
I'm hoping it's something obvious as on scouring the web and Zapier documentation I've not had any luck!
Sample data must be provided from your app and the sample payload is not used for this poll specifically. From the docs:
Sample results will NOT be used for a user's Zap testing step. That
step requires data to be received by an event or returned from a
polling URL. If a user chooses to "Skip Test", then the sample result,
if provided, will be used.
Personally, I have never seen "Skip Test" show up. A while back I asked support about this:
That's a great question! It's definitely one of those "chicken and
egg" situations when using REST Hooks - if there isn't a sample
available, then everything just stalls.
When the Zap editor tries to obtain a "sample result", there are three
places where it's going to look:
The Polling endpoint (in Step #3 of your trigger's setup) is invoked for the current user. If that returns "nothing", then the Zap
editor will try the next step.
The "most recent record/data" in the Zap's history. Since this is a brand new Zap, there won't be anything present.
The Sample result (in Step #4 of your trigger's setup). The Zap editor will tell the user that there's "nothing to show", and will
give the user the option to "skip test and continue", which will use
the sample JSON that you've provided here.
In reality, it will just continue to retry the request over and over and never provide the user with a "skip test and continue" option. I just emailed again asking if anything has changed since then, but it looks like existing sample data is a requirement.
Perhaps create a record in your API by default and hide it from normal use and just send back that one?
Or send back dummy data even though Zapier says not to. Not sure, but I don't know how people can set up a zap when no data has been created yet (and Zapier says not many of their apps have this issue, but nearly every trigger I've created and ever use case for other applications would hint to me otherwise).

Is there a way to mark the end of a method in RAML?

I'm writing some RAML in an API designer and I have the following code:
/users:
/{id}:
/tags:
description: Personal tags of a user
get:
description: A list of the user's personal tags
responses:
200:
body:
application/json:
example: |
{
tags: [
{...},
...
]
}
/{slug}:
description: A personal tag
put:
The parser is throwing an error at /{slug} because it thinks that I'm trying to use it as a property of the get: method. However, /{slug} needs to be indented to make it subordinate to /tags.
Is there a way in RAML (or YAML, since RAML is supposed to be an instance of YAML), to mark the end of a map? Or do you have any other suggestions?
RAML doesn't (AFAIK) support explicit termination of maps, but we also don't need that to solve your problem :-).
Since in YAML the whitespace is semantic, what's happening is that your GET method is currently indented such that it's a method on the /users/{id} level, so even though it looks like /{slug} is subordinate to tags, it thinks it is in the definition of /users/{id} Really, we should probably throw an error here, since the method definition comes after you've defined a sub-resource (thanks for finding this case).
To solve, all you need to do is indent your description and get definition for /users/{id}/tags one additional level, and it should all parse fine. Updated RAML is below.
/users:
/{id}:
/tags:
description: Personal tags of a user
get:
description: A list of the user's personal tags
responses:
200:
body:
application/json:
example: |
{
tags: [
{...},
...
]
}
/{slug}:
description: A personal tag
put:

Resources