-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added test for zh_TW locale #10
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,18 @@ def test_locale(self, mozwebqa): | |
else: | ||
print "There is no language selector on the page" | ||
|
||
@pytest.mark.nondestructive | ||
def test_locale_zh_TW (self, mozwebqa): | ||
main_page = MySiteHomePage(mozwebqa) | ||
zh_TW_locale = ['/zh-TW'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's call this |
||
for path in zh_TW_locale: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this |
||
url = main_page.base_url + path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could have issues if the components are not separated by a single slash. Try using urlparse.urljoin() to create the new URL. |
||
|
||
Assert.true(url.endswith('/en-US')) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will fail because it's testing the above variable. What we need to do is make a request based on the new URL and check that our final URL after any redirects contains either our original locale or 'en-US'. We could make this request via Selenium or something like requests. |
||
|
||
if !url: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The correct syntax for checking a falsey value here is |
||
Assert.false(url.endswith('/zh-CN')) | ||
|
||
@pytest.mark.nondestructive | ||
def test_response_200(self, mozwebqa): | ||
main_page = MySiteHomePage(mozwebqa) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include a docstring to explain the test here. If I understand correctly we want to check that opening [base]/zh_TW should either stay as [base]/zh_TW or become [base]/en-US. If this is the case I would attempt to make this test a little more generic using a list of locales that this could apply to (with just one for now). I would therefore also update the name of the test to reflect this. Something like
test_locales_persist_or_fallback_to_en_us
.