diff --git a/.circleci/config.yml b/.circleci/config.yml index 800a82f..eee24a8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,24 @@ -version: 2 +version: 2.1 -jobs: - "python-2.7": &test-template +executors: + python-27: + docker: + - image: circleci/python:2.7-stretch-browsers + resource_class: large + python-36: docker: - - image: circleci/python:2.7-stretch-browsers + - image: circleci/python:3.6-stretch-browsers + resource_class: large + + +jobs: + python-27: &test-template + executor: python-27 steps: - checkout + - setup_remote_docker: + docker_layer_caching: true - run: name: Write job name @@ -35,7 +47,7 @@ jobs: flake8 dash_auth setup.py - run: - name: Test with pytest + name: Run tests command: | . venv/bin/activate python -m unittest -v tests.test_basic_auth_integration @@ -43,14 +55,13 @@ jobs: python -m unittest -v tests.test_api_requests python -m unittest -v tests.test_plotlyauth - "python-3.6": + python-36: <<: *test-template - docker: - - image: circleci/python:3.6-stretch-browsers + executor: python-36 workflows: version: 2 build: jobs: - - "python-2.7" - - "python-3.6" \ No newline at end of file + - python-27 + - python-36 \ No newline at end of file diff --git a/tests/IntegrationTests.py b/tests/IntegrationTests.py index 25360d0..15385ec 100644 --- a/tests/IntegrationTests.py +++ b/tests/IntegrationTests.py @@ -33,7 +33,9 @@ def setUpClass(cls): def setUp(self): options = webdriver.ChromeOptions() - # options.headless = True + options.headless = True + options.add_argument('no-sandbox') + options.add_argument('--disable-dev-shm-usage') self.driver = webdriver.Chrome(options=options) def tearDown(self): diff --git a/tests/test_plotly_auth_integration.py b/tests/test_plotly_auth_integration.py index 3cb7a12..7fbb521 100644 --- a/tests/test_plotly_auth_integration.py +++ b/tests/test_plotly_auth_integration.py @@ -92,7 +92,8 @@ def private_app_unauthorized(self, url_base_pathname=None, ) el = self.wait_for_element_by_css_selector( '#dash-auth--authorization__denied') - self.assertEqual(el.text, 'You are not authorized to view this app') + self.wait_for_text_to_equal('#dash-auth--authorization__denied', + 'You are not authorized to view this app') switch_windows(self.driver) self.driver.refresh() # login screen should still be there @@ -106,13 +107,15 @@ def private_app_authorized(self, url_base_pathname=None, oauth_urls=None): url_base_pathname, ) switch_windows(self.driver) - self.driver.implicitly_wait(3) + time.sleep(3) + try: el = self.wait_for_element_by_css_selector('#output') except: print(self.driver.find_element_by_tag_name( 'body').get_attribute('innerHTML')) - self.assertEqual(el.text, 'initial value') + + self.wait_for_text_to_equal('#output', 'initial value') def test_private_app_authorized_index(self): self.private_app_authorized('/')