diff --git a/app/assets/javascripts/app/lib/app_post/test_helper.coffee b/app/assets/javascripts/app/lib/app_post/test_helper.coffee deleted file mode 100644 index e2702b75e..000000000 --- a/app/assets/javascripts/app/lib/app_post/test_helper.coffee +++ /dev/null @@ -1,11 +0,0 @@ -class App.TestHelper - @attachmentUploadFake: ( selector ) -> - - fileTemplate = '''
-
fake.file
-
30 KB
-
-
Delete File -
-
''' - $(selector).append(fileTemplate) diff --git a/test/browser/agent_ticket_actions_level6_test.rb b/test/browser/agent_ticket_actions_level6_test.rb index 127e2eb0f..46519354f 100644 --- a/test/browser/agent_ticket_actions_level6_test.rb +++ b/test/browser/agent_ticket_actions_level6_test.rb @@ -39,7 +39,10 @@ class AgentTicketActionLevel6Test < TestCase #alert = alert.text # add attachment, attachment check should quiet - @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .richtext .attachments')" ) + file_upload( + css: '.active .attachmentPlaceholder-inputHolder input', + files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'], + ) # submit form click( css: '.content.active .js-submit' ) @@ -48,10 +51,18 @@ class AgentTicketActionLevel6Test < TestCase # no warning #alert = @browser.switch_to.alert - # check if ticket is shown + # check if ticket is shown and attachment exists location_check( url: '#ticket/zoom/' ) sleep 2 ticket_number = @browser.find_elements( { css: '.active .ticketZoom-header .ticket-number' } )[0].text + match( + css: '.active .ticket-article-item:nth-child(1) .attachments', + value: 'upload2.jpg', + ) + match( + css: '.active .ticket-article-item:nth-child(1) .attachments', + value: 'upload1.txt', + ) # # attachment checks - update ticket @@ -76,7 +87,10 @@ class AgentTicketActionLevel6Test < TestCase alert.dismiss() # add attachment, attachment check should quiet - @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .article-add .textBubble .attachments')" ) + file_upload( + css: '.active .attachmentPlaceholder-inputHolder input', + files: ['test/fixtures/upload1.txt'], + ) # submit form click( @@ -106,9 +120,20 @@ class AgentTicketActionLevel6Test < TestCase css: '.active div.ticket-article', value: 'test 6 - ticket 1-1', ) + match_not( + css: '.active .ticket-article-item:nth-child(2) .attachments', + value: 'upload2.jpg', + ) + match( + css: '.active .ticket-article-item:nth-child(2) .attachments', + value: 'upload1.txt', + ) # add attachment without body - @browser.execute_script( "App.TestHelper.attachmentUploadFake('.active .article-add .textBubble .attachments')" ) + file_upload( + css: '.active .attachmentPlaceholder-inputHolder input', + files: ['test/fixtures/upload2.jpg', 'test/fixtures/upload1.txt'], + ) # submit form click( @@ -150,7 +175,14 @@ class AgentTicketActionLevel6Test < TestCase body: '', }, ) - + match( + css: '.active .ticket-article-item:nth-child(3) .attachments', + value: 'upload2.jpg', + ) + match( + css: '.active .ticket-article-item:nth-child(3) .attachments', + value: 'upload1.txt', + ) # # ticket customer change checks # diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 39a5fdd76..0c780ba60 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -881,8 +881,8 @@ class TestCase < Test::Unit::TestCase file_upload( browser: browser1, - css: '#content .text-1', - value: 'some text', + css: '.active .attachmentPlaceholder-inputHolder input' + files: ['path/in/home/some_file.ext'], # 'test/fixtures/test1.pdf' ) =end @@ -893,15 +893,9 @@ class TestCase < Test::Unit::TestCase instance = params[:browser] || @browser - filename = 'some-file.txt' - file = File.join(Dir.pwd, filename) - #file = 'some test lalal' - - instance.find_elements({ css: params[:css] })[0].send_keys file - #instance.find_elements({ :css => params[:css] })[0] - #element - #@driver.find_element(id: 'file-submit').click - + params[:files].each {|file| + instance.find_elements({ css: params[:css] })[0].send_keys "#{Rails.root}/#{file}" + } end =begin diff --git a/test/fixtures/upload1.txt b/test/fixtures/upload1.txt new file mode 100644 index 000000000..c73e9b503 --- /dev/null +++ b/test/fixtures/upload1.txt @@ -0,0 +1 @@ +some content äöüß diff --git a/test/fixtures/upload2.jpg b/test/fixtures/upload2.jpg new file mode 100644 index 000000000..2cfadfaeb Binary files /dev/null and b/test/fixtures/upload2.jpg differ