Uploaded image for project: 'Release Notes Application'
  1. Release Notes Application
  2. RN-91

The contributors functional test saves without waiting for the asynchronous save to complete

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.5.1
    • 2.5
    • Development Issue Only
    • None
    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      Problem

      In ReleaseNotesIT.contributorsListAndChangeNumbering, the contributors entry is saved with a raw click and the test then navigates away immediately:

      setup.getDriver().findElement(By.cssSelector("input[name='action_save']")).click();
      ViewPage afterPage = setup.gotoPage(releaseNote);
      

      The inline editor saves over AJAX, so navigating away right after the click can abort the save, and the assertions that follow can fail nondeterministically.

      Notes

      The same test class already does this correctly ~400 lines later, with a comment naming the exact hazard:

      // Save through the page object, which waits for the asynchronous save to complete: reading the saved value
      // straight after a click on the button races it, and reads back the value from before the save.
      new InlinePage().clickSaveAndView();
      

      So the fix is to use InlinePage.clickSaveAndView() here too.

      Related, same method: the textarea is located as By.cssSelector("textarea"), i.e. whatever textarea happens to be first in the DOM, rather than through the page object's field accessor.

      More broadly, the class uses getDriver() 20 times. Two other sites are worth moving behind page objects: the Live Data column measurement done with executeJavascript (RN-86 was a bug in that very measurement, now buried as an inline JS string) and the administration field lookups done with raw By.name. The XWiki testing conventions treat a raw findElement in a test as a sign that a page object is missing an API.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: