test_that_user_can_add_cases_to_a_suite #81

Closed
wants to merge 9 commits into
from

6 participants

@bebef1987

this uses code from pull #79

fix #77

@klrmn klrmn and 1 other commented on an outdated diff Oct 29, 2012
tests/test_manage_suites_page.py
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ edit_suite = manage_suites_pg.edit_suite(name=suite['name'])
+
+ # add the last 2 cases
+ edit_suite.add_cases(case['name'] for case in cases[3:])
+ edit_suite.save_suite()
+
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ # check that the suite was created
+ Assert.true(manage_suites_pg.is_element_present(*suite['locator']))
+
+ manage_test_cases_pg = manage_suites_pg.view_cases(name=suite['name'])
+
+ # check that the first 3 cases are in the suite
@klrmn
klrmn added a line comment Oct 29, 2012

i think you need to be testing for all 5 cases here...looks like it's just a matter of changing the comment.

@bebef1987
bebef1987 added a line comment Oct 30, 2012

updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@klrmn klrmn and 1 other commented on an outdated diff Oct 29, 2012
tests/test_manage_suites_page.py
+ Assert.true(manage_test_cases_pg.is_element_present(*case['locator']))
+
+ # open and filter the suite under test
+ manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in)
+ manage_suites_pg.go_to_manage_suites_page()
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ edit_suite = manage_suites_pg.edit_suite(name=suite['name'])
+
+ # add the last 2 cases
+ edit_suite.add_cases(case['name'] for case in cases[3:])
+ edit_suite.save_suite()
+
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ # check that the suite was created
@klrmn
klrmn added a line comment Oct 29, 2012

do you need to test this here? you didn't just create a suite.

@bebef1987
bebef1987 added a line comment Oct 30, 2012

yes it's a good check 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@klrmn

test passed for me on both xp and mac

@zacc zacc commented on an outdated diff Oct 31, 2012
pages/manage_suites_page.py
@@ -41,3 +43,15 @@ def activate_suite(self, name='Test Suite'):
self.selenium.find_element(*self._suite_status_locator).click()
self.wait_for_ajax()
+
+ def view_cases(self, name='Test Suite'):
+ _view_cases_locator = (self._view_cases_locator[0], self._view_cases_locator[1] % {'suite_name': name})
+ self.selenium.find_element(*_view_cases_locator).click()
+ from pages.manage_cases_page import MozTrapManageCasesPage
+ return MozTrapManageCasesPage(self.testsetup)
+
+ def edit_suite(self, name='Test Suite'):
+ _edit_cases_locator = (self._edit_suite_locator[0], self._edit_suite_locator[1] % {'suite_name': name})
+ self.selenium.find_element(*_edit_cases_locator).click()
+ from pages.edit_suites_page import MozTrapEditSuitePage
+ return MozTrapEditSuitePage(self.testsetup, )
@zacc
zacc added a line comment Oct 31, 2012

Something missing in (self.testsetup, ) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@zacc

What are the intentions of these two tests?

They sound pretty much the same except the name has been reordered to make them seem different.

I'm worried the 2nd one will be too long and be a bit flaky and if they're doing the same thing we should retain just one test. Or simplify the focus of the 2nd test.

Edit:
With regard to the two tests I am comparing test_that_user_can_create_suite_and_add_some_cases_to_it and test_that_user_can_add_cases_to_a_suite

@zacc zacc commented on an outdated diff Oct 31, 2012
tests/test_manage_suites_page.py
@@ -42,3 +42,46 @@ def test_that_user_can_create_suite_and_add_some_cases_to_it(self, mozwebqa_logg
for case in cases:
Assert.true(manage_test_cases_pg.is_element_present(*case['locator']))
+
+ def test_that_user_can_add_cases_to_a_suite(self, mozwebqa_logged_in):
+ manage_suites_pg = MozTrapManageSuitesPage(mozwebqa_logged_in)
+
+ product = self.create_product(mozwebqa_logged_in)
+ # create 5 cases
+ cases = [self.create_case(mozwebqa=mozwebqa_logged_in, product=product) for i in range(5)]
+
+ # add the first 3 cases in the suite
+ suite = self.create_suite(mozwebqa=mozwebqa_logged_in, product=product, case_name_list=[case['name'] for case in cases[:3]])
+
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ # check that the suite was created
+ Assert.true(manage_suites_pg.is_element_present(*suite['locator']))
@zacc
zacc added a line comment Oct 31, 2012

Can you add a custom message with the name of the suite that it is trying to assert is present? This will help debug failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@zacc zacc commented on an outdated diff Oct 31, 2012
tests/test_manage_suites_page.py
+ edit_suite = manage_suites_pg.edit_suite(name=suite['name'])
+
+ # add the last 2 cases
+ edit_suite.add_cases(case['name'] for case in cases[3:])
+ edit_suite.save_suite()
+
+ manage_suites_pg.filter_suites_by_name(name=suite['name'])
+
+ # check that the suite was created
+ Assert.true(manage_suites_pg.is_element_present(*suite['locator']))
+
+ manage_test_cases_pg = manage_suites_pg.view_cases(name=suite['name'])
+
+ # check that the first 5 cases are in the suite
+ for case in cases:
+ Assert.true(manage_test_cases_pg.is_element_present(*case['locator']))
@zacc
zacc added a line comment Oct 31, 2012

Custom message with the name of the case it is trying to locate. As it is now you can't tell whehter it's the 1st, 2nd or 5th or whatever case that has failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@bebef1987 bebef1987 merge test_that_user_can_create_suite_and_add_some_cases_to_it with t…
…est_that_user_can_create_and_add_cases_to_a_suite
646247a
@teodosia

The test fails for me on Win7 and FF14. Here is the stacktrace http://pastebin.mozilla.org/1895091
But it passes on Mac.

@AlinT

This fails for me also on windows.

@bebef1987

can you retest it because the test is passing on win for me
and we run the test on mac in Jenkins which also passes

@bebef1987

(moztrap)florinstrugariu@P4298:~/work/moztrap-tests-bebe$ py.test --baseurl=http://moztrap-dev.allizom.org/ --browserver=16 --browsername=firefox --platform=mac --credentials=/home/florinstrugariu/work/webqa-credentials/moztrap.yaml --destructive -k test_that_user_can_create_and_add_cases_to_a_suite --host=qa-selenium.mv.mozilla.com
================================================================================================ test session starts ================================================================================================
platform linux2 -- Python 2.7.3 -- pytest-2.2.4
collected 18 items

tests/test_manage_suites_page.py .

=================================================================== 17 tests deselected by '-ktest_that_user_can_create_and_add_cases_to_a_suite' ===================================================================
===================================================================================== 1 passed, 17 deselected in 384.04 seconds =====================================================================================

@AlinT

py.test --browsername=firefox --platform=mac --browserver=16 --baseurl=https://moztrap-dev.allizom.org --credentials=/home/alintrif/WebQA/credentials/webqa-credentials/moztrap.yaml tests/ --destructive -ktest_that_user_can_create_and_add_cases_to_a_suite --host=qa-selenium.mv.mozilla.com
============================= test session starts ==============================
platform linux2 -- Python 2.7.3 -- pytest-2.2.4
collected 18 items

tests/test_manage_suites_page.py .

17 tests deselected by '-ktest_that_user_can_create_and_add_cases_to_a_suite' =
================== 1 passed, 17 deselected in 380.20 seconds ==================

@AlinT

I don't know why the test is still failing locally, but I ran it on jenkins like 5 times and it passed.

@bobsilverberg

I'm looking at all of these outstanding moztrap pulls. This one has merge conflicts and hasn't been looked at in 3 months. Is it still relevant, or should it be closed? @bebef1987, I can review it if you like if you can resolve the merge conflicts.

@AlinT

@bebef1987 any thoughts on this?

@bebef1987

I think this should be closed

If anyone wants to redo these tests fell free

@bebef1987 bebef1987 closed this Mar 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment