1441 |
ariadna |
1 |
@core @core_form
|
|
|
2 |
Feature: Setting and validating date fields
|
|
|
3 |
Behat steps to set and check the date fields
|
|
|
4 |
|
|
|
5 |
Background:
|
|
|
6 |
Given I log in as "admin"
|
|
|
7 |
|
|
|
8 |
Scenario: Setting moodleform date fields by field label
|
|
|
9 |
Given I am on fixture page "/lib/form/tests/behat/fixtures/dates_form.php"
|
|
|
10 |
And I set the following fields to these values:
|
|
|
11 |
| Simple only date | ## 2023-07-31 ## |
|
|
|
12 |
| simpleoptionaldateonly[enabled] | 1 |
|
|
|
13 |
| Simple optional only date | ## 2023-08-31 ## |
|
|
|
14 |
| Simple date and time | ## 2023-07-31 11:15 ## |
|
|
|
15 |
| simpleoptionaldatetime[enabled] | 1 |
|
|
|
16 |
| Simple optional date and time | ## 2023-08-31 14:45 ## |
|
|
|
17 |
| Group1 only date | ## 2023-07-31 ## |
|
|
|
18 |
| group1optionaldateonly[enabled] | 1 |
|
|
|
19 |
| Group1 optional only date | ## 2023-08-31 ## |
|
|
|
20 |
| Group1 date and time | ## 2023-07-31 11:15 ## |
|
|
|
21 |
| group1optionaldatetime[enabled] | 1 |
|
|
|
22 |
| Group1 optional date and time | ## 2023-08-31 14:45 ## |
|
|
|
23 |
| Group2 only date | ## 2023-07-31 ## |
|
|
|
24 |
| dategroup2[group2optionaldateonly][enabled] | 1 |
|
|
|
25 |
| Group2 optional only date | ## 2023-08-31 ## |
|
|
|
26 |
| Group2 date and time | ## 2023-07-31 11:15 ## |
|
|
|
27 |
| dategroup2[group2optionaldatetime][enabled] | 1 |
|
|
|
28 |
| Group2 optional date and time | ## 2023-08-31 14:45 ## |
|
|
|
29 |
When I press "Send form"
|
|
|
30 |
Then I should see "simpledateonly: 1690732800"
|
|
|
31 |
And I should see "simpleoptionaldateonly: 1693411200"
|
|
|
32 |
And I should see "simpledatetime: 1690773300"
|
|
|
33 |
And I should see "simpleoptionaldatetime: 1693464300"
|
|
|
34 |
And I should see "group1dateonly: 1690732800"
|
|
|
35 |
And I should see "group1optionaldateonly: 1693411200"
|
|
|
36 |
And I should see "group1datetime: 1690773300"
|
|
|
37 |
And I should see "group1optionaldatetime: 1693464300"
|
|
|
38 |
And I should see "dategroup2[group2dateonly]: 1690732800"
|
|
|
39 |
And I should see "dategroup2[group2optionaldateonly]: 1693411200"
|
|
|
40 |
And I should see "dategroup2[group2datetime]: 1690773300"
|
|
|
41 |
And I should see "dategroup2[group2optionaldatetime]: 1693464300"
|
|
|
42 |
|
|
|
43 |
Scenario: Setting moodleform date fields by field name
|
|
|
44 |
Given I am on fixture page "/lib/form/tests/behat/fixtures/dates_form.php"
|
|
|
45 |
And I set the following fields to these values:
|
|
|
46 |
| simpledateonly | ## 2023-07-31 ## |
|
|
|
47 |
| simpleoptionaldateonly[enabled] | 1 |
|
|
|
48 |
| simpleoptionaldateonly | ## 2023-08-31 ## |
|
|
|
49 |
| simpledatetime | ## 2023-07-31 11:15 ## |
|
|
|
50 |
| simpleoptionaldatetime[enabled] | 1 |
|
|
|
51 |
| simpleoptionaldatetime | ## 2023-08-31 14:45 ## |
|
|
|
52 |
| group1dateonly | ## 2023-07-31 ## |
|
|
|
53 |
| group1optionaldateonly[enabled] | 1 |
|
|
|
54 |
| group1optionaldateonly | ## 2023-08-31 ## |
|
|
|
55 |
| group1datetime | ## 2023-07-31 11:15 ## |
|
|
|
56 |
| group1optionaldatetime[enabled] | 1 |
|
|
|
57 |
| group1optionaldatetime | ## 2023-08-31 14:45 ## |
|
|
|
58 |
| dategroup2[group2dateonly] | ## 2023-07-31 ## |
|
|
|
59 |
| dategroup2[group2optionaldateonly][enabled] | 1 |
|
|
|
60 |
| dategroup2[group2optionaldateonly] | ## 2023-08-31 ## |
|
|
|
61 |
| dategroup2[group2datetime] | ## 2023-07-31 11:15 ## |
|
|
|
62 |
| dategroup2[group2optionaldatetime][enabled] | 1 |
|
|
|
63 |
| dategroup2[group2optionaldatetime] | ## 2023-08-31 14:45 ## |
|
|
|
64 |
When I press "Send form"
|
|
|
65 |
Then I should see "simpledateonly: 1690732800"
|
|
|
66 |
And I should see "simpleoptionaldateonly: 1693411200"
|
|
|
67 |
And I should see "simpledatetime: 1690773300"
|
|
|
68 |
And I should see "simpleoptionaldatetime: 1693464300"
|
|
|
69 |
And I should see "group1dateonly: 1690732800"
|
|
|
70 |
And I should see "group1optionaldateonly: 1693411200"
|
|
|
71 |
And I should see "group1datetime: 1690773300"
|
|
|
72 |
And I should see "group1optionaldatetime: 1693464300"
|
|
|
73 |
And I should see "dategroup2[group2dateonly]: 1690732800"
|
|
|
74 |
And I should see "dategroup2[group2optionaldateonly]: 1693411200"
|
|
|
75 |
And I should see "dategroup2[group2datetime]: 1690773300"
|
|
|
76 |
And I should see "dategroup2[group2optionaldatetime]: 1693464300"
|