galenframework / galen

Layout and functional testing framework for websites
http://galenframework.com
1.41k stars 161 forks source link

EcmaError Exception: Error in main.gspec #607

Closed nicholaswkc34 closed 5 years ago

nicholaswkc34 commented 5 years ago

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.

ishubin commented 5 years ago

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.

nicholaswkc34 commented 5 years ago

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

ishubin commented 5 years ago

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

nicholaswkc34 commented 5 years ago

Thanks for your explanation.