weekly release 3.6dev
[moodle.git] / auth / tests / behat / validateagedigitalconsentmap.feature
CommitLineData
25dbbdf9
MG
1@core @verify_age_location
2Feature: Test validation of 'Age of digital consent' setting.
3 In order to set the 'Age of digital consent' setting
4 As an admin
5 I need to provide valid data and valid format
6
7 Background:
8 Given I log in as "admin"
1727c939 9 And I navigate to "Privacy settings" node in "Site administration > Privacy and policies"
25dbbdf9
MG
10
11 Scenario: Admin provides valid value for 'Age of digital consent'.
12 Given I set the field "s__agedigitalconsentmap" to multiline:
13 """
14 *, 16
15 AT, 14
16 BE, 14
17 """
18 When I press "Save changes"
19 Then I should see "Changes saved"
20 And I should not see "Some settings were not changed due to an error."
21 And I should not see "The digital age of consent is not valid:"
22
23 Scenario: Admin provides invalid format for 'Age of digital consent'.
24 # Try to set a value with missing space separator
25 Given I set the field "s__agedigitalconsentmap" to multiline:
26 """
27 *16
28 AT, 14
29 BE, 14
30 """
31 When I press "Save changes"
32 Then I should not see "Changes saved"
33 And I should see "Some settings were not changed due to an error."
34 And I should see "The digital age of consent is not valid: \"*16\" has more or less than one comma separator."
35 # Try to set a value with missing default age of consent
36 When I set the field "s__agedigitalconsentmap" to multiline:
37 """
38 AT, 14
39 BE, 14
40 """
41 And I press "Save changes"
42 Then I should not see "Changes saved"
43 And I should see "Some settings were not changed due to an error."
44 And I should see "The digital age of consent is not valid: Default (*) value is missing."
45
46 Scenario: Admin provides invalid age of consent or country for 'Age of digital consent'.
47 # Try to set a value containing invalid age of consent
48 Given I set the field "s__agedigitalconsentmap" to multiline:
49 """
50 *, 16
51 AT, age
52 BE, 14
53 """
54 When I press "Save changes"
55 Then I should not see "Changes saved"
56 And I should see "Some settings were not changed due to an error."
57 And I should see "The digital age of consent is not valid: \"age\" is not a valid value for age."
58 # Try to set a value containing invalid country
59 When I set the field "s__agedigitalconsentmap" to multiline:
60 """
61 *, 16
62 COUNTRY, 14
63 BE, 14
64 """
65 And I press "Save changes"
66 Then I should not see "Changes saved"
67 And I should see "Some settings were not changed due to an error."
68 And I should see "The digital age of consent is not valid: \"COUNTRY\" is not a valid value for country."