Skip to content

Commit b309bff

Browse files
committed
interaction_forms.feature
1 parent 500699b commit b309bff

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
@tool @tool_lifecycle @javascript
2+
Feature: Add a workflow with a manual trigger and a duplicate step and test the interaction as a teacher
3+
4+
Background:
5+
Given the following "users" exist:
6+
| username | firstname | lastname | email |
7+
| teacher1 | Teacher | 1 | teacher1@example.com |
8+
And the following "courses" exist:
9+
| fullname | shortname | category |
10+
| Course 1 | C1 | 0 |
11+
And the following "course enrolments" exist:
12+
| user | course | role |
13+
| teacher1 | C1 | editingteacher |
14+
And I log in as "admin"
15+
And I am on workflowdrafts page
16+
And I click on "Create new workflow" "link"
17+
And I set the following fields to these values:
18+
| Title | My Workflow |
19+
| Displayed workflow title | Teachers view on workflow |
20+
And I press "Save changes"
21+
And I select "Manual trigger" from the "tool_lifecycle-choose-trigger" singleselect
22+
And I set the following fields to these values:
23+
| Instance name | My Trigger |
24+
| Icon | t/delete |
25+
| Action name | Duplicate course |
26+
| Capability | moodle/course:manageactivities |
27+
And I press "Save changes"
28+
And I select "Duplicate step" from the "tool_lifecycle-choose-step" singleselect
29+
And I set the following fields to these values:
30+
| Instance name | Duplicate step |
31+
And I press "Save changes"
32+
And I click on "Workflow drafts" "link"
33+
And I press "Activate"
34+
And I log out
35+
36+
Scenario: Test interaction of duplicate step including the correct handling of the form for aditional information
37+
Given I log in as "teacher1"
38+
When I am on lifecycle view
39+
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
40+
And I should see the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
41+
When I click on the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
42+
Then I should see "Duplicate course"
43+
When I set the following fields to these values:
44+
| Course short name | C2 |
45+
| Course full name | Course 2 |
46+
And I press "Save changes"
47+
Then I should see "Duplicated course will be available shortly." in the "tool_lifecycle_remaining" "table"
48+
When I log out
49+
And I log in as "admin"
50+
And I run the scheduled task "tool_lifecycle\task\lifecycle_task"
51+
And I log out
52+
And I log in as "teacher1"
53+
And I am on lifecycle view
54+
Then I should see "Course 2" in the "tool_lifecycle_remaining" "table"
55+
And I should see "C2" in the "tool_lifecycle_remaining" "table"
56+
57+
Scenario: Test interaction of duplicate step when interaction is interrupted
58+
Given I log in as "teacher1"
59+
When I am on lifecycle view
60+
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
61+
And I should see the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
62+
When I click on the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
63+
Then I should see "Duplicate course"
64+
When I am on lifecycle view
65+
Then I should see the tool "Enter data" in the "Course 1" row of the "tool_lifecycle_interaction" table
66+
When I click on the tool "Enter data" in the "Course 1" row of the "tool_lifecycle_interaction" table
67+
Then I should see "Duplicate course"
68+
When I set the following fields to these values:
69+
| Course short name | C2 |
70+
| Course full name | Course 2 |
71+
And I press "Save changes"
72+
Then I should see "Duplicated course will be available shortly." in the "tool_lifecycle_remaining" "table"
73+
When I log out
74+
And I log in as "admin"
75+
And I run the scheduled task "tool_lifecycle\task\lifecycle_task"
76+
And I log out
77+
And I log in as "teacher1"
78+
And I am on lifecycle view
79+
Then I should see "Course 2" in the "tool_lifecycle_remaining" "table"
80+
And I should see "C2" in the "tool_lifecycle_remaining" "table"
81+
82+
Scenario: Test interaction of duplicate step when interaction is canceled
83+
Given I log in as "teacher1"
84+
When I am on lifecycle view
85+
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
86+
And I should see the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
87+
When I click on the tool "Duplicate course" in the "Course 1" row of the "tool_lifecycle_remaining" table
88+
Then I should see "Duplicate course"
89+
When I press "Cancel"
90+
Then I should not see "Duplicated course will be available shortly." in the "tool_lifecycle_remaining" "table"
91+
And I should see "Course 1" in the "tool_lifecycle_remaining" "table"

0 commit comments

Comments
 (0)