Skip to content

Commit

Permalink
fix(connectionTime): indexLoaded & documentReady
Browse files Browse the repository at this point in the history
  • Loading branch information
hristoterezov committed Dec 6, 2023
1 parent 3bf245d commit 931bd1f
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions src/test/java/org/jitsi/meet/test/ConnectionTimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ public class ConnectionTimeTest
extends WebTestBase
{
/**
* Number of conferences that are going to be started and closed to
* Number of conferences that are going to be started and closed to
* gather the data.
*/
private static int NUMBER_OF_CONFERENCES = 10;

/**
* Script that checks if the mandatory objects that are going to be used to
* get the connection time measurements are created or not.
* get the connection time measurements are created or not.
*/
private static final String CHECK_OBJECTS_CREATED_SCRIPT
private static final String CHECK_OBJECTS_CREATED_SCRIPT
= "return (APP && APP.connection "
+ "&& APP.conference && APP.conference._room)? true : false";

Expand All @@ -57,31 +57,31 @@ public class ConnectionTimeTest
*/
private enum TimeMeasurements
{
INDEX_LOADED("return APP.connectionTimes['index.loaded']", null, 200.0),
DOCUMENT_READY("return APP.connectionTimes['document.ready']",
INDEX_LOADED("return window.JitsiMeetJS?.app?.connectionTimes['index.loaded']", null, 200.0),

DOCUMENT_READY("return window.JitsiMeetJS?.app?.connectionTimes['document.ready']",
INDEX_LOADED, 600.0),

CONNECTION_ATTACHING(
"return APP.connection.getConnectionTimes()['attaching']",
DOCUMENT_READY, 500.0),

CONNECTION_ATTACHED(
"return APP.connection.getConnectionTimes()['attached']",
"return APP.connection.getConnectionTimes()['attached']",
CONNECTION_ATTACHING, 5.0),

CONNECTION_CONNECTING(
"return APP.connection.getConnectionTimes()['connecting']",
"return APP.connection.getConnectionTimes()['connecting']",
DOCUMENT_READY, 500.0),

CONNECTION_CONNECTED(
"return APP.connection.getConnectionTimes()['connected']",
"return APP.connection.getConnectionTimes()['connected']",
CONNECTION_CONNECTING, 1000.0),

MUC_JOINED(
"return APP.conference._room.getConnectionTimes()['muc.joined']",
null, 500.0),

SESSION_INITIATE("return APP.conference._room.getConnectionTimes()"
+ "['session.initiate']", MUC_JOINED, 600.0),

Expand All @@ -90,10 +90,10 @@ private enum TimeMeasurements
// to the original value
ICE_CHECKING("return APP.conference._room.getConnectionTimes()"
+ "['ice.state.checking']", SESSION_INITIATE, 300.0),

ICE_CONNECTED("return APP.conference._room.getConnectionTimes()"
+ "['ice.state.connected']", ICE_CHECKING, 500.0),

AUDIO_RENDER(
"return APP.conference._room.getConnectionTimes()['audio.render']",
ICE_CONNECTED, 200.0),
Expand All @@ -119,32 +119,32 @@ private enum TimeMeasurements
* The script used to get the data for a time measurement type.
*/
private String script;

/**
* Max time between the previous measurement and
* Max time between the previous measurement and
* the current one
*/
private Double threshold;

/**
* The previous executed time measurement. We are going to compare the
* period of time between 2 consecutive time measurements and the
* The previous executed time measurement. We are going to compare the
* period of time between 2 consecutive time measurements and the
* threshold.
*/
private TimeMeasurements prevStep;

/**
* The number of time measurements/
*/
public static final int length = TimeMeasurements.values().length;
/**

/**
* Construct new TimeMeasurements instance.
* @param script The script used to get the data for a time
* @param script The script used to get the data for a time
* measurement type.
* @param prevStep previous measurement.
* @param threshold Max time between the previous measurement and
* the current one
* @param threshold Max time between the previous measurement and
* the current one
*/
TimeMeasurements(String script, TimeMeasurements prevStep,
Double threshold)
Expand All @@ -153,7 +153,7 @@ private enum TimeMeasurements
this.prevStep = prevStep;
this.threshold = threshold;
}

/**
* Returns the threshold property.
* @return the threshold property.
Expand All @@ -162,7 +162,7 @@ public Double getThreshold()
{
return threshold;
}

/**
* Returns prevStep property.
* @return prevStep property.
Expand All @@ -171,7 +171,7 @@ public TimeMeasurements getPrevStep()
{
return prevStep;
}

/**
* Executes the script property for the given {@link WebDriver}
* and returns a time measurement. (?)
Expand All @@ -197,7 +197,7 @@ else if (res == null)

return null;
}

/**
* Executes CHECK_OBJECTS_CREATED_SCRIPT for passed WebDriver and
* returns the result. That way we can check if all objects that are
Expand All @@ -220,8 +220,8 @@ public static Boolean isReadyToStart(WebDriver driver)
}
return null;
}


}

@Override
Expand Down Expand Up @@ -376,7 +376,7 @@ public Double[][] collectData()

return data;
}

/**
* Refreshes the second participant.
*/
Expand All @@ -390,7 +390,7 @@ private void refreshParticipant2()

ensureTwoParticipants();
}

/**
* Waits for all measurements to be complete. We only wait for VIDEO_RENDER,
* AUDIO_RENDER and DATA_CHANNEL_OPEN, assuming all the rest would have
Expand Down Expand Up @@ -431,7 +431,7 @@ private void checkThreshold(
medianValue < s.getThreshold(),
"Expected:" + s.getThreshold() + ", was:" + medianValue);
}

/**
* Returns the median from passed array.
* @param data the array
Expand All @@ -442,7 +442,7 @@ private static Double getMedian(Double[] data)
Arrays.sort(data);
return data[data.length/2];
}

/**
* Returns array with elements constructed by subtracting element from a
* from element from b with the same index.
Expand Down

0 comments on commit 931bd1f

Please sign in to comment.