From 5d7c520de4c58bc7464dd31533f0b1b2155bbdec Mon Sep 17 00:00:00 2001 From: Alfonso Salces Date: Mon, 18 Mar 2024 10:15:00 +0100 Subject: [PATCH] MOBILE-4219 blog: Create acceptance testing --- .github/workflows/acceptance.yml | 1 + .../blog/tests/behat/edit-entry.feature | 68 +++++++++++++++++++ src/addons/blog/tests/behat/entries.feature | 30 ++++++++ .../blog/tests/behat/fixtures/stub6.txt | 1 + .../blog/tests/behat/fixtures/stub7.txt | 1 + 5 files changed, 101 insertions(+) create mode 100644 src/addons/blog/tests/behat/edit-entry.feature create mode 100644 src/addons/blog/tests/behat/entries.feature create mode 100644 src/addons/blog/tests/behat/fixtures/stub6.txt create mode 100644 src/addons/blog/tests/behat/fixtures/stub7.txt diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index a2d2e1330..c352ec0c3 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -86,6 +86,7 @@ jobs: "@addon_mod_survey" "@addon_mod_workshop" "@addon_notifications" + "@addon_blog" "@core" "@core_comments" "@core_course" diff --git a/src/addons/blog/tests/behat/edit-entry.feature b/src/addons/blog/tests/behat/edit-entry.feature new file mode 100644 index 000000000..2dae7244b --- /dev/null +++ b/src/addons/blog/tests/behat/edit-entry.feature @@ -0,0 +1,68 @@ +@addon_blog @core_blog @app @javascript @lms_from4.4 +Feature: Edit blog entries + In order to add or edit blog entries as User + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | testuser | Test | User | moodle@example.com | + | testuser2 | Test | User2 | moodle@example.com | + And the following "core_blog > entries" exist: + | subject | body | user | + | Blog post one | User 1 blog post content | testuser | + | Blog post two | User 1 blog post content | testuser | + + Scenario: Edit blog entry + Given I entered the app as "testuser" + When I press the user menu button in the app + And I press "Blog entries" in the app + Then I should find "Blog post one" in the app + And I press "Display options" in the app + And I press "Edit" in the app + + Then I should find "Blog post one" in the app + And I set the field "Entry title" to "Blog post one (updated)" in the app + And I set the field "Blog entry body" to "User 1 blog post content (updated)" in the app + And I press "Publish to" in the app + And I press "Yourself (draft)" in the app + And I press "Save" in the app + + Then I should find "Blog post one (updated)" in the app + And I should find "User 1 blog post content (updated)" in the app + And I should find "Yourself (draft)" near "User 1 blog post content (updated)" in the app + + Scenario: Add a blog entry + Given I entered the app as "testuser" + When I press the user menu button in the app + And I press "Blog entries" in the app + And I press "Add a new entry" in the app + + And I set the field "Entry title" to "New blog entry" in the app + And I set the field "Blog entry body" to "This is a new blog entry." in the app + And I press "Publish to" in the app + And I press "Anyone on this site" in the app + And I press "Add a new entry" "button" in the app + + Then I should find "Blog entries" in the app + And I should find "New blog entry" in the app + + Scenario: Add a blog entry with attachments + Given I entered the app as "testuser" + When I press the user menu button in the app + And I press "Blog entries" in the app + And I press "Add a new entry" in the app + + And I set the field "Entry title" to "Entry with attachments" in the app + And I set the field "Blog entry body" to "This is a new blog entry with attachments." in the app + + And I press "Add file" in the app + And I upload "stub6.txt" to "File" ".action-sheet-button" in the app + And I press "Add file" in the app + And I upload "stub7.txt" to "File" ".action-sheet-button" in the app + + And I press "Add a new entry" "button" in the app + + Then I should find "Blog entries" in the app + And I should find "Entry with attachments" in the app + And I should find "stub6.txt" in the app + And I should find "stub7.txt" in the app diff --git a/src/addons/blog/tests/behat/entries.feature b/src/addons/blog/tests/behat/entries.feature new file mode 100644 index 000000000..a1a153384 --- /dev/null +++ b/src/addons/blog/tests/behat/entries.feature @@ -0,0 +1,30 @@ +@addon_blog @core_blog @app @javascript @lms_from4.4 +Feature: Blog entries + In order to modify or delete a blog entry + As a user + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | testuser | Test | User | moodle@example.com | + And the following "core_blog > entries" exist: + | subject | body | user | + | Blog post one | User 1 blog post content | testuser | + | Blog post two | User 1 blog post content | testuser | + + Scenario: List every blog entry + Given I entered the app as "testuser" + When I press the user menu button in the app + And I press "Blog entries" in the app + Then I should find "Blog post one" in the app + And I should find "Blog post two" in the app + + Scenario: Delete blog entry + Given I entered the app as "testuser" + When I press the user menu button in the app + And I press "Blog entries" in the app + Then I should find "Blog post one" in the app + When I press "Display options" near "Blog post one" in the app + And I press "Delete" in the app + And I pull to refresh in the app + And I should not find "Blog post one" in the app diff --git a/src/addons/blog/tests/behat/fixtures/stub6.txt b/src/addons/blog/tests/behat/fixtures/stub6.txt new file mode 100644 index 000000000..c96555531 --- /dev/null +++ b/src/addons/blog/tests/behat/fixtures/stub6.txt @@ -0,0 +1 @@ +This is the stub file 6 created at 13/03/2025. diff --git a/src/addons/blog/tests/behat/fixtures/stub7.txt b/src/addons/blog/tests/behat/fixtures/stub7.txt new file mode 100644 index 000000000..6360631d2 --- /dev/null +++ b/src/addons/blog/tests/behat/fixtures/stub7.txt @@ -0,0 +1 @@ +This is the stub file 7 created at 13/03/2025.