Program: 69471
Project: 69471
Buggy source:
/** 
 * An author upload a test, create a course with a test course element, publish the course, assign the course to a student. The student come to pass the test, logout after passing it. The author check if the test of the student is passed in the assessment tool.
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test @RunAsClient public void qti12CourseWithAssessment(@InitialPage LoginPage authorLoginPage,@Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
  screenshotTestRule.setBrowsers(browser);
  Assume.assumeTrue(browser instanceof FirefoxDriver);
  UserVO author=new UserRestClient(deploymentUrl).createAuthor();
  authorLoginPage.loginAs(author.getLogin(),author.getPassword());
  UserVO ryomou=new UserRestClient(deploymentUrl).createRandomUser("String_Node_Str");
  String qtiTestTitle="String_Node_Str" + UUID.randomUUID();
  URL qtiTestUrl=JunitTestHelper.class.getResource("String_Node_Str");
  File qtiTestFile=new File(qtiTestUrl.toURI());
  navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle,qtiTestFile);
  String courseTitle="String_Node_Str" + UUID.randomUUID();
  navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
  String testNodeTitle="String_Node_Str";
  CourseEditorPageFragment courseEditor=CoursePageFragment.getCourse(browser).edit();
  courseEditor.createNode("String_Node_Str").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
  courseEditor.publish().quickPublish(Access.membersOnly);
  CoursePageFragment courseRuntime=courseEditor.clickToolbarBack();
  courseRuntime.clickTree().selectWithTitle(testNodeTitle);
  WebElement testH2=browser.findElement(By.cssSelector("String_Node_Str"));
  Assert.assertEquals(testNodeTitle,testH2.getText().trim());
  courseRuntime.members().addMember().searchMember(ryomou,true).next().next().next().finish();
  LoginPage ryomouLoginPage=LoginPage.getLoginPage(ryomouBrowser,deploymentUrl);
  ryomouLoginPage.loginAs(ryomou.getLogin(),ryomou.getPassword()).resume();
  NavigationPage ryomouNavBar=new NavigationPage(ryomouBrowser);
  ryomouNavBar.openMyCourses().select(courseTitle);
  CoursePageFragment ryomouTestCourse=new CoursePageFragment(ryomouBrowser);
  ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
  QTI12Page testPage=QTI12Page.getQTI12Page(ryomouBrowser);
  testPage.start().selectItem(0).answerSingleChoice(0).saveAnswer().selectItem(1).answerMultipleChoice(0,2).saveAnswer().selectItem(2).answerKPrim(true,false,true,false).saveAnswer().selectItem(3).answerFillin("String_Node_Str").saveAnswer();
  testPage.endTest();
  By resultsBy=By.id("String_Node_Str");
  OOGraphene.waitElement(resultsBy,ryomouBrowser);
  WebElement resultsEl=ryomouBrowser.findElement(resultsBy);
  Assert.assertTrue(resultsEl.getText().contains(ryomou.getFirstName()));
  testPage.closeTest();
  WebElement passedEl=ryomouBrowser.findElement(By.cssSelector("String_Node_Str"));
  Assert.assertTrue(passedEl.isDisplayed());
  UserToolsPage roymouUserTools=new UserToolsPage(ryomouBrowser);
  roymouUserTools.logout();
  navBar.openMyCourses().select(courseTitle);
  AssessmentToolPage assessmentTool=new CoursePageFragment(browser).assessmentTool();
  assessmentTool.users().assertOnUsers(ryomou).selectUser(ryomou).assertPassed(ryomou);
}

Fixed version (ground truth):
/** 
 * An author upload a test, create a course with a test course element, publish the course, assign the course to a student. The student come to pass the test, logout after passing it. The author check if the test of the student is passed in the assessment tool.
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test @RunAsClient public void qti12CourseWithAssessment(@InitialPage LoginPage authorLoginPage,@Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
  Assume.assumeTrue(browser instanceof FirefoxDriver);
  UserVO author=new UserRestClient(deploymentUrl).createAuthor();
  authorLoginPage.loginAs(author.getLogin(),author.getPassword());
  UserVO ryomou=new UserRestClient(deploymentUrl).createRandomUser("String_Node_Str");
  String qtiTestTitle="String_Node_Str" + UUID.randomUUID();
  URL qtiTestUrl=JunitTestHelper.class.getResource("String_Node_Str");
  File qtiTestFile=new File(qtiTestUrl.toURI());
  navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle,qtiTestFile);
  String courseTitle="String_Node_Str" + UUID.randomUUID();
  navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
  String testNodeTitle="String_Node_Str";
  CourseEditorPageFragment courseEditor=CoursePageFragment.getCourse(browser).edit();
  courseEditor.createNode("String_Node_Str").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
  courseEditor.publish().quickPublish(Access.membersOnly);
  CoursePageFragment courseRuntime=courseEditor.clickToolbarBack();
  courseRuntime.clickTree().selectWithTitle(testNodeTitle);
  WebElement testH2=browser.findElement(By.cssSelector("String_Node_Str"));
  Assert.assertEquals(testNodeTitle,testH2.getText().trim());
  courseRuntime.members().addMember().searchMember(ryomou,true).next().next().next().finish();
  LoginPage ryomouLoginPage=LoginPage.getLoginPage(ryomouBrowser,deploymentUrl);
  ryomouLoginPage.loginAs(ryomou.getLogin(),ryomou.getPassword()).resume();
  NavigationPage ryomouNavBar=new NavigationPage(ryomouBrowser);
  ryomouNavBar.openMyCourses().select(courseTitle);
  CoursePageFragment ryomouTestCourse=new CoursePageFragment(ryomouBrowser);
  ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
  QTI12Page testPage=QTI12Page.getQTI12Page(ryomouBrowser);
  testPage.start().selectItem(0).answerSingleChoice(0).saveAnswer().selectItem(1).answerMultipleChoice(0,2).saveAnswer().selectItem(2).answerKPrim(true,false,true,false).saveAnswer().selectItem(3).answerFillin("String_Node_Str").saveAnswer();
  testPage.endTest();
  By resultsBy=By.id("String_Node_Str");
  OOGraphene.waitElement(resultsBy,ryomouBrowser);
  WebElement resultsEl=ryomouBrowser.findElement(resultsBy);
  Assert.assertTrue(resultsEl.getText().contains(ryomou.getFirstName()));
  testPage.closeTest();
  WebElement passedEl=ryomouBrowser.findElement(By.cssSelector("String_Node_Str"));
  Assert.assertTrue(passedEl.isDisplayed());
  UserToolsPage roymouUserTools=new UserToolsPage(ryomouBrowser);
  roymouUserTools.logout();
  navBar.openMyCourses().select(courseTitle);
  AssessmentToolPage assessmentTool=new CoursePageFragment(browser).assessmentTool();
  assessmentTool.users().assertOnUsers(ryomou).selectUser(ryomou).assertPassed(ryomou);
}