From 836e361a2e11c5e5f9ab9df7608e06567dcd9bc3 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 28 Feb 2017 14:18:31 +0100 Subject: [PATCH] Add link tests and work test --- main/inc/lib/link.lib.php | 2 +- tests/behat/features/link.feature | 45 +++++++++++++++++++++++++++++++ tests/behat/features/work.feature | 17 ++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/behat/features/link.feature create mode 100644 tests/behat/features/work.feature diff --git a/main/inc/lib/link.lib.php b/main/inc/lib/link.lib.php index 2f20185adc..2acaace1d0 100755 --- a/main/inc/lib/link.lib.php +++ b/main/inc/lib/link.lib.php @@ -405,7 +405,7 @@ class Link extends Model api_get_user_id() ); self::delete_link_from_search_engine(api_get_course_id(), $id); - Display:: display_confirmation_message(get_lang('LinkDeleted')); + Display::addFlash(Display::return_message(get_lang('LinkDeleted'))); $result = true; break; case 'category': diff --git a/tests/behat/features/link.feature b/tests/behat/features/link.feature new file mode 100644 index 0000000000..dfe58b18d1 --- /dev/null +++ b/tests/behat/features/link.feature @@ -0,0 +1,45 @@ +Feature: Link tool + In order to use the link tool + The teachers should be able to create link categories and links + + Background: + Given I am a platform administrator + And I am on course "TEMP" homepage + + Scenario: Create a link category + Given I am on "/main/link/link.php?action=addcategory&cidReq=TEMP" + When I fill in the following: + | category_title | Category 1 | + | description | Category description | + And I press "submitCategory" + Then I should see "Category added" + + Scenario: Create a link + Given I am on "/main/link/link.php?action=addlink&cidReq=TEMP" + When I fill in the following: + | url | http://www.chamilo.org | + | title | Chamilo | + And I press "submitLink" + Then I should see "The link has been added" + + Scenario: Create a link with category + Given I am on "/main/link/link.php?action=addlink&cidReq=TEMP" + When I fill in the following: + | url | http://www.chamilo.org | + | title | Chamilo in category 1 | + And I select "Category 1" from "category_id" + And I press "submitLink" + Then I should see "The link has been added" + + Scenario: Delete link + Given I am on "/main/link/link.php?cidReq=TEMP" + And I follow "Delete" + Then I should see "The link has been deleted" + + Scenario: Delete link category + Given I am on "/main/link/link.php?cidReq=TEMP" + And I follow "Delete" + Then I should see "The category has been deleted." + + + diff --git a/tests/behat/features/work.feature b/tests/behat/features/work.feature new file mode 100644 index 0000000000..b22fc086dc --- /dev/null +++ b/tests/behat/features/work.feature @@ -0,0 +1,17 @@ +Feature: Work tool + In order to use the work tool + The teachers should be able to create works + + Background: + Given I am a platform administrator + And I am on course "TEMP" homepage + + Scenario: Create a work + Given I am on "/main/work/work.php?action=create_dir&cidReq=TEMP" + When I fill in the following: + | new_dir | Work 1 | + | description | Work description | + And I press "submit" + Then I should see "Directory created" + +