MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 78852ee7 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

Merge branch 'feature-c/refactor-functional-browser' into 'dev'

Refactor functional client tests

See merge request !57
parents c245ce2f c1076b5f
......@@ -40,7 +40,7 @@ Info.prototype = {
patient_info,
'patient_info',
'patient_info_text',
'patient information',
'information',
'info');
parent.appendChild(div_patient_info);
......
......@@ -27,8 +27,8 @@ class BrowserTest < MiniTest::Test
end
def set_browser(vidjil_file, analysis_file=nil)
folder_path = Dir.pwd
folder_path.sub! '/browser/test', ''
folder_path = File.expand_path(File.dirname(__FILE__))
folder_path.sub! '/browser/test/functional', ''
index_path = 'file://' + folder_path + '/browser/index.html'
data_path = folder_path + vidjil_file
analysis_path = nil
......@@ -41,9 +41,7 @@ class BrowserTest < MiniTest::Test
end
print "Open browser\n"
#$b = VidjilBrowser.new :safari
$b = VidjilBrowser.new :firefox
#$b = VidjilBrowser.new :chrome
$b = VidjilBrowser.new
print "Resize\n"
$b.window.resize_to(1500, 800)
......@@ -66,8 +64,8 @@ class BrowserTest < MiniTest::Test
print "Welcome popup.\n"
# check the welcoming popup
assert ($b.div(:class => 'popup_msg').present?), "Popup message is not present at the opening of Vidjil"
# wait for the welcoming popup
$b.div(:class => 'popup_msg').wait_until_present(2)
# close the welcoming popup
$b.div(:class => 'popup_msg').button(:text => 'ok').click
......
load 'browser_test.rb'
class SegmenterTest < BrowserTest
def set_browser
# Redefine set_browser as the tested webpage is totally different
folder_path = File.expand_path(File.dirname(__FILE__))
folder_path.sub! '/browser/test/functional', ''
index_path = 'file://' + folder_path + '/browser/segmenter_page.html'
print "Open browser\n"
$b = SegmenterBrowser.new
print "Resize\n"
$b.window.resize_to(1500, 800)
print "Testing segmenter page at " + index_path + "\n"
$b.goto index_path
# check that the segmenter loaded correctly
if not $b.textarea(:id => 'form_sequences').present?
print "Loading of segmenter page failed. Do not execute remaining tests."
exit
end
print "Segmenter page loaded, launching tests.\n"
end
def setup
super
if not defined? $b
set_browser
end
end
end
load 'segmenter_browser.rb'
load 'browser_test.rb'
load 'segmenter_test.rb'
class TestSegmenterPage < BrowserTest
def set_browser
# Redefine set_browser as the tested webpage is totally different
folder_path = Dir.pwd
folder_path.sub! '/browser/test', ''
index_path = 'file://' + folder_path + '/browser/segmenter_page.html'
print "Open browser\n"
#$b = VidjilBrowser.new :safari
$b = SegmenterBrowser.new :firefox
#$b = VidjilBrowser.new :chrome
print "Resize\n"
$b.window.resize_to(1500, 800)
print "Testing segmenter page at " + index_path + "\n"
$b.goto index_path
# check that the segmenter loaded correctly
if not $b.textarea(:id => 'form_sequences').present?
print "Loading of segmenter page failed. Do not execute remaining tests."
exit
end
print "Segmenter page loaded, launching tests.\n"
end
def setup
super
if not defined? $b
set_browser
end
end
class TestSegmenterPage < SegmenterTest
def test_00_launch_query
sequences = $b.textarea(:id => 'form_sequences')
......@@ -148,7 +113,7 @@ GGGGGAGGCTTGGTACAGCCTGGGGGGTCCCTGAGACTCTCCTGTGCAGCCTCTGGATTCACCTTCAGTAGCTACGACAT
assert (right_coord_of_textarea < left_coord_of_scatterplot), "Textarea should be left of scatterplot"
end
def test_zz_close
close_everything
end
......
load 'segmenter_browser.rb'
load 'browser_test.rb'
load 'segmenter_test.rb'
class TestSegmenterPageErrors < BrowserTest
def set_browser
# Redefine set_browser as the tested webpage is totally different
folder_path = Dir.pwd
folder_path.sub! '/browser/test', ''
index_path = 'file://' + folder_path + '/browser/segmenter_page.html'
print "Open browser\n"
#$b = VidjilBrowser.new :safari
$b = SegmenterBrowser.new :firefox
#$b = VidjilBrowser.new :chrome
print "Resize\n"
$b.window.resize_to(1500, 800)
print "Testing segmenter page at " + index_path + "\n"
$b.goto index_path
# check that the segmenter loaded correctly
if not $b.textarea(:id => 'form_sequences').present?
print "Loading of segmenter page failed. Do not execute remaining tests."
exit
end
print "Segmenter page loaded, launching tests.\n"
end
def setup
super
if not defined? $b
set_browser
end
end
class TestSegmenterPageErrors < SegmenterTest
def test_00_launch_bad_query
sequences = $b.textarea(:id => 'form_sequences')
......
......@@ -3,6 +3,17 @@ require 'watir-webdriver'
class VidjilBrowser < Watir::Browser
def initialize
if ENV['WATIR_BROWSER_PATH']
print "Using custom browser location " + ENV['WATIR_BROWSER_PATH'] + "\n"
Selenium::WebDriver::Firefox.path = ENV['WATIR_BROWSER_PATH']
end
# :chrome or :safari
super :firefox
print "Running "+driver.capabilities.browser_name+" "+driver.capabilities.version+"\n"
end
# Return the text field that allows to edit a clone name
def clone_name_editor
return text_field(:id => 'new_name')
......
rename_reports_in() {
dir="$1"
b="$2"
if [ "$b" = "." ]; then
b="default"
else
b=$(echo "$b" | tr '/' '-')
fi
for file in $1/*.xml; do
filename=$(basename -s .xml $file)
mv $file $dir/$filename-$b.xml
done
}
rm -f test/*.xml
EXIT=0
for file in test_*rb; do
ruby $file;
TMP_EXIT=$?
if [ $TMP_EXIT -ne 0 ]; then
EXIT=$TMP_EXIT
fi
mv test/reports/*.xml test/
if [ -z "$FUNCTIONAL_CLIENT_BROWSER_PATH" ]; then
FUNCTIONAL_CLIENT_BROWSER_PATH="."
fi
for browser in $FUNCTIONAL_CLIENT_BROWSER_PATH; do
for file in functional/test_*rb; do
if [ ${#browser} -gt 1 ]; then
export WATIR_BROWSER_PATH="$browser"
fi
ruby -I functional $file;
TMP_EXIT=$?
if [ $TMP_EXIT -ne 0 ]; then
EXIT=$TMP_EXIT
fi
rename_reports_in test/reports/ "$browser"
mv test/reports/*.xml test/
done
done
exit $EXIT
\ No newline at end of file
exit $EXIT
......@@ -294,7 +294,7 @@ The cache is stored for each user and is updated only when a change occurs (mess
**** Architecture
The browser functional testing is done in the directory
=browser/tests=, with Watir.
=browser/tests/functional=, with Watir.
The functional tests are built using two base files:
- vidjil_browser.rb :: abstracts the vidjil browser (avoid using IDs or
class names that could change in the test). The tests must rely as
......@@ -303,12 +303,14 @@ The cache is stored for each user and is updated only when a change occurs (mess
- browser_test.rb :: prepares the environment for the tests. Each test
file will extend this class (as can be seen in test_multilocus.rb)
The file =segmenter_test.rb= extends the class in =browser_test.rb= to adapt
it to the purpose of testing the analyze autonomous app.
The tests are in the files whose name matches the pattern =test*.rb=. The
tests are launched by the script in =launch_functional_tests= which launches
tests are launched by the script in =../launch_functional_tests= which launches
all the files matching the previous pattern. It also backs up the test
reports as =ci_reporter= removes them before each file is run.
**** Installation
The following instructions are for Ubuntu.
......@@ -358,6 +360,14 @@ the webdriver may not work with recent versions of Firefox (> 45).
make functional
#+END_SRC
By default the tests are launched on the Firefox installed on the system.
This can be modified by providing the =FUNCTIONAL_CLIENT_BROWSER_PATH=
environment variable (which can contain several pathes, separated with
spaces) to the =launch_functional_tests= script. Or, if one wants to launch
individual test scripts, to set the =WATIR_BROWSER_PATH= environment
variable.
**** Headless mode
On servers without a X server the browser tests can be launched in headless
......@@ -388,7 +398,8 @@ make functional
2. =vncviewer :0=
**** Interactive mode
For debugging purposes, it may be useful to launch Watir in interactive
mode. In that case, you should launch =irb= in the =browser/tests= directory.
mode. In that case, you should launch =irb= in the =browser/tests/functional=
directory.
Then load the file =browser_test.rb= and create a =BrowserTest=:
#+BEGIN_SRC ruby
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment