Skip to content

Commit

Permalink
CLDR-17248 Measure vote timing; update cldr-apps-webdriver (#28)
Browse files Browse the repository at this point in the history
-Update selenium-grid-start.sh to work with current Selenium

-Update instructional comments in SurveyDriver.java
  • Loading branch information
btangmu authored Dec 12, 2023
1 parent 0fa0ad1 commit c9f3768
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
4 changes: 2 additions & 2 deletions scripts/selenium-grid-start.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

HUB_URL=http://localhost:4444/grid/register java -jar selenium-server-standalone-3.141.59.jar -role hub &
HUB_URL=http://localhost:4444/grid/register java -jar selenium-server-4.16.1.jar standalone &

for ((PORT = 5555; PORT <= 5564; PORT++))
do
HUB_URL=http://localhost:4444/grid/register java -jar selenium-server-standalone-3.141.59.jar -role node -port $PORT &
HUB_URL=http://localhost:4444/grid/register java -jar selenium-server-4.16.1.jar standalone --port $PORT &
done
38 changes: 15 additions & 23 deletions src/test/java/org/unicode/cldr/surveydriver/SurveyDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,34 @@

/**
* Perform automated testing of the CLDR Survey Tool using Selenium WebDriver.
* Reference: https://unicode.org/cldr/trac/ticket/11488
* "Implement new Survey Tool automated test framework and infrastructure"
*
* This test has been used with the cldr-apps-webdriver project running in Eclipse. At the same time,
* cldr-apps can be running either on localhost (in the same Eclipse as cldr-apps-webdriver) or on SmokeTest.
* This test has been used with the cldr-apps-webdriver project running in IntelliJ. At the same time,
* cldr-apps can be running either on localhost or on SmokeTest.
*
* This code requires installing an implementation of WebDriver, such as chromedriver for Chrome.
* On macOS, chromedriver can be installed from Terminal with brew as follows:
* brew tap homebrew/cask
* brew install chromedriver
* -- or download chromedriver from https://chromedriver.storage.googleapis.com
* (Testing with geckodriver for Firefox has been unsuccessful.)
* Then, right-click chromedriver, choose Open, and authorize to avoid the macOS error,
* "“chromedriver” cannot be opened because the developer cannot be verified".
* Press Ctrl+C to stop this instance of chromedriver.
*
* A tutorial for setting up a project using Selenium in Eclipse:
* https://www.guru99.com/selenium-tutorial.html
* (Testing with geckodriver for Firefox was unsuccessful, but has not been tried recently.)
*
* The Selenium jar files must be added to the Eclipse project. Download from
* https://www.seleniumhq.org/download/ and unzip to get a folder like selenium-java-3.141.59.
* In Eclipse, right-click on "cldr-apps-webdriver" and select Properties. Click on "Java Build Path".
* Click on the Libraries tab. Click on "Add External JARs". Navigate to the selenium folder and
* add all the jar files outside the "lib" folder. Click on "Add External JARs" again and add all
* the jar files inside "lib".
* Go to https://www.selenium.dev/downloads/ and scroll down to "Selenium Server (Grid)" and
* follow the link to download a file like selenium-server-4.16.1.jar and save it in the parent
* directory of cldr-apps-webdriver.
*
* For Gson, CLDR already includes cldr/tools/java/libs/gson.jar. Take advantage of that
* and add it to Eclipse as follows: Right-click on "cldr-apps-webdriver" and select Properties.
* Click on "Java Build Path". Click on the Libraries tab. Click on "Add External JARs".
* Navigate to cldr/tools/java/libs and select gson.jar.
*
* Setting up may require adding a specific set of test users to the db, consistent
* with getNodeLoginQuery:
* Add a specific set of simulated test users to the db, consistent with the method getNodeLoginQuery below:
*
* mysql cldrdb < cldr-apps-webdriver/scripts/cldr-add-webdrivers.sql
*
* and starting selenium grid:
* Start selenium grid:
*
* sh cldr-apps-webdriver/scripts/selenium-grid-start.sh &
*
* Open this file (SurveyDriver.java) in IntelliJ, right-click cldr-apps-webdriver in the Project
* panel, and choose "Debug All Tests". You can do this repeatedly to start multiple browsers with
* simulated vetters vetting at the same time.
*/
public class SurveyDriver {

Expand Down

0 comments on commit c9f3768

Please sign in to comment.