-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Incomplete jasmine stack-trace in case of utam method caused a test failure #122
Comments
Hi @tanujvishno, thank you for taking the time to open this issue.
May you clarify what's
Would you be able to set up a minimal repository where the unwanted behavior can be reproduced? That would be helpful to see a test that exhibits this behavior (it can be against any Web page and doesn't have to be against a Salesforce test environment). |
sorry for the confusion , Yes, by utam-webdriver-jasmine I meant webdriverIO with jasmine , I'll share a repo url soon reproducing this issue |
@olivier-martin-sf https://github.com/tanujvishnoi/utam_demo , here is the demo code to produce truncated stack trace |
Thank you so much for providing the minimal repository, we are going to look into this as soon as we have the capacity to do so (probably next week) |
Hi @tanujvishnoi, I look into this issue and I would like to clarify the problem statement and expectations. Digging deeper, if I understood the problem statement correctly, it seems that the issue appears in the context of a waitFor predicate.
Getting non-existing elementFrom my observations, if I am trying to get a non-existing element, the stack trace provides the Jasmine context (with the position of the line that throws the error in the spec file). To reproduce try to define a public element with a CSS selector that doesn't match any element and try to invoke the function that gets the element from the test. For example: {
// other non-relevant properties
"elements": [
{
"name": "userNameInput",
"type": ["editable", "clickable"],
"public": true,
"selector": {
"css": ".dsadsads"
}
}
],
// other non-relevant properties
} And try to invoke this from the test: await demoPage.getUserNameInput(); This should throw an error with the following stack trace:
As you can see the last line of the stack trace is the Jasmine UserContext.
Getting non-existing element inside a predicateHowever if I am trying to wait for an element that doesn't exist in a waitFor predicate such as: // other non-relevant properties
"methods:" [
{
"name": "waitForNonExistentElement",
"compose": [
{
"apply": "waitFor",
"args": [
{
"type": "function",
"predicate": [
{
"element": "root",
"apply": "containsElement",
"args": [
{
"type": "locator",
"value": {
"css": ".fdskjfdkslj"
}
}
]
}
]
}
]
}
]
}
]
// other non-relevant properties And I am trying to invoke this method from my test: await demoPage.waitForNonExistentElement(); This is the error that I am having:
There we don't have the information about the test context (we don't know which line in our spec file generated the error). |
Thanks for sharing the examples . Yes the issue eventually reproducible for predicate . If a condition get failed inside a predicate , we did not get the full error stack `1) reproduce truncate error stack Case 1: Getting no existing element directly using getter
|
Thanks, I will pull your changes. Judging by your stack traces example, 1 & 2 provide the full stack trace but 3, 4 & 5 don't and all of them are related to timeout errors so can we narrow the problem statement to: "we don't have the full stack trace when there's a wait condition that times out?" Do you agree with that? If yes, I will start investigating why we shallow the context in waitFor |
Yes absolutely agree. |
After some investigation, I can confirm that I can reproduce the issue. It happens when the The problem is due to the execution of an async function that is triggered by a timer as described here: https://github.com/sindresorhus/got/blob/main/documentation/async-stack-traces.md. I created an item in our backlog so that we can fix the issue in a future release. Thank you for reporting this |
Hi @olivier-martin-sf just taking a follow up, please let us know once we have a fix for this issue |
Hello @tanujvishnoi , what company do you represent? |
@olivier-martin-sf Just wondered if there are any updates on this one and any plans as to when it may be fixed? |
Hi @tanujvishnoi & @KierenLWoods, this issue is being tracked in our backlog but hasn't been prioritised yet. |
Actual behavior
Hey everyone, we're working with utam-webdriver-jasmine flavors along with TS and during spec run we have noticed the stack trace get truncated if a test failed because of web-element issue [utam waitfor- method or element is not in scope],
in-short we got a complete stack trace in case of assertion failure like which spec line and file, but other failures wont populate complete stack-traces & the error source,
What is your expected behavior?
during any failure, the complete stack-trace should be visible indicating the spec line which actually caused this issue
Steps to reproduce
1: Create a TS-Jasmine-utam-wdio based project
2: Create few utam files with wait for methods that will fail or some non-existing locators
3: Draft spec file and use utam file and called specific methods or access locators stated in step2
4: Run the spec and observe the stack traces
Environment
Additional context
Refer to attached truncated stack-traces
1:
2:
The text was updated successfully, but these errors were encountered: