├── .gitattributes
├── README.md
└── automate-amazon
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── libraries
│ ├── Maven__cglib_cglib_nodep_2_1_3.xml
│ ├── Maven__com_beust_jcommander_1_12.xml
│ ├── Maven__com_google_code_gson_gson_2_3_1.xml
│ ├── Maven__com_google_guava_guava_18_0.xml
│ ├── Maven__commons_codec_commons_codec_1_10.xml
│ ├── Maven__commons_collections_commons_collections_3_2_1.xml
│ ├── Maven__commons_io_commons_io_2_4.xml
│ ├── Maven__commons_logging_commons_logging_1_2.xml
│ ├── Maven__io_netty_netty_3_5_2_Final.xml
│ ├── Maven__junit_junit_3_8_1.xml
│ ├── Maven__net_java_dev_jna_jna_4_1_0.xml
│ ├── Maven__net_java_dev_jna_jna_platform_4_1_0.xml
│ ├── Maven__net_sourceforge_cssparser_cssparser_0_9_16.xml
│ ├── Maven__net_sourceforge_htmlunit_htmlunit_2_18.xml
│ ├── Maven__net_sourceforge_htmlunit_htmlunit_core_js_2_17.xml
│ ├── Maven__net_sourceforge_nekohtml_nekohtml_1_9_22.xml
│ ├── Maven__org_apache_commons_commons_exec_1_3.xml
│ ├── Maven__org_apache_commons_commons_lang3_3_4.xml
│ ├── Maven__org_apache_httpcomponents_httpclient_4_5_1.xml
│ ├── Maven__org_apache_httpcomponents_httpcore_4_4_3.xml
│ ├── Maven__org_apache_httpcomponents_httpmime_4_5.xml
│ ├── Maven__org_apache_logging_log4j_log4j_api_2_5.xml
│ ├── Maven__org_apache_logging_log4j_log4j_core_2_5.xml
│ ├── Maven__org_beanshell_bsh_2_0b4.xml
│ ├── Maven__org_eclipse_jetty_jetty_io_9_2_12_v20150709.xml
│ ├── Maven__org_eclipse_jetty_jetty_util_9_2_12_v20150709.xml
│ ├── Maven__org_eclipse_jetty_websocket_websocket_api_9_2_12_v20150709.xml
│ ├── Maven__org_eclipse_jetty_websocket_websocket_client_9_2_12_v20150709.xml
│ ├── Maven__org_eclipse_jetty_websocket_websocket_common_9_2_12_v20150709.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_api_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_chrome_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_edge_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_firefox_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_htmlunit_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_ie_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_java_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_leg_rc_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_remote_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_safari_driver_2_48_2.xml
│ ├── Maven__org_seleniumhq_selenium_selenium_support_2_48_2.xml
│ ├── Maven__org_testng_testng_6_1_1.xml
│ ├── Maven__org_w3c_css_sac_1_3.xml
│ ├── Maven__org_webbitserver_webbit_0_4_14.xml
│ ├── Maven__org_yaml_snakeyaml_1_6.xml
│ ├── Maven__xalan_serializer_2_7_2.xml
│ ├── Maven__xalan_xalan_2_7_2.xml
│ ├── Maven__xerces_xercesImpl_2_11_0.xml
│ ├── Maven__xml_apis_xml_apis_1_4_01.xml
│ ├── apache_log4j_2.xml
│ └── org_apache_logging_log4j_log4j_api_2_0.xml
├── misc.xml
├── modules.xml
├── uiDesigner.xml
└── workspace.xml
├── all.log
├── automate-amazon.iml
├── lib
├── log4j-api-2.0-javadoc.jar
├── log4j-api-2.0-sources.jar
├── log4j-api-2.0.jar
└── org.osgi.core-4.3.1.jar
├── log
└── CrunchifyTest.log
├── pom.xml
├── src
└── test
│ └── java
│ ├── actions
│ └── OrderActions.java
│ ├── base
│ └── LoadProperties.java
│ ├── enums
│ ├── Products.java
│ └── Url.java
│ ├── pages
│ ├── HomePage.java
│ ├── ProductPage.java
│ ├── ShoppingCartPage.java
│ ├── ShoppingCartReviewPage.java
│ └── SignInPage.java
│ ├── pojo
│ └── Book.java
│ ├── properties
│ └── user.properties
│ ├── testcases
│ └── PurchaseOrderTest.java
│ └── utils
│ ├── CommonUtils.java
│ └── DriverUtils.java
└── target
└── test-classes
├── actions
└── OrderActions.class
├── base
└── LoadProperties.class
├── enums
├── Products.class
└── Url.class
├── pages
├── HomePage.class
├── ProductPage.class
├── ShoppingCartPage.class
├── ShoppingCartReviewPage.class
└── SignInPage.class
├── pojo
└── Book.class
├── testcases
└── PurchaseOrderTest.class
└── utils
├── CommonUtils.class
└── DriverUtils.class
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # automate-amazon
2 | December 2015 - January 2016
3 |
A practice automation test framework for Amazon.com, based on the knowledge gained as a first year automation engineer at Fitbit-Boston.
4 | Problems: I wasn't able to set up tests to run in parallel. I didn't initially build that into DriverUtils, and haven't been able to figure this part out.
5 | Blog: Adventures in Automation
6 | A sample project in order to practice designing automated test frameworks.
7 |
8 | Automate Amazon:
9 |
20 |
21 |
22 | The directory structure:
23 |
24 | src/test/java
25 |
26 | actions
27 |
30 | base
31 |
34 | enums
35 |
39 | pages
40 |
47 | pojo
48 |
51 | properties
52 |
55 | testcases
56 |
59 | utils
60 |
64 |
65 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/.name:
--------------------------------------------------------------------------------
1 | automate-amazon
--------------------------------------------------------------------------------
/automate-amazon/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__cglib_cglib_nodep_2_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__com_beust_jcommander_1_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__com_google_code_gson_gson_2_3_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__com_google_guava_guava_18_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__commons_codec_commons_codec_1_10.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__commons_collections_commons_collections_3_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__commons_io_commons_io_2_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__io_netty_netty_3_5_2_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__junit_junit_3_8_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_java_dev_jna_jna_4_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_java_dev_jna_jna_platform_4_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_sourceforge_cssparser_cssparser_0_9_16.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_sourceforge_htmlunit_htmlunit_2_18.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_sourceforge_htmlunit_htmlunit_core_js_2_17.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__net_sourceforge_nekohtml_nekohtml_1_9_22.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_commons_commons_exec_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_httpcomponents_httpmime_4_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_beanshell_bsh_2_0b4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_eclipse_jetty_jetty_io_9_2_12_v20150709.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_eclipse_jetty_jetty_util_9_2_12_v20150709.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_api_9_2_12_v20150709.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_client_9_2_12_v20150709.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_eclipse_jetty_websocket_websocket_common_9_2_12_v20150709.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_api_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_chrome_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_edge_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_firefox_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_htmlunit_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_ie_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_java_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_leg_rc_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_remote_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_safari_driver_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_seleniumhq_selenium_selenium_support_2_48_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_testng_testng_6_1_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_w3c_css_sac_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_webbitserver_webbit_0_4_14.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__org_yaml_snakeyaml_1_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__xalan_serializer_2_7_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__xalan_xalan_2_7_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__xerces_xercesImpl_2_11_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/Maven__xml_apis_xml_apis_1_4_01.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/apache_log4j_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/libraries/org_apache_logging_log4j_log4j_api_2_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 | -
9 |
10 |
11 | -
12 |
13 |
14 | -
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
45 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/automate-amazon/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 | 1450150327488
727 |
728 | 1450150327488
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 | file://$USER_HOME$/Documents/code/github/automate-amazon/automate-amazon/src/test/java/pages/ShoppingCartPage.java
832 | 19
833 |
834 |
835 |
836 |
837 | file://$USER_HOME$/Documents/code/github/automate-amazon/automate-amazon/src/test/java/pages/ShoppingCartReviewPage.java
838 | 16
839 |
840 |
841 |
842 |
843 | file://$USER_HOME$/Documents/code/github/automate-amazon/automate-amazon/src/test/java/pages/HomePage.java
844 | 10
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
866 |
867 |
868 |
869 |
870 |
871 |
872 |
873 |
874 |
875 |
876 |
877 |
878 |
879 |
880 |
881 |
882 |
883 |
884 |
885 |
886 |
887 |
888 |
889 |
890 |
891 |
892 |
893 |
894 |
895 |
896 |
897 |
898 |
899 |
900 |
901 |
902 |
903 |
904 |
905 |
906 |
907 |
908 |
909 |
910 |
911 |
912 |
913 |
914 |
915 |
916 |
917 |
918 |
919 |
920 |
921 |
922 |
923 |
924 |
925 |
926 |
927 |
928 |
929 |
930 |
931 |
932 |
933 |
934 |
935 |
936 |
937 |
938 |
939 |
940 |
941 |
942 |
943 |
944 |
945 |
946 |
947 |
948 |
949 |
950 |
951 |
952 |
953 |
954 |
955 |
956 |
957 |
958 |
959 |
960 |
961 |
962 |
963 |
964 |
965 |
966 |
967 |
968 |
969 |
970 |
971 |
972 |
973 |
974 |
975 |
976 |
977 |
978 |
979 |
980 |
981 |
982 |
983 |
984 |
985 |
986 |
987 |
988 |
989 |
990 |
991 |
992 |
993 |
994 |
995 |
996 |
997 |
998 |
999 |
1000 |
1001 |
1002 |
1003 |
1004 |
1005 |
1006 |
1007 |
1008 |
1009 |
1010 |
1011 |
1012 |
1013 |
1014 |
1015 |
1016 |
1017 |
1018 |
1019 |
1020 |
1021 |
1022 |
1023 |
1024 |
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 |
1035 |
1036 |
1037 |
1038 |
1039 |
1040 |
1041 |
1042 |
1043 |
1044 |
1045 |
1046 |
1047 |
1048 |
1049 |
1050 |
1051 |
1052 |
1053 |
1054 |
1055 |
1056 |
1057 |
1058 |
1059 |
1060 |
1061 |
1062 |
1063 |
1064 |
1065 |
1066 |
1067 |
1068 |
1069 |
1070 |
1071 |
1072 |
1073 |
1074 |
1075 |
1076 |
1077 |
1078 |
1079 |
1080 |
1081 |
1082 |
1083 |
1084 |
1085 |
1086 |
1087 |
1088 |
1089 |
1090 |
1091 |
1092 |
1093 |
1094 |
1095 |
1096 |
1097 |
1098 |
1099 |
1100 |
1101 |
1102 |
1103 |
1104 |
1105 |
1106 |
1107 |
1108 |
1109 |
1110 |
1111 |
1112 |
1113 |
1114 |
1115 |
1116 |
1117 |
1118 |
1119 |
1120 |
1121 |
1122 |
1123 |
1124 |
1125 |
1126 |
1127 |
1128 |
1129 |
1130 |
1131 |
1132 |
1133 |
1134 |
1135 |
1136 |
1137 |
1138 |
1139 |
1140 |
1141 |
1142 |
1143 |
1144 |
1145 |
1146 |
1147 |
1148 |
1149 |
1150 |
1151 |
1152 |
1153 |
1154 |
1155 |
1156 |
1157 |
1158 |
1159 |
1160 |
1161 |
1162 |
1163 |
1164 |
1165 | No facets are configured
1166 |
1167 |
1168 |
1169 |
1170 |
1171 |
1172 |
1173 |
1174 |
1175 |
1176 |
1177 |
1178 |
1179 |
1180 |
1181 |
1182 |
1183 |
1184 |
1185 |
1186 |
1187 |
1188 | 1.8
1189 |
1190 |
1191 |
1192 |
1193 |
1194 |
1195 |
1196 |
1197 |
1198 |
1199 |
1200 | automate-amazon
1201 |
1202 |
1203 |
1204 |
1205 |
1206 |
1207 |
1208 |
1209 |
1210 |
1211 |
1212 |
1213 | 1.8
1214 |
1215 |
1216 |
1217 |
1218 |
1219 |
1220 |
1221 |
1222 |
1223 |
1224 |
1225 | apache-log4j-2
1226 |
1227 |
1228 |
1229 |
1230 |
1231 |
1232 |
1233 |
1234 |
1235 |
1236 |
1237 |
--------------------------------------------------------------------------------
/automate-amazon/all.log:
--------------------------------------------------------------------------------
1 | 2015-12-22 23:18:08.781 [main] INFO OrderActions - INITIALIZING: Signing out, if needed.
2 |
3 | 2015-12-22 23:18:08.912 [main] INFO HomePage - Navigating to Amazon.com: http://www.amazon.com
4 | 2015-12-22 23:18:08.941 [main] INFO HomePage - Selecting [YOUR_ACCOUNT] in navigation bar.
5 | 2015-12-22 23:18:13.491 [main] INFO HomePage - Navigating to the SIGNIN_PAGE.
6 |
7 | 2015-12-22 23:18:13.491 [main] INFO SignInPage - Entering username: amzn.tester23@gmail.com
8 | 2015-12-22 23:18:15.311 [main] INFO SignInPage - Entering password.
9 | 2015-12-22 23:18:16.308 [main] INFO SignInPage - Clicking the [SIGN_IN] button.
10 |
11 | 2015-12-22 23:18:20.031 [main] INFO OrderActions - INITIALIZING: Deleting all Items in Cart.
12 |
13 | 2015-12-22 23:18:22.734 [main] INFO OrderActions - Starting process to load info for HITCHHIKERS_GUIDE:
14 | 2015-12-22 23:18:22.830 [main] INFO ProductPage - Navigated to http://www.amazon.com/gp/product/0345391802
15 |
--------------------------------------------------------------------------------
/automate-amazon/automate-amazon.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/automate-amazon/lib/log4j-api-2.0-javadoc.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/lib/log4j-api-2.0-javadoc.jar
--------------------------------------------------------------------------------
/automate-amazon/lib/log4j-api-2.0-sources.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/lib/log4j-api-2.0-sources.jar
--------------------------------------------------------------------------------
/automate-amazon/lib/log4j-api-2.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/lib/log4j-api-2.0.jar
--------------------------------------------------------------------------------
/automate-amazon/lib/org.osgi.core-4.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/lib/org.osgi.core-4.3.1.jar
--------------------------------------------------------------------------------
/automate-amazon/log/CrunchifyTest.log:
--------------------------------------------------------------------------------
1 | 2015-12-22 21:09:08,383 [main] INFO HomePage:24 - HOME_PAGE: Navigating to Amazon.com: http://www.amazon.com
2 | 2015-12-22 21:09:08,413 [main] INFO HomePage:29 - HOME_PAGE: Selecting [YOUR_ACCOUNT] in navigation bar.
3 | 2015-12-22 21:09:13,504 [main] INFO HomePage:31 - HOME_PAGE: Navigating to the SIGNIN_PAGE.
4 |
5 |
--------------------------------------------------------------------------------
/automate-amazon/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.tjmaher.selenium
8 | com.tjmaher.selenium
9 | 1.0-SNAPSHOT
10 |
11 |
12 | org.seleniumhq.selenium
13 | selenium-java
14 | 2.48.2
15 |
16 |
17 | org.testng
18 | testng
19 | 6.1.1
20 |
21 |
22 | org.apache.logging.log4j
23 | log4j-api
24 | 2.5
25 |
26 |
27 | org.apache.logging.log4j
28 | log4j-core
29 | 2.5
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/actions/OrderActions.java:
--------------------------------------------------------------------------------
1 | package actions;
2 |
3 | import enums.Products;
4 | import pages.*;
5 | import pojo.Book;
6 |
7 | /**
8 | * Created by tmaher on 12/21/2015.
9 | */
10 | public class OrderActions {
11 |
12 | public void navigateToHomePage(){
13 | HomePage homePage = new HomePage();
14 | homePage.navigateToHomePage();
15 | }
16 |
17 | public void loginAs(String username, String password){
18 | HomePage homePage = new HomePage();
19 | SignInPage signIn = new SignInPage();
20 | homePage.navigateToSignInPage();
21 | signIn.enterUsername(username);
22 | signIn.enterPassword(password);
23 | signIn.clickSignInButton();
24 | }
25 |
26 | public Book loadProductPageDataIntoProductObject(Products product){
27 | System.out.println("Starting process to load info for " + product + ":");
28 | Book book = new Book();
29 | ProductPage productPage = new ProductPage();
30 | productPage.navigateToProductPage(product);
31 | productPage.verifyProductTitle(product.getProductTitle());
32 | book.loadInfoFromProductPage();
33 | System.out.println(book + "\n");
34 | return book;
35 | }
36 |
37 | public void addProductToShoppingCartReview(Products product){
38 | ShoppingCartReviewPage shoppingCartReviewPage = new ShoppingCartReviewPage();
39 | System.out.println("Adding " + product + " to cart:");
40 | ProductPage productPage = new ProductPage();
41 | productPage.navigateToProductPage(product);
42 | productPage.verifyProductTitle(product.getProductTitle());
43 | productPage.clickAddToCart();
44 | shoppingCartReviewPage.verifyOnShoppingCartReviewPage();
45 | }
46 |
47 | public Book loadShoppingCartDataIntoProductObject(Products product){
48 | ShoppingCartPage shoppingCartPage = new ShoppingCartPage();
49 | Book book = new Book();
50 | shoppingCartPage.verifyOnShoppingCartPage();
51 |
52 | return book;
53 | }
54 |
55 | public void initializeLogin(){
56 | System.out.println("INITIALIZING: Signing out, if needed.\n");
57 | signOut();
58 | }
59 |
60 | public void initializeCart(){
61 | System.out.println("INITIALIZING: Deleting all Items in Cart.\n");
62 | deleteAllItemsIfAnyFromCart();
63 | }
64 |
65 | public void signOut(){
66 | HomePage homePage = new HomePage();
67 | homePage.signOutWithSignOutLink();
68 | }
69 |
70 | public void deleteAllItemsIfAnyFromCart(){
71 | HomePage homePage = new HomePage();
72 | ShoppingCartPage shoppingCartPage = new ShoppingCartPage();
73 | String itemsInCart = homePage.getNumberOfItemsListedInShoppingCartIcon();
74 | if (!itemsInCart.equals("0")){
75 | homePage.selectShoppingCartIcon();
76 | shoppingCartPage.deleteAllItemsInCart();
77 | } else {
78 | System.out.println("\t* There are already '0' items in the Shopping Cart.");
79 | }
80 | }
81 |
82 | /**
83 | * Compares actual and expected values, and sets up the results in one line item.
84 | * @param fieldName: What you are comparing, such as "unitPrice".
85 | * @param actualValue: The value you wish to compare.
86 | * @param expectedValue: The value you hope the actual value will be.
87 | * @return
88 | */
89 | private String outputPassOrFailOnFieldComparison(String fieldName, String actualValue, String expectedValue){
90 | if (actualValue.equals(expectedValue)){
91 | return "\t* " + fieldName + ": '" + actualValue + "' (PASS)";
92 | } else {
93 | return "\t* " + fieldName + ": '" + actualValue + "' : Should be: '" + expectedValue + "' (FAIL)";
94 | }
95 | }
96 |
97 | public boolean checkMatchingValues(String testHeading, Object actualValue, Object expectedValue) {
98 | String successMessage = "\t* The Expected and Actual Values match. (PASS)\n";
99 | String failureMessage = "\t* The Expected and Actual Values do not match! (FAIL)\n";
100 |
101 | boolean doesPriceMatch = false;
102 |
103 | System.out.println(testHeading);
104 | System.out.println("\t* Expected Value: " + expectedValue);
105 | System.out.println("\t* Actual Value: " + actualValue);
106 |
107 | if (actualValue.equals(expectedValue)) {
108 | System.out.println(successMessage);
109 | doesPriceMatch = true;
110 | } else {
111 | System.out.println(failureMessage);
112 | doesPriceMatch = false;
113 | }
114 | return doesPriceMatch;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/base/LoadProperties.java:
--------------------------------------------------------------------------------
1 | package base;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 |
5 | import java.io.FileInputStream;
6 | import java.io.FileNotFoundException;
7 | import java.io.IOException;
8 | import java.util.Properties;
9 | import java.util.Set;
10 |
11 | /**
12 | * Created by tmaher on 12/22/2015.
13 | */
14 | public class LoadProperties {
15 |
16 | public static Properties user = loadProperties("src/test/java/properties/user.properties");
17 |
18 | private static Properties loadProperties(String filePath) {
19 | Properties properties = new Properties();
20 | try {
21 | FileInputStream f = new FileInputStream(filePath);
22 | properties.load(f);
23 | } catch (FileNotFoundException e) {
24 | e.printStackTrace();
25 | } catch (IOException e){
26 | e.printStackTrace();
27 | }
28 | return properties;
29 | }
30 |
31 | public static String getPropertyValue(String path, String key){
32 | Properties p = loadProperties(path);
33 | String result = "";
34 |
35 | Set values = p.stringPropertyNames();
36 | for(String value : values){
37 | if(StringUtils.equalsIgnoreCase(value, key)){
38 | result = p.getProperty(value);
39 | break;
40 | }
41 | }
42 | return result;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/enums/Products.java:
--------------------------------------------------------------------------------
1 | package enums;
2 |
3 | /**
4 | * Created by tmaher on 12/22/2015.
5 | */
6 | public enum Products {
7 | HITCHHIKERS_GUIDE("0345391802", "The Hitchhiker's Guide to the Galaxy");
8 |
9 | // The price will always fluctuate. The product id and product title will be more or less constant.
10 | private String id;
11 | private String productTitle;
12 |
13 | Products(String id, String productTitle){
14 | this.id = id;
15 | this.productTitle = productTitle;
16 | }
17 |
18 | public String getProductId(){
19 | return id;
20 | }
21 |
22 | public String getProductTitle(){
23 | return productTitle;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/enums/Url.java:
--------------------------------------------------------------------------------
1 | package enums;
2 |
3 | /**
4 | * Created by tmaher on 12/22/2015.
5 | */
6 | public enum Url {
7 | PRODUCT_SECTION("/gp/product"),
8 | BASEURL("http://www.amazon.com"),
9 | SIGNOUT("/gp/flex/sign-out.html");
10 |
11 | String url;
12 |
13 | Url(String url){
14 | this.url = url;
15 | }
16 |
17 | public String getURL() {
18 | return url;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pages/HomePage.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import enums.Url;
4 | import org.openqa.selenium.By;
5 | import utils.CommonUtils;
6 |
7 | /**
8 | * Created by tmaher on 12/21/2015.
9 | */
10 | public class HomePage extends CommonUtils {
11 | private final By YOUR_ACCOUNT = By.id("nav-link-yourAccount");
12 | private final By SHOPPING_CART_ICON = By.cssSelector("#nav-cart");
13 | private final By SHOPPING_CART_COUNT = By.cssSelector("#nav-cart > #nav-cart-count");
14 |
15 | public HomePage(){
16 | }
17 |
18 | public void navigateToHomePage() {
19 | String url = Url.BASEURL.getURL();
20 | System.out.println("Navigating to Amazon.com: " + url);
21 | navigateToURL(url);
22 | }
23 |
24 | public void navigateToSignInPage(){
25 | System.out.println("HOME_PAGE: Selecting [YOUR_ACCOUNT] in navigation bar.");
26 | scrollToThenClick(YOUR_ACCOUNT);
27 | System.out.println("HOME_PAGE: Navigating to the SIGNIN_PAGE.\n");
28 | }
29 |
30 | public void signOutWithSignOutLink(){
31 | String url = Url.BASEURL.getURL() + Url.SIGNOUT.getURL();
32 | navigateToURL(url);
33 | }
34 |
35 | public void selectShoppingCartIcon(){
36 | click(SHOPPING_CART_ICON);
37 | }
38 |
39 | public String getNumberOfItemsListedInShoppingCartIcon(){
40 | return getElementText(SHOPPING_CART_COUNT);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pages/ProductPage.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import enums.Products;
4 | import enums.Url;
5 | import org.openqa.selenium.By;
6 | import org.testng.TestException;
7 | import utils.CommonUtils;
8 |
9 | /**
10 | * Created by tmaher on 12/21/2015.
11 | */
12 | public class ProductPage extends CommonUtils {
13 |
14 | private final By PRODUCT_TITLE = By.cssSelector("#productTitle");
15 | private final By AUTHOR = By.cssSelector(".a-link-normal.contributorNameID");
16 | private final By EDITION = By.cssSelector(".a-size-medium.a-color-secondary.a-text-normal");
17 | private final By PRICE = By.cssSelector(".a-size-medium.a-color-price.offer-price.a-text-normal");
18 | private final By ADD_TO_CART = By.cssSelector("#add-to-cart-button");
19 |
20 | public void navigateToProductPage(Products product){
21 | String url = Url.BASEURL.getURL() + Url.PRODUCT_SECTION.getURL() + "/" + product.getProductId();
22 | navigateToURL(url);
23 | System.out.println("PRODUCT_PAGE: Navigated to " + url);
24 | }
25 |
26 | public void verifyProductTitle(String expectedTitle){
27 | String actualTitle = getProductTitle();
28 | System.out.println("PRODUCT_PAGE: Verifying that the product title is '" + actualTitle + "'");
29 | if (!expectedTitle.equals(actualTitle)){
30 | throw new TestException("ERROR: PRODUCT_PAGE: Product Title is ['" + actualTitle + "']. Expected ['" + expectedTitle + "'].");
31 | }
32 | }
33 |
34 | public String getProductTitle(){
35 | return getElementText(PRODUCT_TITLE);
36 | }
37 |
38 | public String getAuthor(){
39 | return getElementText(AUTHOR);
40 | }
41 |
42 | public String getEdition(){
43 | return getElementText(EDITION);
44 | }
45 |
46 | public String getPrice(){
47 | return getElementText(PRICE);
48 | }
49 |
50 | public void clickAddToCart(){
51 | System.out.println("PRODUCT_PAGE: Clicking on [ADD_TO_CART] button. \n");
52 | click(ADD_TO_CART);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pages/ShoppingCartPage.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import org.openqa.selenium.By;
4 | import org.openqa.selenium.WebElement;
5 | import org.testng.TestException;
6 | import utils.CommonUtils;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by tmaher on 12/21/2015.
12 | */
13 | public class ShoppingCartPage extends CommonUtils {
14 |
15 | private final By SHOPPING_CART_HEADER = By.cssSelector("h1");
16 | private final By DELETE_BUTTONS = By.cssSelector("input[value='Delete']");
17 | private final String SHOPPING_CART_EMPTY_MSG = "Your Shopping Cart is empty.";
18 |
19 | public void verifyOnShoppingCartPage(){
20 | String url = getCurrentURL();
21 | System.out.println("SHOPPING_CART_PAGE: Verifying that we are on SHOPPING_CART_PAGE.");
22 | if (!url.contains("cart")){
23 | throw new TestException("ERROR: Not on SHOPPING_CART_PAGE! URL: " + url);
24 | }
25 | }
26 |
27 | public void verifyOnShoppingCartReviewPage(){
28 | String url = getCurrentURL();
29 | System.out.println("SHOPPING_CART_PAGE: Verifying that we are on SHOPPING_CART_REVIEW_PAGE.");
30 | if (!url.contains("view")){
31 | throw new TestException("ERROR: Not on SHOPPING_CART_PAGE! URL: " + url);
32 | }
33 | }
34 |
35 | public String getShoppingCartMessage(){
36 |
37 | return getElementText(SHOPPING_CART_HEADER);
38 | }
39 |
40 | boolean checkIfShoppingCartHeaderListsEmptyMessage(){
41 | String actualMessage = getShoppingCartMessage();
42 | return (actualMessage.equals(SHOPPING_CART_EMPTY_MSG));
43 | }
44 |
45 | public void deleteAllItemsInCart(){
46 | List deleteButtons = getElements(DELETE_BUTTONS);
47 | for ( WebElement button : deleteButtons ){
48 | button.click();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pages/ShoppingCartReviewPage.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import org.openqa.selenium.By;
4 | import org.testng.TestException;
5 | import utils.CommonUtils;
6 |
7 | /**
8 | * Created by tmaher on 12/21/2015.
9 | */
10 | public class ShoppingCartReviewPage extends CommonUtils {
11 |
12 | private final By CART_BUTTON = By.cssSelector("#hlb-view-cart-announce");
13 | private final By PROCEED_TO_CHECKOUT_BUTTON = By.cssSelector("#hlb-ptc-btn-native");
14 | private final By PRICE = By.cssSelector("[class='a-color-price hlb-price a-inline-block a-text-bold']");
15 |
16 | public void verifyOnShoppingCartReviewPage(){
17 | String url = getCurrentURL();
18 | System.out.println("SHOPPING_CART_REVIEW_PAGE: Verifying that we are on SHOPPING_CART_REVIEW_PAGE.");
19 | if (!url.contains("view")){
20 | throw new TestException("ERROR: Not on SHOPPING_CART_REVIEW_PAGE! URL: " + url);
21 | }
22 | }
23 |
24 | public String getCartSubtotal(){
25 | return getElementText(PRICE);
26 | }
27 |
28 | public void clickProceedToCheckoutButton(){
29 | click(PROCEED_TO_CHECKOUT_BUTTON);
30 | }
31 |
32 | public void clickCartButton() {
33 | click(CART_BUTTON);
34 | }
35 |
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pages/SignInPage.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import org.openqa.selenium.By;
4 | import utils.CommonUtils;
5 |
6 | /**
7 | * Created by tmaher on 12/21/2015.
8 | */
9 | public class SignInPage extends CommonUtils {
10 |
11 | private final By USERNAME = By.cssSelector("#ap_email");
12 | private final By PASSWORD = By.cssSelector("#ap_password");
13 | private final By SIGNIN_BUTTON = By.cssSelector("#signInSubmit");
14 |
15 | public void enterUsername(String userName){
16 | System.out.println("SIGNIN_PAGE: Entering username: " + userName);
17 | waitForElementToBeVisible(USERNAME);
18 | sendKeys(USERNAME, userName);
19 | }
20 |
21 | public void enterPassword(String password){
22 | System.out.println("SIGNIN_PAGE: Entering password.");
23 | waitForElementToBeVisible(PASSWORD);
24 | sendKeys(PASSWORD, password);
25 | }
26 |
27 | public void clickSignInButton(){
28 | System.out.println("SIGNIN_PAGE: Clicking the [SIGN_IN] button.\n");
29 | click(SIGNIN_BUTTON);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/pojo/Book.java:
--------------------------------------------------------------------------------
1 | package pojo;
2 |
3 | import org.testng.TestException;
4 | import pages.ProductPage;
5 |
6 | /**
7 | * Created by tmaher on 12/22/2015.
8 | */
9 | public class Book {
10 | private String productTitle = "";
11 | private String author = "";
12 | private String offerPrice = "";
13 | private String edition = "";
14 |
15 | public Book(){
16 | }
17 |
18 | @Override
19 | public String toString(){
20 | return String.format(
21 | "Product Title: " + this.productTitle + "\n"
22 | + "Author: " + this.author + "\n"
23 | + "Edition: " + this.edition + "\n"
24 | + "Offer Price: " + this.offerPrice + "\n"
25 | );
26 | }
27 |
28 | public void loadInfoFromProductPage(){
29 | ProductPage productPage = new ProductPage();
30 | String currentURL = productPage.getCurrentURL();
31 |
32 | if (!currentURL.contains("product")){
33 | throw new TestException("LOAD INFO ERROR: Product data should only be loaded from product page!\nCurrent URL: " + currentURL);
34 | } else {
35 | System.out.println("LOAD_INFO: Loading data...\n");
36 | this.productTitle = productPage.getProductTitle();
37 | this.author = productPage.getAuthor();
38 | this.offerPrice = productPage.getPrice();
39 | this.edition = productPage.getEdition();
40 | }
41 | }
42 |
43 | public String getProductTitle() {
44 | return productTitle;
45 | }
46 |
47 | public void setProductTitle(String productTitle) {
48 | this.productTitle = productTitle;
49 | }
50 |
51 | public String getAuthor() {
52 | return author;
53 | }
54 |
55 | public void setAuthor(String author) {
56 | this.author = author;
57 | }
58 |
59 | public String getOfferPrice() {
60 | return offerPrice;
61 | }
62 |
63 | public void setOfferPrice(String offerPrice) {
64 | this.offerPrice = offerPrice;
65 | }
66 |
67 | public String getEdition() {
68 | return edition;
69 | }
70 |
71 | public void setEdition(String edition) {
72 | this.edition = edition;
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/properties/user.properties:
--------------------------------------------------------------------------------
1 | tester23.username=amzn.tester23@gmail.com
2 | tester23.password=amzntester23
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/testcases/PurchaseOrderTest.java:
--------------------------------------------------------------------------------
1 | package testcases;
2 |
3 |
4 | import base.LoadProperties;
5 | import enums.Products;
6 | import org.openqa.selenium.WebDriver;
7 | import actions.*;
8 | import org.testng.annotations.AfterClass;
9 | import org.testng.annotations.BeforeClass;
10 | import org.testng.annotations.Test;
11 | import pages.ShoppingCartReviewPage;
12 | import pojo.Book;
13 | import utils.DriverUtils;
14 |
15 |
16 | import static org.testng.Assert.assertEquals;
17 |
18 | /**
19 | * Created by tmaher on 12/14/2015.
20 | */
21 | public class PurchaseOrderTest {
22 |
23 | public WebDriver driver;
24 |
25 | @BeforeClass
26 | public void setUp(){
27 | driver = DriverUtils.getDriver();
28 |
29 | }
30 |
31 | // @Test()
32 | // public void test_Login(){
33 | // OrderActions orderActions = new OrderActions();
34 | // String username = LoadProperties.user.getProperty("tester23.username");
35 | // String password = LoadProperties.user.getProperty("tester23.password");
36 | // orderActions.navigateToHomePage();
37 | // orderActions.loginAs(username, password);
38 | // orderActions.initializeLogin();
39 | // }
40 |
41 | @Test()
42 | public void test_createPurchaseOrderForSingleProduct(){
43 | Products testBook = Products.HITCHHIKERS_GUIDE;
44 | String username = LoadProperties.user.getProperty("tester23.username");
45 | String password = LoadProperties.user.getProperty("tester23.password");
46 | OrderActions orderActions = new OrderActions();
47 | ShoppingCartReviewPage shoppingCartReviewPage = new ShoppingCartReviewPage();
48 |
49 | orderActions.initializeLogin();
50 | orderActions.navigateToHomePage();
51 | orderActions.loginAs(username, password);
52 | orderActions.initializeCart();
53 |
54 | Book bookProductPage = orderActions.loadProductPageDataIntoProductObject(testBook);
55 | orderActions.addProductToShoppingCartReview(testBook);
56 | String actualCartSubtotalPrice = shoppingCartReviewPage.getCartSubtotal();
57 | String expectedBookPrice = bookProductPage.getOfferPrice();
58 | orderActions.checkMatchingValues("Verify the Price Listed for the book:", actualCartSubtotalPrice, expectedBookPrice);
59 | assertEquals(actualCartSubtotalPrice, expectedBookPrice, "SHOPPING_CART_REVIEW: Cart Subtotal not what is expected!");
60 | //Book bookShoppingCart = orderActions.loadShoppingCartDataIntoProductObject(testBook);
61 | }
62 |
63 | @AfterClass
64 | public void tearDown(){
65 | driver.quit();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/utils/CommonUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import org.apache.commons.lang3.StringUtils;
4 | import org.openqa.selenium.*;
5 | import org.openqa.selenium.interactions.Actions;
6 | import org.openqa.selenium.support.ui.ExpectedConditions;
7 | import org.openqa.selenium.support.ui.Select;
8 | import org.openqa.selenium.support.ui.WebDriverWait;
9 | import org.testng.TestException;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | /**
15 | * Created by tmaher on 12/21/2015.
16 | */
17 | public abstract class CommonUtils {
18 |
19 | private static int timeout = 10;
20 |
21 | public CommonUtils() {
22 | _driver = DriverUtils.getDriver();
23 | }
24 |
25 | public static WebDriver _driver;
26 | public WebDriverWait wait;
27 | public Actions actions;
28 | public Select select;
29 |
30 | public void navigateToURL(String URL) {
31 | try {
32 | _driver.navigate().to(URL);
33 | } catch (Exception e) {
34 | System.out.println("FAILURE: URL did not load: " + URL);
35 | throw new TestException("URL did not load");
36 | }
37 | }
38 |
39 | public void navigateBack() {
40 | try {
41 | _driver.navigate().back();
42 | } catch (Exception e) {
43 | System.out.println("FAILURE: Could not navigate back to previous page.");
44 | throw new TestException("Could not navigate back to previous page.");
45 | }
46 | }
47 |
48 | public String getPageTitle() {
49 | try {
50 | return _driver.getTitle();
51 | } catch (Exception e) {
52 | throw new TestException(String.format("Current page title is: %s", _driver.getTitle()));
53 | }
54 | }
55 |
56 | public String getCurrentURL() {
57 | try {
58 | return _driver.getCurrentUrl();
59 | } catch (Exception e) {
60 | throw new TestException(String.format("Current URL is: %s", _driver.getCurrentUrl()));
61 | }
62 | }
63 |
64 | public WebElement getElement(By selector) {
65 | try {
66 | return _driver.findElement(selector);
67 | } catch (Exception e) {
68 | System.out.println(String.format("Element %s does not exist - proceeding", selector));
69 | }
70 | return null;
71 | }
72 |
73 | public String getElementText(By selector) {
74 | waitUntilElementIsDisplayedOnScreen(selector);
75 | try {
76 | return StringUtils.trim(_driver.findElement(selector).getText());
77 | } catch (Exception e) {
78 | System.out.println(String.format("Element %s does not exist - proceeding", selector));
79 | }
80 | return null;
81 | }
82 |
83 | public List getElements(By Selector) {
84 | waitForElementToBeVisible(Selector);
85 | try {
86 | return _driver.findElements(Selector);
87 | } catch (Exception e) {
88 | throw new NoSuchElementException(String.format("The following element did not display: [%s] ", Selector.toString()));
89 | }
90 | }
91 |
92 | public List getListOfElementTexts(By selector) {
93 | List elementList = new ArrayList();
94 | List elements = getElements(selector);
95 |
96 | for (WebElement element : elements) {
97 | if (element == null) {
98 | throw new TestException("Some elements in the list do not exist");
99 | }
100 | if (element.isDisplayed()) {
101 | elementList.add(element.getText().trim());
102 | }
103 | }
104 | return elementList;
105 | }
106 |
107 | public void click(By selector) {
108 | WebElement element = getElement(selector);
109 | waitForElementToBeClickable(selector);
110 | try {
111 | element.click();
112 | } catch (Exception e) {
113 | throw new TestException(String.format("The following element is not clickable: [%s]", selector));
114 | }
115 | }
116 |
117 | public void scrollToThenClick(By selector) {
118 | WebElement element = _driver.findElement(selector);
119 | actions = new Actions(_driver);
120 | try {
121 | ((JavascriptExecutor) _driver).executeScript("arguments[0].scrollIntoView(true);", element);
122 | actions.moveToElement(element).perform();
123 | actions.click(element).perform();
124 | } catch (Exception e) {
125 | throw new TestException(String.format("The following element is not clickable: [%s]", element.toString()));
126 | }
127 | }
128 |
129 | public void sendKeys(By selector, String value) {
130 | WebElement element = getElement(selector);
131 | clearField(element);
132 | try {
133 | element.sendKeys(value);
134 | } catch (Exception e) {
135 | throw new TestException(String.format("Error in sending [%s] to the following element: [%s]", value, selector.toString()));
136 | }
137 | }
138 |
139 | public void clearField(WebElement element) {
140 | try {
141 | element.clear();
142 | waitForElementTextToBeEmpty(element);
143 | } catch (Exception e) {
144 | System.out.print(String.format("The following element could not be cleared: [%s]", element.getText()));
145 | }
146 | }
147 |
148 | public void waitForElementToDisplay(By Selector) {
149 | WebElement element = getElement(Selector);
150 | while (!element.isDisplayed()) {
151 | System.out.println("Waiting for element to display: " + Selector);
152 | sleep(200);
153 | }
154 | }
155 |
156 | public void waitForElementTextToBeEmpty(WebElement element) {
157 | String text;
158 | try {
159 | text = element.getText();
160 | int maxRetries = 10;
161 | int retry = 0;
162 | while ((text.length() >= 1) || (retry < maxRetries)) {
163 | retry++;
164 | text = element.getText();
165 | }
166 | } catch (Exception e) {
167 | System.out.print(String.format("The following element could not be cleared: [%s]", element.getText()));
168 | }
169 |
170 | }
171 |
172 | public void waitForElementToBeVisible(By selector) {
173 | try {
174 | wait = new WebDriverWait(_driver, timeout);
175 | wait.until(ExpectedConditions.presenceOfElementLocated(selector));
176 | } catch (Exception e) {
177 | throw new NoSuchElementException(String.format("The following element was not visible: %s", selector));
178 | }
179 | }
180 |
181 | public void waitUntilElementIsDisplayedOnScreen(By selector) {
182 | try {
183 | wait = new WebDriverWait(_driver, timeout);
184 | wait.until(ExpectedConditions.visibilityOfElementLocated(selector));
185 | } catch (Exception e) {
186 | throw new NoSuchElementException(String.format("The following element was not visible: %s ", selector));
187 | }
188 | }
189 |
190 | public void waitForElementToBeClickable(By selector) {
191 | try {
192 | wait = new WebDriverWait(_driver, timeout);
193 | wait.until(ExpectedConditions.elementToBeClickable(selector));
194 | } catch (Exception e) {
195 | throw new TestException("The following element is not clickable: " + selector);
196 | }
197 | }
198 |
199 | public void sleep(final long millis) {
200 | System.out.println((String.format("sleeping %d ms", millis)));
201 | try {
202 | Thread.sleep(millis);
203 | } catch (InterruptedException ex) {
204 | ex.printStackTrace();
205 | }
206 | }
207 |
208 | public void selectIfOptionTextContains(By selector, String searchCriteria) {
209 |
210 | waitForElementToBeClickable(selector);
211 | Select dropdown = new Select(getElement(selector));
212 |
213 | List options = dropdown.getOptions();
214 |
215 | String optionText = "";
216 |
217 | if (options == null) {
218 | throw new TestException("Options for the dropdown list cannot be found.");
219 | }
220 |
221 | for (WebElement option : options) {
222 |
223 | optionText = option.getText().trim();
224 | boolean isOptionDisplayed = option.isDisplayed();
225 |
226 | if (optionText.contains(searchCriteria) && isOptionDisplayed) {
227 | try {
228 | dropdown.selectByVisibleText(optionText);
229 | break;
230 | } catch (Exception e) {
231 | throw new NoSuchElementException(String.format("The following element did not display: [%s] ", selector.toString()));
232 | }
233 | }
234 | }
235 | }
236 |
237 | public void selectIfOptionTextEquals(By selector, String searchCriteria) {
238 |
239 | waitForElementToBeClickable(selector);
240 | Select dropdown = new Select(getElement(selector));
241 |
242 | List options = dropdown.getOptions();
243 |
244 | String optionText = "";
245 |
246 | if (options == null) {
247 | throw new TestException("Options for the dropdown list cannot be found.");
248 | }
249 |
250 | for (WebElement option : options) {
251 |
252 | optionText = option.getText().trim();
253 | boolean isOptionDisplayed = option.isDisplayed();
254 |
255 | if (optionText.equals(searchCriteria) && isOptionDisplayed) {
256 | try {
257 | dropdown.selectByVisibleText(optionText);
258 | break;
259 | } catch (Exception e) {
260 | throw new NoSuchElementException(String.format("The following element did not display: [%s] ", selector.toString()));
261 | }
262 | }
263 | }
264 | }
265 |
266 | public List getDropdownValues(By selector) {
267 |
268 | waitForElementToDisplay(selector);
269 | Select dropdown = new Select(getElement(selector));
270 | List elementList = new ArrayList();
271 |
272 | List allValues = dropdown.getOptions();
273 |
274 | if (allValues == null) {
275 | throw new TestException("Some elements in the list do not exist");
276 | }
277 |
278 | for (WebElement value : allValues) {
279 | if (value.isDisplayed()) {
280 | elementList.add(value.getText().trim());
281 | }
282 | }
283 | return elementList;
284 | }
285 | }
--------------------------------------------------------------------------------
/automate-amazon/src/test/java/utils/DriverUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import org.openqa.selenium.WebDriver;
4 | import org.openqa.selenium.firefox.FirefoxDriver;
5 | import org.testng.annotations.AfterSuite;
6 | import org.testng.annotations.BeforeSuite;
7 |
8 | /**
9 | * Created by tmaher on 12/22/2015.
10 | */
11 | public class DriverUtils {
12 |
13 | public static WebDriver _driver;
14 |
15 | @BeforeSuite(alwaysRun = true)
16 | public void setUp() {
17 | _driver = new FirefoxDriver();
18 | }
19 |
20 | public static WebDriver getDriver() {
21 | if ( _driver == null) {
22 | _driver = new FirefoxDriver();
23 | }
24 | return _driver;
25 | }
26 |
27 | @AfterSuite(alwaysRun = true)
28 | public void tearDown() throws Exception {
29 | _driver.close();
30 | _driver.quit();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/actions/OrderActions.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/actions/OrderActions.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/base/LoadProperties.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/base/LoadProperties.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/enums/Products.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/enums/Products.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/enums/Url.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/enums/Url.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pages/HomePage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pages/HomePage.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pages/ProductPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pages/ProductPage.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pages/ShoppingCartPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pages/ShoppingCartPage.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pages/ShoppingCartReviewPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pages/ShoppingCartReviewPage.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pages/SignInPage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pages/SignInPage.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/pojo/Book.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/pojo/Book.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/testcases/PurchaseOrderTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/testcases/PurchaseOrderTest.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/utils/CommonUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/utils/CommonUtils.class
--------------------------------------------------------------------------------
/automate-amazon/target/test-classes/utils/DriverUtils.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tjmaher/automate-amazon/71b428a444f16f2f951bc9085d76c7d813ab74d4/automate-amazon/target/test-classes/utils/DriverUtils.class
--------------------------------------------------------------------------------