by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
ralves20
@ralves20
How can I do this in a better way?
Jan Molak
@jan-molak
Hi @ralves20 - @nbarrett is working on this feature under serenity-js/serenity-js#373
ralves20
@ralves20
Thank you very much @jan-molak
Just one more question... which is the best way to assert that every element from a list is visible ?
Jan Molak
@jan-molak
Can you tell me more about the scenario? What sort of behaviour are you trying to verify?
ralves20
@ralves20
I have a list of rows inside an accordion, each row has a different text, but that follows always the same pattern
I want to verify if every row has it content visible, and if every row has this specific text
Jan Molak
@jan-molak
👋 Hello folks! Version 2.14.0 is out and brings support for working with <select /> boxes. Huge thanks for Mr. @nbarrett for helping out on this new feature!
zuyetawarmatik
@zuyetawarmatik

Hi guys,

I have one quite problematic question.

Currently I'm using Acuant, which is a passport scanner library. Once initialized, it pops up a file dialog. The question is, how to select the file from this dialog in serenity-js ? The file dialog is triggered by the library, by document.createElement('input') with type=file, but the things that doing isPresent() assertion for the target input[type=file] will fail.

Jan Molak
@jan-molak
Hey @zuyetawarmatik - selenium webdriver doesn't have access to the dialog itself, but you should be able to use an interaction to Enter.theValue(pathToFile).into(targetForAcuantInputBox) to provide the file
zuyetawarmatik
@zuyetawarmatik

Hey @zuyetawarmatik - selenium webdriver doesn't have access to the dialog itself, but you should be able to use an interaction to Enter.theValue(pathToFile).into(targetForAcuantInputBox) to provide the file

Thanks @jan-molak ! I will try to use it, but as mentioned targetForAcuantInputBox is null when I do assertion. I'm not sure if programmatically-created DOM element (document.createElement()) is findable by webdriver? If it's somewhere on the HTML tree then life has been better, but I cannot see it in inspection (because the library doesn't do appendChild for the input)

Jan Molak
@jan-molak
I don't know Acuant, so can't really comment
but
if Acuant can be interacted with programmatically (i.e. from dev tools), you can always make Serenity/JS execute a script
actor.attemptsTo(
  ExecuteScript.sync(`
    window.acuant.doStuff()
  `)
)
zuyetawarmatik
@zuyetawarmatik
@jan-molak I think it's more on the fundamental of HTML itself, that an element created by document.createElement() cannot be get using document.querySelector() if it's not appended to the body, so that's why isPresent() fails. Seems it's quite hard to work around unless hacking into the lib code to do append the element to the body so the file input can be found
Jan Molak
@jan-molak
@zuyetawarmatik yes, it all depends on where the boundary of your system under test is and how much of the external system you're willing to interact with
Josh McVey
@y3rsh_gitlab

Hello, I can't seem to figure out how to build a loop to repeat a Question and Task/Interaction.

I am looking to implement an Interaction/Task that repeats a different Task until The Answer to a Question is true.
Think of a wallet on a shopping site that allows you to save multiple credit card details to make payments in the future. I might have 5,0, or 1 credit cards saved. Regardless of the state when I enter the wallet management page (the list of my saved cards) I desire to have the wallet empty. I have a Task RemoveWalletItem that performs the steps to remove the first wallet item in the list(which refreshes the list). There is no multi select or clear wallet functionality, I must remove them one at a time. I can ask the Question IsWalletEmpty()
pseudocode:

while(not IsWalletEmpty()){
RemoveWalletItem();
}

or

RemoveWalletItems(){
if (not IsWalletEmpty()){
RemoveWalletItem();
RemoveWalletItems();
}
}

2 replies
Jan Molak
@jan-molak
Hey @y3rsh_gitlab; you might need a custom task for that to keep repeating the while loop until the condition is met
the (imaginary) While task would need to do something similar to Ensure, so make the actor answer the question and if the condition is now met, perform a list of activities
Jan Molak
@jan-molak
please feel free to raise a ticket to add this in (or even better submit a PR) - https://github.com/orgs/serenity-js/projects
it sounds like a useful feature
Josh McVey
@y3rsh_gitlab
cool, ty @jan-molak
Ijee
@Ijee
I feel like I can't fix all the problems I have with my code when I migrate it. I think I tried doing this months ago but with all my protractor related custom code it would take an eternity to migrate. Might as well not
Jan Molak
@jan-molak
What problems do you have? Maybe we need to add more tips to the migration guide?
Ijee
@Ijee
It's just quite a lot
serenity-js/serenity-js#603
What I wrote here basically. I'd like to use my old protractor Questions somehow
isSelected.png
I also get this when I do isSelected()
and it points to a target that is a checkbox and all my target go to "css selector > label"
because in 1.x I could not click with protractor on the checkbox itself only on the label
and it seems like it can not check whether it is selected or not if I have that target
Ijee
@Ijee
correctText.png
I have another interaction that checks whether the correct text is inside an input and it can be a date or just plain text. If it is a date I have to split it as it can show differently based on location / language but my Ensure.that() just produces this
It can not get the actual value of the input somehow
And I am not doing anything special either it is just a Ensure.that(Text.of(actualTarget), equals(desiredText))
Ijee
@Ijee
I have to log off here for today. I'll check back tomorrow. Maybe I need some coaching, lol
Jan Molak
@jan-molak
Haha, no worries, I do coaching too ;-)
Ijee
@Ijee
The thing is that no one else here on my project knows enough about this test project to really help with it
unless to add more test cases
just not a priority as we are really tight on time
Jan Molak
@jan-molak
Got it; if you'd like we could help you with the migration
Ijee
@Ijee
Yeah I'll talk about it with someone. It's just that it also uses the funny general tasks that I told you about some time ago. To write more tests without any added code. So one thing being broken somewhere just cascades a lot more
At least we had a rebuild of the site so we have quite a lot less test cases at the moment
Jan Molak
@jan-molak
Yes, I remember that pattern you showed me
The good thing about it is that if we manage to migrate those general tasks everything else will just start to work :-)