Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(27)

Unified Diff: _ui_tests/test_tickets.py

Issue 109400043: Added test for +tickets view
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « MoinMoin/templates/tickets.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: _ui_tests/test_tickets.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/_ui_tests/test_tickets.py
@@ -0,0 +1,65 @@
+from selenium import webdriver
+import pytest
+import config
+import utils
+from whoosh.query import Term, And
+from flask import g as flaskg
+from MoinMoin.items import Item
+from MoinMoin.constants.keys import ITEMTYPE, CLOSED, LATEST_REVS, ITEMID, ACTION_SAVE
+from MoinMoin.constants.itemtypes import ITEMTYPE_TICKET
+
+def pytest_funcarg__driver(request):
+ """A driver for a web browser."""
+ driver = webdriver.Firefox()
+ request.addfinalizer(driver.quit)
+ return driver
+
+def create_ticket():
+ """Creates a new wiki ticket"""
+
+ meta = {
+ u'contenttype': u'text/x.moin.wiki;charset=utf-8',
+ u'itemtype': ITEMTYPE_TICKET,
+ u'tags': [],
+ u'superseded_by': u'',
+ u'depends_on': u'',
+ u'summary': u'TestTicket Summary' + utils.generate_random_word(5),
+ u'priority': None,
+ u'difficulty': None,
+ u'closed': True,
+ u'assigned_to': u'',
+ u'effort': None,
+ u'severity': None
+ }
+ item_name = utils.generate_random_name(u'TestTicket', 15)
+ item = Item.create(name=item_name, itemtype=ITEMTYPE_TICKET, contenttype=u'text/x.moin.wiki;charset=utf-8')
+ revid, abcd = item._save(meta=meta)
+ return revid
+
+class TestTicketsview:
+ """Functional Tests for +tickets view"""
+
+ def test_tickets(self, driver):
+ """Checks for the status of the tickets being shown"""
+ base_url = config.BASE_URL
+ closed_ids = []
+
+ id = create_ticket()
+
+ driver.get(base_url + '+tickets')
+ driver.find_element_by_css_selector('#closed').click()
+ for tr in driver.find_elements_by_xpath('//table[@id="ticket-list"]//tr'):
+ tds = tr.find_elements_by_tag_name('td')
+ if tds:
+ closed_ids.append(tds[0].text)
+ assert id in closed_ids
+
+ with flaskg.storage.indexer.ix[LATEST_REVS].searcher() as searcher:
+ terms = [Term(ITEMTYPE, ITEMTYPE_TICKET)]
+ terms.append(Term(CLOSED, True))
+ q = And(terms)
+ results = searcher.search(q, limit=None)
+ original_ids = []
+ for result in results:
+ original_ids.append(result[ITEMID])
+ assert id in original_ids
« no previous file with comments | « MoinMoin/templates/tickets.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b