-
Notifications
You must be signed in to change notification settings - Fork 149
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
feat(SS): Implement test #121
Conversation
} | ||
catch (IOException e) | ||
{ | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what ? shouldn't that fail the test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will eventually fail the test probably anyway. How do you want to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to wrap in RuntimeException and re-throw at least
throws IOException | ||
{ | ||
URL website = new URL( | ||
EXT_DOWNLOAD_URL_PREFIX + id + EXT_DOWNLOAD_URL_SUFIX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use string format here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How? My Java is a little rusty... What will be the benefit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://dzone.com/articles/java-string-format-examples
It is weird that there are two constants for something which is actually one thing, where prefix is never used without the suffix.
It's possible that the % signs in the string would have to be escaped.
File extension = File.createTempFile("jidesha", ".crx"); | ||
extension.deleteOnExit(); | ||
|
||
FileOutputStream fos = new FileOutputStream(extension); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my java is a little bit rusty as I said. So could you please explain with more details? The part that puzzles me is I want this method to trow the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but the purpose of using that is to close the resource, not to catch the IOException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll read the docs more carefully!
public static Object getConfigValue(WebDriver participant, String key) | ||
{ | ||
return ((JavascriptExecutor) participant) | ||
.executeScript("return config." + key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this approach for getting config parameters, because it requires alive and connected to an existing conference WebParticipant. I don't see any of such assumptions being mentioned anywhere around here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Could you be more specific which approach you would like for this situation? If you don't have better approach in mind, the current approach will be still the best....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably at least moving this method to WebParticipant, because having it there means that it belongs to web only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
Why don't we go with PageObjects given the test is being rewritten ? |
I have no idea what are you talking about! What is |
PageObjects are used here for example: https://github.com/jitsi/jitsi-meet-torture/blob/master/src/test/java/org/jitsi/meet/test/ChatPanelTest.java |
*/ | ||
void driverVideoLayoutTest(Participant participant) | ||
void driverVideoLayoutTest(Participant participant, boolean isScreenSharing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method is now superfluous (and the doc needs an update).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs are updated! I decided to leave it because in future we may want to add more stuff in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs are updated!
I don't think this actually made it to the PR:
* The webdriver to test. |
I've added pr testing for torture now. And this one failed: We should handle the case if desktop sharing is not configured. |
@paweldomas I don't see why we need to implement page object for tests that are running only on web. Especially for the desktop sharing test, we don't have any idea if this feature will ever be implemented for mobile and how it will look there. Even if we refactor it now we'll have to definitely refactor it later again when the functionality is implemented for mobile. I think that for desktop sharing test adding page objects will be waste of time (3 times refactoring/rewriting). At the end if there is a desktop sharing for mobile, it can be so different that we may even need totally different test. I'm sorry if I misunderstood the idea behind the page objects! Please correct me if I'm wrong! |
The ChatPanel test is currently only for web too, so I don't find this argument relevant. I will try to be more specific and comment on each place where that would be suitable and we can continue the discussion from there. |
ensureTwoParticipants( | ||
null, null, null, | ||
new WebParticipantOptions().setChromeExtensionId( | ||
(String) MeetUtils.getConfigValue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move getConfigValue method to WebParticipant ? Then you can call getParticipant1().getConfigValue(). Actually it could event be a method "getDesktopSharingExtensionId()" in the WebParticipantDirectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I ask for that is that we're trying to go away from accessing the driver directly and using it with static utility functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the previous comments. I've agreed with this and getConfigValue is already a moved to WebParticipant.
|
||
final String expectedResult = "desktop"; | ||
// holds the last retrieved value for the remote type | ||
final Object[] remoteVideoType = new Object[1]; | ||
try | ||
{ | ||
final String scriptToExecute = "return APP.UI.getRemoteVideoType('" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this script execution a "getRemoteVideoType" method in WebParticipant ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there other place where we are using this? I don't think so. That's why I think this belongs to the DesktopSharingTest!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it does not ! It belongs to the WebParticipant !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test class describes what is being tested and how. Who's video type is ? Participant's. In this particular case we're checking what video type given web participant has received for given remote participant through presence. Other tests can be also interested in checking that.
MeetUIUtils.clickOnToolbarButton( | ||
getParticipant1().getDriver(), "toggleFilmstripButton"); | ||
|
||
TestUtils.waitMillis(5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we waiting here for exactly ? Waits like this are waste of time and never check for the condition that is expected after the wait period is over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will leave this for now like this. Hiding the filmstrip because of animations can take some time. We cannot check for a css change, cause currently, we change the css and after the change, it starts moving the filmstrip away from the screen for two seconds (which with the framebuffer can take more). We already spend a lot of time looking at it to figure it out. Maybe checking for isDisplayed of the local video is one solution will give it a quick try and if it doesn't work will leave the waits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the purpose could be explained in a comment at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to wait for local video not displayed works. Will see how it goes. Will merge it after the tests pass.
MeetUIUtils.clickOnToolbarButton( | ||
getParticipant1().getDriver(), "toggleFilmstripButton"); | ||
|
||
TestUtils.waitMillis(5000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again: what's the purpose of the wait here ?
*/ | ||
private void startDesktopSharing() | ||
{ | ||
TestUtils.waitForElementByXPath( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this 3 statements in the PageObject world would be:
Toolbat toolbar = getParticipant2().getToolbar();
Button dsButton = toolbar.getDesktopsharingButton();
dsButton.click();
dsButton.assertToggled(true /* toggled /, 2 / timeout seconds */);
I don't know what would be the exact type of the Button. Maybe it's just WebElement. Or maybe we need a class the wraps it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the approach with getButton and then click is not good at all in the context of react. I would even say to skip searching for web element and getting them and then executing click. We already had such problems with the toolbars. The better approach is at the end to just execute document.getElementById('...').click();
https://github.com/jitsi/jitsi-meet-torture/blob/master/src/test/java/org/jitsi/meet/test/util/MeetUIUtils.java#L243
The problem is a StaleElementException coming from selenium. You take the element and try to click it, but by that time react has re-rendered the toolbar and that element is stale.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is a problem with saving the WebElement, and not a problem with the "getButton" abstraction itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's right, thanks for the clarification :)
*/ | ||
private void stopDesktopSharing() | ||
{ | ||
TestUtils.waitForElementByXPath( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
private void checkExpandingDesktopSharingLargeVideo(boolean isScreenSharing) | ||
{ | ||
// check layout | ||
new VideoLayoutTest().driverVideoLayoutTest( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate that we need to create test instances somewhere else, but it would be probably too much to refactor this in this PR...
@paweldomas Thanks very much for the additional explanations. Maybe I was not very clear. My problem here is that I don't think we should use the PageObjects for this test. But let's discuss this offline because it seems like a longer discussion. |
@hristoterezov Why would we have two different ways of dealing with things ? Everything is "longer discussion" always. I keep hearing that all the time recently. We can discuss that on the retro or call a meeting. |
@damencho we can do document.getElemntById on web inside of the Button or PageObject abstraction. But on mobile it will be a different way for getting WebElement (find by accessibility ID or something else). |
Btw. long time ago I was forbidden to rewrite whole torture into the PageObject concept and there was an agreement to do that step by step, so here we are. I am really getting frustrated about this attitude of getting shortcuts all the time and then someone else when adding new thing will have to deal with all that. You have just a couple of places to address. I'm not asking you to write full Toolbar or whatever -just the part you need (1 button ?). |
TestUtils.waitMillis(5000); | ||
TestUtils.waitForDisplayedElementByXPath( | ||
getParticipant1().getDriver(), | ||
"//span[@id='localVideoWrapper']", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this duplicates the constant and could be a TestUtil method, but I give up since you want to merge it now
private void testDesktopSharingInPresence(final String expectedResult) | ||
{ | ||
String participant1Jid | ||
= MeetUtils.getResourceJid(getParticipant2().getDriver()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name suggests this is the id of participant 1, but the code gets the id of participant 2. What is the intention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No intention. It's a mistake! I should change the variable name!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging anyway and will change it
/** | ||
* Stops desktop sharing. | ||
*/ | ||
private void stopDesktopSharing() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startDesktopSharing and stopDesktopSharing are exactly the same? Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of. After the refactoring I end up implementing a method that handles both cases. Maybe I should remove the start/stopDesktopSharing and use the new method directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging anyway and replaced the two methods with "toggleDesktopSharing"
No description provided.