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