SWTBot test to read the Welcome page text

327 views Asked by At

I'm trying to write a SWTBot test that opens the welcome page view in eclipse and then reads/maps the content into some object (don't care if only string) so I could compare it with the expected text, I thought this is a very trivial issue and that i will find example on the internet, but I couldn't! Any help please?

@Test
public void testExpandText() throws Exception {
    bot.menu(Constants.HELP_MENU).menu(Constants.WELCOME).click();
    welcomePageView = bot.viewByTitle(Constants.WELCOME);
    //expandText();
    //assertText();
    welcomePageView.close();
}
1

There are 1 answers

1
Andy_Li On

Seems the content of welcome page is a website page... Maybe it is not supported by SWTBot now.

And, if you want to see some sample test codes, you can try to open the Perspective menu using the following codes.

bot.menu("Window").menu("Open Perspective").menu("Other...").click();
bot.shell("Open Perspective").activate();
bot.table().select("Debug");
//bot.table().getTableItem(2).getText(); //Get the 2nd line text of the list. 
bot.button("OK").click();

Hope the code is useful for you.