Skip to content

Commit

Permalink
Adjustments to test to run with new code versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
abelardopardo committed Jun 22, 2019
1 parent 96911c2 commit 8050076
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/action/tests/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ActionTestSerializers(test.OnTaskTestCase):
"name": "age-2",
"description_text": "",
"data_type": "double",
"is_key": True,
"is_key": False,
"position": 1,
"in_viz": True,
"categories": [],
Expand Down
Empty file added src/ontask/tests/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions src/table/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,11 @@ def test_table_views(self):
"//table[@id='view-table']//tr/td[1][normalize-space() = 'v1']/"
"../td[3]/button[1]"
).click()
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.XPATH, '//button[normalize-space()="Clone view"]')
)
)
# Confirm view cloning
self.selenium.find_element_by_xpath(
"//div[@class='modal-footer']/button[normalize-space()='Clone "
Expand Down
59 changes: 33 additions & 26 deletions src/workflow/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-

import os
import test

from django.conf import settings
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select, WebDriverWait

from dataops.pandas import db
import test
from workflow.models import Workflow


Expand Down Expand Up @@ -44,10 +44,11 @@ def test_01_workflow_create_upload_merge_column_edit(self):

# Set the file name
self.selenium.find_element_by_id('id_data_file').send_keys(
os.path.join(settings.BASE_DIR(),
'workflow',
'fixtures',
'simple.csv')
os.path.join(
settings.BASE_DIR(),
'workflow',
'fixtures',
'simple.csv')
)

# Click on the NEXT button
Expand All @@ -56,7 +57,7 @@ def test_01_workflow_create_upload_merge_column_edit(self):
).click()
WebDriverWait(self.selenium, 10).until(
EC.text_to_be_present_in_element((By.XPATH, "//body/div/h1"),
'Select Columns')
'Select Columns')
)

# Change the name of one of the columns
Expand Down Expand Up @@ -101,9 +102,9 @@ def test_01_workflow_create_upload_merge_column_edit(self):
# Set the file name
self.selenium.find_element_by_id('id_data_file').send_keys(
os.path.join(settings.BASE_DIR(),
'workflow',
'fixtures',
'simple2.csv')
'workflow',
'fixtures',
'simple2.csv')
)

# Click on the NEXT button
Expand All @@ -112,7 +113,7 @@ def test_01_workflow_create_upload_merge_column_edit(self):
).click()
WebDriverWait(self.selenium, 10).until(
EC.text_to_be_present_in_element((By.XPATH, "//body/div/h1"),
'Select Columns')
'Select Columns')
)

# Change the name of sid2 to sid
Expand Down Expand Up @@ -197,10 +198,11 @@ def test_02_workflow_create_upload_with_prelude(self):

# Set the file name
self.selenium.find_element_by_id('id_data_file').send_keys(
os.path.join(settings.BASE_DIR(),
'workflow',
'fixtures',
'csv_with_prelude_postlude.csv')
os.path.join(
settings.BASE_DIR(),
'workflow',
'fixtures',
'csv_with_prelude_postlude.csv'),
)
# Set the prelude to 6 lines and postlude to 3
self.selenium.find_element_by_id('id_skip_lines_at_top').clear()
Expand All @@ -216,7 +218,7 @@ def test_02_workflow_create_upload_with_prelude(self):
).click()
WebDriverWait(self.selenium, 10).until(
EC.text_to_be_present_in_element((By.XPATH, "//body/div/h1"),
'Select Columns')
'Select Columns')
)
WebDriverWait(self.selenium, 10).until_not(
EC.visibility_of_element_located((By.ID, 'div-spinner'))
Expand Down Expand Up @@ -368,7 +370,7 @@ def test_03_workflow_column_rename(self):
# Select filter tab
self.select_filter_tab()
self.open_condition(None,
"//button[contains(@class, 'js-filter-create')]")
"//button[contains(@class, 'js-filter-create')]")
# Select the another2 column (with new name
select = Select(self.selenium.find_element_by_name(
'builder_rule_0_filter'))
Expand Down Expand Up @@ -473,22 +475,27 @@ def test_workflow_attributes(self):
'//table[@id="attribute-table"]'
'//tr[2]/td[3]//button[contains(@class, "js-attribute-delete")]'
).click()
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable((
By.XPATH,
'//div[@id="modal-item"]//div[@class="modal-footer"]/button')),
)
# Click in the delete confirm button
self.selenium.find_element_by_xpath(
"//div[@id = 'modal-item']//div[@class = 'modal-footer']/button"
'//div[@id = "modal-item"]//div[@class = "modal-footer"]/button'
).click()
# MODAL WAITING
self.wait_for_page(element_id='workflow-detail')
WebDriverWait(self.selenium, 10).until(
EC.element_to_be_clickable(
(By.CLASS_NAME, "js-attribute-create")
(By.CLASS_NAME, 'js-attribute-create')
)
)

# There should only be a single element
self.assertEqual(
len(self.selenium.find_elements_by_xpath(
"//table[@id='attribute-table']/tbody/tr"
'//table[@id="attribute-table"]/tbody/tr'
)),
1
)
Expand Down Expand Up @@ -558,8 +565,8 @@ def test_workflow_share(self):
# Value now should be in the table
self.select_share_tab()
self.search_table_row_by_string('share-table',
1,
'instructor02@bogus.com')
1,
'instructor02@bogus.com')

# Click in the create share dialog again
self.selenium.find_element_by_class_name('js-share-create').click()
Expand Down Expand Up @@ -591,8 +598,8 @@ def test_workflow_share(self):
# Value now should be in the table
self.select_share_tab()
self.search_table_row_by_string('share-table',
1,
'instructor02@bogus.com')
1,
'instructor02@bogus.com')

# Check that the shared users are properly stored in the workflow
workflow = Workflow.objects.all()[0]
Expand All @@ -603,14 +610,14 @@ def test_workflow_share(self):

# click the delete button in the superuser@bogus.com row
element = self.search_table_row_by_string('share-table',
1,
'superuser@bogus.com')
1,
'superuser@bogus.com')
element.find_element_by_xpath('td[2]/button').click()

# Wait for the delete confirmation frame
WebDriverWait(self.selenium, 10).until(
EC.text_to_be_present_in_element((By.CLASS_NAME, 'modal-title'),
'Confirm user deletion')
'Confirm user deletion')
)
# Click in the delete confirm button
self.selenium.find_element_by_xpath(
Expand Down

0 comments on commit 8050076

Please sign in to comment.