-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Potential bug with Text.ofAll() #603
Comments
I haven't 100% confirmed it yet but Text.of() also seems to not get the actual selected visible text from a target that points to a select. |
Hi @Ijee, Thanks for providing a test case! Given a HTML snippet like in the example above: <html>
<select>
<h1>Category</h1>
<option>Feature</option>
<option>Bug</option>
</select>
</html> and the question: Text.ofAll(Target.the('Category select').located(by.css('html > select')); what you're effectively saying is "give me text of all the However, because there's only one Could you try adding Text.ofAll(Target.the('Category select').located(by.css('html > select option')); Thanks, |
So the thing is. Hope that makes sense. I am not sure that I really want different Targets for the same HTML Element when I want all visible text options or just the selected one. |
Hi @Ijee - maybe this PR might provide you with more flexibility in getting the exact text you want? Hopefully will be merged soon @jan-molak? |
@nbarrett that really looks like what I was looking for / expected. I like it! I haven't taken a closer look but it does work with only a select as a target, aye? |
So it's been a year and I still have this problem. The thing is that I know what you mean but I don't see myself writing multiple targets for selects. I just don't see why that is necessary. This way I'd have to have a different target if I wanted to select a specific value / option text and another one if I wanted to check the currently selected value or am I missing something? I got quite a lot of problems with my tests for a while now and I am basically still stuck on the old 1.x version due to a big amount of tests just failing.. I mean yeah it is kind of my problem because in the old version I did a lot of custom Questions to get the desired result like this
This Question basically just got all the option text and I could simply assert them with my test case (it is obviously not the whole code). If I knew how to make them work again I'd do so in a hearbeat. |
As I mentioned on gitter currently Text.ofAll() does not return an array when your target points towards a select and you want to get the option text. Instead it will return a string that contains new line breaks as \n.
Here text.ofAll(Target.the('Category select').located(by.css('html > select')); would currently only return
Feature\nBug\n
as the actual value as a string on the site.It only does that currently for html selects and works for every other html strcuture I used it on.
I added a reproduceable unit test on my fork here
In the meantime can I somehow get the values myself and transform them to an array so I can easily compare them for my tests? As I have quite a lot of those tests spread around in one of my test repos a lot of tests currently fail.
The text was updated successfully, but these errors were encountered: