Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintenance: Add tests for user profile.
- Loading branch information
Showing
44 changed files
with
91 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'Desktop > Account', app: :desktop_view, authenticated_as: :agent, type: :system do | ||
let(:agent) { create(:agent) } | ||
|
||
before do | ||
visit '/' | ||
find("[aria-label=\"Avatar (#{agent.fullname})\"]").click | ||
end | ||
|
||
describe 'appearance selection' do | ||
it 'user can switch appearance' do | ||
# Switch starts on 'auto' | ||
default_theme = page.execute_script("return matchMedia('(prefers-color-scheme: dark)').matches") ? 'dark' : 'light' | ||
expect(page).to have_css("html[data-theme=#{default_theme}]") | ||
|
||
# Switch to 'dark' | ||
click_on 'Appearance' | ||
wait_for_mutation('accountAppearance') | ||
expect(page).to have_css('html[data-theme=dark]') | ||
|
||
# Switch to 'light' | ||
click_on 'Appearance' | ||
wait_for_mutation('accountAppearance', number: 2) | ||
expect(page).to have_css('html[data-theme=light]') | ||
|
||
end | ||
end | ||
|
||
describe 'language selection' do | ||
it 'user can change language' do | ||
click_on 'Profile settings' | ||
click_on 'Language' | ||
|
||
find('label', text: 'Your language').click | ||
find('span', text: 'Deutsch').click | ||
expect(page).to have_text('Sprache') | ||
end | ||
end | ||
|
||
describe 'avatar handling', authenticated_as: :agent do | ||
let(:agent) { create(:agent, firstname: 'Jane', lastname: 'Doe') } | ||
|
||
it 'user can upload avatar' do | ||
click_on 'Profile settings' | ||
click_on 'Avatar' | ||
|
||
expect(page).to have_text('JD') | ||
find('input[data-test-id="fileUploadInput"]', visible: :all).set(Rails.root.join('test/data/image/1000x1000.png')) | ||
expect(page).to have_text('Avatar Preview') | ||
click_on 'Save' | ||
|
||
expect(page).to have_text('Your avatar has been uploaded') | ||
|
||
avatar_element_style = find("#user-menu span[aria-label=\"Avatar (#{agent.fullname})\"]").style('background-image') | ||
expect(avatar_element_style['background-image']).to include("/api/v1/users/image/#{Avatar.last.store_hash}") | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...ps/mobile/tickets/articles/create_spec.rb → ...obile_old/tickets/articles/create_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...le/tickets/ticket_article_actions_spec.rb → ...ld/tickets/ticket_article_actions_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...le/tickets/ticket_create_security_spec.rb → ...ld/tickets/ticket_create_security_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...apps/mobile/tickets/ticket_create_spec.rb → .../mobile_old/tickets/ticket_create_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...apps/mobile/tickets/ticket_update_spec.rb → .../mobile_old/tickets/ticket_update_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...apps/mobile/user/detail_view_edit_spec.rb → .../mobile_old/user/detail_view_edit_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.