コード例 #1
0
    def test_child_and_sibling(self):
        sel = Selector()
        sel.child(text="...")
        self.assertEqual(sel["childOrSibling"], ["child"])
        self.assertEqual(sel["childOrSiblingSelector"], [Selector(text="...")])

        sel.sibling(text="---")
        self.assertEqual(sel["childOrSibling"], ["child", "sibling"])
        self.assertEqual(
            sel["childOrSiblingSelector"],
            [Selector(text="..."), Selector(text="---")])
コード例 #2
0
    def test_clone(self):
        kwargs = {
            "text": "1234",
            "description": "desc...",
            "clickable": True,
            "focusable": False,
            "packageName": "android"
        }
        sel = Selector(**kwargs)
        sel.child(text="1")
        sel.sibling(text="1")
        sel.child(text="1")

        clone = sel.clone()
        for k in kwargs:
            self.assertEqual(sel[k], clone[k])
        self.assertEqual(sel["childOrSibling"], clone["childOrSibling"])
        self.assertEqual(sel["childOrSiblingSelector"],
                         clone["childOrSiblingSelector"])