From 1393078fe67c1613c6fc6ccbacd69409a1f7daaf Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Jul 2020 13:49:07 +0200 Subject: [PATCH 1/2] e2e: fix oauth/oidc tests not working with current grafana --- e2e/test_provider_oauth.py | 18 ++++++------------ e2e/test_provider_oidc.py | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/e2e/test_provider_oauth.py b/e2e/test_provider_oauth.py index 722872377..1cff7f366 100644 --- a/e2e/test_provider_oauth.py +++ b/e2e/test_provider_oauth.py @@ -104,22 +104,19 @@ class TestProviderOAuth(SeleniumTestCase): ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[1]/div/input", + By.CSS_SELECTOR, "input[name=name]" ).get_attribute("value"), USER().username, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[2]/div/input", + By.CSS_SELECTOR, "input[name=email]" ).get_attribute("value"), USER().email, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[3]/div/input", + By.CSS_SELECTOR, "input[name=login]" ).get_attribute("value"), USER().username, ) @@ -176,22 +173,19 @@ class TestProviderOAuth(SeleniumTestCase): ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[1]/div/input", + By.CSS_SELECTOR, "input[name=name]" ).get_attribute("value"), USER().username, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[2]/div/input", + By.CSS_SELECTOR, "input[name=email]" ).get_attribute("value"), USER().email, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[3]/div/input", + By.CSS_SELECTOR, "input[name=login]" ).get_attribute("value"), USER().username, ) diff --git a/e2e/test_provider_oidc.py b/e2e/test_provider_oidc.py index 73b653cbe..8bd51e50f 100644 --- a/e2e/test_provider_oidc.py +++ b/e2e/test_provider_oidc.py @@ -154,22 +154,19 @@ class TestProviderOIDC(SeleniumTestCase): ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[1]/div/input", + By.CSS_SELECTOR, "input[name=name]" ).get_attribute("value"), USER().name, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[2]/div/input", + By.CSS_SELECTOR, "input[name=email]" ).get_attribute("value"), USER().email, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[3]/div/input", + By.CSS_SELECTOR, "input[name=login]" ).get_attribute("value"), USER().email, ) @@ -236,22 +233,19 @@ class TestProviderOIDC(SeleniumTestCase): ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[1]/div/input", + By.CSS_SELECTOR, "input[name=name]" ).get_attribute("value"), USER().name, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[2]/div/input", + By.CSS_SELECTOR, "input[name=email]" ).get_attribute("value"), USER().email, ) self.assertEqual( self.driver.find_element( - By.XPATH, - "/html/body/grafana-app/div/div/div/react-profile-wrapper/form[1]/div[3]/div/input", + By.CSS_SELECTOR, "input[name=login]" ).get_attribute("value"), USER().email, ) From 418b94a45a47c40fcca245ac9c5bac832bbf4155 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Jul 2020 13:50:45 +0200 Subject: [PATCH 2/2] e2e: fix grafana docker image tag --- e2e/test_provider_oauth.py | 2 +- e2e/test_provider_oidc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/test_provider_oauth.py b/e2e/test_provider_oauth.py index 1cff7f366..6b40bbfc7 100644 --- a/e2e/test_provider_oauth.py +++ b/e2e/test_provider_oauth.py @@ -29,7 +29,7 @@ class TestProviderOAuth(SeleniumTestCase): """Setup client grafana container which we test OAuth against""" client: DockerClient = from_env() container = client.containers.run( - image="grafana/grafana:latest", + image="grafana/grafana:7.1.0", detach=True, network_mode="host", auto_remove=True, diff --git a/e2e/test_provider_oidc.py b/e2e/test_provider_oidc.py index 8bd51e50f..c9ae3524c 100644 --- a/e2e/test_provider_oidc.py +++ b/e2e/test_provider_oidc.py @@ -32,7 +32,7 @@ class TestProviderOIDC(SeleniumTestCase): """Setup client grafana container which we test OIDC against""" client: DockerClient = from_env() container = client.containers.run( - image="grafana/grafana:latest", + image="grafana/grafana:7.1.0", detach=True, network_mode="host", auto_remove=True,