Skip to content
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

Merged
merged 13 commits into from Jan 19, 2017
Merged

Simple log-in test addition #27

merged 13 commits into from Jan 19, 2017

Conversation

ltrilety
Copy link
Contributor

Example how to use webstr framework in our tests

@mbukatov
Copy link
Contributor

@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)
Copy link
Contributor

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)

Copy link
Contributor Author

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
@ltrilety ltrilety requested review from fbalak and removed request for fbalak January 18, 2017 11:54
Copy link
Contributor

@mkudlej mkudlej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@mbukatov mbukatov left a 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
Copy link
Contributor

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?

Copy link
Contributor Author

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")
Copy link
Contributor

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).

Copy link
Contributor Author

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 = '/#'
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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)

Copy link
Contributor Author

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 @@
"""
Copy link
Contributor

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?

Copy link
Contributor Author

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.")
Copy link
Contributor

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.")

Copy link
Contributor Author

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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

@mbukatov
Copy link
Contributor

mbukatov commented Jan 18, 2017

I haven't tried to run it though. Just checked that the unit tests pass when I have webstr installed :)

Copy link
Contributor

@mbukatov mbukatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@mbukatov mbukatov merged commit b281655 into usmqe:master Jan 19, 2017
@ltrilety ltrilety deleted the ltrilety_work branch January 19, 2017 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants