Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Profiles #58

Merged
merged 2 commits into from

4 participants

@bebef1987
Collaborator

No description provided.

@zacc

The test fails at:

  manage_profiles_pg.filter_profiles_by_name(name=profile['name'])

tests/test_manage_profiles_page.py:21:

My suspicion is that the test is assuming that after creating the profile it is returning to the manage/profiles/ page whereas it is actually returning to the /manage/profile/add page.

Either the test workflow has been changed or the app workflow has changed. Probiably the former as we have done so much work on it today.
However the nature of the page objects lends itself to these assumptions in the test.

@klrmn klrmn commented on the diff
tests/test_manage_profiles_page.py
@@ -20,11 +20,11 @@ def test_that_user_can_create_and_delete_profile(self, mozwebqa_logged_in):
manage_profiles_pg.filter_profiles_by_name(name=profile['name'])
@klrmn Collaborator
klrmn added a note

the test failed for me at this line.

E NoSuchElementException: Message: u'Unable to locate element: {"method":"id","selector":"text-filter"}\nCommand duration or timeout: 14.25 seconds\nFor documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html\nBuild info: version: \'2.24.1\', revision: \'17205\', time: \'2012-06-19 17:28:14\'\nSystem info: os.name: \'Windows XP\', os.arch: \'x86\', os.version: \'5.1\', java.version: \'1.7.0_04\'\nDriver info: driver.version: EventFiringWebDriver\nSession ID: 67cda6fe-e8bc-424b-846d-f696610bc347' ; Screenshot: available via screen ; Stacktrace: Method newInstance0 threw an error in None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@klrmn klrmn commented on the diff
pages/create_profile_page.py
((6 lines not shown))
profile_category_field.send_keys(profile['category'])
profile_category_field.send_keys(Keys.RETURN)
- element_field = self.selenium.find_element(*self._add_element_input_locator)
+ element_field = self.selenium.find_element(*_add_element_input_locator)
@klrmn Collaborator
klrmn added a note

why does this one locator not use self?

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

side note, i got started working on TestRunTestsPage, but it appears to be dependent upon the changes in this pull.
it's https://github.com/klrmn/moztrap-tests/tree/migrate_run_tests if you want to look at it.

@rbillings
Owner

AFAICT the workflow has not changed. After profile creation, the page does go to manage/profiles.

@zacc

Thanks @rbillings and @klrmn , that's the same error I was having @klrmn. @bebef1987 can you step through this test manually and work out why it is going to the wrong page?

@bebef1987
Collaborator

(moz-trap_wd)florinstrugariu@P4298:~/webqa/moztrap-tests/bebe/caseconductor-tests$ py.test --host=qa-selenium.mv.mozilla.com --browsername=firefox --browserver=11 --platform=windows --credentials=/home/florinstrugariu/webqa/Credentials/Mozilla/webqa-credentials/moztrap.yaml --baseurl=https://moztrap-dev.allizom.org/ --destructive -k test_that_user_can_create_and_delete_profile
============================= test session starts ==============================
platform linux2 -- Python 2.7.2 -- pytest-2.2.4
collected 17 items

tests/test_manage_profiles_page.py .

=== 16 tests deselected by '-ktest_that_user_can_create_and_delete_profile' ====
=================== 1 passed, 16 deselected in 65.13 seconds ===================

@bebef1987
Collaborator

the test passes on my end

Make sure you create the profile with the correct test account :D

@zacc

Are you using the shared QA credentials?

@bebef1987
Collaborator

yes

@zacc

OK I have found the issue
at line 59 off create_profile_page.py the step is to click the checkbox of the category (this is right next to the dropdown menu). For myself and @klrmn the checkbox is not being ticked correctly but the step is passing, so the following step (click submit) is being performed too. This fails validation and is not completed so the test is going to the wrong page.

I can't explain why it is clicking for Bebe and not for others but next step is to click the checkbox properly.

@zacc

I have just tested clicking the label element instead of hte input element and it works.

@zacc zacc commented on the diff
pages/create_profile_page.py
@@ -5,7 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
-from selenium.webdriver.support.select import Select
+
+from selenium.webdriver.support.ui import WebDriverWait
@zacc
zacc added a note

I thought this was from selenium.webdriver.support.wait but this seems to work anyway.

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

Fix passes, @klrmn I am sure this will work for you too so I am going to merge but if issues please let us know.

@zacc zacc merged commit 3e78b62 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 9, 2012
  1. TestManageProfilesPage

    Bebe authored
Commits on Jul 10, 2012
  1. update locator

    Bebe authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 14 deletions.
  1. +11 −12 pages/create_profile_page.py
  2. +2 −2 tests/test_manage_profiles_page.py
View
23 pages/create_profile_page.py
@@ -5,7 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
-from selenium.webdriver.support.select import Select
+
+from selenium.webdriver.support.ui import WebDriverWait
@zacc
zacc added a note

I thought this was from selenium.webdriver.support.wait but this seems to work anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
from selenium.webdriver.common.keys import Keys
from datetime import datetime
@@ -17,7 +18,7 @@ class MozTrapCreateProfilePage(MozTrapBasePage):
_page_title = 'MozTrap'
_profile_name_locator = (By.ID, 'id_name')
- _select_category_locator = (By.CSS_SELECTOR, '#profile-add-form .itemlist .bulkselectitem[data-title="%(category_name)s"] .bulk-value')
+ _select_category_locator = (By.CSS_SELECTOR, '#profile-add-form .itemlist .bulkselectitem[data-title="%(category_name)s"] .listitem .itembody .element[data-title="%(element_name)s"] label')
_delete_category_locator = (By.CSS_SELECTOR, '#profile-add-form .itemlist .bulkselectitem .action-delete[title="delete %(category_name)s"]')
_add_category_locator = (By.CSS_SELECTOR, '#profile-add-form .itemlist .add-item .itemhead')
_add_category_input_locator = (By.ID, 'new-category-name')
@@ -37,7 +38,7 @@ def create_profile(self, name='Test Profile', category_name='Test Category', ele
profile['category'] = u'%(category_name)s %(dt_string)s' % {'category_name': category_name, 'dt_string': dt_string}
profile['element'] = u'%(element_name)s %(dt_string)s' % {'element_name': element_name, 'dt_string': dt_string}
profile['locator'] = (self._profile_locator[0], self._profile_locator[1] % {'profile_name': profile['name']})
- _select_category_locator = (self._select_category_locator[0], self._select_category_locator[1] % {'category_name': profile['category']})
+ _select_category_locator = (self._select_category_locator[0], self._select_category_locator[1] % {'category_name': profile['category'], 'element_name': profile['element']})
_add_element_input_locator = (self._add_element_input_locator[0], self._add_element_input_locator[1] % {'category_name': profile['category']})
_new_element_locator = (self._new_element_locator[0], self._new_element_locator[1] % {'category_name': profile['category'], 'element_name': profile['element']})
@@ -47,22 +48,20 @@ def create_profile(self, name='Test Profile', category_name='Test Category', ele
add_category = self.selenium.find_element(*self._add_category_locator)
add_category.click()
- profile_category_field = self.selenium.find_element(*self.add_category_input_locator)
+ profile_category_field = self.selenium.find_element(*self._add_category_input_locator)
profile_category_field.send_keys(profile['category'])
profile_category_field.send_keys(Keys.RETURN)
- element_field = self.selenium.find_element(*self._add_element_input_locator)
+ element_field = self.selenium.find_element(*_add_element_input_locator)
@klrmn Collaborator
klrmn added a note

why does this one locator not use self?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
element_field.send_keys(profile['element'])
element_field.send_keys(Keys.RETURN)
+ WebDriverWait(self.selenium, self.timeout).until(lambda s: self.selenium.find_element(*_new_element_locator))
+ self.selenium.find_element(*_select_category_locator).click()
- self.selenium.key_down(_add_element_input_locator, '13')
- self.wait_for_element_visible(_new_element_locator)
-
- select_category = Select(self.selenium.find_element(*self._select_category_locator))
- select_category.select_by_visible_text("select category")
+ self.selenium.find_element(*self._submit_locator).click()
return profile
def delete_environment_category(self, category_name='Test Category'):
- _delete_category_locator = self._delete_category_locator % {'category_name': category_name}
- self.selenium.find_element._delete_category_locator.click()
+ _delete_category_locator = (self._delete_category_locator[0], self._delete_category_locator[1] % {'category_name': category_name})
+ self.selenium.find_element(*_delete_category_locator).click()
View
4 tests/test_manage_profiles_page.py
@@ -20,11 +20,11 @@ def test_that_user_can_create_and_delete_profile(self, mozwebqa_logged_in):
manage_profiles_pg.filter_profiles_by_name(name=profile['name'])
@klrmn Collaborator
klrmn added a note

the test failed for me at this line.

E NoSuchElementException: Message: u'Unable to locate element: {"method":"id","selector":"text-filter"}\nCommand duration or timeout: 14.25 seconds\nFor documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html\nBuild info: version: \'2.24.1\', revision: \'17205\', time: \'2012-06-19 17:28:14\'\nSystem info: os.name: \'Windows XP\', os.arch: \'x86\', os.version: \'5.1\', java.version: \'1.7.0_04\'\nDriver info: driver.version: EventFiringWebDriver\nSession ID: 67cda6fe-e8bc-424b-846d-f696610bc347' ; Screenshot: available via screen ; Stacktrace: Method newInstance0 threw an error in None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- Assert.true(manage_profiles_pg.is_element_present(profile['locator']))
+ Assert.true(manage_profiles_pg.is_element_present(*profile['locator']))
manage_profiles_pg.delete_profile(name=profile['name'])
- Assert.false(manage_profiles_pg.is_element_present(profile['locator']))
+ Assert.false(manage_profiles_pg.is_element_present(*profile['locator']))
create_profile_pg.go_to_create_profile_page()
create_profile_pg.delete_environment_category(category_name=profile['category'])
Something went wrong with that request. Please try again.