Maintenance: Update selenium to latest compatible version. Current issue with latest: Chrome crashes in chat test when reloading page.

This commit is contained in:
Thorsten Eckel 2020-02-02 16:40:13 +01:00
parent fbbc50f24a
commit 201027d23c
4 changed files with 43 additions and 13 deletions

View file

@ -350,7 +350,7 @@ browser:build:
alias: postgresql alias: postgresql
- name: registry.znuny.com/docker/zammad-elasticsearch:stable - name: registry.znuny.com/docker/zammad-elasticsearch:stable
alias: elasticsearch alias: elasticsearch
- name: docker.io/elgalu/selenium:3.14.0-p17 - name: docker.io/elgalu/selenium:3.141.59-p32
alias: selenium alias: selenium
- name: registry.znuny.com/docker/docker-imap-devel:latest - name: registry.znuny.com/docker/docker-imap-devel:latest
alias: mail alias: mail
@ -549,7 +549,7 @@ test:browser:core:chrome_6:
services: services:
- name: registry.znuny.com/docker/zammad-postgresql:latest - name: registry.znuny.com/docker/zammad-postgresql:latest
alias: postgresql alias: postgresql
- name: docker.io/elgalu/selenium:3.14.0-p17 - name: docker.io/elgalu/selenium:3.141.59-p32
alias: selenium alias: selenium
.test_browser_integration_template: &test_browser_integration_definition .test_browser_integration_template: &test_browser_integration_definition

View file

@ -4,7 +4,7 @@ class AgentTicketTaskChangedTest < TestCase
# regression test for issue #2042 - incorrect notification when closing a tab after setting up an object # regression test for issue #2042 - incorrect notification when closing a tab after setting up an object
def test_detection_of_ticket_update_after_new_attribute def test_detection_of_ticket_update_after_new_attribute
@browser = instance = browser_instance @browser = browser_instance
login( login(
username: 'master@example.com', username: 'master@example.com',
password: 'test', password: 'test',
@ -35,9 +35,7 @@ class AgentTicketTaskChangedTest < TestCase
# verify the 'Discard your changes' message does not appear (since there are no changes) # verify the 'Discard your changes' message does not appear (since there are no changes)
assert_nil execute(js: "return $('.content.active .js-attributeBar .js-reset:not(\".hide\")').get(0)") assert_nil execute(js: "return $('.content.active .js-attributeBar .js-reset:not(\".hide\")').get(0)")
# try and close the existing open ticket window tasks_close_all()
instance.action.move_to(instance.find_elements(css: '#navigation .tasks .task:first-child')[0]).release.perform
instance.find_elements(css: '#navigation .tasks .task:first-child .js-close')[0].click
sleep 0.5 sleep 0.5
exists_not( css: '.modal') exists_not( css: '.modal')

View file

@ -37,6 +37,10 @@ class MaintenanceLoginMessageTest < TestCase
browser: browser2, browser: browser2,
url: browser_url, url: browser_url,
) )
watch_for(
browser: browser2,
css: '.login',
)
exists_not( exists_not(
browser: browser2, browser: browser2,
css: '.js-maintenanceLogin', css: '.js-maintenanceLogin',

View file

@ -353,9 +353,25 @@ class TestCase < ActiveSupport::TestCase
end end
return if !clues return if !clues
instance.execute_script("$('.js-modal--clue .js-close').click()") checks = 25
previous = clues.location
(checks + 1).times do |check|
raise "Element still moving after #{checks} checks" if check == checks
current = clues.location
sleep 0.2 if ENV['CI']
break if previous == current
previous = current
end
clues.click
watch_for_disappear(
browser: instance,
css: 'modal-backdrop js-backdrop',
)
assert(true, 'clues closed') assert(true, 'clues closed')
sleep 1
end end
=begin =begin
@ -752,11 +768,18 @@ class TestCase < ActiveSupport::TestCase
instance = params[:browser] || @browser instance = params[:browser] || @browser
begin
retries ||= 0
element = instance.find_elements(css: params[:css])[0] element = instance.find_elements(css: params[:css])[0]
if !params[:no_click] if !params[:no_click]
element.click element.click
end end
element.clear element.clear
rescue Selenium::WebDriver::Error::StaleElementReferenceError
sleep retries
retries += 1
retry if retries < 3
end
begin begin
if !params[:slow] if !params[:slow]
@ -1596,8 +1619,13 @@ wait untill text in selector disabppears
break break
end end
rescue rescue
# try again # Firefox doesn't move the mouse if it's already at the position.
# Therefore the hover event is not triggered in all cases.
# That's why we move the mouse a bit as a workaround and try again.
# The last working selenium version was: https://github.com/elgalu/docker-selenium/releases/tag/3.14.0-p17
instance.action.move_by(100, 100).perform
# try again
end end
assert(true, 'all tasks closed') assert(true, 'all tasks closed')
end end