|
1 | | -from runestone.unittest_base import module_fixture_maker, RunestoneTestCase |
| 1 | +def test_hello(selenium_utils_get): |
| 2 | + """ |
| 3 | + 1. Get the outer div id of the activecode component |
| 4 | + 2. Find the run button using its class name |
| 5 | + 3. Run the example |
| 6 | + 4. Check the output from the ac_output element |
| 7 | + :return: |
| 8 | + """ |
| 9 | + t1 = selenium_utils_get.driver.find_element_by_id("qtest_1") |
| 10 | + li = t1.find_element_by_tag_name("ol") |
| 11 | + num = li.get_attribute("start") |
| 12 | + assert num == "1" |
2 | 13 |
|
3 | | -setUpModule, tearDownModule = module_fixture_maker(__file__) |
| 14 | + class_string = t1.get_attribute("class") |
| 15 | + assert "full-width container" in class_string |
4 | 16 |
|
| 17 | + t1 = selenium_utils_get.driver.find_element_by_id("qtest_2") |
| 18 | + li = t1.find_element_by_tag_name("ol") |
| 19 | + num = li.get_attribute("start") |
| 20 | + assert num == "2" |
5 | 21 |
|
6 | | -class QuestionTests(RunestoneTestCase): |
7 | | - def test_hello(self): |
8 | | - """ |
9 | | - 1. Get the outer div id of the activecode component |
10 | | - 2. Find the run button using its class name |
11 | | - 3. Run the example |
12 | | - 4. Check the output from the ac_output element |
13 | | - :return: |
14 | | - """ |
15 | | - self.driver.get(self.host + "/index.html") |
16 | | - t1 = self.driver.find_element_by_id("qtest_1") |
17 | | - self.assertIsNotNone(t1) |
18 | | - li = t1.find_element_by_tag_name("ol") |
19 | | - self.assertIsNotNone(li) |
20 | | - num = li.get_attribute("start") |
21 | | - self.assertEqual(num, "1") |
22 | 22 |
|
23 | | - class_string = t1.get_attribute("class") |
24 | | - self.assertTrue("full-width container" in class_string) |
25 | | - |
26 | | - t1 = self.driver.find_element_by_id("qtest_2") |
27 | | - self.assertIsNotNone(t1) |
28 | | - li = t1.find_element_by_tag_name("ol") |
29 | | - self.assertIsNotNone(li) |
30 | | - num = li.get_attribute("start") |
31 | | - self.assertEqual(num, "2") |
32 | | - |
33 | | - # def test_mc(self): |
34 | | - # self.driver.get(self.host + "/index.html") |
35 | | - # t1 = self.driver.find_element_by_id("qtest_2") |
36 | | - # cbs = t1.find_elements_by_tag_name("li") |
37 | | - # for el in cbs: |
38 | | - # el.click() |
39 | | - # |
40 | | - # checkme = t1.find_element_by_tag_name('button') |
41 | | - # checkme.click() |
42 | | - # |
43 | | - # fb = t1.find_element_by_id("question1_2_feedback") |
44 | | - # self.assertIsNotNone(fb) |
45 | | - # cnamestr = fb.get_attribute("class") |
46 | | - # self.assertEqual(cnamestr, "alert alert-danger") |
47 | | - # |
48 | | - # def test_mc2(self): |
49 | | - # self.driver.get(self.host + "/index.html") |
50 | | - # t1 = self.driver.find_element_by_id("qtest_2") |
51 | | - # t1.find_element_by_id("question1_2_opt_0").click() |
52 | | - # t1.find_element_by_id("question1_2_opt_1").click() |
53 | | - # t1.find_element_by_id("question1_2_opt_3").click() |
54 | | - # |
55 | | - # checkme = t1.find_element_by_tag_name('button') |
56 | | - # checkme.click() |
57 | | - # |
58 | | - # fb = t1.find_element_by_id("question1_2_feedback") |
59 | | - # self.assertIsNotNone(fb) |
60 | | - # cnamestr = fb.get_attribute("class") |
61 | | - # self.assertEqual(cnamestr, "alert alert-success") |
| 23 | +# def test_mc(self): |
| 24 | +# t1 = self.driver.find_element_by_id("qtest_2") |
| 25 | +# cbs = t1.find_elements_by_tag_name("li") |
| 26 | +# for el in cbs: |
| 27 | +# el.click() |
| 28 | +# |
| 29 | +# checkme = t1.find_element_by_tag_name('button') |
| 30 | +# checkme.click() |
| 31 | +# |
| 32 | +# fb = t1.find_element_by_id("question1_2_feedback") |
| 33 | +# self.assertIsNotNone(fb) |
| 34 | +# cnamestr = fb.get_attribute("class") |
| 35 | +# assert cnamestr, "alert alert-danger") |
| 36 | +# |
| 37 | +# |
| 38 | +# def test_mc2(self): |
| 39 | +# t1 = self.driver.find_element_by_id("qtest_2") |
| 40 | +# t1.find_element_by_id("question1_2_opt_0").click() |
| 41 | +# t1.find_element_by_id("question1_2_opt_1").click() |
| 42 | +# t1.find_element_by_id("question1_2_opt_3").click() |
| 43 | +# |
| 44 | +# checkme = t1.find_element_by_tag_name('button') |
| 45 | +# checkme.click() |
| 46 | +# |
| 47 | +# fb = t1.find_element_by_id("question1_2_feedback") |
| 48 | +# self.assertIsNotNone(fb) |
| 49 | +# cnamestr = fb.get_attribute("class") |
| 50 | +# assert cnamestr, "alert alert-success") |
0 commit comments