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

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: renaming 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 WARNING: All the content of the PROFILEPATH is going to be deleted.
34 Show the help:
35 python tests.py --help
36 Run all the working tests tests by executing:
37 python tests.py --chrome-path CHROMEPATH --chromedriver-path CHROMEDRIVERPATH
38 --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
39
40 Run all the tests by executing:
41 python tests.py --all --chrome-path CHROMEPATH --chromedriver-path
42 CHROMEDRIVERPATH --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
43
44 Run one or many tests by executing:
45 python tests.py google --chrome-path CHROMEPATH --chromedriver-path
46 CHROMEDRIVERPATH profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
47
48 python tests.py google facebook --chrome-path CHROMEPATH --chromedriver-path
49 CHROMEDRIVERPATH --profile-path PROFILEPATH [--passwords_path PASSWORDSPATH]
50
51 python tests.py google facebook amazon --chrome-path CHROMEPATH
52 --chromedriver-path CHROMEDRIVERPATH --profile-path PROFILEPATH
53 [--passwords_path PASSWORDSPATH]
54
55 To display the log on the screen, use:
vabr (Chromium) 2014/05/20 14:47:25 nit: "the log" -> "debugging messages" Also below.
rchtara 2014/05/22 08:44:38 Done.
56 python tests.py --log DEBUG|INFO|WARNING|ERROR|CRITICAL --log-screen
57 To save the log into a file, use:
58 python tests.py --log DEBUG|INFO|WARNING|ERROR|CRITICAL --log-file LOG_FILE
59
60 For more information about DEBUG|INFO|WARNING|ERROR|CRITICAL goto
61 https://goto.google.com/pbkoq
vabr (Chromium) 2014/05/20 14:47:25 This URL is internal, please remove it from the so
rchtara 2014/05/22 08:44:38 Done.
62
63
64 =====Creating new test=====
65
66 1) Open tests.py.
67
68 2) Add these lines :
vabr (Chromium) 2014/05/20 14:47:25 That's not completely true -- not exactly the line
rchtara 2014/05/22 08:44:38 Done.
69
70 class NewWebsiteTest(WebsiteTest):
71
72 def Login(self):
73 self.GoTo("http://url")
74 self.FillUsernameInto("Username CSS selector")
75 self.FillPasswordInto("Password CSS selector")
76 self.Submit("Password CSS selector")
77
78 def Logout(self):
79 self.Click("Logout button CSS selector")
80
81 environment.AddWebsiteTest(NewWebsiteTest("http://url"))
vabr (Chromium) 2014/05/20 14:47:25 Here you write "http://url", but below in tests.py
rchtara 2014/05/22 08:44:38 Done.
82
83 Then, to create the new test, you need just to add:
vabr (Chromium) 2014/05/20 14:47:25 Are these 3 lines obsolete?
rchtara 2014/05/22 08:44:38 Done.
84 environment.AddWebsiteTest(
85 NewWebsiteTest("website name", "username", "password"))
vabr (Chromium) 2014/05/20 14:47:25 Please note what you mean by "website name". In pa
rchtara 2014/05/22 08:44:38 Done.
86
87 * For security reasons, you can use websites.xml which is a private to keep
88 your passwords. You have to add the following line to the xml file:
89
90 <website name = "website name">
91 <username>username</username>
92 <password>password</password>
93 </website>
94
95
96
97 3) Use the flowing methods to perform the login and logout:
vabr (Chromium) 2014/05/20 14:47:25 This is not "step 3", as in: it should not follow
rchtara 2014/05/22 08:44:38 Done.
98 The methods that you can use are:
99
100 * Click: find an element using CSS Selector and click on it. Throw an
101 exception if the element is not visible.
102 self.Click("css_selector")
103 * ClickIfVisible: find an element using CSS Selector and if it's visible,
104 click on it.
105 self.ClickIfVisible("css_selector")
106 * GoTo: navigate the main frame to a url.
107 self.GoTo("url")
108 * HoverOver: find an element using CSS Selector and hover over it.
109 self.HoverOver("css_selector")
110 * SendEnterTo: find an element using CSS Selector and send enter to it.
111 self.SendEnterTo("css_selector")
112
113 * IsDisplayed: check if an element is displayed.
114 self.IsDisplayed("css_selector")
115 * Wait: wait for some amount of time in seconds.
116 self.Wait(10)
117 * WaitUntilDisplayed: wait for an element defined using CSS Selector to be
118 displayed.
119 self.WaitUntilDisplayed("css_selector")
120
121 * FillPasswordInto: find an input element using CSS Selector and fill it with
122 the password.
123 self.FillPasswordInto("css_selector")
124 * FillUsernameInto: find an input element using CSS Selector and fill it with
125 the username.
126 self.FillUsernameInto("css_selector")
127 * Submit: find an element using CSS Selector and call its submit() handler.
128 self.Submit("css_selector")
129
130
131 =====Files structure=====
132
133 Classes:
134 * environment.py: the definition the tests Environment.
135 * websitetest.py: WebsiteTest is defined here. You need to create an instance
136 of this class for each website you want to test.
137
138 Tests:
139 * tests.py: the tests setup and the configuration for each website happens
140 here. This file contain 3 separate kinds of tests:
141
142 1) working tests: tests that are supposed to work. If you have a problem with
143 one of them, rerun it again. Or try using the Known Issues section to fix it.
144 2) tests that can cause a crash (the cause of the crash is not related to the
145 password manager): This means that this set is expected to become a working
146 test or failing test when the issue that causes the crash now is solved.
147 3) failing tests: tests that fail for known bug related to the password
148 manager. When this bug is solved, all the tests that were failing because of
149 it are going to be moved to working tests.
150
151 Other files:
152 * websites.xml : a private file where you can find all the passwords. You can
153 ask someone to give it to you or just create your own with your personal
154 accounts.
155 <websites>
156 <website name = "website name">
157 <username>username</username>
158 <password>password</password>
159 </website>
160 </websites>
161
162
163 =====Known Issues=====
164
165 The tests are very fragile. Here are some suggestions for solving most of the
166 problems:
167 * Restart the tests.
168 * Remove the profile if the tests fail at the beginning for unknown reason.
169 * If tests fail, isolate the one that causes problem, read the log and keep
170 your eyes on the browser window to understand its causes:
171 a) In the tests, we often need to wait for a menu to appear ... If the
172 menu takes more time to appear than expected, the tests are going to fail.
173 b) The websites change very often. And even if they are not changed, they some
174 time show a popup that broke the tests. In the case you need to login manually
175 to the website, close all popup and logout.
176 * If you are logged in when the tests crashes, don't forget to log out before
177 running the tests a second time.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698