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
Simple log-in test addition #27
Conversation
log in test example, for now only old skyring log in test
@fbalak check this pull request for usage of webstr module |
some of fixtures/methods is common for all web tests, hence the web directory was created in usmqe_tests it looks better when the same directory structure is for api tests too, hence the api directory was created
driver: webdriver instance | ||
""" | ||
self.location = pytest.config.getini("usm_web_url") | ||
super(WebstrModel, self).__init__(driver) |
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.
Redo location and super(LoginPageModel)
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.
Done
removing unnecessary vim formating line correct 'Atributes' and 'Parameters' key words in doc strings fix work with model LOCATION parameter it will be used as information how the url should look like it will not be used anywhere by default could be used for URL check test
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.
LGTM
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.
I have few minor notes or questions, but it looks good overall.
it logs again anyway | ||
|
||
Atributes: | ||
testcase - instance of UITestCase |
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.
Could you refer to whole name including module path? I guess it's webstr.core.test.UITestCase
, right?
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.
right, it is. I thought about that and decided against, however I could/will change it
Atributes: | ||
driver: web driver | ||
""" | ||
self._location = pytest.config.getini("usm_web_url") |
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.
Would it be possible to pass the location from the test case? That way we would not have to import pytest from pages and it woud give us more flexibility (eg. when we would like to do some test cases with a modified url to test redirection or some negative cases).
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.
fine
|
||
# part of url which is placed after 'usm_web_url' | ||
# for getting on the described page in the module | ||
LOCATION = '/#' |
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.
Which code is using (or is expected to use) this global variable? I tried to grep but failed to find it.
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.
None, but the idea is that you can check the URL of the page if you want, just pul usm_web_url + LOCATION and check it.
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.
Ah, so this is expected url, which can be checked in the test if needed.
|
||
# part of url which is placed after 'usm_web_url' | ||
# for getting on the described page in the module | ||
LOCATION = None |
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.
Which code is using (or is expected to use) this global variable? I tried to grep but failed to find it. (the same comment again)
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.
The same as in previous comment
@@ -0,0 +1,92 @@ | |||
""" |
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.
Minor nitpick, wouldn't it make more sense to name this file test_login.py
?
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.
right
pytest.config.getini("usm_username"), | ||
pytest.config.getini("usm_password") | ||
).__class__.__name__ == 'NavMenuBars', | ||
"Login and wait for main page.") |
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.
Would it make sense to write in in this way instead? So that it would be immediately obvious that we return page object there.
loginpage_inst = loginpage.LoginPage(testcase_set.driver)
page_inst = loginpage_inst.login_user(
pytest.config.getini("usm_username"),
pytest.config.getini("usm_password"))
pytest.check(page_inst.__class__.__name__ == "NavMenuBars", "Login and wait for main page.")
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.
I don't much care will change that. You could say historical reasons is in play here.
""" | ||
if username is True: | ||
username = pytest.config.getini("usm_username") | ||
if password is None: |
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.
I see that you don't have password
set to None
in the pytest.mark.parametrize list, is that intentional?
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.
let's say I just left open doors for other scenarios here
I haven't tried to run it though. Just checked that the unit tests pass when I have |
ece91f1
to
ddc96a0
Compare
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.
Looks good.
Example how to use webstr framework in our tests