Changeset 32715


Ignore:
Timestamp:
2018-12-18T22:12:16+13:00 (5 years ago)
Author:
ak19
Message:

Turning off EDT (event dispatch thread) violation check doesn't help if the EDT violation still remains in GLI. In fact, by turning off the check and leaving the errors in, the robot suddenly stops working here and there, with tests failing cryptically. Committing the modifications for turning off the EDT violation check a separate file, but there seems to be no choice but to read up on SwingWorker and start doing the right thing in GLI.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.EDTcheckOff_NoHelp

    r32714 r32715  
    7373 * Class that will eventually go through all the Greenstone3 tutorials by running GLI and GEMS.
    7474 */
    75 public class RunGLITest extends AssertJSwingJUnitTestCase {
     75public class RunGLITest {
    7676    // For aborting running test suite, with Ctrl+Shift+A by default
    7777    // https://joel-costigliola.github.io/assertj/assertj-swing-running.html
    7878    private static EmergencyAbortListener abortListener = EmergencyAbortListener.registerInToolkit();   
    79     private static WebDriver _driver = new FirefoxDriver(); // selenium
     79    private static WebDriver _driver = new FirefoxDriver(); // for browser tests with selenium
     80    private static Robot robot; // for Java GUI tests with assertj-swing
    8081   
    8182    private FrameFixture window;
     83   
     84    @BeforeClass
     85    public static void setUpOnce() {
     86    //FailOnThreadViolationRepaintManager.install();
    8287
    83     // Selenium
     88    // Need to have the robot before we can call runGLI()
     89    // Robot is the class that controls/drives user input by taking control over the keyboard and mouse
     90    robot = BasicRobot.robotWithNewAwtHierarchy();
     91    }
     92   
     93
    8494    @Before
    8595    public void init()
    8696    {
     97    // 1. Selenium
     98   
    8799    //https://stackoverflow.com/questions/38676719/selenium-using-java-the-path-to-the-driver-executable-must-be-set-by-the-webdr
    88100    // GS3's build.xml would have set the webdriver.gecko.driver path System.Property to
     
    90102    // So now we can continue to just do:
    91103    _driver.get(System.getProperty("SERVERURL"));
    92     }
    93104   
    94105
    95     // assertj-swing
    96     // As init() above, onSetUp() gets called before every test method too,
    97     // but is overridden from assertj-swing base class
    98     @Override
    99     protected void onSetUp() {
     106    // 2. assertj-swing
     107
     108    // Run GLI and show the window 
    100109    // Launch GLI and then get a ref to the launched app window:
    101110    runGLI();
    102    
    103    
    104     // IMPORTANT, note the call to 'robot()': must use the Robot from AssertJSwingJUnitTestCase
     111
     112    // IMPORTANT, note the call to 'robot()': must use the Robot from AssertJSwingJUnitTestCase base class
    105113    //window = findFrame("GUIManager").using(robot());
    106     window = GSGUITestingUtil.getGLIApplicationWindow(robot());
     114    window = GSGUITestingUtil.getGLIApplicationWindow(robot);
    107115    }
    108116   
     
    150158      closeCollection(); // collection must be closed in order to be deleted
    151159      deleteCollection("pinky");
     160     
    152161      // wait a few of seconds again?
    153162      PAUSE(2);
     
    165174      PAUSE(3);
    166175  }
    167 
     176   
     177    @After
     178    public void tearDown() {
     179    // call FrameFixture's cleanUp() which
     180    // "Cleans up any used resources (keyboard, mouse, open windows and ScreenLock) used by this robot."
     181    window.cleanUp();
     182    }
     183   
    168184    // Selenium
    169185    // called once and only once: to quit the firefox driver geckodriver
Note: See TracChangeset for help on using the changeset viewer.