def exists(self): profile = self.parent.filters.get("parent") if profile: view = ViaWebUI.navigate_to(profile, "Details") else: view = ViaWebUI.navigate_to(self.parent, "All") return view.posts(self.post_id).is_displayed
def delete(self): profile = self.parent.filters.get("parent") if profile: view = ViaWebUI.navigate_to(profile, "Details") else: view = ViaWebUI.navigate_to(self.parent, "All") view.posts(self.post_id).delete()
def update(self, username=None, about=None, city=None): view = ViaWebUI.navigate_to(self, "Edit") changed = view.fill({"username": username, "about": about, "city": city}) if changed: self.username = username view.submit.click() ViaWebUI.navigate_to(self, "Details")
def update(self, username=None, about=None): view = ViaWebUI.navigate_to(self, "Edit") wait_for(lambda: view.is_displayed) changed = view.fill({"username": username, "about": about}) if changed: self.username = username view.submit.click() ViaWebUI.navigate_to(self, "Details")
def all(self): profile = self.filters.get("parent") if profile: view = ViaWebUI.navigate_to(profile, "Details") else: view = ViaWebUI.navigate_to(self, "All") posts = [] for post_id in view.posts.view_class.all(view.browser): posts.append(self.instantiate(post_id[0])) return posts
def create(self, content): view = ViaWebUI.navigate_to(self, "All") changed = view.fill({"text_area": content}) if changed: post = self.instantiate(view.posts.view_class._last_post_id(view.browser)[0] + 1) view.submit.click() return post
def test_edit_profile(application, request): profile = application.collections.profiles.instantiate(username=application.username) @request.addfinalizer def _revert(): profile.update(username="******", about="") profile.update(username="******", about="My bio") view = ViaWebUI.navigate_to(profile, "Details") assert view.title.text == "User: new_user"
def test_edit_profile(application, request): profile = application.collections.profiles.instantiate( username=application.username) @request.addfinalizer def _revert(): profile.update(username="******", about="") profile.update(username="******", about="My bio") view = ViaWebUI.navigate_to(profile, "Details") wait_for(lambda: view.is_displayed) assert view.title.text == "User: misharov2"
def __init__(self, hostname=None, path="", scheme="https", username=None, password=None): self.application = self self.hostname = hostname self.path = path self.scheme = scheme self.username = username self.password = password self.web_ui = ViaWebUI(owner=self) self.context = MtImplementationContext.from_instances([self.web_ui]) self.collections = EntityCollections.for_application(self)
def test_login(application): view = ViaWebUI.navigate_to(application.web_ui, "LoggedIn") assert view.is_displayed
def delete(self, *post_ids): profile = self.filters.get("profile") ViaWebUI.navigate_to(profile, "Details") if profile else ViaWebUI.navigate_to(self, "All") for post_id in post_ids: post = self.instantiate(post_id) post.delete()