This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 921
System Tests #1996
Open
justintaft
wants to merge
2
commits into
LightTable:master
Choose a base branch
from
justintaft:system-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
System Tests #1996
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
language: clojure | ||
env: | ||
- TRAVIS=1 | ||
os: | ||
- linux | ||
- osx | ||
lein: lein | ||
script: "! lein cljsbuild once 2>&1 | grep WARNING:" | ||
jdk: | ||
- oraclejdk8 | ||
env: | ||
global: | ||
GITHUB_OAUTH_READONLY_TOKEN: 9c40494099f5c56573b6438ff96dfddfb223cbcb | ||
script: | ||
- ./script/build.sh | ||
- ./script/run-tests.sh | ||
language: java | ||
before_script: | ||
- if [[ "${TRAVIS_OS_NAME}" = "linux" ]] ; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; sudo apt-get -qq update; sudo apt-get install -y leiningen; fi | ||
- if [[ "${TRAVIS_OS_NAME}" = "osx" ]] ; then brew update; brew install leiningen; fi | ||
notifications: | ||
irc: "chat.freenode.net#lighttable" | ||
email: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
addons: | ||
apt: | ||
packages: | ||
- chromium-browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
environment: | ||
global: | ||
CYG_ROOT: C:\cygwin | ||
CYG_MIRROR: http://cygwin.mirror.constant.com | ||
CYG_CACHE: C:\cygwin\var\cache\setup | ||
CYG_BASH: C:\cygwin\bin\bash | ||
GITHUB_OAUTH_READONLY_TOKEN: 9c40494099f5c56573b6438ff96dfddfb223cbcb | ||
cache: | ||
- '%CYG_CACHE%' | ||
|
||
install: | ||
- 'echo Setting up Cygwin dependencies' | ||
- '%CYG_ROOT%\setup-x86.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P autoconf -P automake -P bison -P gcc-core -P gcc-g++ -P mingw-runtime -P mingw-binutils -P mingw-gcc-core -P mingw-gcc-g++ -P mingw-pthreads -P mingw-w32api -P libtool -P make -P python -P gettext-devel -P gettext -P intltool -P libiconv -P pkg-config -P git -P wget -P curl -P unzip -P psmisc> NUL' | ||
|
||
- 'echo Check Cygwin setup' | ||
- '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"' | ||
- 'echo Done setting up Cygwin' | ||
|
||
- 'echo installing lein' | ||
- ps: | | ||
$base = "https://raw.githubusercontent.com/technomancy/leiningen/" | ||
$lein = $base + "stable/bin/lein.bat" | ||
(new-object net.webclient).DownloadFile($lein, "c:/projects/lighttable/lein.bat") | ||
- lein self-install | ||
- 'echo Done installing lein' | ||
#Add random location, this prevents qutation mark being added to | ||
#the current directory's path | ||
- cmd: 'set PATH="%PATH%;%cd%;c:\windows\system32"' | ||
- cmd: 'echo %PATH%' | ||
|
||
build_script: | ||
- cmd: 'echo Cygwin root is: %CYG_ROOT%' | ||
- cmd: 'echo Build folder is: %APPVEYOR_BUILD_FOLDER%' | ||
- cmd: 'echo Repo build branch is: %APPVEYOR_REPO_BRANCH%' | ||
- cmd: 'echo Repo build commit is: %APPVEYOR_REPO_COMMIT%' | ||
|
||
- cmd: 'echo creating lein reference' | ||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; echo \"#!/bin/bash\" > lein.sh"' | ||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; echo \"./lein.bat \$@\" >> lein.sh"' | ||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; chmod a+x lein.sh"' | ||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ln -s /cygdrive/c/projects/lighttable/lein.sh lein; ls -la"' | ||
|
||
- cmd: 'echo Running build.sh' | ||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./script/build.sh"' | ||
|
||
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./script/run-tests.sh"' | ||
#DEBUG BEGIN, PAUSES BUILD PROCESS TO ALLOW FOR REMOTE DEBUGGING VIA RDP | ||
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) | ||
#- ps: throw "Failing tests" | ||
#DBEUG END | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# TESTING | ||
|
||
## Quick Guide | ||
After running ```/script/build.sh``` once, run ```/script/run-tests.sh```. | ||
|
||
##Continuous Testing Architecture Overview | ||
When a PR is created or updated, the automated test suite will run on travis and appveyor. | ||
|
||
During the build processes, dependencies must be downloaded from github. API | ||
rate limits were being hit. To increase the limit, a read-only oauth token for | ||
the account ```light-table-bot``` has been added to the repo. | ||
|
||
Light Table is driven by Selenium for testing. | ||
|
||
Note a "test" plugin has been added to Light Table, found in `test/lt/lt-test-plugin/`. | ||
The plugin replaces the native "file dialog" so files can be selected and modified. | ||
During testing, the plugin is copied into a temporary home directory for Light Table, forcing | ||
it to load. | ||
|
||
|
||
## Words Of Caution | ||
Keep in mind the jvm is slow to boot, and the testing environments used may | ||
be under heavy load. If you need to have a process spawn close to the launching | ||
of Light Table, launch the program in the java tests to minimize delay. | ||
|
||
Initially ```light.sh``` was used by test suite to start Light Table. Kill signals | ||
were not propigating correctly and Light Table would not always close. Thus, Light Table | ||
is spawned directly from the test suite. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Installs test dependencies, sets up environment variables, | ||
# calls lein test, and then parses test results to see if | ||
# the tests succeeded. | ||
|
||
# Ensure we start in project root | ||
cd "$(dirname "${BASH_SOURCE[0]}")"; cd .. | ||
DIR=$(pwd) | ||
|
||
#Redirect LightTable STDOUT to a file to clean up test output | ||
LT_STDOUT_FILE="/tmp/lt-stdout" | ||
touch $LT_STDOUT_FILE | ||
if [[ $(uname -s | grep -i CYGWIN) ]]; then | ||
LT_STDOUT_FILE="$(cygpath -aw $LT_STDOUT_FILE)" | ||
fi | ||
|
||
echo "Killing all chromedrivers. New instance will be created by test suite." | ||
killall "chromedriver" &> /dev/null | ||
killall "chromedriver.exe" &> /dev/null | ||
|
||
#Fetch chrome driver | ||
cd ./deploy/electron/ | ||
node_modules/.bin/grunt download-electron-chromedriver | ||
cd - | ||
|
||
echo "Running tests" | ||
LT_STDOUT_FILE="$LT_STDOUT_FILE" lein with-profile dev test | tee /tmp/testoutput | ||
|
||
#Check test results | ||
#lein.bat return code is 0 even if tests fails on windows | ||
#we grep the lein test output to to make sure no tests fail or errors | ||
#this gives us cross os compatibility | ||
tail -n 4 /tmp/testoutput | grep "^0 failures, 0 errors" > /dev/null | ||
RETURN_CODE=$? | ||
|
||
echo "===LIGHT TABLE DEBUG===" | ||
cat $LT_STDOUT_FILE | ||
|
||
exit $RETURN_CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Mocks LightTable components so application can be tested. | ||
|
||
To compile and update plugin: | ||
|
||
1. Create symbolic link in LightTable plugin directory to plugin source | ||
|
||
~~~ | ||
ln -s ~/programming/LightTable/test/lt/lt-test-plugin ~/Library/Application\ Support/LightTable/plugins/lighttable-test-plugin | ||
~~~ | ||
1. Open plugin sourcecode in light table , `src/lt/plugins/lighttable-test-plugin.cljs`. | ||
1. Save cljs file. Light table should auto compile. | ||
1. Remove symbolic link created in step one. | ||
1. Run `lein test` to ensure tests still work. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
test/lt/lt-test-plugin/lighttable test plugin_compiled.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{:+ {:app [(:lt.objs.plugins/load-js ["lighttable test plugin_compiled.js"])]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{:name "LightTable Test Plugin" | ||
:author "Justin Taft" | ||
:source "https://github.com/LightTable/LightTable" | ||
:desc "Mocks Light Table components so application can be tested." | ||
:behaviors "lighttable-test-plugin.behaviors"} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "LightTable Test Plugin", | ||
"author": "Justin Taft", | ||
"version": "0.0.1", | ||
"source": "https://github.com/LightTable/LightTable", | ||
"desc": "Mocks LightTable components so they can be tested", | ||
"behaviors": "lighttable-test-plugin.behaviors" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(defproject lighttable-test-plugin "0.0.1" | ||
:dependencies [[org.clojure/clojure "1.5.1"]]) |
34 changes: 34 additions & 0 deletions
34
test/lt/lt-test-plugin/src/lt/plugins/lighttable-test-plugin.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns lt.plugins.lighttable-test-plugin | ||
"Mocks & extends light table components for auotmated testing." | ||
(:require [clojure.string :as string] | ||
[lt.objs/popup :as popup] | ||
[lt.util.dom :as dom] | ||
[lt.objs.command :as cmd])) | ||
|
||
(def debug-file-path-input (atom "")) | ||
|
||
(defn show-file-dialog-mock | ||
"Mocks show-file-dialog so native file dialog does not show. | ||
A popup dialog with a text field is shown instead. File paths | ||
can be specified in the path fields, seperated by commas to donate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. separated |
||
multiple files." | ||
[type options callback] | ||
(popup/popup! {:body [:div [:h1 "File Dialog Mock"] [:input {:type "text" :id "debug-file-path"}]] | ||
:buttons | ||
[ | ||
{ | ||
:label "Okay" | ||
:action #(swap! debug-file-path-input (fn [_] (dom/val (dom/$ "#debug-file-path")))) | ||
:post-action #(callback (string/split @debug-file-path-input #",")) | ||
} | ||
] | ||
})) | ||
|
||
(cmd/command {:command :lt.testing.mock | ||
:desc "Test Env: Mocks light table components for automated tests." | ||
:exec #( | ||
;TODO error is thrown when evaling this, but it works... | ||
(lt.objs.dialogs/set-show-file-dialog-fn! show-file-dialog-mock) | ||
) | ||
}) | ||
|
5 changes: 5 additions & 0 deletions
5
...arget/classes/META-INF/maven/lighttable-test-plugin/lighttable-test-plugin/pom.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Leiningen | ||
#Sat Nov 12 01:47:39 PST 2016 | ||
version=0.0.1 | ||
groupId=lighttable-test-plugin | ||
artifactId=lighttable-test-plugin |
5 changes: 5 additions & 0 deletions
5
...t/classes/META-INF/maven/lt-test-file-dialog-mock/lt-test-file-dialog-mock/pom.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Leiningen | ||
#Sat Nov 12 00:56:46 PST 2016 | ||
version=0.0.1 | ||
groupId=lt-test-file-dialog-mock | ||
artifactId=lt-test-file-dialog-mock |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automated