I am running parallel execution on Browserstack.
I have done some debugging, I added some logs in Test file that executes in the starting. Here is the code for this and logs
@BeforeClass(alwaysRun = true,dependsOnMethods = { "initialise" })
public void beforeClass() throws IOException, ParseException {
log(Status.INFO, "Before initialization");
this.driver=getDriver();
log(Status.INFO, "before login page initialization");
this.loginPage = new LoginPage(this.driver);
log(Status.INFO, "before home page initialization");
this.homePage = new HomePage(this.driver);
log(Status.INFO, "before welcomeToTLifePage page initialization");
this.welcomeToTLifePage = new WelcomeToTLifePage(this.driver);
log(Status.INFO, "before allowNotificationPage page initialization");
data = new ExcelReaderDataClass();
allowNotificationPage = new AllowNotificationPage(this.driver);
log(Status.INFO, "before allowLocationAccessPage page initialization");
allowLocationAccessPage = new AllowLocationAccessPage(this.driver);
log(Status.INFO, "after allowLocationAccessPage page initialization");
}
2024-06-04 14:15:51,532 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - Before initialization
2024-06-04 14:15:51,534 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - before login page initialization
2024-06-04 14:15:51,683 [TestNG-tests-1] INFO com.tlife.pageObject.core.WelcomeToTLifePage - Clicking on Skip button
2024-06-04 14:15:54,095 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - before home page initialization
2024-06-04 14:15:54,325 [TestNG-tests-5] INFO com.tlife.pageObject.core.WelcomeToTLifePage - Clicking on Skip button
2024-06-04 14:15:55,228 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - before welcomeToTLifePage page initialization
2024-06-04 14:15:55,425 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - before allowNotificationPage page initialization
2024-06-04 14:15:55,635 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - before allowLocationAccessPage page initialization
2024-06-04 14:15:55,922 [TestNG-tests-2] INFO com.tlife.core.homeTest.LoginTest - after allowLocationAccessPage page initialization
If you notice all these object creation takes only few seconds or millieseconds.
Now after running some test suites there is more class in which I have added the loggers, here is the class and their loggers.
@BeforeClass(alwaysRun = true)
public void beforeClass() throws IOException, ParseException, InterruptedException {
System.out.println("Starting before class in ConnectWatch on " + Thread.currentThread().getName());
logThreadState("Before initializing driver");
this.driver=getDriver();
logThreadState("Before initializing loginPage");
LoginPage loginPage = new LoginPage(this.driver);
logThreadState("Before initializing welcomeToTLifePage");
WelcomeToTLifePage welcomeToTLifePage = new WelcomeToTLifePage(this.driver);
logThreadState("Before initializing HomePage");
this.homePage = new HomePage(driver);
logThreadState("Before initializing KidsWatchPage");
this.kidsWatchPage = new KidsWatchPage(driver);
logThreadState("Before initializing ConnectPage");
this.connectPage = new ConnectPage(driver);
logThreadState("After initializing some classes class");
AllowNotificationPage allowNotificationPage = new AllowNotificationPage(this.driver);
AllowLocationAccessPage allowLocationAccessPage = new AllowLocationAccessPage(this.driver);
System.out.println("Starting before clicking skip in ConnectWatch on " + Thread.currentThread().getName());
logThreadState("Before clicking skip in ConnectWatch");
welcomeToTLifePage.clickSkipButton();
System.out.println("Starting after clicking skip in ConnectWatch on " + Thread.currentThread().getName());
logThreadState("after clicking skip in ConnectWatch");
welcomeToTLifePage.clickOnLogInWithTMobileIDButton();
loginPage.login(Configuration.getProperty("login_email2"), Configuration.getProperty("login_password"));
if (getDevice("platformName").equalsIgnoreCase("ios")) {
allowNotificationPage.notificationPermissionScreen();
allowLocationAccessPage.locationPermissionScreen();
} else {
log(Status.INFO, "Not getting the expected Platform");
}
this.homePage.clickOnHomeTab();
System.out.println("Completing before class in ConnectWatch on " + Thread.currentThread().getName());
logThreadState("After completing before class");
}
2024-06-04 14:35:44,754 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing driver - State of the thread: RUNNABLE
2024-06-04 14:35:44,755 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing loginPage - State of the thread: RUNNABLE
2024-06-04 14:36:24,944 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing welcomeToTLifePage - State of the thread: RUNNABLE
2024-06-04 14:36:30,447 [TestNG-tests-1] INFO com.tlife.connect.ConnectPlacesTest - after loading login driver ConnectPlace - State of the thread: RUNNABLE
2024-06-04 14:36:32,179 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing HomePage - State of the thread: RUNNABLE
2024-06-04 14:36:58,398 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing KidsWatchPage - State of the thread: RUNNABLE
2024-06-04 14:37:06,122 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before initializing ConnectPage - State of the thread: RUNNABLE
2024-06-04 14:37:11,553 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - After initializing some classes class - State of the thread: RUNNABLE
2024-06-04 14:37:21,217 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - Before clicking skip in ConnectWatch - State of the thread: RUNNABLE
2024-06-04 14:37:23,031 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - after clicking skip in ConnectWatch - State of the thread: RUNNABLE
2024-06-04 14:38:16,314 [TestNG-tests-2] INFO com.tlife.connect.ConnectWatchTest - After completing before class - State of the thread: RUNNABLE
Now if you see there are classes which are taking around 30-40 seconds to create the object, I am unable to understand what could be possible issues here?
Now because of this time my tests case are throwing idle timeout on BrowserStack, while checking the Appium logs, I did not see any commands coming.