From 387c1f35cc31e9f867acffb6534e15dc07a6c3ab Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sat, 13 Feb 2021 09:48:21 +0100 Subject: [PATCH] Minor - Add document behat tests --- .github/workflows/php.yml | 2 ++ assets/vue/components/ConfirmDelete.vue | 6 ++-- .../features/bootstrap/FeatureContext.php | 2 +- tests/behat/features/toolDocument.feature | 31 +++++++++++++------ 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index fa717cece4..609591e57b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -189,6 +189,8 @@ jobs: ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -vvv ../../vendor/behat/behat/bin/behat features/adminSettings.feature -vv ../../vendor/behat/behat/bin/behat features/career.feature -vvv + ../../vendor/behat/behat/bin/behat features/class.feature -vvv + #../../vendor/behat/behat/bin/behat features/companyReports.feature -vvv ../../vendor/behat/behat/bin/behat features/course.feature -vvv ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -vv ../../vendor/behat/behat/bin/behat features/createUser.feature -vvv diff --git a/assets/vue/components/ConfirmDelete.vue b/assets/vue/components/ConfirmDelete.vue index 8be5986838..4331d6b4f3 100644 --- a/assets/vue/components/ConfirmDelete.vue +++ b/assets/vue/components/ConfirmDelete.vue @@ -9,15 +9,13 @@ - {{ $t('Delete') }} + >{{ $t('Yes') }} - {{ $t('Cancel') }} + >{{ $t('No') }} diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index dd841bc601..fe55c09d54 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -440,7 +440,7 @@ class FeatureContext extends MinkContext */ public function waitForThePageToBeLoaded() { - $this->getSession()->wait(5000); + $this->getSession()->wait(3000); } /** diff --git a/tests/behat/features/toolDocument.feature b/tests/behat/features/toolDocument.feature index 3b05298d04..6b5d7df104 100644 --- a/tests/behat/features/toolDocument.feature +++ b/tests/behat/features/toolDocument.feature @@ -5,10 +5,10 @@ Feature: Document tool Background: Given I am a platform administrator And I am on course "TEMP" homepage - - Scenario: Create a folder Then I follow "document" And wait the page to be loaded when ready + + Scenario: Create a folder Then I should see "New folder" Then I press "New folder" Then I fill in the following: @@ -18,8 +18,6 @@ Feature: Document tool Then I should see "created" Scenario: Create a folder that already exists - Then I follow "document" - And wait the page to be loaded when ready Then I should see "New folder" Then I press "New folder" And I fill in the following: @@ -29,7 +27,6 @@ Feature: Document tool Then I should see "created" Scenario: Create a text document - Then I follow "document" Then I press "New document" And wait for the page to be loaded Then I fill in the following: @@ -45,7 +42,6 @@ Feature: Document tool # Then I should see "This is my first document" Scenario: Create a HTML document - Then I follow "document" Then I press "New document" And wait for the page to be loaded Then I fill in the following: @@ -63,7 +59,6 @@ Feature: Document tool # And I should not see "www.chamilo.org" Scenario: Upload a document - Then I follow "document" Then I press "File upload" And wait for the page to be loaded Then I attach the file "/public/favicon.ico" to "file_upload" @@ -74,9 +69,7 @@ Feature: Document tool Then I should see "favicon.ico" Scenario: Search for "My second document" and edit it - Then I follow "document" Then I press "Search" - And wait for the page to be loaded Then I fill in the following: | search_filter | My second document | Then I press "Filter" @@ -89,11 +82,29 @@ Feature: Document tool Then I fill in the following: | item_title | My second document edited | Then I press "Submit" - And wait very long for the page to be loaded + And wait for the page to be loaded Then I should see "updated" Then move backward one page And I should see "My second document edited" + Scenario: Search for "My second document" and delete it + Then I press "Search" + Then I fill in the following: + | search_filter | My second document | + Then I press "Filter" + And wait very long for the page to be loaded + Then I should see "My second document" + Then I press "Info" + And wait for the page to be loaded + Then I should see "My second document" + Then I press "Delete" + And wait for the page to be loaded + And I press "Yes" + And wait for the page to be loaded + Then I should see "Deleted" + And wait for the page to be loaded + And I should not see "My second document" + # Scenario: Delete simple document