aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration/features/avatar.feature
blob: 8580471ef551268e0d5a7e5996cbbc39390c9f56 (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
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 128
    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 128
    And last avatar is not a single color



  Scenario: get temporary user avatar before cropping it
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/green-square-256.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 a square of size 256
    And last avatar is a single "#00FF00" color

  Scenario: get user avatar before cropping it
    Given Logging in using web as "user0"
    And logged in user posts temporary avatar from file "data/green-square-256.png"
    # Avatar needs to be cropped to finish setting it even if it is squared
    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 128
    And last avatar is not a single color



  Scenario: set user avatar from file
    Given Logging in using web as "user0"
    When logged in user posts temporary avatar from file "data/coloured-pattern.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 128
    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 128
    And last avatar is a single "#FF0000" color

  Scenario: set user avatar from internal path
    Given user "user0" uploads file "data/coloured-pattern.png" to "/internal-coloured-pattern.png"
    And Logging in using web as "user0"
    When logged in user posts temporary avatar from internal path "internal-coloured-pattern.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.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.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 128
    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 128
    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 128
    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 128
    And last avatar is not a single color