summaryrefslogtreecommitdiff
path: root/tests/cffi.py
blob: 34b31b8cacae04a52c2cf455e39efe4053114c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
import base

class Suite(base.Base):
    def test_1(self):
        """Test case 1"""
        self.start('Cffi/main')
        l1 = self.xpath('form[1]/input')
        l1.click()

        b1 = self.xpath('button[1]')
        b1.click() # TODO: check server output somehow

        b2 = self.xpath('button[2]')
        b2.click()
        alert = self.driver.switch_to.alert
        self.assertEqual("<<Hoho>>", alert.text)
        alert.accept()

        b3 = self.xpath('button[3]')
        b3.click()
        alert = self.driver.switch_to.alert
        self.assertEqual("Hi there!", alert.text)
    def test_2(self):
        """Test case 2"""
        self.start('Cffi/main')
        l1 = self.xpath('form[2]/input')
        l1.click()

        self.assertEqual("All good.", self.body_text())
    def test_3(self):
        """Test case 3"""
        self.start('Cffi/main')
        l1 = self.xpath('form[3]/input')
        l1.click()

        self.assertRegex(self.body_text(), "^Fatal error: .*$")