Skip to content

Commit

Permalink
Add a value with no , to the test
Browse files Browse the repository at this point in the history
  • Loading branch information
Oddant1 committed Jun 13, 2024
1 parent 142e3ab commit ca21649
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions q2_feature_table/tests/test_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,13 @@ def test_summarize_viz_firefox(self):
self._selenium_test(driver)

def _selenium_test(self, driver):
table = biom.Table(np.array([[0, 1, 3],
[1, 1, 2],
[400, 450, 500],
[1000, 10000, 100000],
[52, 42, 99]]),
table = biom.Table(np.array([[0, 0, 1, 3],
[1, 1, 1, 2],
[100, 400, 450, 500],
[500, 1000, 10000, 100000],
[50, 52, 42, 99]]),
['O1', 'O2', '03', '04', 'O5'],
['S1', 'S2', 'S3'])
['S1', 'S2', 'S3', 'S4'])

with tempfile.TemporaryDirectory() as output_dir:
summarize(output_dir, table)
Expand All @@ -547,26 +547,37 @@ def _selenium_test(self, driver):
input_element = driver.find_element(By.ID, 'text-box')

# Assert the table is correct
self.assertEqual(element_list[2].text, 'S1 1,453')
self.assertEqual(element_list[1].text, 'S2 10,494')
self.assertEqual(element_list[0].text, 'S3 100,604')
self.assertEqual(element_list[3].text, 'S1 651')
self.assertEqual(element_list[2].text, 'S2 1,453')
self.assertEqual(element_list[1].text, 'S3 10,494')
self.assertEqual(element_list[0].text, 'S4 100,604')

# None should have danger to begin
for element in element_list:
self.assertNotIn('danger', element.get_attribute('class'))

# This is not setting the value in the box, it is sending these key
# presses to the box. There is already a 0 in the box, so we are
# adding these digits to that 0 making the value in the box 10000
input_element.send_keys('1000')
# adding these digits to that 0 making the value in the box 1000
input_element.send_keys('100')

self.assertIn('danger', element_list[3].get_attribute('class'))
self.assertNotIn('danger', element_list[2].get_attribute('class'))
self.assertNotIn('danger', element_list[1].get_attribute('class'))
self.assertNotIn('danger', element_list[0].get_attribute('class'))

# Add another 0 to the box making the value 10000
input_element.send_keys('0')

self.assertIn('danger', element_list[3].get_attribute('class'))
self.assertIn('danger', element_list[2].get_attribute('class'))
self.assertNotIn('danger', element_list[1].get_attribute('class'))
self.assertNotIn('danger', element_list[0].get_attribute('class'))

# Add another 0 to the box making the value 100000
input_element.send_keys('0')

self.assertIn('danger', element_list[3].get_attribute('class'))
self.assertIn('danger', element_list[2].get_attribute('class'))
self.assertIn('danger', element_list[1].get_attribute('class'))
self.assertNotIn('danger', element_list[0].get_attribute('class'))
Expand All @@ -576,6 +587,7 @@ def _selenium_test(self, driver):
# should be artificially capped to 100604
input_element.send_keys('0')

self.assertIn('danger', element_list[3].get_attribute('class'))
self.assertIn('danger', element_list[2].get_attribute('class'))
self.assertIn('danger', element_list[1].get_attribute('class'))
self.assertNotIn('danger', element_list[0].get_attribute('class'))
Expand Down

0 comments on commit ca21649

Please sign in to comment.