galenframework/galen

EcmaError Exception: Error in main.gspec

nicholaswkc34 opened this issue · 4 comments

Dear All,
I tried to implement galen responsive testing using example on github but i encounter this error. I using galen 2.4.0 in Java.

public class ResponsiveTestManager extends GalenTestBase {
 
 private PropertiesManager pm;
 
 @BeforeSuite 
 public void setup() {
 pm = PropertiesManager.createInstance();
 }

 @Test(dataProvider = "devices")
 public void homepage_responsive(TestDevice device) throws IOException {
 load(pm.getProperties().getProperty("homepage"));
 checkLayout(System.getProperty("user.dir") + "\\galen_specs\\main.gspec", device.getTags());
 }
}

main.gspec

@@ set run_in_grid		selenium grid http://127.0.0.1:4444/wd/hub

Homepage in Selenium Grid
    ${run_in_grid} --page http://phptravels.net/login
        check homepage.gspec

Homepage.gspec

@objects
	login-username		css			input[name=username]

What wrong with it? I follow according to the standard but get this error. Please help. Thanks.

Hi, sorry for delay. I actually tried to reproduce this and only now noticed that your have mixed up two things: a test suite and a galen spec. Your main.gspec file is actually not a gspec at all. It is a test suite syntax.

How to solve the errors then? What is the correct approach?

I don't know. But I pointed out that the file that you provided main.gspec is not really a gspec. It is a test suite. I am not sure what you wanted to do in that example because you already use TestNG, so you don't need to use galen test suites. And also checkLayout method works only with gspec files. So I guess the reason it fails for you is because you are giving it a wrong file

Thanks for your explanation.