Improve user_creates_snippet spec
What does this MR do?
In this MR we improve the spec spec/features/snippets/user_creates_snippet_spec.rb
. In local, the time went from 1 min and 21 seconds to 49 seconds. Therefore, the improvement is 32 seconds.
Refs #228688 (closed)
Screenshots
Before
Top 9 slowest examples (47.22 seconds, 57.7% of total time):
User creates snippet behaves like snippet editor Authenticated user creates a snippet
12.56 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:29
User creates snippet behaves like snippet editor when snippets default visibility level is restricted creates a snippet using the lowest available visibility level as default
6.46 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:167
User creates snippet behaves like snippet editor validation fails for the first time
6.24 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:116
User creates snippet behaves like snippet editor uploads a file when dragging into textarea
4.69 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:67
User creates snippet behaves like snippet editor Authenticated user creates a snippet with + in filename
4.36 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:143
User creates snippet behaves like snippet editor when the git operation fails has the correct action path
3.43 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:110
User creates snippet behaves like snippet editor when the git operation fails displays the error
3.32 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:102
User creates snippet behaves like snippet editor when the git operation fails renders new page
3.21 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:106
User creates snippet behaves like snippet editor previews a snippet with file
2.96 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:45
Finished in 1 minute 21.87 seconds (files took 4.61 seconds to load)
After
Top 6 slowest examples (23.73 seconds, 47.7% of total time):
User creates snippet Authenticated user creates a snippet
8.05 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:39
User creates snippet uploads a file when dragging into textarea
4.5 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:77
User creates snippet when snippets default visibility level is restricted creates a snippet using the lowest available visibility level as default
3.53 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:136
User creates snippet when the git operation fails renders the new page and displays the error
2.9 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:112
User creates snippet previews a snippet with file
2.68 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:55
User creates snippet validation fails for the first time
2.07 seconds ./spec/features/snippets/user_creates_snippet_spec.rb:121
Finished in 49.77 seconds (files took 3.1 seconds to load)