summaryrefslogtreecommitdiffstats
path: root/build/integration/features/avatar.feature
blob: 06135a2569346e81ae1dede19508e23a9668249e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
Feature: avatar

  Background:
    Given user "user0" exists

  Scenario: get default user avatar
    When user "user0" gets avatar for user "user0"
    Then The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 0 |
    And last avatar is a square of size 512
    And last avatar is not a single color

  Scenario: get default user avatar as an anonymous user
    When user "anonymous" gets avatar for user "user0"
    Then The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 0 |
    And last avatar is a square of size 512
    And last avatar is not a single color



  Scenario: get temporary non-square user avatar before cropping it
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    When logged in user gets temporary avatar
    Then The following headers should be set
      | Content-Type | image/png |
    # "last avatar" also includes the last temporary avatar
    And last avatar is not a square
    And last avatar is not a single color

  Scenario: get non-square user avatar before cropping it
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    # Avatar needs to be cropped to finish setting it
    When user "user0" gets avatar for user "user0"
    Then The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 0 |
    And last avatar is a square of size 512
    And last avatar is not a single color

  Scenario: set square user avatar from file
    Given Logging in using web as "user0"
    When logged in user posts temporary avatar from file "data/green-square-256.png"
    And user "user0" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    # Last avatar size is 512 by default when getting avatar without size parameter
    And last avatar is a square of size 512
    And last avatar is a single "#00FF00" color
    And user "anonymous" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#00FF00" color

  Scenario: set square user avatar from internal path
    Given user "user0" uploads file "data/green-square-256.png" to "/internal-green-square-256.png"
    And Logging in using web as "user0"
    When logged in user posts temporary avatar from internal path "internal-green-square-256.png"
    And user "user0" gets avatar for user "user0" with size "64"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 64
    And last avatar is a single "#00FF00" color
    And user "anonymous" gets avatar for user "user0" with size "64"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 64
    And last avatar is a single "#00FF00" color

  Scenario: set non-square user avatar from file
    Given Logging in using web as "user0"
    When logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    And logged in user crops temporary avatar
      | x | 384 |
      | y | 256 |
      | w | 128 |
      | h | 128 |
    Then logged in user gets temporary avatar with 404
    And user "user0" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color
    And user "anonymous" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color

  Scenario: set non-square user avatar from internal path
    Given user "user0" uploads file "data/coloured-pattern-non-square.png" to "/internal-coloured-pattern-non-square.png"
    And Logging in using web as "user0"
    When logged in user posts temporary avatar from internal path "internal-coloured-pattern-non-square.png"
    And logged in user crops temporary avatar
      | x | 704 |
      | y | 320 |
      | w | 64 |
      | h | 64 |
    Then logged in user gets temporary avatar with 404
    And user "user0" gets avatar for user "user0" with size "64"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 64
    And last avatar is a single "#00FF00" color
    And user "anonymous" gets avatar for user "user0" with size "64"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 64
    And last avatar is a single "#00FF00" color

  Scenario: cropped user avatar needs to be squared
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    When logged in user crops temporary avatar with 400
      | x | 384 |
      | y | 256 |
      | w | 192 |
      | h | 128 |



  Scenario: delete user avatar
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    And logged in user crops temporary avatar
      | x | 384 |
      | y | 256 |
      | w | 128 |
      | h | 128 |
    And user "user0" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color
    And user "anonymous" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color
    When logged in user deletes the user avatar
    Then user "user0" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 0 |
    And last avatar is a square of size 512
    And last avatar is not a single color
    And user "anonymous" gets avatar for user "user0"
    And The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 0 |
    And last avatar is a square of size 512
    And last avatar is not a single color



  Scenario: get user avatar with a larger size than the original one
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    And logged in user crops temporary avatar
      | x | 384 |
      | y | 256 |
      | w | 128 |
      | h | 128 |
    When user "user0" gets avatar for user "user0" with size "192"
    Then The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color

  Scenario: get user avatar with a smaller size than the original one
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
    And logged in user crops temporary avatar
      | x | 384 |
      | y | 256 |
      | w | 128 |
      | h | 128 |
    When user "user0" gets avatar for user "user0" with size "96"
    Then The following headers should be set
      | Content-Type | image/png |
      | X-NC-IsCustomAvatar | 1 |
    And last avatar is a square of size 512
    And last avatar is a single "#FF0000" color



  Scenario: get default guest avatar
    When user "user0" gets avatar for guest "guest0"
    Then The following headers should be set
      | Content-Type | image/png |
    And last avatar is a square of size 512
    And last avatar is not a single color

  Scenario: get default guest avatar as an anonymous user
    When user "anonymous" gets avatar for guest "guest0"
    Then The following headers should be set
      | Content-Type | image/png |
    And last avatar is a square of size 512
    And last avatar is not a single color