Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: components/test/data/password_manager/README

Issue 273523004: Password Manager testing automation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new arch Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 This file contains high-level info about how to use password manager tests and
2 how to create new ones.
3
4 The password manager tests purpose is to allow automatic password manager
5 checking and avoiding to do so manually.
6 The tests are written in python using selenium Webdriver library.
7
8
9 =====Getting started=====
10
11 Build ChromeDriver by building the 'chromedriver' target. This will
12 create an executable binary in the build folder named 'chromedriver[.exe]'.
13
14 Build chrome too by building the 'chrome' target. This will
15 create an executable binary in the build folder named 'chrome[.exe]'.
16
17 Install Selenium (the version tested was 2.41.0):
18 pip install -U selenium
19
20
21 For security reasons, we didn't publish the passwords and the usernames we
22 used to test. So we put them to an xml file (websites.xml). The structure of
23 the file is the following:
24 <websites>
25 <website name = "website name">
26 <username>username</username>
27 <password>password</password>
28 </website>
29 <websites>
30 You can ask someone to give you the websites.xml file and put it in the same
31 folder as the tests. You can also create your own websites.xml with your
32 personal accounts.
33
34 Run all the working tests tests by executing:
35 python tests.py --chrome-path CHROMEPATH --chromedriver-path CHROMEDRIVERPATH
36 --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
37
38 Run all the tests by executing:
39 python tests.py --all --chrome-path CHROMEPATH --chromedriver-path
40 CHROMEDRIVERPATH --profile-path PROFILEPATH --passwords_path PASSWORDSPATH]
41
42 Run one or many tests by executing:
43 python tests.py --chrome-path CHROMEPATH --chromedriver-path CHROMEDRIVERPATH
vabr (Chromium) 2014/05/14 15:16:09 Is this command the same as the one for "Run all t
rchtara 2014/05/15 09:39:11 Done.
44 --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
45
46 python tests.py google --chrome-path CHROMEPATH --chromedriver-path
47 CHROMEDRIVERPATH profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
48
49 python tests.py google facebook --chrome-path CHROMEPATH --chromedriver-path
50 CHROMEDRIVERPATH --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
51
52 python tests.py google facebook amazon --chrome-path CHROMEPATH
53 --chromedriver-path CHROMEDRIVERPATH --profile-path PROFILEPATH
54 [--passwords_path PASSWORDSPATH]
55
56
57 =====Creating new test=====
58
59 1) Open tests.py.
60
61 2) Add these lines :
62 website = environment.AddWebsite("website name",
63 "username",
64 "password")
65 * For security reasons, you can use websites.xml which is a private to keep
66 your passwords. You have to add the following line to the xml file:
67
68 <website name = "website name">
69 <username>username</username>
70 <password>password</password>
71 </website>
72
73 Then, to create the new test, you need just to add:
74 class NEWWEBSITE(Website):
vabr (Chromium) 2014/05/14 15:16:09 Using all-caps for class name is against the Pytho
rchtara 2014/05/15 09:39:11 Done.
75
76 def Login(self):
77 self.GoTo("hhtp://url")
vabr (Chromium) 2014/05/14 15:16:09 hhtp->http
rchtara 2014/05/15 09:39:11 Done.
78 self.FillUsername("#username")
vabr (Chromium) 2014/05/14 15:16:09 What do you actually mean by #username, #password?
rchtara 2014/05/15 09:39:11 Done.
79 self.FillPassword("#password")
80 self.Submit("#password")
81
82 def Logout(self):
83 self.Click("#logout")
84
85 environment.AddWebsite(
86 Yahoo("NEWWEBSITE("http://url", username_not_auto=True))
vabr (Chromium) 2014/05/14 15:16:09 There is an odd number (3) of quotation marks in t
rchtara 2014/05/15 09:39:11 Done.
87
88
89 3) Use the flowing methods to perform the login and logout:
90 The methods that you can use are:
91 * Click: find an element using CSS Selector and click on it.
92 self.Click("css_selector")
93 * ClickIfAvailable: find an element using CSS Selector and if it's available,
vabr (Chromium) 2014/05/14 15:16:09 Please elaborate on what's the difference between
rchtara 2014/05/15 09:39:11 Done.
94 click on it.
95 self.ClickIfAvailable("css_selector")
96 * Enter: find an element using CSS Selector and send enter to it.
97 self.Enter("css_selector")
vabr (Chromium) 2014/05/14 15:16:09 nit: Enter -> SendEnterTo (The literal meaning of
rchtara 2014/05/15 09:39:11 Done.
98 * GoTo: go to some url.
vabr (Chromium) 2014/05/14 15:16:09 What does "go to" mean? Navigating the main frame?
rchtara 2014/05/15 09:39:11 Done.
99 self.GoTo("url")
100 * Hover: find an element using CSS Selector and hover it.
vabr (Chromium) 2014/05/14 15:16:09 hover it -> hover over it
rchtara 2014/05/15 09:39:11 Done.
101 self.Hover("css_selector")
vabr (Chromium) 2014/05/14 15:16:09 optional nit: Hover -> HoverOver
rchtara 2014/05/15 09:39:11 Done.
102
vabr (Chromium) 2014/05/14 15:16:09 Why the blank line? Unless it separates different
rchtara 2014/05/15 09:39:11 Done.
103 * IsDisplayed: check if an element is displayed.
104 self.IsDisplayed("css_selector")
105 * Wait: wait for some amount of time.
vabr (Chromium) 2014/05/14 15:16:09 Please mention units. (Seconds?)
rchtara 2014/05/15 09:39:11 Done.
106 self.Wait(10)
107 * WaitUntilDisplayed: wait for an element defined using CSS Selector to be
108 displayed.
109 self.WaitUntilDisplayed("css_selector")
110
111
112 * FillPassword: find an input element using CSS Selector and fill it with
vabr (Chromium) 2014/05/14 15:16:09 nit: FillPasswordInto, FillUsernameInto Just Fill
rchtara 2014/05/15 09:39:11 Done.
113 the password.
114 self.FillPassword("css_selector")
115 * Fillusername: find an input element using CSS Selector and fill it with
116 the username.
117 self.FillUsername("css_selector")
118 * OptionalFillUsername: find an input element using CSS Selector and fill it
vabr (Chromium) 2014/05/14 15:16:09 nit: OptionalFillUsername -> FillUsernameIfVisible
rchtara 2014/05/15 09:39:11 Done.
119 with the username. Do nothing if the input element is not visible.
vabr (Chromium) 2014/05/14 15:16:09 Is "doing nothing" the important difference? Or wo
rchtara 2014/05/15 09:39:11 Done.
120 self.OptionalFillUsername("css_selector")
121 * Submit: find an element using CSS Selector and submit it.
vabr (Chromium) 2014/05/14 15:16:09 optional nit: submit it -> call its submit() handl
rchtara 2014/05/15 09:39:11 Done.
122 self.Submit("css_selector")
123
124
125 =====Files structure=====
126
127 Classes:
128 * environment.py: the definition the tests Environment.
129 * website.py: Website is defined here. You need to create an instance of this
130 class for each website you want to test.
131
132 Tests:
133 * tests.py: the tests setup and the configuration for each website happens
134 here. This file contain 3 separate kinds of tests:
135
136 1) working tests: tests that are supposed to work. If you have a problem with
137 one of them, rerun it again. Or try using the Known Issues section to fix it.
138 2) tests that can cause a crash (the cause of the crash is not related to the
139 password manager): This means that this set is expected to become a working
140 test or failing test when the issue that causes the crash now is solved.
141 3) failing tests: tests that fail for known bug related to the password
142 manager. When this bug is solved, all the tests that were failing because of
143 it are going to be moved to working tests.
144
145 Other files:
146 * websites.xml : a private file where you can find all the passwords. You can
147 ask someone to give it to you or just create your own with your personal
148 accounts.
149 <websites>
150 <website name = "website name">
151 <username>username</username>
152 <password>password</password>
153 </website>
154 </websites>
155
156
157 =====Known Issues=====
158
159 The tests are very fragile. Here are some suggestions for solving most of the
160 problems:
161 * Restart the tests.
162 * Remove the profile if the tests fail at the beginning for unknown reason.
163 * If tests fail, isolate the one that causes problem, read the log and keep
164 your eyes on the browser window to understand its causes:
165 a) In the tests, we often need to wait for a menu to appear ... If the
166 menu takes more time to appear than expected, the tests are going to fail.
167 b) The websites change very often. And even if they are not changed, they some
168 time show a popup that broke the tests. In the case you need to login manually
169 to the website, close all popup and logout.
170 * If you are logged in when the tests crashes, don't forget to log out before
171 running the tests a second time.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698