2

我尝试在http://www.playframework.com/documentation/2.1.0/JavaGuide6上关注 play 2.1 教程,但我被困在这行代码上

@Test
public void newProject() throws Exception {
    drawer.group("Personal").newProject();
    dashboard.await().until(drawer.group("Personal").hasProject("New project"));
    dashboard.await().until(drawer.group("Personal").project("New project").isInEdit());
}

我将此代码放在 test/views/DrawerTest.java 上,但在运行 play test 时出现此错误:

zentasks/test/views/DrawerTest.java:32: cannot find symbol
[error] symbol  : variable dashboard
[error] location: class views.DrawerTest
[error]         dashboard.await().until(drawer.group("Personal").hasProject("New project"));

请帮我。谢谢

4

1 回答 1

2

您可以尝试像这样更改您的DrawerTest课程:

public Drawer drawer;
public Dashboard dashboard; // <------ Add this

@Before
public void setUp() {
    start();
    Login login = browser.createPage(Login.class);
    login.go();
    login.login("bob@example.com", "secret");
    dashboard = browser.createPage(Dashboard.class); // <------ Add this
    drawer = dashboard.drawer(); // <------ Change this
}
于 2013-05-02T05:34:23.793 回答