Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use url from env for running cdc tests. #4554

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest

from selenium.webdriver.common.by import By
Expand All @@ -22,18 +23,25 @@
from server.webdriver.base_utils import find_elem
from server.webdriver.base_utils import wait_elem

# The tests in this file can be run with any CDC instance loaded with sample data from the custom_dc/sample folder.

# From project datcom-website-dev > Cloud Run: dc-autopush > Revisions
CDC_AUTOPUSH_URL = 'https://dc-autopush-kqb7thiuka-uc.a.run.app'
DEFAULT_CDC_TEST_BASE_URL = 'https://dc-autopush-kqb7thiuka-uc.a.run.app'

# Get base test url from the CDC_TEST_BASE_URL env variable, defaulting to DEFAULT_CDC_TEST_BASE_URL
CDC_TEST_BASE_URL = os.environ.get('CDC_TEST_BASE_URL',
DEFAULT_CDC_TEST_BASE_URL)
print(f'Running CDC tests against base URL: {CDC_TEST_BASE_URL}')


class CdcAutopushWebdriverTest(unittest.TestCase):
class CdcWebdriverTest(unittest.TestCase):

def setUp(self, preferences=None):
"""Runs at the beginning of every individual test."""
# Maximum time, in seconds, before throwing a TimeoutException.
self.TIMEOUT_SEC = shared.TIMEOUT
self.driver = create_driver(preferences)
self._base_url = CDC_AUTOPUSH_URL
self._base_url = CDC_TEST_BASE_URL

def tearDown(self):
"""Runs at the end of every individual test."""
Expand Down Expand Up @@ -67,10 +75,10 @@ def test_statvar_explorer(self):
'Custom SV (Average Annual Wage) element not found')


class CdcAutopushNLTest(ExploreTest):
class CdcNLTest(ExploreTest):

def get_server_url(self):
return CDC_AUTOPUSH_URL
return CDC_TEST_BASE_URL

def test_cdc_nl(self):
self.run_detect_and_fulfill('cdc_nl', ['gender wage gap in europe'])
Loading