From 8ce69dcbc30d986e745c993b99b8054777b17742 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 2 Jun 2021 14:25:04 +0200 Subject: [PATCH] Update tests --- .github/workflows/php.yml | 193 ++++++++++++++++++ tests/behat/README.md | 14 +- .../features/bootstrap/FeatureContext.php | 76 ++++--- tests/behat/features/createUser.feature | 42 +++- tests/behat/features/createUserViaCSV.feature | 2 +- tests/behat/features/profile.feature | 4 +- .../behat/features/sessionManagement.feature | 6 +- tests/behat/features/toolExercise.feature | 59 ++++-- tests/behat/features/toolLp.feature | 38 ++-- tests/datafiller/data_users.php | 1 + 10 files changed, 357 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000000..54332f175e --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,193 @@ +name: Behat tests 1.11.x 🐞 + +on: [push, pull_request] + +jobs: + build: + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + runs-on: ubuntu-18.04 + + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest] + php-versions: ['7.1', '7.2', '7.3', '7.4'] + +# services: +# mysql: +# image: mysql:5.7 +# env: +# MYSQL_ALLOW_EMPTY_PASSWORD: false +# MYSQL_ROOT_PASSWORD: chamilo +# MYSQL_DATABASE: chamilo +# ports: +# - 3306/tcp +# options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup apache + run: | + sudo apt-get install software-properties-common + sudo add-apt-repository ppa:ondrej/php + sudo apt-get update + sudo apt-get install apache2 php${{ matrix.php-versions }} php${{ matrix.php-versions }}-common php${{ matrix.php-versions }}-cli libapache2-mod-php${{ matrix.php-versions }} + sudo a2enmod rewrite actions + sudo cp -f tests/travis/gh-apache /etc/apache2/sites-available/000-default.conf + sudo chmod 777 -R $HOME + cat /etc/apache2/sites-available/000-default.conf + sudo service apache2 restart + sudo systemctl restart apache2 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, xml, ctype, iconv, intl, pdo, pdo_mysql, dom, gd, json, soap, zip, bcmath + ini-values: post_max_size=256M, max_execution_time=600, memory_limit=4096M + + - name: Get composer cache directory + id: composer-cache-v1 + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache-v1.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: v1-${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: v1-${{ runner.os }}-composer- + + - name: Install dependencies with composer + run: composer install --prefer-dist --no-progress + +# - name: Install assets +# run: php bin/console assets:install +# +# - name: Generate fos_js_routes.json +# run: php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json + +# - name: Get yarn cache directory +# id: yarn-cache +# run: echo "::set-output name=dir::$(yarn cache dir)" +# +# - name: Cache yarn dependencies +# uses: actions/cache@v2 +# with: +# path: ${{ steps.yarn-cache.outputs.dir }} +# # Use composer.json for key, if composer.lock is not committed. +# # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} +# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} +# restore-keys: ${{ runner.os }}-yarn- +# +# - name: Yarn install +# uses: borales/actions-yarn@v2.3.0 +# with: +# cmd: install # will run `yarn install` command +# +# - name: Yarn run encore dev +# uses: borales/actions-yarn@v2.3.0 +# with: +# cmd: run encore dev + + - name: Start chrome + run: | + sudo apt-get install google-chrome-stable + google-chrome --version + google-chrome-stable --version + google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & + whereis google-chrome-stable + + # https://github.com/marketplace/actions/setup-chromedriver + - name: Start chromedriver + uses: nanasess/setup-chromedriver@master + with: + # Optional: do not specify to match Chrome's version + chromedriver-version: '88.0.4324.96' + + - run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional + +# wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip --quiet && unzip chromedriver_linux64.zip +# sudo mv chromedriver /usr/bin +# sudo chmod +x /usr/bin/chromedriver +# chromedriver --version + +# - run: | +# export DISPLAY=:99 +# chromedriver --url-base=/wd/hub & +# sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional +# chromedriver --version + + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Get Selenium + run: | + wget http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar --quiet + + - name: Run Selenium + run: | + java -version + export DISPLAY=:99.0 + sudo xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-3.141.59.jar -log selenium.log > /dev/null & + + - name: Start mysql service + run: | + sudo /etc/init.d/mysql start + sudo systemctl restart apache2 +# +# - name: Install database +# run: | +# bin/console doctrine:database:create || echo "Error while creating the DB" +# env: +# DATABASE_URL: mysql://root:root@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/chamilo +# DATABASE_HOST: 127.0.0.1 +# DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }} +# DATABASE_NAME: chamilo +# DATABASE_USER: root +# DATABASE_PASSWORD: root +# APP_INSTALLED: 1 + + - name: Check settings + run: | + php -ini + php -v + php -m + +# - name: Check chamilo +# run: | +# sudo chmod 777 -R ${{ github.workspace }} +# curl http://localhost/main/install/index.php + + - name: Install chash + run: | + git clone https://github.com/chamilo/chash + cd chash + git checkout 0.2.x + composer install + php -d phar.readonly=0 createPhar.php + chmod +x chash.phar + sudo mv chash.phar /usr/local/bin/chash + + - name: Install chamilo + run: | + php ${{ github.workspace }}/chash/chash.php chash:chamilo_install 1.11.x ${{ github.workspace }} --no-interaction --sitename="Chamilo" --site_url="http://localhost/" --institution="Chamilo" --institution_url="https://chamilo.org" --encrypt_method="sha1" --firstname="John" --lastname="Doe" --language="english" --driver="pdo_mysql" --host="localhost" --port="3306" --dbname="chamilo" --dbuser="root" --dbpassword="root" --permissions_for_new_directories="0777" --permissions_for_new_files="0666" --linux-user="www-data" --linux-group="www-data" --username="admin" --password="admin" --email="admin@example.com" --phone="555-5555" + sudo chmod -R 777 app/cache app/logs app/courses app/upload web + php ${{ github.workspace }}/chash/chash.php chash:chamilo_status + ls -la + bash tests/travis/post_installation.sh + curl http://localhost/index.php + ls -la web/build + + - name: Behat tests + run: | + cd ${{ github.workspace }}/tests/behat + ../../vendor/behat/behat/bin/behat -vvv diff --git a/tests/behat/README.md b/tests/behat/README.md index 6d9982f922..11c54f0da9 100644 --- a/tests/behat/README.md +++ b/tests/behat/README.md @@ -8,7 +8,9 @@ http://www.seleniumhq.org/download/ And run it with the following command: ``` -java -jar /my-dir/selenium-server-standalone-3.1.0.jar +Example: +wget https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar +java -jar selenium-server-standalone-3.141.59.jar ``` - Download the Chrome driver, unzip and copy into /usr/bin @@ -17,7 +19,15 @@ Check the latest version at https://sites.google.com/a/chromium.org/chromedriver then adapt the following command to the latest version: ``` -cd /tmp && wget https://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/local/bin +cd /tmp && wget https://chromedriver.storage.googleapis.com/85.0.4183.83/chromedriver_linux64.zip && unzip chromedriver_linux64.zip && sudo mv chromedriver /usr/local/bin +``` + +- Install google-chrome (stable version, not beta or dev). +- Test if chromedriver is working correctly, the result should be something like: + +``` +chromedriver --version +ChromeDriver 2.34.522913 ``` ### Chamilo configuration diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index 1d82f4e306..31ddbb92ae 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -21,7 +21,6 @@ class FeatureContext extends MinkContext */ public function iAmAPlatformAdministrator() { - $this->visit('/index.php?logout=logout&uid=1'); $this->iAmOnHomepage(); $this->fillField('login', 'admin'); $this->fillField('password', 'admin'); @@ -34,7 +33,6 @@ class FeatureContext extends MinkContext */ public function iAmATeacher() { - $this->visit('/index.php?logout=logout'); $this->iAmOnHomepage(); $this->fillField('login', 'mmosquera'); $this->fillField('password', 'mmosquera'); @@ -46,7 +44,6 @@ class FeatureContext extends MinkContext */ public function iAmAStudent() { - $this->visit('/index.php?logout=logout'); $this->iAmOnHomepage(); $this->fillField('login', 'acostea'); $this->fillField('password', 'acostea'); @@ -58,7 +55,6 @@ class FeatureContext extends MinkContext */ public function iAmAnHR() { - $this->visit('/index.php?logout=logout'); $this->iAmOnHomepage(); $this->fillField('login', 'ptook'); $this->fillField('password', 'ptook'); @@ -70,7 +66,6 @@ class FeatureContext extends MinkContext */ public function iAmAStudentBoss() { - $this->visit('/index.php?logout=logout'); $this->iAmOnHomepage(); $this->fillField('login', 'abaggins'); $this->fillField('password', 'abaggins'); @@ -82,7 +77,6 @@ class FeatureContext extends MinkContext */ public function iAmAnInvitee() { - $this->visit('/index.php?logout=logout'); $this->iAmOnHomepage(); $this->fillField('login', 'bproudfoot'); $this->fillField('password', 'bproudfoot'); @@ -94,21 +88,10 @@ class FeatureContext extends MinkContext */ public function courseExists($argument) { - $this->iAmAPlatformAdministrator(); $this->visit('/main/admin/course_list.php?keyword='.$argument); $this->assertPageContainsText($argument); } - /** - * @Given /^course "([^"]*)" is deleted$/ - */ - public function courseIsDeleted($argument) - { - $this->iAmAPlatformAdministrator(); - $this->visit('/main/admin/course_list.php?keyword='.$argument); - $this->clickLink('Delete'); - } - /** * @Given /^I am on course "([^"]*)" homepage$/ */ @@ -179,10 +162,12 @@ class FeatureContext extends MinkContext ] ); + $this->visit('/index.php?logout=logout'); $this->iAmAPlatformAdministrator(); $this->visit($sendInvitationURL); $this->iAmLoggedAs($friendUsername); $this->visit($acceptInvitationURL); + $this->visit('/index.php?logout=logout'); $this->iAmAPlatformAdministrator(); } @@ -236,7 +221,6 @@ class FeatureContext extends MinkContext */ public function adminTopBarIsDisabled() { - $this->iAmAPlatformAdministrator(); $this->visit('/main/admin/settings.php'); $this->fillField('search_field', 'show_admin_toolbar'); $this->pressButton('submit_button'); @@ -249,7 +233,6 @@ class FeatureContext extends MinkContext */ public function adminTopBarIsEnabled() { - $this->iAmAPlatformAdministrator(); $this->visit('/main/admin/settings.php'); $this->fillField('search_field', 'show_admin_toolbar'); $this->pressButton('submit_button'); @@ -303,6 +286,24 @@ class FeatureContext extends MinkContext ); } + /** + * @Then /^I fill the only ckeditor in the page with "([^"]*)"$/ + */ + public function iFillTheOnlyEditorInThePage($value) + { + // Just in case wait that ckeditor is loaded + $this->getSession()->wait(2000); + + + $this->getSession()->executeScript( + " + var textarea = $('textarea'); + var id = textarea.attr('id'); + CKEDITOR.instances[id].setData(\"$value\"); + " + ); + } + /** * @Given /^I fill hidden field "([^"]*)" with "([^"]*)"$/ */ @@ -391,18 +392,31 @@ class FeatureContext extends MinkContext $('$field > option').each(function(index, option) { if (option.text == '$value') { $('$field').selectpicker('val', option.value); - } + } }); "); } + /** + * @When /^(?:|I )fill in select "(?P(?:[^"]|\\")*)" with option value "(?P(?:[^"]|\\")*)" with class "(?P(?:[^"]|\\")*)"$/ + */ + public function iFillInSelectWithOptionValue($field, $value, $class) + { + $this->getSession()->wait(1000); + $this->getSession()->executeScript(" + var input = $('$field').filter('$class'); + var id = input.attr('id'); + var input = $('#'+id); + input.val($value); + "); + } /** * @When /^wait for the page to be loaded$/ */ public function waitForThePageToBeLoaded() { - $this->getSession()->wait(3000); + $this->getSession()->wait(2000); } /** @@ -411,7 +425,7 @@ class FeatureContext extends MinkContext public function waitVeryLongForThePageToBeLoaded() { //$this->getSession()->wait(10000, "document.readyState === 'complete'"); - $this->getSession()->wait(8000); + $this->getSession()->wait(4000); } /** @@ -474,6 +488,20 @@ class FeatureContext extends MinkContext return true; } + /** + * @Given /^I check the "([^"]*)" radio button selector$/ + */ + public function iCheckTheRadioButtonBasedInSelector($element) + { + $this->getSession()->executeScript(" + $(function() { + $('$element').prop('checked', true); + }); + "); + + return true; + } + /** * @Then /^I should see an icon with title "([^"]*)"$/ */ @@ -526,8 +554,8 @@ class FeatureContext extends MinkContext /** * Example: Then I should see the table "#category_results": * | Categories | Absolute score | Relative score | - * | Categoryname2 | 50 / 70 | 71.43% | - * | Categoryname1 | 60 / 60 | 100% | + * | Categoryname2 | 50 / 70 | 71.43 % | + * | Categoryname1 | 60 / 60 | 100 % | * * @Then /^I should see the table "([^"]*)":$/ * diff --git a/tests/behat/features/createUser.feature b/tests/behat/features/createUser.feature index ecbedcdf75..5ab7682977 100644 --- a/tests/behat/features/createUser.feature +++ b/tests/behat/features/createUser.feature @@ -4,18 +4,18 @@ Feature: Users management as admin As an administrator I need to be able to create new users - Scenario: See the users list link on the admin page + Background: Given I am a platform administrator - And I am on "/main/admin/index.php" + + Scenario: See the users list link on the admin page + Given I am on "/main/admin/index.php" Then I should see "Users list" Scenario: See the user creation link on the admin page - Given I am a platform administrator And I am on "/main/admin/index.php" Then I should see "Add a user" Scenario: Create a user with only basic info - Given I am a platform administrator And I am on "/main/admin/user_add.php" And I fill in the following: | firstname | Sammy | @@ -23,11 +23,35 @@ Feature: Users management as admin | email | smarshall@example.com | | username | smarshall | | password | smarshall | + And I check the "#send_mail_no" radio button selector And I press "submit" Then I should see "The user has been added" + Scenario: Create a user with wrong username + And I am on "/main/admin/user_add.php" + And I fill in the following: + | firstname | NIÑO | + | lastname | NIÑO | + | email | example@example.com | + | username | NIÑO | + | password | smarshall | + And I check the "#send_mail_no" radio button selector + And I press "submit" + Then I should see "Only letters and numbers allowed" + + Scenario: Create a user with wrong email + And I am on "/main/admin/user_add.php" + And I fill in the following: + | firstname | Juls | + | lastname | Juls | + | email | NI -ÑO@example.com | + | username | Juls | + | password | Juls | + And I check the "#send_mail_no" radio button selector + And I press "submit" + Then I should see "The email address is not complete or contains some invalid characters" + Scenario: Search and delete a user - Given I am a platform administrator And Admin top bar is disabled And I am on "/main/admin/user_list.php" And I fill in "keyword" with "smarshall" @@ -37,7 +61,6 @@ Feature: Users management as admin Then I should see "The user has been deleted" Scenario: Create a HRM user - Given I am a platform administrator And I am on "/main/admin/user_add.php" And I fill in the following: | firstname | HRM firstname| @@ -45,12 +68,12 @@ Feature: Users management as admin | email | hrm@example.com | | username | hrm | | password | hrm | + And I check the "#send_mail_no" radio button selector And I fill in select bootstrap static input "#status_select" select "4" And I press "submit" Then I should see "The user has been added" Scenario: Create a teacher user - Given I am a platform administrator And I am on "/main/admin/user_add.php" And I fill in the following: | firstname | teacher firstname| @@ -59,11 +82,11 @@ Feature: Users management as admin | username | teacher | | password | teacher | And I fill in select bootstrap static input "#status_select" select "1" + And I check the "#send_mail_no" radio button selector And I press "submit" Then I should see "The user has been added" Scenario: Create a student user - Given I am a platform administrator And I am on "/main/admin/user_add.php" And I fill in the following: | firstname | student firstname| @@ -72,11 +95,11 @@ Feature: Users management as admin | username | student | | password | student | And I fill in select bootstrap static input "#status_select" select "5" + And I check the "#send_mail_no" radio button selector And I press "submit" Then I should see "The user has been added" Scenario: HRM follows teacher - Given I am a platform administrator And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" And I should see "HRM lastname" And I should see "Human Resources Manager" @@ -87,7 +110,6 @@ Feature: Users management as admin Then I should see "The assigned users have been updated" Scenario: HRM follows student - Given I am a platform administrator And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" And I should see "HRM lastname" And I should see "Human Resources Manager" diff --git a/tests/behat/features/createUserViaCSV.feature b/tests/behat/features/createUserViaCSV.feature index 19e1dde327..cb3dfb29be 100644 --- a/tests/behat/features/createUserViaCSV.feature +++ b/tests/behat/features/createUserViaCSV.feature @@ -6,6 +6,6 @@ Feature: Users creation via CSV And I am on "/main/admin/user_import.php" Then I attach the file "/main/admin/example.csv" to "import_file" Then I press "Import" - Then I should see "File imported" + Then I should see "The user has been added" Then I am on "main/admin/user_list.php?keyword=drbrown@example.net" Then I should see "emmert" diff --git a/tests/behat/features/profile.feature b/tests/behat/features/profile.feature index 18a16afe98..9bd2d70365 100644 --- a/tests/behat/features/profile.feature +++ b/tests/behat/features/profile.feature @@ -11,10 +11,12 @@ Feature: Profile page And I press "Save settings" And wait for the page to be loaded Then I should see "Your new profile has been saved" + Then I am on "/main/social/home.php" And I should see "Andrew" + Then I am on "/main/auth/profile.php" Then I fill in the following: | firstname | Andrea | And I press "Save settings" Then I should see "Your new profile has been saved" Then I am on "/main/social/home.php" - Then I should see "Andrea" \ No newline at end of file + Then I should see "Andrea" diff --git a/tests/behat/features/sessionManagement.feature b/tests/behat/features/sessionManagement.feature index 5362bff5a2..0e9c2cbc6e 100644 --- a/tests/behat/features/sessionManagement.feature +++ b/tests/behat/features/sessionManagement.feature @@ -57,8 +57,7 @@ Feature: Session management tool Then I should see "Update successful" Scenario: Check session description with platform setting off - Given I am a platform administrator - And I am on "/main/admin/settings.php?search_field=show_session_description&category=search_setting" + Given I am on "/main/admin/settings.php?search_field=show_session_description&category=search_setting" And I check the "show_session_description" radio button with "false" value And I press "Save settings" Then I am on "/user_portal.php?nosession=true" @@ -66,8 +65,7 @@ Feature: Session management tool And I should not see "Description for Temp Session" Scenario: Check session description with platform setting on - Given I am a platform administrator - And I am on "/main/admin/settings.php?search_field=show_session_description&category=search_setting" + Given I am on "/main/admin/settings.php?search_field=show_session_description&category=search_setting" And I check the "show_session_description" radio button with "true" value And I press "Save settings" Then I should see "Update successful" diff --git a/tests/behat/features/toolExercise.feature b/tests/behat/features/toolExercise.feature index 214d14f1ae..2044a16268 100644 --- a/tests/behat/features/toolExercise.feature +++ b/tests/behat/features/toolExercise.feature @@ -262,13 +262,12 @@ Feature: Exercise tool # Question 1 Then I should see "Multiple choice" And I check the "Answer true" radio button - And wait for the page to be loaded Then I press "Next question" - # Question 2 And wait for the page to be loaded + # Question 2 And I check the "Answer true" radio button - And wait for the page to be loaded Then I press "Next question" + And wait for the page to be loaded # Question 3 Then I fill in the following: | choice_id_3_0 | Juliet | @@ -284,36 +283,42 @@ Feature: Exercise tool | choice_id_3_10 | cherchent à | | choice_id_3_11 | Übung | Then I fill in select bootstrap static by text "#choice_id_3_12" select "Ärger" - And wait for the page to be loaded Then I press "Next question" + And wait for the page to be loaded # Question 4 - Matching Then I select "A" from "choice_id_4_1" Then I select "B" from "choice_id_4_2" Then I press "Next question" + And wait for the page to be loaded # Question 5 - Open question - #Then I fill in ckeditor field "" with "" Then wait for the page to be loaded + Then I fill the only ckeditor in the page with "Hello you" Then I press "Next question" + And wait for the page to be loaded # Question 6 - Oral question - Then wait for the page to be loaded Then I press "Next question" + And wait for the page to be loaded # Question 7 - Exact answers combination Then I check "Answer true" Then I press "Next question" - Then wait for the page to be loaded + And wait for the page to be loaded # Question 8 - Unique answer with unknown And I check the "Answer true" radio button Then I press "Next question" - Then wait for the page to be loaded + And wait for the page to be loaded # Question 9 - Multiple answer true - false - dont know #@todo Then I press "Next question" + And wait for the page to be loaded # Question 10 - Combination true - false - don't-know #@todo Then I press "Next question" + And wait for the page to be loaded # Question 11 - Global multiple answer Then I check "Answer true" Then I press "End test" + And wait for the page to be loaded + Then I should see "Hello you" Then I should see "Score for the test: 83 / 117" Scenario: Check exercise result @@ -322,9 +327,18 @@ Feature: Exercise tool And I follow "Edit" And I follow "Results and feedback" Then I should see "Learner score" - And wait for the page to be loaded + And wait very long for the page to be loaded And I follow "Grade activity" Then I should see "Score for the test: 83 / 117" + And I press "Edit individual feedback and grade the open question" + And I should see "Assign a grade" + And I fill the only ckeditor in the page with "open question teacher answer" + And I fill in select "select[name=marks]" with option value "10" with class ".grade_select" + Then I press "Correct test" + And wait very long for the page to be loaded + And I follow "Edit" + Then I should see "open question teacher answer" + And I should see "Score for the test: 93 / 117" Scenario: Create a session "Session Exercise" and add user "acostea" Given I am on "/main/session/session_add.php" @@ -345,7 +359,7 @@ Feature: Exercise tool Then I should see "Update successful" Scenario: Try exercise with categorized questions as student - Given I am a student + Given I am logged as "acostea" And I am on course "TEMP" homepage in session "Session Exercise" Then I should see "TEMP (Session Exercise)" And I am on "/main/exercise/exercise.php?cidReq=TEMP" @@ -353,22 +367,28 @@ Feature: Exercise tool And I follow "Start test" When wait for the page to be loaded And I press "Next question" + And wait for the page to be loaded And I check "oligarchy" And I check "oligopoly" And I check "timocracy" And I check "autocracy" And I press "Next question" + And wait for the page to be loaded And I check the "semantics" radio button And I press "Next question" + And wait for the page to be loaded And I check the "RNASL" radio button And I press "Next question" + And wait for the page to be loaded And I check the "10" radio button And I press "Next question" + And wait for the page to be loaded And fill in the following: | choice_id_6_0 | words | | choice_id_6_1 | fill | | choice_id_6_2 | blanks | And I press "Next question" + And wait for the page to be loaded And I select "A" from "choice_id_7_1" And I select "B" from "choice_id_7_2" And I select "C" from "choice_id_7_3" @@ -378,13 +398,14 @@ Feature: Exercise tool And I press "Next question" And wait for the page to be loaded And I press "End test" + And wait for the page to be loaded Then I should see "Score for the test: 190 / 190" And I should see the table "#category_results": | Categories | Absolute score | Relative score | - | Categoryname2 | 50 / 70 | 71.43% | - | Categoryname1 | 60 / 60 | 100% | - | none | 80 / 60 | 133.33% | - | Total | 190 / 190 | 100% | + | Categoryname1 | 60 / 60 | 100 % | + | Categoryname2 | 50 / 70 | 71.43 % | + | none | 80 / 60 | 133.33 % | + | Total | 190 / 190 | 100 % | Scenario: Teacher looks at exercise results by categories Given I am on "/user_portal.php" @@ -399,10 +420,10 @@ Feature: Exercise tool Then I should see "Score for the test: 190 / 190" And I should see the table "#category_results": | Categories | Absolute score | Relative score | - | Categoryname2 | 50 / 70 | 71.43% | - | Categoryname1 | 60 / 60 | 100% | - | none | 80 / 60 | 133.33% | - | Total | 190 / 190 | 100% | + | Categoryname1 | 60 / 60 | 100 % | + | Categoryname2 | 50 / 70 | 71.43 % | + | none | 80 / 60 | 133.33 % | + | Total | 190 / 190 | 100 % | Scenario: Delete an exercise Given I am on "/main/exercise/exercise.php?cidReq=TEMP" @@ -425,4 +446,4 @@ Feature: Exercise tool And wait for the page to be loaded And I follow "Delete" And I confirm the popup - Then I should see "Deleted" + Then I should see "Deleted" \ No newline at end of file diff --git a/tests/behat/features/toolLp.feature b/tests/behat/features/toolLp.feature index 4bb93b63dd..822b4fd522 100644 --- a/tests/behat/features/toolLp.feature +++ b/tests/behat/features/toolLp.feature @@ -48,8 +48,6 @@ Feature: LP tool Then I should see "LP 1" And I should see "Document 1" And I should see "Exercise 1" - And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list" - Then I should see "LP 1" # Scenario: Check the PDF export in LP list if hide SCORM PDF link is false # Given I am on "/main/admin/settings.php?category=Course" @@ -65,19 +63,25 @@ Feature: LP tool # And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list&isStudentView=true" # Then I should not see an icon with title "Export to PDF" - Scenario: LP exists and LP category exists - And I am on "/main/lp/lp_controller.php?cidReq=TEMP&id_session=0&gidReq=0&gradebook=0&origin=" - Then I should see "LP 1" - And I should see "LP category 1" - - Scenario: Delete a LP - Given I am on "/main/lp/lp_controller.php?cidReq=TEMP" - And I follow "Delete" - And I confirm the popup - Then I should not see "LP 1" +# Scenario: LP exists and LP category exists +# Given I am on course "TEMP" homepage +# Then I should see "Learning path" +# Then I am on "/main/lp/lp_controller.php?cidReq=TEMP" +# Then I should see "LP 1" +# And I should see "LP category 1" - Scenario: Delete a LP category - Given I am on "/main/lp/lp_controller.php?cidReq=TEMP" - Then I should see "LP category 1" - And I follow "Delete" - Then I should see "Deleted" \ No newline at end of file +# Scenario: Delete a LP +# Given I am not logged +# And I am a platform administrator +# And I am on course "TEMP" homepage +# And I am on "/main/lp/lp_controller.php?cidReq=TEMP&action=list" +# Then I should see "LP category 1" +# And I follow "Delete" +# And I confirm the popup +# Then I should not see "LP 1" +# +# Scenario: Delete a LP category +# Given I am on "/main/lp/lp_controller.php?cidReq=TEMP" +# Then I should see "LP category 1" +# And I follow "Delete" +# Then I should see "Deleted" \ No newline at end of file diff --git a/tests/datafiller/data_users.php b/tests/datafiller/data_users.php index e62a0208ac..9df0d8639b 100755 --- a/tests/datafiller/data_users.php +++ b/tests/datafiller/data_users.php @@ -221,4 +221,5 @@ $users[] = array('username' => 'helena','pass'=> 'helena','firstname' => 'Helena $users[] = array('username' => 'cgonzales','pass'=> 'cgonzales','firstname' => 'Cecilia','lastname' => 'Gonzales','status' => 5,'auth_source' => 'platform','email' => 'cgonzales@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'amann','pass'=> 'amann','firstname' => 'Aimee','lastname' => 'Mann','status' => 5,'auth_source' => 'platform','email' => 'amann@example.com','creator_id' => 1,'active' => 1); $users[] = array('username' => 'zzaouidi','pass'=> 'zazup','firstname' => 'Zatar','lastname' => 'Zaouidi','status' => 5,'auth_source' => 'platform','email' => 'zazup@example.com','creator_id' => 1,'active' => 1); +$users[] = array('username' => 'drh','pass'=> 'drh','firstname' => 'Joan DRH', 'lastname' => 'Holloway','status' => 4,'auth_source' => 'platform','email' => 'drh@example.com','creator_id' => 1,'active' => 1);