OLD | NEW |
---|---|
(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 Change the chrome path, chromedriver path and the new profile path in | |
21 environment.py : new profile path has to be just an empty folder. | |
22 | |
23 For security reasons, we didn't publish the passwords and the usernames we | |
24 used to test. So we put them to an xml file (websites.xml). The structure of | |
25 the file is the following: | |
26 <websites> | |
27 <website name = "website name"> | |
28 <username>username</username> | |
29 <password>password</password> | |
30 </website> | |
31 <websites> | |
32 You can ask someone to give you the websites.xml file and put it in the same | |
33 folder as the tests. You can also create your own websites.xml with your | |
34 personal accounts. | |
35 | |
36 Run all the working tests tests by executing: | |
37 python tests.py | |
38 | |
39 Run all the tests tests by executing: | |
vabr (Chromium)
2014/05/08 13:53:45
tests tests -- typo?
rchtara
2014/05/14 11:58:04
Done.
| |
40 python tests.py -all | |
41 | |
42 Run one or many tests by executing: | |
43 python tests.py google | |
44 python tests.py google facebook | |
45 python tests.py google facebook amazon | |
46 | |
47 =====Creating new test===== | |
48 | |
49 1) Open tests.py. | |
50 | |
51 2) Add these lines : | |
52 website = environment.AddWebsite("website name", | |
53 "username", | |
54 "password") | |
55 * For security reasons, you can use websites.xml which is a private to keep | |
56 your passwords. You have to add the following line to the xml file: | |
57 | |
58 <website name = "website name"> | |
59 <username>username</username> | |
60 <password>password</password> | |
61 </website> | |
62 | |
63 Then, to create the new test, you need just to add: | |
64 website = environment.AddWebsite("website name") | |
65 | |
66 3) Add login actions: login actions are a sequence of elementary steps | |
67 that you need to do to login. | |
68 The actions that you can use are: | |
69 * goto: go to some url | |
70 website.AddLoginAction("goto", "url") | |
71 * wait: wait for some amount of time. | |
72 website.AddLoginAction("wait", 10) | |
73 * click: find an element using CSS Selector and click on it. | |
74 website.AddLoginAction("click", "css_selector") | |
75 * hover: find an element using CSS Selector and hover it. | |
76 website.AddLoginAction("hover", "css_selector") | |
77 * fillusername: find an input element using CSS Selector and fill it with | |
78 the username. | |
79 website.AddLoginAction("fillusername", "css_selector") | |
80 * optinalfillusername: find an input element using CSS Selector and fill it | |
vabr (Chromium)
2014/05/08 13:53:45
typo: optinal -> optional
rchtara
2014/05/14 11:58:04
Done.
| |
81 with the username. Don't break if the input element is not available. | |
vabr (Chromium)
2014/05/08 13:53:45
nit: "Don't break" -> "Do nothing"
(It's not clear
vabr (Chromium)
2014/05/08 13:53:45
available -> visible
rchtara
2014/05/14 11:58:04
Done.
rchtara
2014/05/14 11:58:04
Done.
| |
82 website.AddLoginAction("optinalfillusername", "css_selector") | |
83 * fillpassword: find an input element using CSS Selector and fill it with | |
84 the password. | |
85 website.AddLoginAction("password", "css_selector") | |
86 * submit: find an element using CSS Selector and submit it. | |
87 website.AddLoginAction("submit", "css_selector") | |
88 * enter: find an element using CSS Selector and send enter to it. | |
89 website.AddLoginAction("enter", "css_selector") | |
90 | |
91 4) Add logout actions: logout actions are a sequence of elementary steps | |
92 that you need to do to logout. | |
93 The actions are the same as for the login ones. | |
94 | |
95 | |
96 =====Files structure===== | |
97 | |
98 Classes: | |
99 * action.py: Action is defined here. addLoginAction and addLogoutAction in the | |
100 class website create an instance of Action. If you need a new kind of files | |
vabr (Chromium)
2014/05/08 13:53:45
I'm not sure I understand what "new kind of files"
rchtara
2014/05/14 11:58:04
Done.
| |
101 you can add it here. | |
102 * environment.py: the definition the tests Environment. | |
103 * website.py: Website is defined here. You need to create an instance of this | |
104 class for each website you want to test. | |
105 | |
106 Tests: | |
107 * tests.py: the tests setup and the configuration for each website happens | |
108 here. This file contain 3 separate kinds of tests: | |
109 | |
110 1) working tests: tests that are supposed to work. If you have a problem with | |
111 one of them, rerun it again. Or try using the Known Issues section to fix it. | |
112 2) tests that can cause a crash (the cause of the crash is not related to the | |
113 password manager): This means that this set is expected to become a working | |
114 test or failing test when the issue that causes the crash now is solved. | |
115 3) failing tests: tests that fail for known bug related to the password | |
116 manager. When this bug is solved, all the tests that were failing because of | |
117 it are going to be moved to working tests. | |
118 | |
119 Other files: | |
120 * websites.xml : a private file where you can find all the passwords. You can | |
121 ask someone to give it to you or just create your own with your personal | |
122 accounts. | |
123 <websites> | |
124 <website name = "website name"> | |
125 <username>username</username> | |
126 <password>password</password> | |
127 </website> | |
128 </websites> | |
129 | |
130 | |
131 =====Known Issues===== | |
132 | |
133 The tests are very fragile. Here are some suggestions for solving most of the | |
134 problems: | |
135 * Restart the tests. | |
136 * Remove the profile if the tests fail at the beginning for unknown reason. | |
137 * If tests fail, isolate the one that causes problem, read the log and keep | |
138 your eyes on the browser window to understand its causes: | |
139 a) In the tests, we often need to wait for a menu to appear ... If the | |
140 menu takes more time to appear than expected, the tests are going to fail. | |
141 b) The websites change very often. And even if they are not changed, they some | |
142 time show a popup that broke the tests. In the case you need to login manually | |
143 to the website, close all popup and logout. | |
144 * If you are logged in when the tests crashes, don't forget to log out before | |
145 running the tests a second time. | |
OLD | NEW |