Пример #1
0
"""
Test Matrix Equations directive (matrixeq)
"""

from unittest import TestCase
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from runestone.unittest_base import module_fixture_maker, RunestoneTestCase

__author__ = 'wayne brown'

mf, setUpModule, tearDownModule = module_fixture_maker(__file__, True)


class Matrixeq_Tests(RunestoneTestCase):

    def test_ma1(self):
        ''' matrixeq - test the click of a mutliplication operator '''
        self.driver.get(self.host + "/index.html")
        wait = WebDriverWait(self.driver, 10)
        try:
            wait.until(
                EC.presence_of_element_located((By.TAG_NAME, "body"))
            )
        except:
            text = self.driver.page_source
            print(text[:300])

        # t1 = self.driver.find_element_by_id("question1")
        #
"""
Test Reveal Answer question directive
"""

__author__ = 'yasinovskyy'

from runestone.unittest_base import module_fixture_maker, RunestoneTestCase

setUpModule, tearDownModule = module_fixture_maker(__file__)

class RevealQuestion_Tests(RunestoneTestCase):
    def test_r1(self):
        '''Initial view. Content is hidden'''
        self.driver.get(self.host + "/index.html")
        t1 = self.driver.find_element_by_id("reveal")

        q1 = t1.find_element_by_id('question1')

        cnamestr = q1.get_attribute("style")
        self.assertEqual("display: none;", cnamestr)


    def test_r2(self):
        '''Reveal button clicked'''
        self.driver.get(self.host + "/index.html")
        t1 = self.driver.find_element_by_id("reveal")

        btn_show = t1.find_element_by_id('question1_show')
        btn_show.click()

        q1 = t1.find_element_by_id('question1')