I have an xtext validation precedure which traverses the elements of the document and might find errors on elements in other files as the one being checked. However, when committing the error it is not marked in the other file, but in the current file at the position of the erroneous element in its file.
How can I assign an error to an other file?
I guess that there is some kind of relationship between the elements in your first document and the element of the other ones. Are the latter imported ? Do your elements cross-reference elements present in other documents ?
In either cases, you should normally be able to access the element at fault in your other document through a reference or a proxy. And once you have this EObject, you can get a link to its resource, on which you should be able to add errors and warnings.
Does it answer your question ?
Alexis
Related
I'm using Cypress to write automated tests. This is for a codebase I have no control over, so I can't make any changes to the app itself.
I'm attempting to run a .each loop to run through a set of collapsible fields to verify the data in each of them is correct. The fields list medical problems and associated data. The issue is that there are two lists of fields, one for active problems, and one for resolved problems, where the only difference between them is the data-cy tags. Those are the only unique identifiers for these elements, so I have to use the data-cy tags to select these without selecting other elements in the same container.
I'd be able to run the exact same .each function on both sets of elements, but I currently can't due to the elements not having the same data-cy tags. Is it possible for me to to have the Cypress .get call search for elements with one of two properties? Something like the following:
cy.get('[data-cy="problem-entry"]' OR '[data-cy="resolved-problem"]')
EDIT: Also, to clarify - I am currently able to get the test to behave by just duplicating the .each loop, once for each data-cy tag. Since the loop is several hundred lines of code, I want to remove the redundancy to clean this up a bit.
This answer is not perfect fix, but may work in your case: if these selectors are the only data-cy with the word "problem" in their value, you could do something like this:cy.get('[data-cy*="problem"]'). This will choose any data-cy which contains word "problem".
If that is not the case, I would like to address your "EDIT" message: you may put the whole code (several hundred lines) in a Cypress custom command and then call it, so instead of copying the code and calling it twice, you would just call your custom command twice (one line each).
I am recently brushing up my skills in TOSCA, I was working on it 2 years ago and switched to Selenium, I noticed that the new TOSCA allows identification using Xpath, and I am really familiar with it now, however, I cannot make it work in TOSCA and I am sure the object identification works because I am testing my xpath in google chrome developer tools.
Something as simple as (//*[text()='Forgot Password?'])[1] does not seem to be working. Could I be missing something?
This is the webpage I am using as reference for this example:
https://www.freecrm.com/index.html
XPath certainly can be used to identify elements of an HTML web UI in Tosca.
Since the question was originally posted, the "Forgot Password?" link at https://www.freecrm.com/index.html appears to have changed so that it's text is now "Forgot your password?" and is actually located at https://ui.freecrm.com/.
To account for that change, this answer uses "(//*[text()='Forgot your password?'])[1]" instead of the expression provided in the original post.
With the text modification, the expression works to idenfity the element in XScan after wrapping it in double quotes:
"(//*[text()='Forgot your password?'])[1]"
Some things to keep in mind when using XPath in Tosca:
It seems that XPath expressions need to be wrapped in double quotes (") so that XScan knows when to start evaluating XPath instead of using its normal rules. Looking closely at the expression that is pregenerated when XScan starts, we see that it is wrapped in double quotes:
"id('ui')/div[1]/div[1]/div[1]/a[1]"
A valid XPath expression doesn't necessarily guarantee uniqueness, so it is helpful to pay attention to any feedback messages at the bottom of XScan. There is a significant difference between "The selected element was not found" and "The selected element is not unique". The former simply indicates XScan can't find a match, the latter indicates that XScan matches successfully, but cannot uniquely identify the element.
My experience has been that it helps to explicitly identify the element to reduce the possibility of ambiguity. If the idea is to target the anchor element in order for tests to click a link, then reducing scope from any element i.e. "(//*[text()='Forgot your Password?'])[1]" to only match anchor elements with that text "//a[text()='Forgot your password?']".
In general, Tricentis (or at least the trainers with whom I have spoken) recommends using methods other than XPath to identify a target if they are available. That said, in my experience I've had better luck with XPath than with "Identify by Anchor".
An XPath expression is visible and editable in the XModuleAttribute properties without having to rescan. Personally, I find it easier to work with than the XML value of the RelativeId property that is generated when using Identify by Anchor.
With Anchor, I've had issues where XModuleAttributes scanned in one browser can no longer be found when switching to another browser, specifically from IE to Chrome. With XPath, I've not had these issues.
While XPath works well to identify the properties of one element with attributes of another because it can identify the relationship between them (very common with controls in Angular applications), the same can often be accomplished by adapting the engine layer using the TBox API (i.e. building a custom control). This requires some initial work up front from developer resources, but it can significantly improve how tests steer these controls in addition to reducing the need for Automation Specialists to have to rely on XPath.
What I know is that you can identify elements with XPath when working with XML messages in Tosca API testing. Your use case seems to be UI testing, but I am not sure about that.
Did you try to use XScan to scan the page? Usually Tosca automatically calculates an XPath expression for you that you can use immediately.
Please see the manual for details.
If it still does not work please try to be more specific? What isn't working? Error message? Unexpected behavior? ...
Tosca provides its set of attributes for locating any type of elements. You can directly select any number of attributes you want to make your element unique along with index of that element. Just make sure that you are not using any dynamic values in 'id' or 'class-name' of that element, also the index range is not so large like 20 out of 100; it could be 5 out of 10, which will be helpful if you need to update it in future.
Also take help of parent elements which will be uniquely located easily and then locate your expected element.
TOSCA provide various ways to locate an element just like selenium plus in addition it will provide other properties also.Under transition properties you will find x path and it will be absolute x path since you know selenium you know the difference between absolute and relative x path. I would suggest you to go with.
1.Identify by ID OR name
2. Identify by anchor
if your relative x path is not working
Try load all properties on the right side bottom. But it showed for me without clicking on it. See here
I have a structure like this:
<sv:a>
<sv:b sv:name="one"/>
<sv:b sv:name="two"/>
<sv:c sv:name="exclude"/>
<sv:b sv:name="error"/>
<sv:a>
I am trying to get all a's and b's but exclude from my search the content of any c.
I have this structure so far for my xpath query
//*[not(name()='error') and jcr:contains(*, 'searchInput')]
I want to add something to this to essentially say, "do not give me any node named exclude" or maybe a better way to put it is "exclude any node named exclude from the search". I am not sure if I can do that using the path initially used of //* and just filtering a different way. I know I cannot just say not(name()='exclude') because it is only looking at one level below root and only excludes nodes at that level.
Is there a way to search 1 more level below and exclude certain nodes by their name or search everything in the entire document and exclude those nodes of a particular name?
Im not sure it matters, but I am working the CMS Magnolia and trying to make a site search. I hit a limitation using jcr sql2 and cannot do what I am trying to do here as far as I have found in researching this.
EDIT:
Based on answers and comments, here is what I am looking at now:
//*[not(#sv:name='exclude' or #sv:name='error') and jcr:contains(*, 'searchInput)]
I still seem to be getting the 'exclude' results so I must either not be registering 'sv:' correctly or missing something in the query needed to exclude some of the results from the search.
I want to add something to this to essentially say, "do not give me any node named exclude"
That's easy: Nodes (elements) named exclude can be selected via the self axis,
using *[self::exclude]. Corollary: An element not named exclude is *[not(self::exclude)].
But I think you don't refer to element names. You don't have any <exclude> elements in your input.
You actually seem to refer to attributes.
//*[not(#sv:name = 'error' or #sv:name = 'exclude') and jcr:contains(*, 'searchInput')]
I am trying to get all a's and b's but exclude from my search the content of any c.
You can't, at least not with pure XPath. XPath is a language for selecting nodes out of an XML tree, not for building new trees that are different. An XPath expression can either select the a or not select the a, but it can't give you a new a element that has only some of the children of the original a and not others.
I have the following problem:
I want to avoid that one field of the copied row gets copied into the new row. (ME51n)
I thought that I could search somewhere in the debugger for this field name.
Example:
first row has the MATNR: 100-1-15
now i want to search in the debugger for the field MATNR. Is this possible?
(I know this example does not make sense, but my field is not used that often because it's an self-created field)
Or is there an user-exit especially for that?
Use watchpoints for that particular aim that you stated. In official documentation you can learn how to do it. The problem of finding suitable user-exit is not related to original question.
Is there any automatic way to check that all referenced messages in my jstl are, in fact, provided in a properties file?
Of course I always add in translations as I make references to them, but I'm mainly concerned about the rare instance where I forget one, or have a typo in either the fmt:messages tag or the properties file; if it is a message that isn't displayed often (e.g. an unusual error message), then I may not realize it until someone gets the error with a ???errormessagename??? which is no good!)
You should always have a default property.
With that you will avoid ???Property_Key??? messages.
But I recently had the same need.
I've made a Excel sheet with automatic merging.
The way I did it is:
Past the first property file content on a first sheet
Same for second on an other sheet
Create a macro parsing each lines, with making a split on the "=" the identify the key.
Put the key of sheet1 on a third sheet
Parsing sheet2 and try to match with keys in sheet3
iF no matches, there is a translation mission, put key in a fourth sheet.
I know it's not a perfect tool, but it's realy helpfull.