├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── encodings.xml ├── jarRepositories.xml ├── misc.xml ├── sonarlint │ └── issuestore │ │ ├── 0 │ │ ├── 1 │ │ │ └── 0181ca378f5c7eaa8b55b926e53dce8a5ab900e3 │ │ ├── 9 │ │ │ ├── 091a6ba4da9b5764bcde22e192f60e5b28d5ffd2 │ │ │ └── 098de7f96d760b5c4f4ccf1e4a911b73296690e2 │ │ ├── a │ │ │ └── 0a95a971e3c1954c1fce331f50e01b0ea2886e6b │ │ └── c │ │ │ └── 0c7ad5b98761a68ab4cffccf4e6cc4c40c51c214 │ │ ├── 1 │ │ ├── 0 │ │ │ └── 104eed832621a6b623a8550a5f231e75bb686b92 │ │ ├── c │ │ │ ├── 1c26d921bcf83dd8e74854b36e33644db7a39874 │ │ │ ├── 1c3ddc08f78496bb40455dca6457c3a3f4612327 │ │ │ └── 1cacb02b260d510071e75725c92a5e4588f0d5b8 │ │ └── d │ │ │ └── 1dca91bec8bc147a7916b279ba98bd76d3c07f9e │ │ ├── 2 │ │ ├── 4 │ │ │ └── 242f1840ee5804d5be21622bb4dfb19e356b60f2 │ │ └── d │ │ │ └── 2d615669787f741af1fbf028799c200d0023d54b │ │ ├── 3 │ │ ├── 0 │ │ │ ├── 302eea97bf62dd5d299c2ad7f14586ea96b95b21 │ │ │ ├── 303d2b974325d9bcf46fbe23e3f34c737520d63b │ │ │ └── 309367d10e9048ce8389dbb6e43f89c46454bbb9 │ │ ├── 2 │ │ │ └── 32fb2d753cc57550c2535adb5792926ebb6e3d58 │ │ ├── b │ │ │ └── 3bb4edab22eabb18c0778cd81fe323d27211cf06 │ │ └── e │ │ │ └── 3ebabe4354d2fce4bfbc7acdff636290506ac3dd │ │ ├── 4 │ │ ├── 4 │ │ │ ├── 442292b8a7efeabbe4cc176709b833b1792140ec │ │ │ └── 44e50eea8f4840a2716c4eec831a475cace6b3eb │ │ └── 5 │ │ │ └── 451aba7a7cb773284825e8c9fea5c6316aae1e41 │ │ ├── 5 │ │ ├── 1 │ │ │ ├── 5130cdccca9520ef0a49fc4938c410edd9481226 │ │ │ └── 51b7e80b11da4821dc80b0384b69de3c1d57bf03 │ │ ├── 3 │ │ │ ├── 53135072c39dfa41705ad8e813c9aac042dfa70a │ │ │ └── 5345bf07db0ef3cb50bad25b5da6a39e23144d73 │ │ ├── 5 │ │ │ └── 55703aa6c8613db82bc617e5023ca4a43aec620c │ │ └── d │ │ │ └── 5d5413e8645f7c223425c9626a8598952bb8d9fd │ │ ├── 6 │ │ └── 6 │ │ │ └── 66089d8a69e7106adfe0e1da43ce5dc3c0bc86ad │ │ ├── 7 │ │ └── f │ │ │ └── 7fda07b2c9ff752790301ea497ddc8582434bff6 │ │ ├── 8 │ │ ├── 0 │ │ │ └── 801176e52deb9f7f391cdeedd65e68747f5e1b6c │ │ └── e │ │ │ └── 8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d │ │ ├── 9 │ │ ├── 0 │ │ │ ├── 90059ba5f56c92fb0dbdf537c47be5c58b50f0db │ │ │ └── 9061cf936115d20b9c1c53df8f3644e5f599240c │ │ ├── 3 │ │ │ └── 93606536273244ad203c8cef084ac0a8f7a93c0b │ │ ├── 5 │ │ │ └── 95d4ee6b3304cc11ef7fd44b5b22b1b62198ee94 │ │ ├── 7 │ │ │ └── 972e88d96525329559605db8b3b16aae175d74f2 │ │ └── e │ │ │ └── 9eab6731188fc0f8402fdaecbb627992306898fc │ │ ├── a │ │ ├── 0 │ │ │ └── a05929e3c34e3ad3146300016386fb008f44fb04 │ │ ├── 4 │ │ │ └── a48a023f7605de14449c52db1b44c7fc97cb9163 │ │ ├── 6 │ │ │ └── a63c88715a1515243dadadf0a87d9569dd316ba7 │ │ ├── 8 │ │ │ └── a89b96d327cd9392d78e198f2974ed81591d1e64 │ │ └── b │ │ │ └── ab37cc03d69925b738f77231093a75a890f22d5a │ │ ├── b │ │ ├── 1 │ │ │ └── b11f34083852ae43ac0c5abfa6a5cba564b12148 │ │ ├── c │ │ │ └── bc8bbf7fdb917f5e11810965136a107862ed6000 │ │ └── f │ │ │ └── bf0fec68b311a84781c4d4d65cec1adb2cc2de04 │ │ ├── c │ │ ├── 9 │ │ │ └── c95aabacbd389cfef2bd8c396cbb231d1be4c6df │ │ ├── d │ │ │ ├── cd082d136659733efb1ec0d1387f6fcec18639b6 │ │ │ └── cd17153bfc21675ccefb41208211840b0a0bd6dd │ │ └── f │ │ │ └── cf37b912cc7e0fe08951e922d8df0b8d28e7c0ff │ │ ├── d │ │ ├── 5 │ │ │ └── d5a62815449cf5bafce1c09973303b7390c6d92c │ │ └── d │ │ │ └── ddf10dc7404ef8eb193d54b4f125ba60c712dfff │ │ ├── e │ │ ├── 8 │ │ │ └── e8be068a58870007eeace5959936de3b5e48ff65 │ │ └── 9 │ │ │ └── e91c70dafbabfe2961e5effa11e46dd6f4e45f53 │ │ ├── f │ │ ├── 2 │ │ │ ├── f220f6577660d0ddfafcde79aa70e81d02dc3b4a │ │ │ ├── f29305d1fc4e80d763e2bdcba74793110bde4d28 │ │ │ └── f2b07ff939c3b8d66d0b9ed916b1d5754f58e127 │ │ ├── 3 │ │ │ └── f379883e6b7873e8431e22ac5c98be287e592cad │ │ ├── 4 │ │ │ ├── f40c56d0f43f57965e2330f8140b6f0b864d0be8 │ │ │ └── f45d58db0d22569c65f698d2da74375bbeacd5bb │ │ ├── 8 │ │ │ └── f8c133c98cff31993ee383fd7d457ea3b3d0d126 │ │ └── e │ │ │ └── fea5874a6671283d52f9ec98d4090134a40f1214 │ │ └── index.pb └── vcs.xml ├── ExtentReports.zip ├── ExtentReports ├── AutomationReport.html ├── ExtentReport_5_0_6.html ├── ExtentReport_5_0_9.html └── Windows_10_Wed_Oct_27_02_22_29_IST_2021_AutomationReport.html ├── README.md ├── Screenshots ├── CHROME │ ├── AddToCartTest_addToCartFeaturedProducts.png │ ├── AddToCartTest_addToCartFromStorePage.png │ ├── CheckoutTest_guestCheckoutUsingDirectBankTransfer.png │ ├── CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png │ ├── LoginTest_loginDuringCheckout.png │ ├── NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png │ └── SearchTest_searchWithPartialMatch.png ├── EDGE │ ├── AddToCartTest_addToCartFeaturedProducts.png │ ├── AddToCartTest_addToCartFromStorePage.png │ ├── CheckoutTest_guestCheckoutUsingDirectBankTransfer.png │ ├── CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png │ ├── LoginTest_2_loginDuringCheckout_2.png │ ├── LoginTest_loginDuringCheckout.png │ ├── MyFirstTestCase_guestCheckoutUsingDirectBankTransfer.png │ ├── MyFirstTestCase_loginAndCheckoutUsingDirectBankTransfer.png │ ├── NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png │ └── SearchTest_searchWithPartialMatch.png ├── FIREFOX │ ├── AddToCartTest_addToCartFeaturedProducts.png │ ├── AddToCartTest_addToCartFromStorePage.png │ ├── CheckoutTest_guestCheckoutUsingDirectBankTransfer.png │ ├── CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png │ ├── LoginTest_loginDuringCheckout.png │ ├── NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png │ └── SearchTest_searchWithPartialMatch.png └── OPERA │ └── AddToCartTest_addToCartFromStorePage.png ├── pom.xml ├── pom_If_Youface_Issue_Of_AspectJWeaver.xml └── src ├── main └── java │ └── org │ └── selenium │ ├── annotations │ └── FrameworkAnnotation.java │ ├── api │ ├── ApiRequest.java │ ├── SpecBuilder.java │ └── actions │ │ ├── CartApi.java │ │ └── SignUpApi.java │ ├── components │ ├── MyHeader.java │ └── ProductThumbnail.java │ ├── constants │ └── FrameworkConstants.java │ ├── dataproviders │ └── JSONDataProvider.java │ ├── driver │ ├── DriverManager.java │ ├── DriverManagerChrome.java │ ├── DriverManagerEdge.java │ ├── DriverManagerFactory.java │ ├── DriverManagerFirefox.java │ ├── DriverManagerOpera.java │ ├── DriverManagerSafari.java │ └── DriverManager_OC.java │ ├── enums │ ├── AuthorType.java │ ├── CategoryType.java │ ├── DriverType.java │ ├── EnvType.java │ └── WaitStrategy.java │ ├── exceptions │ ├── BrowserInvocationFailedException.java │ ├── FrameworkException.java │ ├── InvalidPathForExcelException.java │ ├── InvalidPathForFilesException.java │ ├── InvalidPathForJSONFileException.java │ ├── InvalidPathForPropertyFileException.java │ ├── JSONFileUsageException.java │ └── PropertyFileUsageException.java │ ├── factories │ ├── DriverManagerFactory.java │ └── ExplicitWaitFactory.java │ ├── java_Mail_API │ ├── EmailAttachmentsSender.java │ └── EmailConfig.java │ ├── listeners │ ├── AnnotationTransformer.java │ ├── ListenerClass.java │ ├── MethodInterceptor.java │ └── RetryFailedTests.java │ ├── objects │ ├── BillingAddress.java │ ├── Product.java │ └── User.java │ ├── pages │ ├── BasePage.java │ ├── CartPage.java │ ├── CheckoutPage.java │ ├── HomePage.java │ └── StorePage.java │ ├── reports │ ├── ExtentLogger.java │ ├── ExtentManager.java │ └── ExtentReport.java │ └── utils │ ├── BrowserInfoUtils.java │ ├── BrowserOSInfoUtils.java │ ├── ConfigLoader.java │ ├── CookieUtils.java │ ├── DateUtils.java │ ├── EmailSendUtils.java │ ├── FakerUtils.java │ ├── IconUtils.java │ ├── JacksonUtils.java │ ├── OSInfoUtils.java │ ├── PropertyUtils.java │ ├── ReportPathUtils.java │ ├── ScreenshotUtils.java │ ├── VerificationManager.java │ └── ZipUtils.java └── test ├── java └── org │ └── selenium │ ├── base │ └── BaseTest.java │ └── tests │ ├── AddToCartTest.java │ ├── LoginTest.java │ ├── NavigationTest.java │ └── SearchTest.java └── resources ├── allure.properties ├── int_config.properties ├── myBillingAddress.json ├── products.json ├── runners ├── testng_Jenkins_CrossBrowser.xml ├── testng_Jenkins_CrossBrowser_Safari.xml ├── testng_Jenkins_OneBrowser.xml ├── testng_Local.xml ├── testng_Local_Firefox.xml ├── testng_Local_GROUPING.xml ├── testng_Local_Only1TestCase.xml ├── testng_Local_Only1TestCase_WithSafari.xml └── testng_Local_Safari.xml └── stg_config.properties /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | MasterSeleniumFramework.iml 3 | test-output 4 | Screenshots 5 | Drivers 6 | allure-results 7 | .idea 8 | .settings 9 | ExtentReports.zip 10 | ExtentReports 11 | .classpath 12 | .project 13 | z_others 14 | testng_Local_Edge.xml 15 | testng_Local_Only1TestCase.xml 16 | README.md -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/0/1/0181ca378f5c7eaa8b55b926e53dce8a5ab900e3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/0/1/0181ca378f5c7eaa8b55b926e53dce8a5ab900e3 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/0/9/091a6ba4da9b5764bcde22e192f60e5b28d5ffd2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/0/9/091a6ba4da9b5764bcde22e192f60e5b28d5ffd2 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/0/9/098de7f96d760b5c4f4ccf1e4a911b73296690e2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/0/9/098de7f96d760b5c4f4ccf1e4a911b73296690e2 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/0/a/0a95a971e3c1954c1fce331f50e01b0ea2886e6b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/0/a/0a95a971e3c1954c1fce331f50e01b0ea2886e6b -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/0/c/0c7ad5b98761a68ab4cffccf4e6cc4c40c51c214: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/0/c/0c7ad5b98761a68ab4cffccf4e6cc4c40c51c214 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/1/0/104eed832621a6b623a8550a5f231e75bb686b92: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/1/0/104eed832621a6b623a8550a5f231e75bb686b92 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/1/c/1c26d921bcf83dd8e74854b36e33644db7a39874: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/1/c/1c26d921bcf83dd8e74854b36e33644db7a39874 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/1/c/1c3ddc08f78496bb40455dca6457c3a3f4612327: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/1/c/1c3ddc08f78496bb40455dca6457c3a3f4612327 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/1/c/1cacb02b260d510071e75725c92a5e4588f0d5b8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/1/c/1cacb02b260d510071e75725c92a5e4588f0d5b8 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/1/d/1dca91bec8bc147a7916b279ba98bd76d3c07f9e: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/1/d/1dca91bec8bc147a7916b279ba98bd76d3c07f9e -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/2/4/242f1840ee5804d5be21622bb4dfb19e356b60f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/2/4/242f1840ee5804d5be21622bb4dfb19e356b60f2 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/2/d/2d615669787f741af1fbf028799c200d0023d54b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/2/d/2d615669787f741af1fbf028799c200d0023d54b -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/0/302eea97bf62dd5d299c2ad7f14586ea96b95b21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/0/302eea97bf62dd5d299c2ad7f14586ea96b95b21 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/0/303d2b974325d9bcf46fbe23e3f34c737520d63b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/0/303d2b974325d9bcf46fbe23e3f34c737520d63b -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/0/309367d10e9048ce8389dbb6e43f89c46454bbb9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/0/309367d10e9048ce8389dbb6e43f89c46454bbb9 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/2/32fb2d753cc57550c2535adb5792926ebb6e3d58: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/2/32fb2d753cc57550c2535adb5792926ebb6e3d58 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/b/3bb4edab22eabb18c0778cd81fe323d27211cf06: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/b/3bb4edab22eabb18c0778cd81fe323d27211cf06 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/3/e/3ebabe4354d2fce4bfbc7acdff636290506ac3dd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/3/e/3ebabe4354d2fce4bfbc7acdff636290506ac3dd -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/4/4/442292b8a7efeabbe4cc176709b833b1792140ec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/4/4/442292b8a7efeabbe4cc176709b833b1792140ec -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/4/4/44e50eea8f4840a2716c4eec831a475cace6b3eb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/4/4/44e50eea8f4840a2716c4eec831a475cace6b3eb -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/4/5/451aba7a7cb773284825e8c9fea5c6316aae1e41: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/4/5/451aba7a7cb773284825e8c9fea5c6316aae1e41 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/1/5130cdccca9520ef0a49fc4938c410edd9481226: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/1/5130cdccca9520ef0a49fc4938c410edd9481226 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/1/51b7e80b11da4821dc80b0384b69de3c1d57bf03: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/1/51b7e80b11da4821dc80b0384b69de3c1d57bf03 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/3/53135072c39dfa41705ad8e813c9aac042dfa70a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/3/53135072c39dfa41705ad8e813c9aac042dfa70a -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/3/5345bf07db0ef3cb50bad25b5da6a39e23144d73: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/3/5345bf07db0ef3cb50bad25b5da6a39e23144d73 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/5/55703aa6c8613db82bc617e5023ca4a43aec620c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/5/55703aa6c8613db82bc617e5023ca4a43aec620c -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/5/d/5d5413e8645f7c223425c9626a8598952bb8d9fd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/5/d/5d5413e8645f7c223425c9626a8598952bb8d9fd -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/6/6/66089d8a69e7106adfe0e1da43ce5dc3c0bc86ad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/6/6/66089d8a69e7106adfe0e1da43ce5dc3c0bc86ad -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/7/f/7fda07b2c9ff752790301ea497ddc8582434bff6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/7/f/7fda07b2c9ff752790301ea497ddc8582434bff6 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/8/0/801176e52deb9f7f391cdeedd65e68747f5e1b6c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/8/0/801176e52deb9f7f391cdeedd65e68747f5e1b6c -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/0/90059ba5f56c92fb0dbdf537c47be5c58b50f0db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/0/90059ba5f56c92fb0dbdf537c47be5c58b50f0db -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/0/9061cf936115d20b9c1c53df8f3644e5f599240c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/0/9061cf936115d20b9c1c53df8f3644e5f599240c -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/3/93606536273244ad203c8cef084ac0a8f7a93c0b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/3/93606536273244ad203c8cef084ac0a8f7a93c0b -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/5/95d4ee6b3304cc11ef7fd44b5b22b1b62198ee94: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/5/95d4ee6b3304cc11ef7fd44b5b22b1b62198ee94 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/7/972e88d96525329559605db8b3b16aae175d74f2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/7/972e88d96525329559605db8b3b16aae175d74f2 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/9/e/9eab6731188fc0f8402fdaecbb627992306898fc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/9/e/9eab6731188fc0f8402fdaecbb627992306898fc -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/a/0/a05929e3c34e3ad3146300016386fb008f44fb04: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/a/0/a05929e3c34e3ad3146300016386fb008f44fb04 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/a/4/a48a023f7605de14449c52db1b44c7fc97cb9163: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/a/4/a48a023f7605de14449c52db1b44c7fc97cb9163 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/a/6/a63c88715a1515243dadadf0a87d9569dd316ba7: -------------------------------------------------------------------------------- 1 | 2 | V java:S107"AConstructor has 8 parameters, which is greater than 7 authorized.(ܬر -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/a/8/a89b96d327cd9392d78e198f2974ed81591d1e64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/a/8/a89b96d327cd9392d78e198f2974ed81591d1e64 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/a/b/ab37cc03d69925b738f77231093a75a890f22d5a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/a/b/ab37cc03d69925b738f77231093a75a890f22d5a -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/b/1/b11f34083852ae43ac0c5abfa6a5cba564b12148: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/b/1/b11f34083852ae43ac0c5abfa6a5cba564b12148 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/b/c/bc8bbf7fdb917f5e11810965136a107862ed6000: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/b/c/bc8bbf7fdb917f5e11810965136a107862ed6000 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/b/f/bf0fec68b311a84781c4d4d65cec1adb2cc2de04: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/b/f/bf0fec68b311a84781c4d4d65cec1adb2cc2de04 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/c/9/c95aabacbd389cfef2bd8c396cbb231d1be4c6df: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/c/9/c95aabacbd389cfef2bd8c396cbb231d1be4c6df -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/c/d/cd082d136659733efb1ec0d1387f6fcec18639b6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/c/d/cd082d136659733efb1ec0d1387f6fcec18639b6 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/c/d/cd17153bfc21675ccefb41208211840b0a0bd6dd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/c/d/cd17153bfc21675ccefb41208211840b0a0bd6dd -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/c/f/cf37b912cc7e0fe08951e922d8df0b8d28e7c0ff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/c/f/cf37b912cc7e0fe08951e922d8df0b8d28e7c0ff -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/d/5/d5a62815449cf5bafce1c09973303b7390c6d92c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/d/5/d5a62815449cf5bafce1c09973303b7390c6d92c -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/d/d/ddf10dc7404ef8eb193d54b4f125ba60c712dfff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/d/d/ddf10dc7404ef8eb193d54b4f125ba60c712dfff -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/e/8/e8be068a58870007eeace5959936de3b5e48ff65: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/e/8/e8be068a58870007eeace5959936de3b5e48ff65 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/e/9/e91c70dafbabfe2961e5effa11e46dd6f4e45f53: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/e/9/e91c70dafbabfe2961e5effa11e46dd6f4e45f53 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/2/f220f6577660d0ddfafcde79aa70e81d02dc3b4a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/2/f220f6577660d0ddfafcde79aa70e81d02dc3b4a -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/2/f29305d1fc4e80d763e2bdcba74793110bde4d28: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/2/f29305d1fc4e80d763e2bdcba74793110bde4d28 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/2/f2b07ff939c3b8d66d0b9ed916b1d5754f58e127: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/2/f2b07ff939c3b8d66d0b9ed916b1d5754f58e127 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/3/f379883e6b7873e8431e22ac5c98be287e592cad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/3/f379883e6b7873e8431e22ac5c98be287e592cad -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/4/f40c56d0f43f57965e2330f8140b6f0b864d0be8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/4/f40c56d0f43f57965e2330f8140b6f0b864d0be8 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/4/f45d58db0d22569c65f698d2da74375bbeacd5bb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/4/f45d58db0d22569c65f698d2da74375bbeacd5bb -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/8/f8c133c98cff31993ee383fd7d457ea3b3d0d126: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/8/f8c133c98cff31993ee383fd7d457ea3b3d0d126 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/f/e/fea5874a6671283d52f9ec98d4090134a40f1214: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/.idea/sonarlint/issuestore/f/e/fea5874a6671283d52f9ec98d4090134a40f1214 -------------------------------------------------------------------------------- /.idea/sonarlint/issuestore/index.pb: -------------------------------------------------------------------------------- 1 | 2 | 9 3 | README.md,8/e/8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d 4 | S 5 | #ExtentReports/AutomationReport.html,5/3/5345bf07db0ef3cb50bad25b5da6a39e23144d73 6 | 7 7 | pom.xml,4/4/442292b8a7efeabbe4cc176709b833b1792140ec 8 | _ 9 | /src/test/java/org/selenium/tests/LoginTest.java,5/3/53135072c39dfa41705ad8e813c9aac042dfa70a 10 | d 11 | 4src/test/java/org/selenium/tests/NavigationTest.java,0/9/098de7f96d760b5c4f4ccf1e4a911b73296690e2 12 | ` 13 | 0src/test/java/org/selenium/tests/SearchTest.java,2/d/2d615669787f741af1fbf028799c200d0023d54b 14 | ] 15 | -src/test/java/org/selenium/base/BaseTest.java,2/4/242f1840ee5804d5be21622bb4dfb19e356b60f2 16 | c 17 | 3src/main/java/org/selenium/api/actions/CartApi.java,a/b/ab37cc03d69925b738f77231093a75a890f22d5a 18 | e 19 | 5src/main/java/org/selenium/api/actions/SignUpApi.java,0/9/091a6ba4da9b5764bcde22e192f60e5b28d5ffd2 20 | ^ 21 | .src/main/java/org/selenium/api/ApiRequest.java,f/3/f379883e6b7873e8431e22ac5c98be287e592cad 22 | _ 23 | /src/main/java/org/selenium/api/SpecBuilder.java,3/2/32fb2d753cc57550c2535adb5792926ebb6e3d58 24 | c 25 | 3src/main/java/org/selenium/components/MyHeader.java,7/f/7fda07b2c9ff752790301ea497ddc8582434bff6 26 | k 27 | ;src/main/java/org/selenium/components/ProductThumbnail.java,0/1/0181ca378f5c7eaa8b55b926e53dce8a5ab900e3 28 | l 29 | src/main/java/org/selenium/dataproviders/JSONDataProvider.java,9/7/972e88d96525329559605db8b3b16aae175d74f2 32 | d 33 | 4src/main/java/org/selenium/driver/DriverManager.java,9/e/9eab6731188fc0f8402fdaecbb627992306898fc 34 | g 35 | 7src/main/java/org/selenium/driver/DriverManager_OC.java,3/0/309367d10e9048ce8389dbb6e43f89c46454bbb9 36 | j 37 | :src/main/java/org/selenium/driver/DriverManagerChrome.java,5/5/55703aa6c8613db82bc617e5023ca4a43aec620c 38 | k 39 | ;src/main/java/org/selenium/driver/DriverManagerFactory.java,1/c/1c3ddc08f78496bb40455dca6457c3a3f4612327 40 | h 41 | 8src/main/java/org/selenium/driver/DriverManagerEdge.java,e/9/e91c70dafbabfe2961e5effa11e46dd6f4e45f53 42 | k 43 | ;src/main/java/org/selenium/driver/DriverManagerFirefox.java,a/8/a89b96d327cd9392d78e198f2974ed81591d1e64 44 | i 45 | 9src/main/java/org/selenium/driver/DriverManagerOpera.java,5/d/5d5413e8645f7c223425c9626a8598952bb8d9fd 46 | j 47 | :src/main/java/org/selenium/driver/DriverManagerSafari.java,3/b/3bb4edab22eabb18c0778cd81fe323d27211cf06 48 | ] 49 | -src/main/java/org/selenium/enums/EnvType.java,1/c/1cacb02b260d510071e75725c92a5e4588f0d5b8 50 | b 51 | 2src/main/java/org/selenium/enums/WaitStrategy.java,4/5/451aba7a7cb773284825e8c9fea5c6316aae1e41 52 | ` 53 | 0src/main/java/org/selenium/enums/DriverType.java,f/2/f2b07ff939c3b8d66d0b9ed916b1d5754f58e127 54 | n 55 | >src/main/java/org/selenium/factories/DriverManagerFactory.java,f/4/f40c56d0f43f57965e2330f8140b6f0b864d0be8 56 | i 57 | 9src/main/java/org/selenium/java_Mail_API/EmailConfig.java,9/3/93606536273244ad203c8cef084ac0a8f7a93c0b 58 | t 59 | Dsrc/main/java/org/selenium/java_Mail_API/EmailAttachmentsSender.java,0/c/0c7ad5b98761a68ab4cffccf4e6cc4c40c51c214 60 | o 61 | ?src/main/java/org/selenium/listeners/AnnotationTransformer.java,3/e/3ebabe4354d2fce4bfbc7acdff636290506ac3dd 62 | g 63 | 7src/main/java/org/selenium/listeners/ListenerClass.java,b/f/bf0fec68b311a84781c4d4d65cec1adb2cc2de04 64 | k 65 | ;src/main/java/org/selenium/listeners/MethodInterceptor.java,f/4/f45d58db0d22569c65f698d2da74375bbeacd5bb 66 | j 67 | :src/main/java/org/selenium/listeners/RetryFailedTests.java,1/c/1c26d921bcf83dd8e74854b36e33644db7a39874 68 | f 69 | 6src/main/java/org/selenium/objects/BillingAddress.java,a/6/a63c88715a1515243dadadf0a87d9569dd316ba7 70 | _ 71 | /src/main/java/org/selenium/objects/Product.java,1/0/104eed832621a6b623a8550a5f231e75bb686b92 72 | \ 73 | ,src/main/java/org/selenium/objects/User.java,6/6/66089d8a69e7106adfe0e1da43ce5dc3c0bc86ad 74 | ^ 75 | .src/main/java/org/selenium/pages/BasePage.java,d/d/ddf10dc7404ef8eb193d54b4f125ba60c712dfff 76 | b 77 | 2src/main/java/org/selenium/pages/CheckoutPage.java,c/9/c95aabacbd389cfef2bd8c396cbb231d1be4c6df 78 | ^ 79 | .src/main/java/org/selenium/pages/CartPage.java,3/0/303d2b974325d9bcf46fbe23e3f34c737520d63b 80 | ^ 81 | .src/main/java/org/selenium/pages/HomePage.java,3/0/302eea97bf62dd5d299c2ad7f14586ea96b95b21 82 | _ 83 | /src/main/java/org/selenium/pages/StorePage.java,f/8/f8c133c98cff31993ee383fd7d457ea3b3d0d126 84 | h 85 | 8src/main/java/org/selenium/utils/BrowserOSInfoUtils.java,a/0/a05929e3c34e3ad3146300016386fb008f44fb04 86 | f 87 | 6src/main/java/org/selenium/utils/BrowserInfoUtils.java,9/5/95d4ee6b3304cc11ef7fd44b5b22b1b62198ee94 88 | b 89 | 2src/main/java/org/selenium/utils/ConfigLoader.java,4/4/44e50eea8f4840a2716c4eec831a475cace6b3eb 90 | a 91 | 1src/main/java/org/selenium/utils/CookieUtils.java,c/d/cd17153bfc21675ccefb41208211840b0a0bd6dd 92 | _ 93 | /src/main/java/org/selenium/utils/DateUtils.java,b/1/b11f34083852ae43ac0c5abfa6a5cba564b12148 94 | d 95 | 4src/main/java/org/selenium/utils/EmailSendUtils.java,f/2/f220f6577660d0ddfafcde79aa70e81d02dc3b4a 96 | ` 97 | 0src/main/java/org/selenium/utils/FakerUtils.java,1/d/1dca91bec8bc147a7916b279ba98bd76d3c07f9e 98 | b 99 | 2src/main/java/org/selenium/utils/JacksonUtils.java,9/0/90059ba5f56c92fb0dbdf537c47be5c58b50f0db 100 | _ 101 | /src/main/java/org/selenium/utils/IconUtils.java,c/f/cf37b912cc7e0fe08951e922d8df0b8d28e7c0ff 102 | ^ 103 | .src/main/java/org/selenium/utils/ZipUtils.java,8/0/801176e52deb9f7f391cdeedd65e68747f5e1b6c 104 | i 105 | 9src/main/java/org/selenium/utils/VerificationManager.java,9/0/9061cf936115d20b9c1c53df8f3644e5f599240c 106 | e 107 | 5src/main/java/org/selenium/utils/ScreenshotUtils.java,5/1/5130cdccca9520ef0a49fc4938c410edd9481226 108 | e 109 | 5src/main/java/org/selenium/utils/ReportPathUtils.java,a/4/a48a023f7605de14449c52db1b44c7fc97cb9163 110 | c 111 | 3src/main/java/org/selenium/utils/PropertyUtils.java,f/2/f29305d1fc4e80d763e2bdcba74793110bde4d28 112 | a 113 | 1src/main/java/org/selenium/utils/OSInfoUtils.java,5/1/51b7e80b11da4821dc80b0384b69de3c1d57bf03 114 | d 115 | 4src/main/java/org/selenium/reports/ExtentLogger.java,d/5/d5a62815449cf5bafce1c09973303b7390c6d92c 116 | e 117 | 5src/main/java/org/selenium/reports/ExtentManager.java,e/8/e8be068a58870007eeace5959936de3b5e48ff65 118 | d 119 | 4src/main/java/org/selenium/reports/ExtentReport.java,b/c/bc8bbf7fdb917f5e11810965136a107862ed6000 120 | ` 121 | 0src/main/java/org/selenium/enums/AuthorType.java,0/a/0a95a971e3c1954c1fce331f50e01b0ea2886e6b 122 | b 123 | 2src/main/java/org/selenium/enums/CategoryType.java,c/d/cd082d136659733efb1ec0d1387f6fcec18639b6 -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ExtentReports.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/ExtentReports.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MasterSeleniumFramework 2 | With further updates - This project is designed and developed with the help of - 3 | 1. Udemy course (OmPrakash Chavan - Selenium Java Test Framework & Best Practices - Masterclass) - [Learnings from Course (UDEMY - OC - Selenium).pdf](https://github.com/rajatt95/MasterSeleniumFramework/files/7421670/Learnings.from.Course.UDEMY.-.OC.-.Selenium.pdf) 4 | 2. YouTube playlist (Testing Mini Bytes - Selenium Automation Framework with Real-time dashboard) 5 | ------------------------------------------------------------ 6 | It has a concept of Atomic tests (Achieved by Selenium WebDriver API and RestAssured API) 7 | ------------------------------------------------------------ 8 | # Atomic Tests: 9 | ![image](https://user-images.githubusercontent.com/26399692/138962929-70094e77-ff3c-405e-95f8-c91c4e0912a6.png) 10 | ------------------------------------------------------------ 11 | ![image](https://user-images.githubusercontent.com/26399692/135917549-ee1e000a-ce07-4051-89b1-b57ec9b6b9b7.png) 12 | ![image](https://user-images.githubusercontent.com/26399692/138963232-172cc99c-87df-48a6-85eb-71f749a4bf95.png) 13 | ------------------------------------------------------------ 14 | Updations done: 15 | ------------------------------------------------------------ 16 | **ExtentReports V5** 17 | 1. User can apply the Filters - 18 | - Author - Rajat, Nishant, Gautam, Pankaj 19 | - Browser - Chrome, Edge, Safari, Firefox 20 | - TestType - Smoke, Sanity, Regression, BVT 21 | 22 | 2. Screenshots are attached in the ExtentReport as Base64 format. 23 | ![image](https://user-images.githubusercontent.com/26399692/138960828-90e184a0-a354-43bc-b55d-c440b29b9d7a.png) 24 | ![image](https://user-images.githubusercontent.com/26399692/138960863-e799db94-38e3-47ca-ae2d-0436fff3a08a.png) 25 | ------------------------------------------------------------ 26 | **Allure Reports** 27 | ![image](https://user-images.githubusercontent.com/26399692/135977881-10e654b4-6224-4aa9-8343-841af16aeeb3.png) 28 | ------------------------------------------------------------ 29 | **User has options for customization** 30 | ![image](https://user-images.githubusercontent.com/26399692/135927821-1e293278-14f2-4ad2-94dc-5505b080680d.png) 31 | ------------------------------------------------------------ 32 | **Email to User(s) using Java mail API** 33 | ![image](https://user-images.githubusercontent.com/26399692/135975570-d520d163-a7eb-4695-b22c-a25979415ef5.png) 34 | ------------------------------------------------------------ 35 | **Others implementations:** 36 | 1. Retry failed test cases 37 | 2. Custom Enums, Exceptions, Annotations 38 | 3. Serialization and Deserialization using Jackson-Databind dependency 39 | 4. Data Driven testing using JSON file 40 | ------------------------------- 41 | 5. Icons addition in ExtentReport 42 | a. Browser icon with every test case 43 | b. Test status 44 | Test Description -> Last -> Pass (Happy), Fail (Sad) 45 | c. WIN + Browser 46 | d. Navigating to Right 47 | e. Details (Add Rajat linkedIn and Github URL) 48 | Make them Links and align it with Name 49 | ------------------------------ 50 | 6. Zip the ExtentReports directory into Project path (you can send this Zip file as well as an Attachment in Email) 51 | 7. Automatically open the report after tests execution. 52 | ---------------------------------- 53 | 8. Send EMail using Java mail API to User(s) with attachment(s). 54 | - https://mvnrepository.com/artifact/javax.mail/mail/1.4.7 55 | - https://www.tutorialspoint.com/java/java_sending_email.htm 56 | - Gmail -> Manage your Google account: 57 | ![image](https://user-images.githubusercontent.com/26399692/137579937-12c01d4d-1f62-4867-8c40-c056391d3b7e.png) 58 | - Security -> Turn on : Less Secure App access: 59 | ![image](https://user-images.githubusercontent.com/26399692/137579959-e1554f06-5583-4ad1-ad28-ed69ed27b922.png) 60 | 61 | ------------------------------------------------------------ 62 | **How to run the Project from Local machine** 63 | 1. Pull the code into your machine and import in IDE (Eclipse/intelliJ). 64 | 2. Go to testng_Local.xml -> Run this file as TestNG suite 65 | It should start the execution -> Parallel Cross Browser Testing. 66 | - **NOTE:** stg_config.properties is the default configuration file. 67 | 3. To view the Allure reports 68 | - Setup the Allure in your machine 69 | - Go to URL (https://docs.qameta.io/allure/) -> Search for Manual installation -> Steps are mentioned 70 | - Go to your project location 71 | - Open command prompt -> allure serve allure-results 72 | ------------------------------------------------------------ 73 | **How to run the Project from Jenkins** 74 | [__Final-OC_Selenium-Github-ActiveChoiceParams.pdf](https://github.com/rajatt95/MasterSeleniumFramework/files/7314914/__Final-OC_Selenium-Github-ActiveChoiceParams.pdf) 75 | ![image](https://user-images.githubusercontent.com/26399692/136642687-ce999564-df0a-4c64-a4e5-bccc05ef0388.png) 76 | ------------------------------------------------------------ 77 | Email to User(s) using Jenkins: 78 | ![image](https://user-images.githubusercontent.com/26399692/136642963-4a658292-b024-421c-ad7c-ada22777128b.png) 79 | ------------------------------------------------------------ 80 | -------------------------------------------------------------------------------- /Screenshots/CHROME/AddToCartTest_addToCartFeaturedProducts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/AddToCartTest_addToCartFeaturedProducts.png -------------------------------------------------------------------------------- /Screenshots/CHROME/AddToCartTest_addToCartFromStorePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/AddToCartTest_addToCartFromStorePage.png -------------------------------------------------------------------------------- /Screenshots/CHROME/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/CHROME/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/CHROME/LoginTest_loginDuringCheckout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/LoginTest_loginDuringCheckout.png -------------------------------------------------------------------------------- /Screenshots/CHROME/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png -------------------------------------------------------------------------------- /Screenshots/CHROME/SearchTest_searchWithPartialMatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/CHROME/SearchTest_searchWithPartialMatch.png -------------------------------------------------------------------------------- /Screenshots/EDGE/AddToCartTest_addToCartFeaturedProducts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/AddToCartTest_addToCartFeaturedProducts.png -------------------------------------------------------------------------------- /Screenshots/EDGE/AddToCartTest_addToCartFromStorePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/AddToCartTest_addToCartFromStorePage.png -------------------------------------------------------------------------------- /Screenshots/EDGE/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/EDGE/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/EDGE/LoginTest_2_loginDuringCheckout_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/LoginTest_2_loginDuringCheckout_2.png -------------------------------------------------------------------------------- /Screenshots/EDGE/LoginTest_loginDuringCheckout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/LoginTest_loginDuringCheckout.png -------------------------------------------------------------------------------- /Screenshots/EDGE/MyFirstTestCase_guestCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/MyFirstTestCase_guestCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/EDGE/MyFirstTestCase_loginAndCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/MyFirstTestCase_loginAndCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/EDGE/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png -------------------------------------------------------------------------------- /Screenshots/EDGE/SearchTest_searchWithPartialMatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/EDGE/SearchTest_searchWithPartialMatch.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/AddToCartTest_addToCartFeaturedProducts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/AddToCartTest_addToCartFeaturedProducts.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/AddToCartTest_addToCartFromStorePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/AddToCartTest_addToCartFromStorePage.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/CheckoutTest_guestCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/CheckoutTest_loginAndCheckoutUsingDirectBankTransfer.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/LoginTest_loginDuringCheckout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/LoginTest_loginDuringCheckout.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/NavigationTest_NavigateFromHomeToStoreUsingMainMenu.png -------------------------------------------------------------------------------- /Screenshots/FIREFOX/SearchTest_searchWithPartialMatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/FIREFOX/SearchTest_searchWithPartialMatch.png -------------------------------------------------------------------------------- /Screenshots/OPERA/AddToCartTest_addToCartFromStorePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rajatt95/MasterSeleniumFramework/9103307697a65a811c6f514161aaf88d0c9afac3/Screenshots/OPERA/AddToCartTest_addToCartFromStorePage.png -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.learning 4 | MasterSeleniumFramework 5 | 0.0.1-SNAPSHOT 6 | 7 | 8 | 8 9 | 8 10 | UTF-8 11 | 13 | testng_Local 14 | 1.9.4 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-surefire-plugin 24 | 3.0.0-M5 25 | 26 | 27 | 28 | ${browserInstances} 29 | 30 | 31 | 32 | 33 | src/test/resources/runners/${suiteFile}.xml 34 | 35 | 36 | -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" 37 | 38 | 39 | 40 | 41 | org.aspectj 42 | aspectjweaver 43 | ${aspectj.version} 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.seleniumhq.selenium 55 | selenium-java 56 | 3.141.59 57 | 58 | 59 | 60 | 61 | 62 | org.testng 63 | testng 64 | 65 | 7.3.0 66 | compile 67 | 68 | 69 | 70 | 71 | 72 | io.github.bonigarcia 73 | webdrivermanager 74 | 5.0.1 75 | 76 | 77 | 78 | 80 | 81 | 82 | com.fasterxml.jackson.core 83 | jackson-databind 84 | 2.13.0 85 | 86 | 87 | 88 | 89 | io.rest-assured 90 | rest-assured 91 | 4.3.3 92 | 93 | 94 | 95 | 96 | 97 | com.github.javafaker 98 | javafaker 99 | 1.0.2 100 | 101 | 102 | 103 | 104 | 105 | 106 | org.jsoup 107 | jsoup 108 | 1.14.2 109 | 110 | 111 | 112 | 113 | ru.yandex.qatools.ashot 114 | ashot 115 | 1.5.4 116 | 117 | 118 | 119 | 120 | io.qameta.allure 121 | allure-testng 122 | 2.14.0 123 | 124 | 125 | 126 | 127 | com.aventstack 128 | extentreports 129 | 130 | 5.0.9 131 | 132 | 133 | 134 | 135 | com.sun.mail 136 | javax.mail 137 | 1.6.2 138 | 139 | 140 | 141 | 142 | commons-io 143 | commons-io 144 | 2.6 145 | 146 | 147 | 148 | 149 | org.zeroturnaround 150 | zt-zip 151 | 1.14 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /pom_If_Youface_Issue_Of_AspectJWeaver.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.learning 6 | MasterSeleniumFramework 7 | 0.0.1-SNAPSHOT 8 | 9 | 10 | 8 11 | 8 12 | UTF-8 13 | 14 | testng_Local.xml 15 | 2 16 | 17 | 18 | 19 | 20 | 21 | 22 | org.apache.maven.plugins 23 | maven-surefire-plugin 24 | 3.0.0-M5 25 | 26 | 27 | 28 | ${browserInstances} 29 | 30 | 31 | 32 | ${suiteFile} 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.seleniumhq.selenium 44 | selenium-java 45 | 3.141.59 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.testng 53 | testng 54 | 55 | 7.3.0 56 | compile 57 | 58 | 59 | 60 | 61 | 62 | io.github.bonigarcia 63 | webdrivermanager 64 | 5.0.1 65 | 66 | 67 | 68 | 70 | 71 | 72 | com.fasterxml.jackson.core 73 | jackson-databind 74 | 2.13.0 75 | 76 | 77 | 78 | 79 | io.rest-assured 80 | rest-assured 81 | 4.3.3 82 | 83 | 84 | 85 | 86 | 87 | com.github.javafaker 88 | javafaker 89 | 1.0.2 90 | 91 | 92 | 93 | 94 | 95 | 96 | org.jsoup 97 | jsoup 98 | 1.14.2 99 | 100 | 101 | 102 | 103 | ru.yandex.qatools.ashot 104 | ashot 105 | 1.5.4 106 | 107 | 108 | 109 | 110 | io.qameta.allure 111 | allure-testng 112 | 2.14.0 113 | 114 | 115 | 116 | 117 | com.aventstack 118 | extentreports 119 | 5.0.6 120 | 121 | 122 | 123 | com.sun.mail 124 | javax.mail 125 | 1.6.2 126 | 127 | 128 | 129 | 130 | commons-io 131 | commons-io 132 | 2.6 133 | 134 | 135 | 136 | 137 | org.zeroturnaround 138 | zt-zip 139 | 1.14 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/annotations/FrameworkAnnotation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.annotations; 15 | 16 | import org.selenium.enums.AuthorType; 17 | import org.selenium.enums.CategoryType; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | //This is an Custom Annotation 25 | @Retention(RetentionPolicy.RUNTIME) 26 | @Target(ElementType.METHOD) 27 | public @interface FrameworkAnnotation { 28 | 29 | // This is not a method 30 | public AuthorType[] author(); 31 | 32 | // public String[] category(); 33 | public CategoryType[] category(); 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/api/ApiRequest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.api; 14 | 15 | import io.restassured.filter.log.RequestLoggingFilter; 16 | import io.restassured.http.Cookies; 17 | import io.restassured.http.Headers; 18 | import io.restassured.response.Response; 19 | import org.apache.commons.io.output.WriterOutputStream; 20 | import org.selenium.reports.ExtentLogger; 21 | import org.selenium.utils.ConfigLoader; 22 | 23 | import java.io.PrintStream; 24 | import java.io.StringWriter; 25 | import java.util.HashMap; 26 | 27 | import static io.restassured.RestAssured.given; 28 | import static org.selenium.constants.FrameworkConstants.YES; 29 | 30 | public class ApiRequest extends SpecBuilder { 31 | 32 | public static Response post(String endPoint, Headers headers, HashMap formParams, Cookies cookies) { 33 | 34 | StringWriter writerRequest; 35 | PrintStream captor; 36 | writerRequest = new StringWriter(); 37 | captor = new PrintStream(new WriterOutputStream(writerRequest), true); 38 | 39 | Response response = given(getRequestSpec()).filter(new RequestLoggingFilter(captor)). 40 | // filter(new ResponseLoggingFilter(captor)). 41 | headers(headers).formParams(formParams).cookies(cookies).when().post(endPoint).then() 42 | .spec(getResponseSpec()).extract().response(); 43 | 44 | printDetailsInExtentReport(writerRequest, response); 45 | return response; 46 | } 47 | 48 | private static void printDetailsInExtentReport(StringWriter writer, Response response) { 49 | if (ConfigLoader.getInstance().getRequestDetailsInReports().equalsIgnoreCase(YES)) { 50 | ExtentLogger.info("
Request details: " + "" 51 | + "
" + writer.toString() + "
" + "
\n"); 52 | // ExtentLogger.info("
Response details: 53 | // " + "" 54 | // + "
" + response.toString() + "
" + "
\n"); 55 | // + "
" + response + "
" + " \n"); 56 | // + "
" + response.asString() + "
" + " \n"); 57 | // + "
" + response.asPrettyString() + "
" + " \n"); 58 | // + "
" + response.peek() + "
" + " \n"); 59 | // + "
" + response.print() + "
" + " \n"); 60 | // + response.print() + " \n"); 61 | } 62 | } 63 | 64 | public static Response get(String endPoint, Cookies cookies) { 65 | 66 | StringWriter writerRequest; 67 | PrintStream captor; 68 | writerRequest = new StringWriter(); 69 | captor = new PrintStream(new WriterOutputStream(writerRequest), true); 70 | 71 | Response response = given(getRequestSpec()).filter(new RequestLoggingFilter(captor)). 72 | // filter(new ResponseLoggingFilter(captor)). 73 | cookies(cookies).when().get(endPoint).then().spec(getResponseSpec()).extract().response(); 74 | 75 | printDetailsInExtentReport(writerRequest, response); 76 | return response; 77 | 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/api/SpecBuilder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.api; 14 | 15 | import io.restassured.builder.RequestSpecBuilder; 16 | import io.restassured.builder.ResponseSpecBuilder; 17 | import io.restassured.filter.log.LogDetail; 18 | import io.restassured.specification.RequestSpecification; 19 | import io.restassured.specification.ResponseSpecification; 20 | import org.selenium.utils.ConfigLoader; 21 | 22 | public class SpecBuilder { 23 | 24 | public static RequestSpecification getRequestSpec() { 25 | return new RequestSpecBuilder(). 26 | //setBaseUri(Environment.getUrl()). 27 | setBaseUri(ConfigLoader.getInstance().getBaseUrl()). 28 | log(LogDetail.ALL). 29 | build(); 30 | } 31 | 32 | public static ResponseSpecification getResponseSpec() { 33 | return new ResponseSpecBuilder(). 34 | // log(LogDetail.METHOD). 35 | // log(LogDetail.URI). 36 | // log(LogDetail.PARAMS). 37 | // log(LogDetail.STATUS). 38 | // log(LogDetail.HEADERS). 39 | // log(LogDetail.COOKIES). 40 | log(LogDetail.ALL). 41 | build(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/api/actions/CartApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.api.actions; 14 | 15 | import io.restassured.http.Cookies; 16 | import io.restassured.http.Header; 17 | import io.restassured.http.Headers; 18 | import io.restassured.response.Response; 19 | import org.selenium.api.ApiRequest; 20 | import org.selenium.constants.FrameworkConstants; 21 | import org.selenium.utils.VerificationManager; 22 | 23 | import java.util.HashMap; 24 | 25 | public class CartApi { 26 | 27 | private Cookies cookies; 28 | 29 | public Cookies getCookies() { 30 | return cookies; 31 | } 32 | 33 | public void setCookies(Cookies cookies) { 34 | this.cookies = cookies; 35 | } 36 | 37 | public CartApi() { 38 | super(); 39 | } 40 | 41 | public CartApi(Cookies cookies) { 42 | super(); 43 | this.cookies = cookies; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "CartApi [cookies=" + cookies + "]"; 49 | } 50 | 51 | public Response addToCart(int productId, int quantity) { 52 | Header header = new Header("content-type", "application/x-www-form-urlencoded"); 53 | Headers headers = new Headers(header); 54 | 55 | HashMap formParams = new HashMap<>(); 56 | formParams.put("product_sku", ""); 57 | formParams.put("product_id", productId); 58 | formParams.put("quantity", quantity); 59 | 60 | /* If the Customer is not logged in, then only create the Object of Cookies */ 61 | /* If the Customer is logged in, then use the already created Cookies */ 62 | if (cookies == null) { 63 | cookies = new Cookies(); 64 | } 65 | 66 | // Response response = 67 | // given(). 68 | // baseUri(ConfigLoader.getInstance().getBaseUrl()). 69 | // headers(headers). 70 | // formParams(formParams). 71 | // cookies(cookies). 72 | // log().all(). 73 | // when(). 74 | // post("/?wc-ajax=add_to_cart"). 75 | // then(). 76 | // log().all(). 77 | // extract().response(); 78 | 79 | Response response=ApiRequest.post("/?wc-ajax=add_to_cart", headers, formParams, cookies); 80 | 81 | VerificationManager.validateResponse(response.getStatusCode(),200, 82 | FrameworkConstants.ASSERTION_FOR_RESPONSE_STATUS_CODE +" - Add the product to the Cart "); 83 | 84 | this.cookies = response.getDetailedCookies(); 85 | return response; 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/api/actions/SignUpApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.api.actions; 14 | 15 | import io.restassured.http.Cookies; 16 | import io.restassured.http.Header; 17 | import io.restassured.http.Headers; 18 | import io.restassured.response.Response; 19 | import org.jsoup.Jsoup; 20 | import org.jsoup.nodes.Document; 21 | import org.jsoup.nodes.Element; 22 | import org.selenium.api.ApiRequest; 23 | import org.selenium.constants.FrameworkConstants; 24 | import org.selenium.objects.User; 25 | import org.selenium.utils.VerificationManager; 26 | 27 | import java.util.HashMap; 28 | 29 | public class SignUpApi { 30 | 31 | private Cookies cookies; 32 | 33 | public Cookies getCookies() { 34 | return cookies; 35 | } 36 | 37 | public void setCookies(Cookies cookies) { 38 | this.cookies = cookies; 39 | } 40 | 41 | // private String fetchRegisterNonceValueUsingGroovyGPath() { 42 | // Response response = getAccount(); 43 | // 44 | // /** 45 | // * We are getting this in the Response in the API call for getAccount() 46 | // * 47 | // * 49 | // * 50 | // * We are trying to fetch this value --> 656055dd4d 51 | // */ 52 | // return response.htmlPath().getString("**.findAll { it.@name == 'woocommerce-register-nonce' }.@value"); 53 | // } 54 | 55 | private String fetchRegisterNonceValueUsingJSoup() { 56 | Response response = getAccount(); 57 | Document doc = Jsoup.parse(response.body().prettyPrint()); 58 | /* 59 | * 61 | */ 62 | Element element = doc.selectFirst("#woocommerce-register-nonce"); 63 | return element.attr("value"); 64 | } 65 | 66 | private Response getAccount() { 67 | Cookies cookies = new Cookies(); 68 | // Response response = 69 | // given(). 70 | // baseUri(ConfigLoader.getInstance().getBaseUrl()). 71 | // cookies(cookies). 72 | // log().all(). 73 | // when(). 74 | // get("/account"). 75 | // then(). 76 | // log().all().extract().response(); 77 | 78 | Response response=ApiRequest.get("account", cookies); 79 | 80 | VerificationManager.validateResponse(response.getStatusCode(),200, 81 | FrameworkConstants.ASSERTION_FOR_RESPONSE_STATUS_CODE +" - Fetch the account details "); 82 | 83 | //ExtentLogger.pass(MarkupHelper.createCodeBlock(response.asString(), CodeLanguage.JSON)); 84 | //ExtentLogger.pass(response.asString()); 85 | return response; 86 | } 87 | 88 | public Response register(User user) { 89 | Cookies cookies = new Cookies(); 90 | 91 | Header header =new Header("content-type", "application/x-www-form-urlencoded"); 92 | Headers headers=new Headers(header); 93 | 94 | HashMap formParams=new HashMap<>(); 95 | formParams.put("username", user.getUsername()); 96 | formParams.put("email", user.getEmail() ); 97 | formParams.put("password", user.getPassword()); 98 | formParams.put("woocommerce-register-nonce", fetchRegisterNonceValueUsingJSoup()); 99 | formParams.put("register", "Register"); 100 | 101 | 102 | // Response response = 103 | // given(). 104 | // baseUri(ConfigLoader.getInstance().getBaseUrl()). 105 | // headers(headers). 106 | // formParams(formParams). 107 | // cookies(cookies). 108 | // log().all(). 109 | // when() 110 | // .post("/account"). 111 | // then(). 112 | // log().all().extract().response(); 113 | 114 | 115 | //Response response=ApiRequest.post(Endpoint.ACCOUNT.url, headers, formParams, cookies); 116 | Response response=ApiRequest.post("/account", headers, formParams, cookies); 117 | 118 | VerificationManager.validateResponse(response.getStatusCode(),302, 119 | FrameworkConstants.ASSERTION_FOR_RESPONSE_STATUS_CODE +" - Register the account "); 120 | 121 | this.cookies=response.getDetailedCookies(); 122 | return response; 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/components/MyHeader.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.components; 14 | 15 | import org.openqa.selenium.By; 16 | import org.openqa.selenium.WebDriver; 17 | import org.selenium.enums.WaitStrategy; 18 | import org.selenium.pages.BasePage; 19 | import org.selenium.pages.StorePage; 20 | 21 | public class MyHeader extends BasePage { 22 | 23 | public MyHeader(WebDriver driver) { 24 | super(driver); 25 | } 26 | 27 | private final By storeMenuLink = By.xpath("//li[@id='menu-item-1227']//a"); 28 | 29 | /* Fluent Interface */ 30 | public StorePage navigateToStoreUsingMenu() { 31 | // driver.findElement(storeMenuLink).click(); 32 | //wait.until(ExpectedConditions.elementToBeClickable(storeMenuLink)).click(); 33 | click(storeMenuLink, WaitStrategy.CLICKABLE, "Store Menu Link"); 34 | return new StorePage(driver); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/components/ProductThumbnail.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.components; 14 | 15 | import io.qameta.allure.Step; 16 | import org.openqa.selenium.By; 17 | import org.openqa.selenium.WebDriver; 18 | import org.openqa.selenium.support.ui.ExpectedConditions; 19 | import org.selenium.pages.BasePage; 20 | import org.selenium.pages.CartPage; 21 | 22 | public class ProductThumbnail extends BasePage { 23 | 24 | public ProductThumbnail(WebDriver driver) { 25 | super(driver); 26 | } 27 | 28 | private final By viewCartLink = By.xpath("//a[@title='View cart']"); 29 | 30 | private By getAddToCartBtnElement(String productName) { 31 | 32 | return By.cssSelector("a[aria-label='Add “" + productName + "” to your cart']"); 33 | } 34 | 35 | /* 36 | * private By getAddToCartBtnElement(String productName){ return 37 | * By.cssSelector("a[aria-label='Add “" + productName + "” to your cart']"); } 38 | */ 39 | @Step 40 | /* Handle Dynamic Elements */ 41 | public ProductThumbnail clickaddToCartBtn(String productName) { 42 | By addToCartBtn = getAddToCartBtnElement(productName); 43 | // driver.findElement(addToCartBtn).click(); 44 | wait.until(ExpectedConditions.elementToBeClickable(addToCartBtn)).click(); 45 | return this; 46 | } 47 | 48 | @Step 49 | public CartPage clickViewCartLink() { 50 | // driver.findElement(viewCartLink).click(); 51 | wait.until(ExpectedConditions.elementToBeClickable(viewCartLink)).click(); 52 | return new CartPage(driver); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/constants/FrameworkConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.constants; 14 | 15 | import org.selenium.utils.ReportPathUtils; 16 | 17 | public class FrameworkConstants { 18 | 19 | private static final String PROJECT_PATH = System.getProperty("user.dir"); 20 | // private static final String RESOURCES_PATH = System.getProperty("user.dir") + 21 | // "/src/test/resources"; 22 | 23 | /* ICONS - START */ 24 | public static final String ICON_SMILEY_PASS = ""; 25 | public static final String ICON_SMILEY_SKIP = ""; 26 | public static final String ICON_SMILEY_FAIL = ""; 27 | 28 | public static final String ICON_OS_WINDOWS = ""; 29 | public static final String ICON_OS_MAC = ""; 30 | public static final String ICON_OS_LINUX = ""; 31 | 32 | // public static final String ICON_BROWSER_OPERA = ""; 33 | // public static final String ICON_BROWSER_EDGE = ""; 34 | // public static final String ICON_BROWSER_CHROME = ""; 35 | // public static final String ICON_BROWSER_FIREFOX = ""; 36 | // public static final String ICON_BROWSER_SAFARI = ""; 37 | 38 | public static final String ICON_Navigate_Right = ""; 39 | public static final String ICON_LAPTOP = ""; 40 | public static final String ICON_BUG = ""; 41 | /* style="text-align:center;" */ 42 | public static final String ICON_SOCIAL_LINKEDIN_URL = "https://www.linkedin.com/in/rajat-v-3b0685128/"; 43 | public static final String ICON_SOCIAL_GITHUB_URL = "https://github.com/rajatt95"; 44 | public static final String ICON_SOCIAL_LINKEDIN = ""; 46 | public static final String ICON_SOCIAL_GITHUB = ""; 48 | 49 | // public static final String ICON_SOCIAL_LINKEDIN = ""; 50 | // public static final String ICON_SOCIAL_GITHUB = ""; 51 | // public static final String ICON_SOCIAL_LINKEDIN_VALUE = "LinkedIn"; 52 | // public static final String ICON_SOCIAL_GITHUB_VALUE = "https://github.com/rajatt95"; 53 | 54 | public static final String ICON_CAMERA = ""; 55 | 56 | public static final String ICON_BROWSER_EDGE = "edge"; 57 | public static final String ICON_BROWSER_PREFIX = ""; 59 | 60 | /* ICONS - END */ 61 | 62 | public static final String ASSERTION_FOR_RESPONSE_STATUS_CODE = "Assertion for Response Status Code"; 63 | public static final String ASSERTION_FOR_RESPONSE_HEADER = "Assertion for Response Headers"; 64 | public static final String ASSERTION_FOR_RESPONSE_CUSTOM_FIELD = "Assertion for Response Custom Field"; 65 | 66 | public static final String YES = "yes"; 67 | public static final String NO = "no"; 68 | 69 | private static final int EXPLICIT_WAIT = 10; 70 | public static final int WAIT = 5; 71 | 72 | public static final String EXTENT_REPORT_FOLDER_PATH = PROJECT_PATH + "/ExtentReports/"; 73 | public static final String EXTENT_REPORT_NAME = "AutomationReport.html"; 74 | private static String extentReportFilePath = ""; 75 | 76 | /** Zip file of Extent Reports */ 77 | public static final String Zipped_ExtentReports_Folder_Name = "ExtentReports.zip"; 78 | 79 | private static final String Project_Name = "Automation Test Suite Report - Master Selenium Framework"; 80 | 81 | public static String getProjectPath() { 82 | return PROJECT_PATH; 83 | } 84 | 85 | public static String getProjectName() { 86 | return Project_Name; 87 | } 88 | 89 | public static String getZipped_ExtentReports_Folder_Name() { 90 | return Zipped_ExtentReports_Folder_Name; 91 | } 92 | 93 | public static String getExtentReportFilePath() { 94 | 95 | if (extentReportFilePath.isEmpty()) { 96 | extentReportFilePath = ReportPathUtils.createExtentReportPath(); 97 | } 98 | return extentReportFilePath; 99 | } 100 | 101 | public static int getExplicitWait() { 102 | return EXPLICIT_WAIT; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/dataproviders/JSONDataProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.dataproviders; 14 | 15 | 16 | import org.selenium.objects.Product; 17 | import org.selenium.utils.JacksonUtils; 18 | import org.testng.annotations.DataProvider; 19 | 20 | import java.io.IOException; 21 | 22 | public class JSONDataProvider { 23 | 24 | @DataProvider(name="getFeaturedProducts",parallel = false) 25 | public Product[] getFeaturedProducts() throws IOException { 26 | return JacksonUtils.deSerializationJSON("products.json", Product[].class); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import org.openqa.selenium.WebDriver; 16 | 17 | public final class DriverManager { 18 | 19 | private DriverManager() { 20 | } 21 | 22 | private static ThreadLocal driver = new ThreadLocal(); 23 | 24 | public static WebDriver getDriver() { 25 | return driver.get(); 26 | } 27 | 28 | public static void setDriver(WebDriver driverref) { 29 | driver.set(driverref); 30 | } 31 | 32 | public static void unload() { 33 | driver.remove(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerChrome.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import io.github.bonigarcia.wdm.WebDriverManager; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.chrome.ChromeDriver; 18 | 19 | public class DriverManagerChrome implements DriverManager_OC { 20 | 21 | 22 | @Override 23 | public WebDriver createDriver() { 24 | WebDriverManager.chromedriver().setup(); 25 | WebDriver driver = new ChromeDriver(); 26 | driver.manage().window().maximize(); 27 | return driver; 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerEdge.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import io.github.bonigarcia.wdm.WebDriverManager; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.edge.EdgeDriver; 18 | 19 | public class DriverManagerEdge implements DriverManager_OC { 20 | 21 | @Override 22 | public WebDriver createDriver() { 23 | WebDriverManager.edgedriver().setup(); 24 | WebDriver driver = new EdgeDriver(); 25 | driver.manage().window().maximize(); 26 | return driver; 27 | } 28 | 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import org.selenium.enums.DriverType; 16 | 17 | public class DriverManagerFactory { 18 | 19 | public static DriverManager_OC getManager(DriverType driverType) { 20 | 21 | switch (driverType) { 22 | 23 | case CHROME : { 24 | return new DriverManagerChrome(); 25 | } 26 | case FIREFOX : { 27 | return new DriverManagerFirefox(); 28 | } 29 | case EDGE : { 30 | return new DriverManagerEdge(); 31 | } 32 | case SAFARI : { 33 | return new DriverManagerSafari(); 34 | } 35 | case OPERA : { 36 | return new DriverManagerOpera(); 37 | } 38 | default : throw new IllegalArgumentException("Invalid Driver: " + driverType); 39 | } 40 | /*case CHROME -> { 41 | return new DriverManagerChrome(); 42 | } 43 | case FIREFOX -> { 44 | return new DriverManagerFirefox(); 45 | } 46 | case EDGE -> { 47 | return new DriverManagerEdge(); 48 | } 49 | case SAFARI -> { 50 | return new DriverManagerSafari(); 51 | } 52 | case OPERA -> { 53 | return new DriverManagerOpera(); 54 | } 55 | default -> throw new IllegalArgumentException("Invalid Driver: " + driverType); 56 | }*/ 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerFirefox.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import io.github.bonigarcia.wdm.WebDriverManager; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.firefox.FirefoxDriver; 18 | 19 | public class DriverManagerFirefox implements DriverManager_OC { 20 | 21 | @Override 22 | public WebDriver createDriver() { 23 | WebDriverManager.firefoxdriver().setup(); 24 | WebDriver driver = new FirefoxDriver(); 25 | driver.manage().window().maximize(); 26 | return driver; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerOpera.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import io.github.bonigarcia.wdm.WebDriverManager; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.opera.OperaDriver; 18 | 19 | public class DriverManagerOpera implements DriverManager_OC { 20 | 21 | @Override 22 | public WebDriver createDriver() { 23 | WebDriverManager.operadriver().setup(); 24 | WebDriver driver = new OperaDriver(); 25 | driver.manage().window().maximize(); 26 | return driver; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManagerSafari.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import io.github.bonigarcia.wdm.WebDriverManager; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.safari.SafariDriver; 18 | 19 | public class DriverManagerSafari implements DriverManager_OC { 20 | 21 | @Override 22 | public WebDriver createDriver() { 23 | WebDriverManager.safaridriver().setup(); 24 | WebDriver driver = new SafariDriver(); 25 | driver.manage().window().maximize(); 26 | return driver; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/driver/DriverManager_OC.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.driver; 14 | 15 | import org.openqa.selenium.WebDriver; 16 | 17 | public interface DriverManager_OC { 18 | 19 | WebDriver createDriver(); 20 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/enums/AuthorType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.enums; 15 | 16 | 17 | /**A Java Enum is a special Java type used to define collections of constants.*/ 18 | public enum AuthorType { 19 | 20 | RAJAT, 21 | NISHANT, 22 | GAUTAM, 23 | PANKAJ 24 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/enums/CategoryType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.enums; 15 | 16 | 17 | /**A Java Enum is a special Java type used to define collections of constants.*/ 18 | public enum CategoryType { 19 | 20 | REGRESSION, 21 | SMOKE, 22 | SANITY, 23 | BVT 24 | 25 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/enums/DriverType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.enums; 14 | 15 | public enum DriverType { 16 | 17 | CHROME, 18 | FIREFOX, 19 | EDGE, 20 | SAFARI, 21 | OPERA; 22 | 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/enums/EnvType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.enums; 14 | 15 | public enum EnvType { 16 | 17 | PRODUCTION, 18 | STAGE, 19 | INT, 20 | QA, 21 | 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/enums/WaitStrategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.enums; 14 | 15 | public enum WaitStrategy { 16 | CLICKABLE, PRESENCE, VISIBLE, NONE 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/BrowserInvocationFailedException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | 15 | package org.selenium.exceptions; 16 | 17 | @SuppressWarnings("serial") 18 | public class BrowserInvocationFailedException extends FrameworkException { 19 | public BrowserInvocationFailedException(String message) { 20 | super(message); 21 | } 22 | 23 | public BrowserInvocationFailedException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/FrameworkException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | /** 17 | * extends Runtime - because I want to terminate the program when the Exception 18 | * comes 19 | */ 20 | @SuppressWarnings("serial") 21 | public class FrameworkException extends RuntimeException { 22 | 23 | public FrameworkException(String message) { 24 | super(message); 25 | } 26 | 27 | public FrameworkException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/InvalidPathForExcelException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class InvalidPathForExcelException extends InvalidPathForFilesException { 18 | 19 | public InvalidPathForExcelException(String message) { 20 | 21 | super(message); 22 | } 23 | 24 | public InvalidPathForExcelException(String message, Throwable cause) { 25 | super(message, cause); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/InvalidPathForFilesException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class InvalidPathForFilesException extends FrameworkException { 18 | 19 | public InvalidPathForFilesException(String message) { 20 | super(message); 21 | } 22 | 23 | public InvalidPathForFilesException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/InvalidPathForJSONFileException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class InvalidPathForJSONFileException extends InvalidPathForFilesException { 18 | 19 | public InvalidPathForJSONFileException(String message) { 20 | super(message); 21 | } 22 | 23 | public InvalidPathForJSONFileException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/InvalidPathForPropertyFileException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class InvalidPathForPropertyFileException extends InvalidPathForFilesException { 18 | 19 | public InvalidPathForPropertyFileException(String message) { 20 | super(message); 21 | } 22 | 23 | public InvalidPathForPropertyFileException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/JSONFileUsageException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class JSONFileUsageException extends FrameworkException { 18 | 19 | public JSONFileUsageException(String message) { 20 | super(message); 21 | } 22 | 23 | public JSONFileUsageException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/exceptions/PropertyFileUsageException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.exceptions; 15 | 16 | @SuppressWarnings("serial") 17 | public class PropertyFileUsageException extends FrameworkException { 18 | 19 | public PropertyFileUsageException(String message) { 20 | super(message); 21 | } 22 | 23 | public PropertyFileUsageException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/factories/DriverManagerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.factories; 14 | 15 | import org.selenium.driver.*; 16 | import org.selenium.enums.DriverType; 17 | 18 | public class DriverManagerFactory { 19 | 20 | public static DriverManager_OC getManager(DriverType driverType) { 21 | 22 | switch (driverType) { 23 | 24 | case CHROME: { 25 | return new DriverManagerChrome(); 26 | } 27 | case FIREFOX: { 28 | return new DriverManagerFirefox(); 29 | } 30 | case EDGE: { 31 | return new DriverManagerEdge(); 32 | } 33 | case SAFARI: { 34 | return new DriverManagerSafari(); 35 | } 36 | case OPERA: { 37 | return new DriverManagerOpera(); 38 | } 39 | default: 40 | throw new IllegalArgumentException("Invalid Driver: " + driverType); 41 | } 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/factories/ExplicitWaitFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.factories; 15 | 16 | import org.openqa.selenium.By; 17 | import org.openqa.selenium.WebElement; 18 | import org.openqa.selenium.support.ui.ExpectedConditions; 19 | import org.openqa.selenium.support.ui.WebDriverWait; 20 | import org.selenium.constants.FrameworkConstants; 21 | import org.selenium.driver.DriverManager; 22 | import org.selenium.enums.WaitStrategy; 23 | 24 | public final class ExplicitWaitFactory { 25 | 26 | private ExplicitWaitFactory() { 27 | } 28 | 29 | public static WebElement performExplicitWait(WaitStrategy waitStrategy, By by) { 30 | 31 | WebElement element = null; 32 | if (waitStrategy == WaitStrategy.CLICKABLE) { 33 | element = new WebDriverWait(DriverManager.getDriver(), FrameworkConstants.getExplicitWait()) 34 | .until(ExpectedConditions.elementToBeClickable(by)); 35 | } 36 | else if (waitStrategy == WaitStrategy.PRESENCE) { 37 | element = new WebDriverWait(DriverManager.getDriver(), FrameworkConstants.getExplicitWait()) 38 | .until(ExpectedConditions.presenceOfElementLocated(by)); 39 | } 40 | else if (waitStrategy == WaitStrategy.VISIBLE) { 41 | element = new WebDriverWait(DriverManager.getDriver(), FrameworkConstants.getExplicitWait()) 42 | .until(ExpectedConditions.visibilityOfElementLocated(by)); 43 | } 44 | else if (waitStrategy == WaitStrategy.NONE) { 45 | System.out.println("Not Waiting for anything"); 46 | element = DriverManager.getDriver().findElement(by); 47 | } 48 | return element; 49 | 50 | // wait.until(d -> d.findElement(link_logout).isEnabled());// Java 8 way 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/java_Mail_API/EmailAttachmentsSender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.java_Mail_API; 14 | 15 | import javax.mail.*; 16 | import javax.mail.internet.*; 17 | import java.io.IOException; 18 | import java.util.Date; 19 | import java.util.Properties; 20 | 21 | /** 22 | * https://www.codejava.net/java-ee/javamail/send-e-mail-with-attachment-in-java 23 | */ 24 | public class EmailAttachmentsSender { 25 | 26 | /** 27 | * i) Send n no. of Attachments 28 | * 29 | * ii) Format set for TC count 30 | * 31 | * iii) Send mail to n no. of Users 32 | * 33 | */ 34 | public static void sendEmailWithAttachments(String host, String port, final String userName, final String password, 35 | String[] toAddress, String subject, String message, String... attachFiles) 36 | throws AddressException, MessagingException { 37 | // sets SMTP server properties 38 | 39 | Properties properties = new Properties(); 40 | properties.put("mail.smtp.host", host); 41 | properties.put("mail.smtp.port", port); 42 | properties.put("mail.smtp.auth", "true"); 43 | properties.put("mail.smtp.starttls.enable", "true"); 44 | properties.put("mail.user", userName); 45 | properties.put("mail.password", password); 46 | 47 | // creates a new session with an authenticator 48 | Authenticator auth = new Authenticator() { 49 | public PasswordAuthentication getPasswordAuthentication() { 50 | return new PasswordAuthentication(userName, password); 51 | } 52 | }; 53 | Session session = Session.getInstance(properties, auth); 54 | 55 | // creates a new e-mail message 56 | Message msg = new MimeMessage(session); 57 | 58 | msg.setFrom(new InternetAddress(userName)); 59 | 60 | InternetAddress[] addressTo = new InternetAddress[toAddress.length]; 61 | for (int i = 0; i < toAddress.length; i++) 62 | addressTo[i] = new InternetAddress(toAddress[i]); 63 | msg.setRecipients(Message.RecipientType.TO, addressTo); 64 | 65 | /* 66 | * InternetAddress[] toAddresses = { new InternetAddress(toAddress) }; 67 | * msg.setRecipients(Message.RecipientType.TO, toAddresses); 68 | */ msg.setSubject(subject); 69 | msg.setSentDate(new Date()); 70 | 71 | // creates message part 72 | MimeBodyPart messageBodyPart = new MimeBodyPart(); 73 | messageBodyPart.setContent(message, "text/html"); 74 | 75 | // creates multi-part 76 | Multipart multipart = new MimeMultipart(); 77 | multipart.addBodyPart(messageBodyPart); 78 | 79 | // adds attachments 80 | if (attachFiles != null && attachFiles.length > 0) { 81 | for (String filePath : attachFiles) { 82 | MimeBodyPart attachPart = new MimeBodyPart(); 83 | 84 | try { 85 | attachPart.attachFile(filePath); 86 | } catch (IOException ex) { 87 | ex.printStackTrace(); 88 | } 89 | 90 | multipart.addBodyPart(attachPart); 91 | } 92 | } 93 | 94 | // sets the multi-part as e-mail's content 95 | msg.setContent(multipart); 96 | 97 | // sends the e-mail 98 | Transport.send(msg); 99 | 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/java_Mail_API/EmailConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.java_Mail_API; 14 | 15 | import org.selenium.constants.FrameworkConstants; 16 | 17 | /** 18 | * Data for Sending EMail after execution 19 | */ 20 | public class EmailConfig { 21 | 22 | public static final String SERVER = "smtp.gmail.com"; 23 | public static final String PORT = "587"; 24 | 25 | public static final String FROM = "testtmail95@gmail.com"; 26 | public static final String PASSWORD = "********"; 27 | 28 | /* "**********@gmail.com", */ 29 | public static final String[] TO = {"testtmail95@gmail.com"}; 30 | public static final String SUBJECT = FrameworkConstants.getProjectName(); 31 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/listeners/AnnotationTransformer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.listeners; 14 | 15 | import org.testng.IAnnotationTransformer; 16 | import org.testng.annotations.ITestAnnotation; 17 | 18 | import java.lang.reflect.Constructor; 19 | import java.lang.reflect.Method; 20 | 21 | public class AnnotationTransformer implements IAnnotationTransformer { 22 | public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) { 23 | 24 | /** 25 | * I don't need to add these details with Test case 26 | * 27 | * @Test(dataProvider = "getData", dataProviderClass = DataProviderUtils.class) 28 | */ 29 | annotation.setRetryAnalyzer(RetryFailedTests.class); 30 | //annotation.setDataProvider("getData"); 31 | //annotation.setDataProviderClass(DataProviderUtils.class); 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/listeners/ListenerClass.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.listeners; 14 | 15 | import com.aventstack.extentreports.markuputils.ExtentColor; 16 | import com.aventstack.extentreports.markuputils.Markup; 17 | import com.aventstack.extentreports.markuputils.MarkupHelper; 18 | import org.selenium.annotations.FrameworkAnnotation; 19 | import org.selenium.reports.ExtentLogger; 20 | import org.selenium.reports.ExtentReport; 21 | import org.selenium.utils.BrowserOSInfoUtils; 22 | import org.selenium.utils.EmailSendUtils; 23 | import org.selenium.utils.IconUtils; 24 | import org.selenium.utils.ZipUtils; 25 | import org.testng.*; 26 | 27 | import java.util.Arrays; 28 | 29 | import static org.selenium.constants.FrameworkConstants.*; 30 | 31 | public class ListenerClass implements ITestListener, ISuiteListener { 32 | 33 | static int count_passedTCs; 34 | static int count_skippedTCs; 35 | static int count_failedTCs; 36 | static int count_totalTCs; 37 | 38 | @Override 39 | public void onStart(ISuite suite) { 40 | ExtentReport.initReports(); 41 | } 42 | 43 | @Override 44 | public void onFinish(ISuite suite) { 45 | ExtentReport.flushReports(); 46 | ZipUtils.zip(); 47 | EmailSendUtils.sendEmail(count_totalTCs, count_passedTCs, count_failedTCs, count_skippedTCs); 48 | } 49 | 50 | @Override 51 | public void onTestStart(ITestResult result) { 52 | 53 | // System.out.println("onTestStart() "); 54 | count_totalTCs = count_totalTCs + 1; 55 | ExtentReport.createTest(result.getMethod().getMethodName()); 56 | // ExtentReport.createTest(result.getMethod().getDescription()); 57 | 58 | ExtentReport.addAuthors(result.getMethod().getConstructorOrMethod().getMethod() 59 | .getAnnotation(FrameworkAnnotation.class).author()); 60 | 61 | ExtentReport.addCategories(result.getMethod().getConstructorOrMethod().getMethod() 62 | .getAnnotation(FrameworkAnnotation.class).category()); 63 | 64 | ExtentReport.addDevices(); 65 | // ExtentLogger.info("" + 66 | // BrowserOSInfoUtils.getOS_Browser_BrowserVersionInfo() + ""); 67 | ExtentLogger.info("" + IconUtils.getOSIcon() + " & " + IconUtils.getBrowserIcon() + " --------- " 68 | + BrowserOSInfoUtils.getOS_Browser_BrowserVersionInfo() + ""); 69 | 70 | } 71 | 72 | @Override 73 | public void onTestSuccess(ITestResult result) { 74 | count_passedTCs = count_passedTCs + 1; 75 | String logText = "" + result.getMethod().getMethodName() + " is passed." + " " + ICON_SMILEY_PASS; 76 | Markup markup_message = MarkupHelper.createLabel(logText, ExtentColor.GREEN); 77 | ExtentLogger.pass(markup_message); 78 | } 79 | 80 | @Override 81 | public void onTestFailure(ITestResult result) { 82 | count_failedTCs = count_failedTCs + 1; 83 | ExtentLogger.fail(ICON_BUG + " " + "" + result.getThrowable().toString() + ""); 84 | String exceptionMessage = Arrays.toString(result.getThrowable().getStackTrace()); 85 | String message = "
Exception occured, click to see details: " 86 | + ICON_SMILEY_FAIL + " " + "" + exceptionMessage.replaceAll(",", "
") 87 | + "
\n"; 88 | 89 | ExtentLogger.fail(message); 90 | 91 | String logText = "" + result.getMethod().getMethodName() + " is failed." + " " + ICON_SMILEY_FAIL; 92 | Markup markup_message = MarkupHelper.createLabel(logText, ExtentColor.RED); 93 | ExtentLogger.fail(markup_message, true); 94 | 95 | } 96 | 97 | @Override 98 | public void onTestSkipped(ITestResult result) { 99 | 100 | count_skippedTCs = count_skippedTCs + 1; 101 | 102 | ExtentLogger.skip(ICON_BUG + " " + "" + result.getThrowable().toString() + ""); 103 | // ExtentLogger.skip("" + result.getThrowable().toString() + ""); 104 | String logText = "" + result.getMethod().getMethodName() + " is skipped." + " " + ICON_SMILEY_FAIL; 105 | Markup markup_message = MarkupHelper.createLabel(logText, ExtentColor.YELLOW); 106 | ExtentLogger.skip(markup_message, true); 107 | 108 | } 109 | 110 | @Override 111 | public void onTestFailedButWithinSuccessPercentage(ITestResult result) { 112 | /* 113 | * As of now, we are not using it 114 | */ 115 | } 116 | 117 | @Override 118 | public void onStart(ITestContext result) { 119 | /* 120 | * As of now, we are not using it. 121 | */ 122 | } 123 | 124 | @Override 125 | public void onFinish(ITestContext result) { 126 | /* 127 | * As of now, we are not using it. 128 | */ 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/listeners/MethodInterceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.listeners; 14 | 15 | import org.testng.IMethodInstance; 16 | import org.testng.IMethodInterceptor; 17 | import org.testng.ITestContext; 18 | import org.testng.annotations.Test; 19 | 20 | import java.util.ArrayList; 21 | import java.util.HashSet; 22 | import java.util.List; 23 | import java.util.Set; 24 | 25 | public class MethodInterceptor implements IMethodInterceptor { 26 | 27 | @Override 28 | public List intercept(List methods, ITestContext context) { 29 | 30 | System.out.println("----------------METHOD INTERCEPTOR--------------------------"); 31 | System.out.println("methods: " + methods); 32 | 33 | List result = new ArrayList(); 34 | 35 | // System.setProperty("testCategory", "BVT,Smoke"); 36 | String testCategory = System.getProperty("testCategory"); 37 | System.out.println("testCategory: " + testCategory); 38 | for (IMethodInstance method : methods) { 39 | Test testMethod = method.getMethod().getConstructorOrMethod() 40 | .getMethod().getAnnotation(Test.class); 41 | Set groups = new HashSet(); 42 | for (String group : testMethod.groups()) { 43 | groups.add(group); 44 | } 45 | // if (groups.contains("SMOKE")) { 46 | // if (groups.contains("BVT")) { 47 | if (groups.contains(testCategory)) { 48 | result.add(method); 49 | } 50 | } 51 | if (testCategory == null) { 52 | System.out.println( 53 | "Either You are not running the test execution from Maven" 54 | + " command line or you are not giving the property -D=testCategory"); 55 | return methods; 56 | } else { 57 | return result; 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/listeners/RetryFailedTests.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.listeners; 14 | 15 | import org.selenium.utils.ConfigLoader; 16 | import org.testng.IRetryAnalyzer; 17 | import org.testng.ITestResult; 18 | 19 | import static org.selenium.constants.FrameworkConstants.YES; 20 | 21 | public class RetryFailedTests implements IRetryAnalyzer { 22 | 23 | private int count = 0; 24 | private int retries = 1; 25 | 26 | @Override 27 | public boolean retry(ITestResult result) { 28 | 29 | boolean value = false; 30 | if (ConfigLoader.getInstance().getRetryFailedTests().equalsIgnoreCase(YES)) { 31 | if (count < retries) { 32 | count++; 33 | return true; 34 | } 35 | } 36 | return value; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/objects/BillingAddress.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.objects; 14 | 15 | public class BillingAddress { 16 | 17 | private String firstName; 18 | private String lastName; 19 | private String addressLineOne; 20 | private String city; 21 | private String postalCode; 22 | private String email; 23 | private String country; 24 | private String state; 25 | 26 | public BillingAddress() { 27 | 28 | } 29 | 30 | public BillingAddress(String firstName, String lastName, String addressLineOne, String city, String postalCode, 31 | String email, String country, String state) { 32 | super(); 33 | this.firstName = firstName; 34 | this.lastName = lastName; 35 | this.addressLineOne = addressLineOne; 36 | this.city = city; 37 | this.postalCode = postalCode; 38 | this.email = email; 39 | this.country = country; 40 | this.state = state; 41 | } 42 | 43 | public String getCountry() { 44 | return country; 45 | } 46 | 47 | public void setCountry(String country) { 48 | this.country = country; 49 | } 50 | 51 | public String getState() { 52 | return state; 53 | } 54 | 55 | public void setState(String state) { 56 | this.state = state; 57 | } 58 | 59 | public String getFirstName() { 60 | return firstName; 61 | } 62 | 63 | public BillingAddress setFirstName(String firstName) { 64 | this.firstName = firstName; 65 | return this; 66 | } 67 | 68 | public String getLastName() { 69 | return lastName; 70 | } 71 | 72 | public BillingAddress setLastName(String lastName) { 73 | this.lastName = lastName; 74 | return this; 75 | } 76 | 77 | public String getAddressLineOne() { 78 | return addressLineOne; 79 | } 80 | 81 | public BillingAddress setAddressLineOne(String addressLineOne) { 82 | this.addressLineOne = addressLineOne; 83 | return this; 84 | } 85 | 86 | public String getCity() { 87 | return city; 88 | } 89 | 90 | public BillingAddress setCity(String city) { 91 | this.city = city; 92 | return this; 93 | } 94 | 95 | public String getPostalCode() { 96 | return postalCode; 97 | } 98 | 99 | public BillingAddress setPostalCode(String postalCode) { 100 | this.postalCode = postalCode; 101 | return this; 102 | } 103 | 104 | public String getEmail() { 105 | return email; 106 | } 107 | 108 | public BillingAddress setEmail(String email) { 109 | this.email = email; 110 | return this; 111 | } 112 | 113 | @Override 114 | public String toString() { 115 | return "BillingAddress [firstName=" + firstName + ", lastName=" + lastName + ", addressLineOne=" 116 | + addressLineOne + ", city=" + city + ", postalCode=" + postalCode + ", email=" + email + ", country=" 117 | + country + ", state=" + state + "]"; 118 | } 119 | 120 | } 121 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/objects/Product.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.objects; 14 | 15 | import org.selenium.utils.JacksonUtils; 16 | 17 | import java.io.IOException; 18 | 19 | public class Product { 20 | 21 | private int id; 22 | private String name; 23 | 24 | public Product() { 25 | } 26 | 27 | /* Will take the product ID and set */ 28 | public Product(int id) throws IOException { 29 | Product[] products = JacksonUtils.deSerializationJSON("products.json", Product[].class); 30 | for (Product product : products) { 31 | if (product.getId() == id) { 32 | this.id = id; 33 | this.name = product.getName(); 34 | } 35 | } 36 | } 37 | 38 | public Product(int id, String name) { 39 | this.id = id; 40 | this.name = name; 41 | } 42 | 43 | public int getId() { 44 | return id; 45 | } 46 | 47 | public void setId(int id) { 48 | this.id = id; 49 | } 50 | 51 | public String getName() { 52 | return name; 53 | } 54 | 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return "Product [id=" + id + ", name=" + name + "]"; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/objects/User.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.objects; 14 | 15 | public class User { 16 | 17 | private String username; 18 | private String password; 19 | private String email; 20 | 21 | public User() { 22 | } 23 | 24 | public String getEmail() { 25 | return email; 26 | } 27 | 28 | public User setEmail(String email) { 29 | this.email = email; 30 | return this; 31 | } 32 | 33 | public String getUsername() { 34 | return username; 35 | } 36 | 37 | public User setUsername(String username) { 38 | this.username = username; 39 | return this; 40 | } 41 | 42 | public String getPassword() { 43 | return password; 44 | } 45 | 46 | public User setPassword(String password) { 47 | this.password = password; 48 | return this; 49 | } 50 | 51 | public User(String username, String password, String email) { 52 | super(); 53 | this.username = username; 54 | this.password = password; 55 | this.email = email; 56 | } 57 | 58 | public User(String username, String password) { 59 | super(); 60 | this.username = username; 61 | this.password = password; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "User [username=" + username + ", password=" + password + ", email=" + email + "]"; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/pages/BasePage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.pages; 14 | 15 | import com.aventstack.extentreports.MediaEntityBuilder; 16 | import com.google.common.util.concurrent.Uninterruptibles; 17 | import org.openqa.selenium.By; 18 | import org.openqa.selenium.WebDriver; 19 | import org.openqa.selenium.WebElement; 20 | import org.openqa.selenium.support.ui.ExpectedConditions; 21 | import org.openqa.selenium.support.ui.WebDriverWait; 22 | import org.selenium.constants.FrameworkConstants; 23 | import org.selenium.driver.DriverManager; 24 | import org.selenium.enums.WaitStrategy; 25 | import org.selenium.factories.ExplicitWaitFactory; 26 | import org.selenium.reports.ExtentLogger; 27 | import org.selenium.reports.ExtentManager; 28 | import org.selenium.utils.ConfigLoader; 29 | import org.selenium.utils.ScreenshotUtils; 30 | 31 | import java.util.List; 32 | import java.util.concurrent.TimeUnit; 33 | 34 | import static org.selenium.constants.FrameworkConstants.ICON_Navigate_Right; 35 | import static org.selenium.constants.FrameworkConstants.WAIT; 36 | 37 | public class BasePage { 38 | 39 | /* Class level -> Not Thread safe */ 40 | /* 41 | * No need to use ThreadLocal, because when we are creating the Object of Page, 42 | * those objects are local to test methods. 43 | */ 44 | protected WebDriver driver; 45 | protected WebDriverWait wait; 46 | 47 | /* 48 | * Many waits can also be used in case you want to different time wait for 49 | * different web elements 50 | */ 51 | // protected WebDriverWait waitLong; 52 | // protected WebDriverWait waitShort; 53 | 54 | public BasePage(WebDriver driver) { 55 | this.driver = driver; 56 | wait = new WebDriverWait(driver, FrameworkConstants.getExplicitWait()); 57 | // waitLong = new WebDriverWait(driver, 25); 58 | // waitShort = new WebDriverWait(driver, 5); 59 | 60 | } 61 | 62 | public void load(String endPoint) { 63 | // driver.get("https://askomdch.com/" + endPoint); 64 | driver.get(ConfigLoader.getInstance().getBaseUrl() + endPoint); 65 | ExtentLogger.info(ICON_Navigate_Right + " Navigating to : " + ConfigLoader.getInstance().getBaseUrl() 66 | + endPoint + ""); 67 | } 68 | 69 | public void waitForOverlaysToDisappear(By overlay) { 70 | List overlays = driver.findElements(overlay); 71 | System.out.println("OVERLAY SIZE" + overlays.size()); 72 | if (overlays.size() > 0) { 73 | wait.until(ExpectedConditions.invisibilityOfAllElements(overlays)); 74 | System.out.println("OVERLAY INVISIBLE NOW"); 75 | } else { 76 | System.out.println("OVERLAY NOT FOUND"); 77 | } 78 | } 79 | 80 | protected void click(By by, WaitStrategy waitStrategy, String elementName) { 81 | // DriverManager.getDriver().findElement(by).click(); 82 | ExplicitWaitFactory.performExplicitWait(waitStrategy, by).click(); 83 | ExtentLogger.pass("" + elementName + " is clicked", true); 84 | // log(PASS,elementName+" is clicked"); 85 | } 86 | 87 | protected void sendKeys(By by, String value, WaitStrategy waitStrategy, String elementName) { 88 | ExplicitWaitFactory.performExplicitWait(waitStrategy, by).sendKeys(value); 89 | ExtentLogger.pass("" + value + " is entered successfully in " + elementName + "", true); 90 | // log(PASS,value +" is entered successfully in "+elementName); 91 | } 92 | 93 | protected void clear(By by, WaitStrategy waitStrategy, String elementName) { 94 | ExplicitWaitFactory.performExplicitWait(waitStrategy, by).clear(); 95 | ExtentLogger.info("Clearing the field " + elementName + ""); 96 | // log(PASS,value +" is entered successfully in "+elementName); 97 | } 98 | 99 | protected void clearAndSendKeys(By by, String value, WaitStrategy waitStrategy, String elementName) { 100 | WebElement element = ExplicitWaitFactory.performExplicitWait(waitStrategy, by); 101 | element.clear(); 102 | element.sendKeys(value); 103 | ExtentLogger.pass("" + value + " is entered successfully in " + elementName + "", true); 104 | // log(PASS,value +" is entered successfully in "+elementName); 105 | } 106 | 107 | /* 108 | * protected String getElementName(By by) { return 109 | * DriverManager.getDriver().findElement(by).getText(); } 110 | */ 111 | protected String getPageTitle() { 112 | return DriverManager.getDriver().getTitle(); 113 | } 114 | 115 | /* 116 | * public WebElement getElement(By element) { return 117 | * wait.until(ExpectedConditions.visibilityOfElementLocated(element)); } 118 | */ 119 | 120 | protected void captureScreenshot() { 121 | ExtentManager.getExtentTest().info("Capturing Screenshot", 122 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 123 | } 124 | 125 | protected void waitForSomeTime() { 126 | Uninterruptibles.sleepUninterruptibly(WAIT, TimeUnit.SECONDS); 127 | } 128 | 129 | protected void waitForGivenTime(long time) { 130 | Uninterruptibles.sleepUninterruptibly(time, TimeUnit.SECONDS); 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/pages/CartPage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.pages; 14 | 15 | import org.openqa.selenium.By; 16 | import org.openqa.selenium.WebDriver; 17 | import org.openqa.selenium.WebElement; 18 | import org.openqa.selenium.support.FindBy; 19 | import org.openqa.selenium.support.PageFactory; 20 | import org.openqa.selenium.support.ui.ExpectedConditions; 21 | import org.selenium.enums.WaitStrategy; 22 | 23 | public class CartPage extends BasePage { 24 | 25 | public CartPage(WebDriver driver) { 26 | super(driver); 27 | PageFactory.initElements(driver, this); 28 | } 29 | 30 | public Boolean isLoaded() { 31 | return wait.until(ExpectedConditions.textToBe(cartHeading, "Cart")); 32 | } 33 | 34 | // private final By productName = By.xpath("//a[normalize-space()='Blue 35 | // Shoes']"); 36 | @FindBy(css = "td[class='product-name'] a") 37 | private WebElement productName; 38 | private final By checkoutBtn = By.xpath("//a[normalize-space()='Proceed to checkout']"); 39 | private final By cartHeading = By.cssSelector(".has-text-align-center"); 40 | 41 | public String getProductName() { 42 | // return driver.findElement(productName).getText(); 43 | // return 44 | // wait.until(ExpectedConditions.visibilityOfElementLocated(productName)).getText(); 45 | return wait.until(ExpectedConditions.visibilityOf(productName)).getText(); 46 | 47 | } 48 | 49 | public CheckoutPage checkout() { 50 | // driver.findElement(checkoutBtn).click(); 51 | // wait.until(ExpectedConditions.elementToBeClickable(checkoutBtn)).click(); 52 | click(checkoutBtn, WaitStrategy.CLICKABLE, "Checkout"); 53 | return new CheckoutPage(driver); 54 | } 55 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/pages/HomePage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.pages; 14 | 15 | import org.openqa.selenium.WebDriver; 16 | import org.openqa.selenium.support.ui.ExpectedConditions; 17 | import org.selenium.components.MyHeader; 18 | import org.selenium.components.ProductThumbnail; 19 | 20 | public class HomePage extends BasePage { 21 | 22 | private MyHeader myHeader; 23 | private ProductThumbnail productThumbnail; 24 | 25 | public HomePage(WebDriver driver) { 26 | super(driver); 27 | myHeader = new MyHeader(driver); 28 | productThumbnail = new ProductThumbnail(driver); 29 | } 30 | 31 | public MyHeader getMyHeader() { 32 | return myHeader; 33 | } 34 | 35 | public ProductThumbnail getProductThumbnail() { 36 | return productThumbnail; 37 | } 38 | 39 | public HomePage load() { 40 | load(""); 41 | wait.until(ExpectedConditions.titleContains("AskOmDch")); 42 | return this; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/pages/StorePage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.pages; 14 | 15 | import io.qameta.allure.Step; 16 | import org.openqa.selenium.By; 17 | import org.openqa.selenium.WebDriver; 18 | import org.openqa.selenium.support.ui.ExpectedConditions; 19 | import org.selenium.components.ProductThumbnail; 20 | import org.selenium.enums.WaitStrategy; 21 | 22 | public class StorePage extends BasePage { 23 | 24 | private ProductThumbnail productThumbnail; 25 | 26 | public StorePage(WebDriver driver) { 27 | super(driver); 28 | productThumbnail = new ProductThumbnail(driver); 29 | } 30 | 31 | @Step 32 | public ProductThumbnail getProductThumbnail() { 33 | return productThumbnail; 34 | } 35 | 36 | public Boolean isLoaded() { 37 | return wait.until(ExpectedConditions.urlContains("/store")); 38 | } 39 | 40 | private final By vaibav = By.id("woocommerce-product-search-field-0"); 41 | private final By searchBtn = By.xpath("//button[normalize-space()='Search']"); 42 | private final By title = By.xpath("//h1[@class='woocommerce-products-header__title page-title']"); 43 | 44 | /* Builder Pattern - used for Method Chaining */ 45 | /* Structural Page Object */ 46 | /* 1 method will do 1 operation --> sendKeys() */ 47 | public StorePage enterTextInSearchField(String txt) { 48 | // driver.findElement(searchFld).sendKeys(txt); 49 | //wait.until(ExpectedConditions.visibilityOfElementLocated(searchFld)).sendKeys(txt); 50 | sendKeys(vaibav, txt, WaitStrategy.PRESENCE, "Search Field"); 51 | return this; 52 | } 53 | 54 | /* Functional Page Object */ 55 | /* Represents a Functionality */ 56 | /* 1 method will do 2 operations --> sendKeys(), click() */ 57 | public StorePage search(String txt) { 58 | // driver.findElement(searchFld).sendKeys(txt); 59 | // driver.findElement(searchBtn).click(); 60 | search(txt).clickSearchBtn(); 61 | return this; 62 | } 63 | 64 | @Step 65 | public StorePage load() { 66 | load("store"); 67 | return this; 68 | } 69 | 70 | public StorePage clickSearchBtn() { 71 | // driver.findElement(searchBtn).click(); 72 | // wait.until(ExpectedConditions.elementToBeClickable(searchBtn)).click(); 73 | click(searchBtn, WaitStrategy.CLICKABLE, "Search Button"); 74 | return this; 75 | } 76 | 77 | public String getTitle() { 78 | // return driver.findElement(title).getText(); 79 | return wait.until(ExpectedConditions.visibilityOfElementLocated(title)).getText(); 80 | // return this; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/reports/ExtentLogger.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.reports; 15 | 16 | import com.aventstack.extentreports.MediaEntityBuilder; 17 | import com.aventstack.extentreports.markuputils.Markup; 18 | import org.selenium.utils.ConfigLoader; 19 | import org.selenium.utils.ScreenshotUtils; 20 | 21 | import static org.selenium.constants.FrameworkConstants.YES; 22 | 23 | public final class ExtentLogger { 24 | 25 | private ExtentLogger() { 26 | } 27 | 28 | public static void pass(String message) { 29 | ExtentManager.getExtentTest().pass(message); 30 | } 31 | 32 | public static void pass(Markup message) { 33 | ExtentManager.getExtentTest().pass(message); 34 | } 35 | 36 | public static void fail(String message) { 37 | ExtentManager.getExtentTest().fail(message); 38 | } 39 | 40 | public static void fail(Markup message) { 41 | ExtentManager.getExtentTest().fail(message); 42 | } 43 | 44 | public static void skip(String message) { 45 | ExtentManager.getExtentTest().skip(message); 46 | } 47 | 48 | public static void skip(Markup message) { 49 | ExtentManager.getExtentTest().skip(message); 50 | } 51 | 52 | public static void info(Markup message) { 53 | ExtentManager.getExtentTest().info(message); 54 | } 55 | 56 | public static void info(String message) { 57 | ExtentManager.getExtentTest().info(message); 58 | } 59 | 60 | public static void pass(String message, boolean isScreeshotNeeded) { 61 | // if 62 | // (PropertyUtils.get(ConfigProperties.PASSED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 63 | // && isScreeshotNeeded) { 64 | if (ConfigLoader.getInstance().getPassedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 65 | ExtentManager.getExtentTest().pass(message, 66 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 67 | } else { 68 | pass(message); 69 | } 70 | } 71 | 72 | public static void pass(Markup message, boolean isScreeshotNeeded) { 73 | // if 74 | // (PropertyUtils.get(ConfigProperties.PASSED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 75 | // && isScreeshotNeeded) { 76 | if (ConfigLoader.getInstance().getPassedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 77 | /* 78 | * ExtentManager.getExtentTest().pass(message, 79 | * MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils. 80 | * getBase64Image()).build()); 81 | */ 82 | ExtentManager.getExtentTest().pass( 83 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 84 | ExtentManager.getExtentTest().pass(message); 85 | } else { 86 | pass(message); 87 | } 88 | } 89 | 90 | public static void fail(String message, boolean isScreeshotNeeded) { 91 | // if 92 | // (PropertyUtils.get(ConfigProperties.FAILED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 93 | // && isScreeshotNeeded) { 94 | if (ConfigLoader.getInstance().getFailedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 95 | ExtentManager.getExtentTest().fail(message, 96 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 97 | } else { 98 | fail(message); 99 | } 100 | } 101 | 102 | public static void fail(Markup message, boolean isScreeshotNeeded) { 103 | // if 104 | // (PropertyUtils.get(ConfigProperties.FAILED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 105 | // && isScreeshotNeeded) { 106 | if (ConfigLoader.getInstance().getFailedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 107 | /* 108 | * ExtentManager.getExtentTest().fail(message, 109 | * MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils. 110 | * getBase64Image()).build()); 111 | */ 112 | ExtentManager.getExtentTest().fail( 113 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 114 | ExtentManager.getExtentTest().fail(message); 115 | } else { 116 | fail(message); 117 | } 118 | } 119 | 120 | public static void skip(String message, boolean isScreeshotNeeded) { 121 | // if 122 | // (PropertyUtils.get(ConfigProperties.SKIPPED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 123 | // && isScreeshotNeeded) { 124 | if (ConfigLoader.getInstance().getSkippedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 125 | ExtentManager.getExtentTest().skip(message, 126 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 127 | } else { 128 | skip(message); 129 | } 130 | } 131 | 132 | public static void skip(Markup message, boolean isScreeshotNeeded) { 133 | // if 134 | // (PropertyUtils.get(ConfigProperties.SKIPPED_STEPS_SCREENSHOT).equalsIgnoreCase("yes") 135 | // && isScreeshotNeeded) { 136 | if (ConfigLoader.getInstance().getSkippedStepsScreenshot().equalsIgnoreCase(YES) && isScreeshotNeeded) { 137 | /* 138 | * ExtentManager.getExtentTest().skip(message, 139 | * MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils. 140 | * getBase64Image()).build()); 141 | */ 142 | 143 | ExtentManager.getExtentTest().skip( 144 | MediaEntityBuilder.createScreenCaptureFromBase64String(ScreenshotUtils.getBase64Image()).build()); 145 | ExtentManager.getExtentTest().skip(message); 146 | } else { 147 | skip(message); 148 | } 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/reports/ExtentManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.reports; 15 | 16 | import com.aventstack.extentreports.ExtentTest; 17 | 18 | public class ExtentManager { 19 | 20 | private ExtentManager() { 21 | } 22 | 23 | private static ThreadLocal extentTest = new ThreadLocal<>(); 24 | 25 | public static ExtentTest getExtentTest() { 26 | return extentTest.get(); 27 | } 28 | 29 | static void setExtentTest(ExtentTest test) { 30 | extentTest.set(test); 31 | } 32 | 33 | static void unload() { 34 | extentTest.remove(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/reports/ExtentReport.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | * Tutor: Amuthan Sakthivel (https://www.testingminibytes.com/) 10 | */ 11 | 12 | /***************************************************/ 13 | 14 | package org.selenium.reports; 15 | 16 | import com.aventstack.extentreports.ExtentReports; 17 | import com.aventstack.extentreports.reporter.ExtentSparkReporter; 18 | import com.aventstack.extentreports.reporter.configuration.Theme; 19 | import org.selenium.constants.FrameworkConstants; 20 | import org.selenium.enums.AuthorType; 21 | import org.selenium.enums.CategoryType; 22 | import org.selenium.utils.BrowserInfoUtils; 23 | import org.selenium.utils.IconUtils; 24 | 25 | import java.awt.*; 26 | import java.io.File; 27 | import java.io.IOException; 28 | import java.util.Objects; 29 | 30 | import static org.selenium.constants.FrameworkConstants.*; 31 | 32 | public final class ExtentReport { 33 | 34 | private ExtentReport() { 35 | } 36 | 37 | private static ExtentReports extent; 38 | 39 | public static void initReports() { 40 | if (Objects.isNull(extent)) { 41 | extent = new ExtentReports(); 42 | ExtentSparkReporter spark = new ExtentSparkReporter(FrameworkConstants.getExtentReportFilePath()); 43 | /* 44 | * .viewConfigurer() .viewOrder() .as(new ViewName[] { ViewName.DASHBOARD, 45 | * ViewName.TEST, //ViewName.TAG, ViewName.CATEGORY, ViewName.AUTHOR, 46 | * ViewName.DEVICE, ViewName.EXCEPTION, ViewName.LOG }) .apply(); 47 | */ 48 | 49 | /* 50 | * You can even update the view of the ExtentRerport - Whta do you want to you 51 | * first, you can prioritize 52 | */ 53 | /* 54 | * ExtentSparkReporter spark = new 55 | * ExtentSparkReporter(REPORTS_SPARK_CUSTOMISED_HTML).viewConfigurer().viewOrder 56 | * () .as(new ViewName[] { ViewName.DASHBOARD, ViewName.TEST, ViewName.CATEGORY 57 | * }).apply(); 58 | */ 59 | extent.attachReporter(spark); 60 | 61 | // spark.config().setEncoding("utf-8"); 62 | spark.config().setTheme(Theme.STANDARD); 63 | spark.config().setDocumentTitle(FrameworkConstants.getProjectName() + " - ALL"); 64 | spark.config().setReportName(FrameworkConstants.getProjectName() + " - ALL"); 65 | 66 | extent.setSystemInfo("Organization", "Nagarro"); 67 | extent.setSystemInfo("Employee", 68 | " Rajat Verma " + " " + ICON_SOCIAL_LINKEDIN + " " + ICON_SOCIAL_GITHUB); 69 | extent.setSystemInfo("Domain", "Engineering (IT - Software)"+" "+ICON_LAPTOP); 70 | extent.setSystemInfo("Skill", "Test Automation Engineer"); 71 | } 72 | } 73 | 74 | public static void flushReports() { 75 | if (Objects.nonNull(extent)) { 76 | extent.flush(); 77 | } 78 | ExtentManager.unload(); 79 | try { 80 | Desktop.getDesktop().browse(new File(FrameworkConstants.getExtentReportFilePath()).toURI()); 81 | } catch (IOException e) { 82 | e.printStackTrace(); 83 | } 84 | } 85 | 86 | public static void createTest(String testCaseName) { 87 | // ExtentManager.setExtentTest(extent.createTest(testCaseName)); 88 | ExtentManager.setExtentTest(extent.createTest(IconUtils.getBrowserIcon() + " : " + testCaseName)); 89 | } 90 | 91 | synchronized public static void addAuthors(AuthorType[] authors) { 92 | for (AuthorType author : authors) { 93 | ExtentManager.getExtentTest().assignAuthor(author.toString()); 94 | } 95 | } 96 | 97 | // public static void addCategories(String[] categories) { 98 | synchronized public static void addCategories(CategoryType[] categories) { 99 | // for (String category : categories) { 100 | for (CategoryType category : categories) { 101 | ExtentManager.getExtentTest().assignCategory(category.toString()); 102 | } 103 | } 104 | 105 | synchronized public static void addDevices() { 106 | ExtentManager.getExtentTest().assignDevice(BrowserInfoUtils.getBrowserInfo()); 107 | // ExtentManager.getExtentTest() 108 | // .assignDevice(BrowserIconUtils.getBrowserIcon() + " : " + BrowserInfoUtils.getBrowserInfo()); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/BrowserInfoUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.openqa.selenium.Capabilities; 16 | import org.openqa.selenium.remote.RemoteWebDriver; 17 | import org.selenium.driver.DriverManager; 18 | 19 | public final class BrowserInfoUtils { 20 | 21 | /** 22 | * Private constructor to avoid external instantiation 23 | */ 24 | private BrowserInfoUtils() { 25 | } 26 | 27 | public static String getBrowserInfo() { 28 | Capabilities capabilities = ((RemoteWebDriver) DriverManager.getDriver()).getCapabilities(); 29 | return capabilities.getBrowserName().toUpperCase(); 30 | 31 | } 32 | 33 | public static String getBrowserVersionInfo() { 34 | Capabilities capabilities = ((RemoteWebDriver) DriverManager.getDriver()).getCapabilities(); 35 | return capabilities.getVersion(); 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/BrowserOSInfoUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | public final class BrowserOSInfoUtils { 16 | 17 | /** 18 | * Private constructor to avoid external instantiation 19 | */ 20 | private BrowserOSInfoUtils() { 21 | } 22 | 23 | public static String getOS_Browser_BrowserVersionInfo() { 24 | return OSInfoUtils.getOSInfo() + " & " + BrowserInfoUtils.getBrowserInfo() + " - " 25 | + BrowserInfoUtils.getBrowserVersionInfo(); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/ConfigLoader.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.selenium.enums.EnvType; 16 | 17 | import java.util.Properties; 18 | 19 | /*Singleton Design pattern*/ 20 | public class ConfigLoader { 21 | 22 | private static final String SEND_EMAIL_TO_USERS = "send_email_to_users"; 23 | private static final String OVERRIDE_REPORTS = "override_reports"; 24 | private static final String SKIPPED_STEPS_SCREENSHOT = "skipped_steps_screenshot"; 25 | private static final String PASSED_STEPS_SCREENSHOT = "passed_steps_screenshot"; 26 | private static final String FAILED_STEPS_SCREENSHOT = "failed_steps_screenshot"; 27 | private static final String RETRY_FAILED_TESTS = "retry_failed_tests"; 28 | private static final String PASSWORD = "password"; 29 | private static final String USERNAME = "username"; 30 | private static final String BASE_URL = "baseUrl"; 31 | private static final String REQUEST_DETAILS_IN_REPORTS = "request_details_in_reports"; 32 | 33 | private static final String ENV = "env"; 34 | private static final String CONFIG_PROPERTIES = "_config.properties"; 35 | 36 | /* Default config file is stg_config.properties */ 37 | private static final String STG_CONFIG_PROPERTIES = "stg" + CONFIG_PROPERTIES; 38 | private static final String PROD_CONFIG_PROPERTIES = "prod" + CONFIG_PROPERTIES; 39 | private static final String QA_CONFIG_PROPERTIES = "qa" + CONFIG_PROPERTIES; 40 | private static final String INT_CONFIG_PROPERTIES = "int" + CONFIG_PROPERTIES; 41 | 42 | private static final String RESOURCES_PATH = System.getProperty("user.dir") + "/src/test/resources/"; 43 | private Properties properties; 44 | // private final Properties properties; 45 | private static ConfigLoader configLoader; 46 | 47 | private ConfigLoader() { 48 | 49 | /* Setting EnvType.STAGE as default environment */ 50 | /* 51 | * This will check for the env value from Jenkins/Maven first. If it does not 52 | * get any input from Jenkins/mvn cmd line, then, will take 53 | * stg_config.properties file as default 54 | */ 55 | String env = System.getProperty(ENV, EnvType.STAGE.toString()); 56 | 57 | switch (EnvType.valueOf(env)) { 58 | /* Only STAGE is working, Rest are taken for example */ 59 | 60 | case STAGE: { 61 | properties = getConfigPropertyFile(STG_CONFIG_PROPERTIES); 62 | break; 63 | } 64 | case INT: { 65 | properties = getConfigPropertyFile(INT_CONFIG_PROPERTIES); 66 | break; 67 | } 68 | case QA: { 69 | properties = getConfigPropertyFile(QA_CONFIG_PROPERTIES); 70 | break; 71 | } 72 | case PRODUCTION: { 73 | properties = getConfigPropertyFile(PROD_CONFIG_PROPERTIES); 74 | break; 75 | } 76 | default: { 77 | throw new IllegalStateException("Invalid EnvType: " + env); 78 | } 79 | } 80 | } 81 | 82 | private Properties getConfigPropertyFile(String configFile) { 83 | return PropertyUtils.propertyLoader(RESOURCES_PATH + configFile); 84 | } 85 | 86 | private String getPropertyValue(String propertyKey) { 87 | String prop = properties.getProperty(propertyKey); 88 | if (prop != null) { 89 | return prop.trim(); 90 | } else { 91 | throw new RuntimeException("Property " + propertyKey + " is not specified in the config.properties file"); 92 | } 93 | } 94 | 95 | public static ConfigLoader getInstance() { 96 | if (configLoader == null) { 97 | configLoader = new ConfigLoader(); 98 | } 99 | return configLoader; 100 | } 101 | 102 | public String getBaseUrl() { 103 | return getPropertyValue(BASE_URL); 104 | } 105 | 106 | public String getUsername() { 107 | return getPropertyValue(USERNAME); 108 | } 109 | 110 | public String getPassword() { 111 | return getPropertyValue(PASSWORD); 112 | } 113 | 114 | public String getFailedStepsScreenshot() { 115 | return getPropertyValue(FAILED_STEPS_SCREENSHOT); 116 | } 117 | 118 | public String getPassedStepsScreenshot() { 119 | return getPropertyValue(PASSED_STEPS_SCREENSHOT); 120 | } 121 | 122 | public String getSkippedStepsScreenshot() { 123 | return getPropertyValue(SKIPPED_STEPS_SCREENSHOT); 124 | } 125 | 126 | public String getRetryFailedTests() { 127 | return getPropertyValue(RETRY_FAILED_TESTS); 128 | } 129 | 130 | public String getOverrideReports() { 131 | return getPropertyValue(OVERRIDE_REPORTS); 132 | } 133 | 134 | public String getSendEmailToUsers() { 135 | return getPropertyValue(SEND_EMAIL_TO_USERS); 136 | } 137 | 138 | public String getRequestDetailsInReports() { 139 | return getPropertyValue(REQUEST_DETAILS_IN_REPORTS); 140 | } 141 | 142 | } 143 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/CookieUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import io.restassured.http.Cookies; 16 | import org.openqa.selenium.Cookie; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | public class CookieUtils { 22 | 23 | public List convertRestAssuredCookiesToSeleniumCookies(Cookies cookies) { 24 | 25 | List restAssuredCookies=new ArrayList<>(); 26 | restAssuredCookies=cookies.asList(); 27 | 28 | List seleniumCookies=new ArrayList<>(); 29 | 30 | for(io.restassured.http.Cookie restAssuredCookie: restAssuredCookies) { 31 | seleniumCookies.add( 32 | new Cookie( 33 | restAssuredCookie.getName(), 34 | restAssuredCookie.getValue(), 35 | restAssuredCookie.getDomain(), 36 | restAssuredCookie.getPath(), 37 | restAssuredCookie.getExpiryDate(), 38 | restAssuredCookie.isSecured(), 39 | restAssuredCookie.isHttpOnly() 40 | 41 | /*Present in Selenium 4.x*/ 42 | //restAssuredCookie.getSameSite() 43 | )); 44 | } 45 | 46 | return seleniumCookies; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import java.util.Date; 16 | 17 | //final -> We do not want any class to extend this class 18 | public final class DateUtils { 19 | 20 | //private -> We do not want anyone to create the object of this class 21 | // Private constructor to avoid external instantiation 22 | private DateUtils() { 23 | } 24 | 25 | public static String getCurrentDate() { 26 | Date date = new Date(); 27 | return date.toString().replace(":", "_").replace(" ", "_"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/EmailSendUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.selenium.constants.FrameworkConstants; 16 | import org.selenium.java_Mail_API.EmailAttachmentsSender; 17 | 18 | import javax.mail.MessagingException; 19 | 20 | import static org.selenium.constants.FrameworkConstants.YES; 21 | import static org.selenium.java_Mail_API.EmailConfig.*; 22 | 23 | public class EmailSendUtils { 24 | 25 | /** 26 | * sendEmail_WithAttachmentsAndFormattedBodyText_ToManyUsersRajat 27 | */ 28 | public static void sendEmail(int count_totalTCs, int count_passedTCs, int count_failedTCs, int count_skippedTCs) { 29 | 30 | if (ConfigLoader.getInstance().getSendEmailToUsers().equalsIgnoreCase(YES)) { 31 | System.out.println("****************************************"); 32 | System.out.println("Send Email - START"); 33 | System.out.println("****************************************"); 34 | 35 | System.out.println("File name: " + FrameworkConstants.getExtentReportFilePath()); 36 | 37 | String messageBody = getTestCasesCountInFormat(count_totalTCs, count_passedTCs, count_failedTCs, 38 | count_skippedTCs); 39 | System.out.println(messageBody); 40 | 41 | /* 42 | * String attachmentFile_ExtentReport = Constants.REPORTS_Folder + 43 | * "All_Automation_Report_Fri_Sep_10_03_47_17_IST_2021.html"; 44 | */ 45 | 46 | String attachmentFile_ExtentReport = FrameworkConstants.getExtentReportFilePath(); 47 | 48 | try { 49 | EmailAttachmentsSender.sendEmailWithAttachments(SERVER, PORT, FROM, PASSWORD, TO, SUBJECT, messageBody, 50 | attachmentFile_ExtentReport); 51 | 52 | System.out.println("****************************************"); 53 | System.out.println("Email sent successfully."); 54 | System.out.println("Send Email - END"); 55 | System.out.println("****************************************"); 56 | } catch (MessagingException e) { 57 | e.printStackTrace(); 58 | } 59 | 60 | } 61 | 62 | } 63 | 64 | private static String getTestCasesCountInFormat(int count_totalTCs, int count_passedTCs, int count_failedTCs, 65 | int count_skippedTCs) { 66 | System.out.println("count_totalTCs: " + count_totalTCs); 67 | System.out.println("count_passedTCs: " + count_passedTCs); 68 | System.out.println("count_failedTCs: " + count_failedTCs); 69 | System.out.println("count_skippedTCs: " + count_skippedTCs); 70 | 71 | return "\r\n" + "\r\n" + " \r\n" + "\r\n" 72 | + " \r\n\r\n\r\n\r\n" + " \r\n" + " \r\n" 89 | + " \r\n" 94 | + " \r\n" + " \r\n" + " \r\n" 95 | + "

" 73 | + FrameworkConstants.getProjectName() + "

\r\n\r\n" 74 | + " \r\n" 75 | + " \r\n" 77 | + " \r\n" + " \r\n" 78 | + "
" 76 | + count_totalTCs + "
Total
\r\n" + "
\r\n" 79 | + " \r\n" + " \r\n" 80 | + " \r\n" 82 | + " \r\n" + " \r\n" 83 | + "
" 81 | + count_passedTCs + "
Passed
\r\n" + "
\r\n" 84 | + " \r\n" 85 | + " \r\n" 87 | + " \r\n" + " \r\n" 88 | + "
" 86 | + count_failedTCs + "
Failed
\r\n" + " \r\n" + "
\r\n" + " \r\n" 90 | + " \r\n" 92 | + " \r\n" + " \r\n" 93 | + "
" 91 | + count_skippedTCs + "
Skipped
\r\n" + " \r\n" + "
\r\n" + " \r\n" + " \r\n" + ""; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/FakerUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import com.github.javafaker.Faker; 16 | 17 | public class FakerUtils { 18 | 19 | public Long generateRandomNumber() { 20 | Faker faker = new Faker(); 21 | // return faker.number().randomNumber(); 22 | return faker.number().randomNumber(10, true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/IconUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import static org.selenium.constants.FrameworkConstants.*; 16 | 17 | public final class IconUtils { 18 | 19 | /** 20 | * Private constructor to avoid external instantiation 21 | */ 22 | private IconUtils() { 23 | } 24 | 25 | public static String getBrowserIcon() { 26 | String browserInLowerCase = BrowserInfoUtils.getBrowserInfo().toLowerCase(); 27 | if (browserInLowerCase.contains(ICON_BROWSER_EDGE)) { 28 | return ICON_BROWSER_PREFIX + ICON_BROWSER_EDGE + ICON_BROWSER_SUFFIX; 29 | //return ""; 30 | } else { 31 | return ICON_BROWSER_PREFIX + browserInLowerCase + ICON_BROWSER_SUFFIX; 32 | } 33 | } 34 | 35 | public static String getOSIcon() { 36 | 37 | String operSys = OSInfoUtils.getOSInfo().toLowerCase(); 38 | if (operSys.contains("win")) { 39 | return ICON_OS_WINDOWS; 40 | } else if (operSys.contains("nix") || operSys.contains("nux") || operSys.contains("aix")) { 41 | return ICON_OS_LINUX; 42 | } else if (operSys.contains("mac")) { 43 | return ICON_OS_MAC; 44 | } 45 | return operSys; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/JacksonUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import com.fasterxml.jackson.databind.ObjectMapper; 16 | 17 | import java.io.IOException; 18 | import java.io.InputStream; 19 | 20 | public class JacksonUtils { 21 | 22 | /* 23 | * public static BillingAddress deSerializationJSON(InputStream is, 24 | * BillingAddress billingAddress) throws IOException { ObjectMapper objectMapper 25 | * = new ObjectMapper(); return objectMapper.readValue(is, 26 | * billingAddress.getClass()); } 27 | */ 28 | 29 | /* Generic method -. can be used for any class */ 30 | public static T deSerializationJSON(String fileName, Class T) throws IOException { 31 | /* myBillingAddress.json --> has to be present under src/test/resources */ 32 | InputStream is = JacksonUtils.class.getClassLoader().getResourceAsStream(fileName); 33 | ObjectMapper objectMapper = new ObjectMapper(); 34 | return objectMapper.readValue(is, T); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/OSInfoUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | public final class OSInfoUtils { 16 | 17 | /** 18 | * Private constructor to avoid external instantiation 19 | */ 20 | private OSInfoUtils() { 21 | } 22 | 23 | public static String getOSInfo() { 24 | return System.getProperty("os.name").replace(" ", "_"); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/PropertyUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import java.io.BufferedReader; 16 | import java.io.FileNotFoundException; 17 | import java.io.FileReader; 18 | import java.io.IOException; 19 | import java.util.Properties; 20 | 21 | public class PropertyUtils { 22 | 23 | public static Properties propertyLoader(String filePath) { 24 | Properties properties = new Properties(); 25 | BufferedReader reader = null; 26 | try { 27 | reader = new BufferedReader(new FileReader(filePath)); 28 | } catch (FileNotFoundException e1) { 29 | e1.printStackTrace(); 30 | throw new RuntimeException("Properties file not found at: " + filePath); 31 | } 32 | try { 33 | properties.load(reader); 34 | reader.close(); 35 | } catch (IOException e) { 36 | e.printStackTrace(); 37 | throw new RuntimeException("Failed to load the Properties file: " + filePath); 38 | } 39 | return properties; 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/ReportPathUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import static org.selenium.constants.FrameworkConstants.*; 16 | 17 | //final -> We do not want any class to extend this class 18 | public final class ReportPathUtils { 19 | 20 | // private -> We do not want anyone to create the object of this class 21 | // Private constructor to avoid external instantiation 22 | private ReportPathUtils() { 23 | } 24 | 25 | public static String createExtentReportPath() { 26 | if (ConfigLoader.getInstance().getOverrideReports().equalsIgnoreCase(NO)) { 27 | /** 28 | * Report name -> 29 | * 30 | * Windows_10_Tue_Oct_05_02_30_46_IST_2021_AutomationReport.html 31 | * Mac_OS_X_Tue_Feb_22_17_09_05_IST_2022_AutomationReport.html 32 | */ 33 | return EXTENT_REPORT_FOLDER_PATH + OSInfoUtils.getOSInfo() + "_" + DateUtils.getCurrentDate() + "_" 34 | + EXTENT_REPORT_NAME; 35 | 36 | } else { 37 | return EXTENT_REPORT_FOLDER_PATH + EXTENT_REPORT_NAME; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/ScreenshotUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.openqa.selenium.OutputType; 16 | import org.openqa.selenium.TakesScreenshot; 17 | import org.selenium.driver.DriverManager; 18 | 19 | public final class ScreenshotUtils { 20 | 21 | private ScreenshotUtils() { 22 | } 23 | 24 | public static String getBase64Image() { 25 | return ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BASE64); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/VerificationManager.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.selenium.reports.ExtentLogger; 16 | import org.testng.Assert; 17 | 18 | public class VerificationManager { 19 | 20 | public static void validateResponse(Object actual, Object expected, String message) { 21 | try { 22 | Assert.assertEquals(actual, expected, message); 23 | ExtentLogger.pass( 24 | message + " | Actual: " + actual + " and Expected: " + expected); 25 | } catch (AssertionError assertionError) { 26 | ExtentLogger.fail( 27 | message + " | Actual: " + actual + " and Expected: " + expected); 28 | Assert.fail(message); 29 | } 30 | } 31 | 32 | public static void validateResponse(boolean result, String message) { 33 | try { 34 | Assert.assertTrue(result); 35 | ExtentLogger.pass("" + message + ""); 36 | // report.info("PASS : " + message); 37 | } catch (AssertionError assertionError) { 38 | // report.error("FAIL : " + message); 39 | ExtentLogger.fail("" + message + ""); 40 | Assert.fail(message); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/selenium/utils/ZipUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.utils; 14 | 15 | import org.zeroturnaround.zip.ZipUtil; 16 | 17 | import java.io.File; 18 | 19 | import static org.selenium.constants.FrameworkConstants.*; 20 | 21 | 22 | public class ZipUtils { 23 | 24 | /* make Zip file of Extent Reports in Project Root folder */ 25 | public static void zip() { 26 | 27 | /* 28 | * FrameworkConstants.getExtentReportFolderPath(): 29 | * D:\Work_In_Local_Machine\OneDrive - 30 | * Nagarro\Eclipse_Java_Developers_06_2021_Copy\LearningWS\Final_Code\ 31 | * OC_MasterSeleniumFramework/ExtentReports/ 32 | * FrameworkConstants.getZipped_ExtentReports_Folder_Name(): ExtentReports.zip 33 | */ 34 | 35 | // ZipUtil.pack(new File(FrameworkConstants.getExtentReportFolderPath()), 36 | // new File(FrameworkConstants.getZipped_ExtentReports_Folder_Name())); 37 | 38 | 39 | ZipUtil.pack(new File(EXTENT_REPORT_FOLDER_PATH), 40 | new File(Zipped_ExtentReports_Folder_Name)); 41 | 42 | System.out.println("Zipped ExtentReports folder successfuly"); 43 | } 44 | 45 | // public static void main(String[] args) { 46 | // System.out.println( 47 | // "FrameworkConstants.getExtentReportFolderPath(): " + FrameworkConstants.getExtentReportFolderPath()); 48 | // System.out.println("FrameworkConstants.getZipped_ExtentReports_Folder_Name(): " 49 | // + FrameworkConstants.getZipped_ExtentReports_Folder_Name()); 50 | // String reportsLocation = FrameworkConstants.getProjectPath() + "/ExtentReports"; 51 | // ZipUtil.pack(new File(reportsLocation), new File("ExtentReports.zip")); 52 | // 53 | // } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/org/selenium/base/BaseTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.base; 14 | 15 | import io.restassured.http.Cookies; 16 | import org.apache.commons.io.FileUtils; 17 | import org.openqa.selenium.Cookie; 18 | import org.openqa.selenium.OutputType; 19 | import org.openqa.selenium.TakesScreenshot; 20 | import org.openqa.selenium.WebDriver; 21 | import org.selenium.driver.DriverManager; 22 | import org.selenium.driver.DriverManagerFactory; 23 | import org.selenium.enums.DriverType; 24 | import org.selenium.listeners.AnnotationTransformer; 25 | import org.selenium.listeners.ListenerClass; 26 | import org.selenium.listeners.MethodInterceptor; 27 | import org.selenium.reports.ExtentLogger; 28 | import org.selenium.utils.CookieUtils; 29 | import org.testng.ITestResult; 30 | import org.testng.annotations.*; 31 | import ru.yandex.qatools.ashot.AShot; 32 | import ru.yandex.qatools.ashot.Screenshot; 33 | import ru.yandex.qatools.ashot.shooting.ShootingStrategies; 34 | 35 | import javax.imageio.ImageIO; 36 | import java.io.File; 37 | import java.io.IOException; 38 | import java.util.List; 39 | 40 | @Listeners({ 41 | AnnotationTransformer.class, 42 | ListenerClass.class, 43 | MethodInterceptor.class 44 | }) 45 | public class BaseTest { 46 | 47 | /* Class level -> Not Thread safe */ 48 | /* 49 | * Need to use ThreadLocal -> As Many test cases will try to access it at the 50 | * time of parallel execution 51 | */ 52 | // protected WebDriver driver; 53 | // private ThreadLocal driver = new ThreadLocal<>(); 54 | 55 | protected WebDriver getDriver() { 56 | // return this.driver.get(); 57 | return DriverManager.getDriver(); 58 | } 59 | 60 | private void setDriver(WebDriver driver) { 61 | // this.driver.set(driver); 62 | DriverManager.setDriver(driver); 63 | } 64 | 65 | /* 66 | * @Optional -> You can run the test case individually directly from Java class 67 | */ 68 | @Parameters("browser") 69 | @BeforeMethod 70 | public synchronized void startDriver(@Optional String browser) { 71 | 72 | // System.out.println("@BeforeMethod: @BeforeMethod" + browser); 73 | browser = setBrowserValue(browser); 74 | 75 | // setDriver(new DriverManagerOriginal().initializeDriver(browser)); 76 | // setDriver(DriverManagerFactory.getManager(DriverType.valueOf(browser)).createDriver()); 77 | 78 | // driver = new DriverManager().initializeDriver(browser); 79 | // setDriver(new OriginalDriverManager().initializeDriver(browser)); 80 | setDriver(DriverManagerFactory.getManager(DriverType.valueOf(browser)).createDriver()); 81 | System.out.println("Current Thread info = " + Thread.currentThread().getId() + ", Driver = " + getDriver()); 82 | } 83 | 84 | @Parameters("browser") 85 | @AfterMethod 86 | public synchronized void quitDriver(@Optional String browser, ITestResult result) throws IOException { 87 | 88 | takeScreenshotOnTestFailure(browser, result); 89 | 90 | // driver.quit(); 91 | getDriver().quit(); 92 | 93 | } 94 | 95 | private void takeScreenshotOnTestFailure(String browser, ITestResult result) throws IOException { 96 | browser = setBrowserValue(browser); 97 | System.out.println("Current Thread info = " + Thread.currentThread().getId() + ", Driver = " + getDriver()); 98 | 99 | if (result.getStatus() == ITestResult.FAILURE) { 100 | File destFile = new File("Screenshots" + File.separator + browser + File.separator 101 | + result.getTestClass().getRealClass().getSimpleName() + "_" + result.getMethod().getMethodName() 102 | + ".png"); 103 | takeScreenshot(destFile); 104 | // takeScreenshotUsingAshot(destFile); 105 | } 106 | } 107 | 108 | public void injectCookiesToBrowser(Cookies restAssuredCookies) { 109 | List seleniumCookies = new CookieUtils().convertRestAssuredCookiesToSeleniumCookies(restAssuredCookies); 110 | for (Cookie seleniumCookie : seleniumCookies) { 111 | getDriver().manage().addCookie(seleniumCookie); 112 | } 113 | ExtentLogger.info( 114 | " Injecting Selenium Cookies to Browser (by converting RestAssured Cookies to Selenium Cookies) "); 115 | 116 | /* 117 | * ExtentLogger.info("
 RestAssured Cookies: " + restAssuredCookies +
118 | 		 * "
"); ExtentLogger.info("
 Selenium Cookies: " + seleniumCookies +
119 | 		 * "
"); 120 | */ 121 | ExtentLogger.info("
RestAssured Cookies: " + "" 122 | + "
" + restAssuredCookies + "
" + "
\n"); 123 | ExtentLogger.info("
Selenium Cookies: " + "" 124 | + "
" + seleniumCookies + "
" + "
\n"); 125 | 126 | } 127 | 128 | private void takeScreenshot(File destFile) throws IOException { 129 | File srcFile = ((TakesScreenshot) getDriver()).getScreenshotAs(OutputType.FILE); 130 | FileUtils.copyFile(srcFile, destFile); 131 | } 132 | 133 | private void takeScreenshotUsingAshot(File destFile) throws IOException { 134 | Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(100)) 135 | .takeScreenshot(getDriver()); 136 | try { 137 | ImageIO.write(screenshot.getImage(), "PNG", destFile); 138 | } catch (IOException ex) { 139 | ex.printStackTrace(); 140 | } 141 | } 142 | 143 | private String setBrowserValue(String browser) { 144 | /* 145 | * System.getProperty("browser" -> This is for test execution using Maven 146 | * Command Line file 147 | */ 148 | note(); 149 | 150 | /* This is for test case execution individually from Java class */ 151 | if (browser == null) { 152 | // browser = BrowserType.EDGE; 153 | // browser = String.valueOf(BrowserType.EDGE); 154 | // browser = BrowserType.EDGE.toString().toUpperCase(); 155 | // browser = (BrowserType.EDGE).name().toLowerCase(); 156 | browser = "EDGE"; 157 | System.out.println( 158 | "Test execution not done by Maven cmd or TestNG.xml file -> setting the value: " + "EDGE"); 159 | } 160 | 161 | /* This is for test case execution from Maven command line or testng.xml file */ 162 | browser = System.getProperty("browser", browser); 163 | return browser; 164 | } 165 | 166 | private void note() { 167 | // String browser = System.getProperty("browser"); 168 | /* DriverType.CHROME.toString() -> Default Browser */ 169 | /* 170 | * We can run the test cases even as TestNG suite - not mandatory to run from 171 | * Maven command line 172 | */ 173 | /** This is for test execution using Maven command line */ 174 | // String browser = System.getProperty("browser", DriverType.CHROME.toString()); 175 | 176 | /** This is for test execution using testng.xml file */ 177 | // String browser = browserFromTestNG; 178 | } 179 | 180 | } 181 | 182 | //class-name="org.selenium.listeners.MethodInterceptor"> 183 | -------------------------------------------------------------------------------- /src/test/java/org/selenium/tests/AddToCartTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.tests; 14 | 15 | import io.qameta.allure.*; 16 | import org.selenium.annotations.FrameworkAnnotation; 17 | import org.selenium.base.BaseTest; 18 | import org.selenium.enums.AuthorType; 19 | import org.selenium.enums.CategoryType; 20 | import org.selenium.objects.Product; 21 | import org.selenium.pages.CartPage; 22 | import org.selenium.pages.HomePage; 23 | import org.selenium.pages.StorePage; 24 | import org.testng.Assert; 25 | import org.testng.annotations.Test; 26 | 27 | import java.io.IOException; 28 | 29 | @Epic("Epic - AddtoCart") 30 | @Feature("Feature - Product AddToCart") 31 | public class AddToCartTest extends BaseTest { 32 | 33 | 34 | @Story("Story - User should be able to add the Product into Cart") 35 | @Link("https://example.org") 36 | @Link(name = "allure", type = "mylink") 37 | @Issue("12345") 38 | //@TmsLink -> Test Management System (Manual test cases are written) 39 | @TmsLink("test-1") 40 | @Description("addToCartFromStorePage - This description is coming from Allure Annotation") 41 | @FrameworkAnnotation(author = { AuthorType.GAUTAM, AuthorType.RAJAT}, category = { CategoryType.SANITY,CategoryType.REGRESSION }) 42 | @Test(groups = {"SANITY","REGRESSION"}, description = "addToCartFromStorePage - This description is coming from TestNG annotation property") 43 | public void addToCartFromStorePage() throws IOException { 44 | 45 | Product product = new Product(1215); 46 | CartPage cartPage = 47 | new StorePage(getDriver()). 48 | load(). 49 | //clickaddToCartBtn(product.getName()). 50 | getProductThumbnail(). 51 | clickaddToCartBtn(product.getName()). 52 | clickViewCartLink(); 53 | 54 | 55 | Assert.assertEquals(cartPage.getProductName(), product.getName()+"FAIL"); 56 | } 57 | 58 | @FrameworkAnnotation(author = { AuthorType.GAUTAM, AuthorType.RAJAT}, category = { CategoryType.SANITY,CategoryType.REGRESSION }) 59 | //@Test(dataProvider = "getFeaturedProducts",dataProviderClass = MyDataProvider.class) 60 | public void addToCartFeaturedProducts(Product product) throws IOException { 61 | System.out.println("------------------------------------Product: "+product); 62 | CartPage cartPage=new HomePage(getDriver()). 63 | load(). 64 | //clickaddToCartBtn("Blue Shoes"). 65 | //clickaddToCartBtn(product.getName()). 66 | getProductThumbnail(). 67 | clickaddToCartBtn(product.getName()). 68 | clickViewCartLink(); 69 | Assert.assertEquals(cartPage.getProductName(), product.getName()); 70 | } 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/org/selenium/tests/LoginTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.tests; 14 | 15 | import org.selenium.annotations.FrameworkAnnotation; 16 | import org.selenium.api.actions.CartApi; 17 | import org.selenium.api.actions.SignUpApi; 18 | import org.selenium.base.BaseTest; 19 | import org.selenium.enums.AuthorType; 20 | import org.selenium.enums.CategoryType; 21 | import org.selenium.objects.Product; 22 | import org.selenium.objects.User; 23 | import org.selenium.pages.CheckoutPage; 24 | import org.selenium.utils.FakerUtils; 25 | import org.testng.Assert; 26 | import org.testng.annotations.Test; 27 | 28 | import java.io.IOException; 29 | 30 | public class LoginTest extends BaseTest { 31 | 32 | @FrameworkAnnotation(author = { AuthorType.GAUTAM, AuthorType.PANKAJ}, 33 | category = { CategoryType.SANITY,CategoryType.SMOKE,CategoryType.REGRESSION }) 34 | @Test(groups = {"SANITY","SMOKE","REGRESSION"}) 35 | public void loginDuringCheckout_ATOMIC_TEST() throws IOException, InterruptedException { 36 | 37 | /* Do this using RestAssured library - WebService part */ 38 | User user = getUser(); 39 | 40 | SignUpApi signUpApi = new SignUpApi(); 41 | signUpApi.register(user); 42 | System.out.println("REGISTER Cookies: " + signUpApi.getCookies()); 43 | 44 | CartApi cartApi = new CartApi(); 45 | Product product = new Product(1215); 46 | cartApi.addToCart(product.getId(), 1); 47 | 48 | /* Do this using WebDriver library - UI part */ 49 | CheckoutPage checkoutPage = new CheckoutPage(getDriver()).load(); 50 | Thread.sleep(5000); 51 | 52 | /* We can only inject the Cookies after loading the URL into Browser */ 53 | injectCookiesToBrowser(cartApi.getCookies()); 54 | 55 | checkoutPage.load(); 56 | Thread.sleep(5000); 57 | checkoutPage. 58 | clickHereToLoginLink(). 59 | login(user); 60 | Thread.sleep(5000); 61 | Assert.assertTrue(checkoutPage.getProductName().contains(product.getName())); 62 | 63 | } 64 | 65 | private User getUser() { 66 | String username = "demoUser" + new FakerUtils().generateRandomNumber(); 67 | String password = "demoPwd"; 68 | String email = username + "@gmail.com"; 69 | User user = new User().setUsername(username).setEmail(email).setPassword(password); 70 | return user; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/org/selenium/tests/NavigationTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.tests; 14 | 15 | import org.selenium.annotations.FrameworkAnnotation; 16 | import org.selenium.base.BaseTest; 17 | import org.selenium.enums.AuthorType; 18 | import org.selenium.enums.CategoryType; 19 | import org.selenium.pages.HomePage; 20 | import org.selenium.pages.StorePage; 21 | import org.testng.Assert; 22 | import org.testng.annotations.Test; 23 | 24 | public class NavigationTest extends BaseTest{ 25 | 26 | @FrameworkAnnotation(author = { AuthorType.RAJAT, AuthorType.NISHANT}, 27 | category = { CategoryType.BVT,CategoryType.REGRESSION }) 28 | @Test(groups = {"BVT","REGRESSION"}) 29 | public void navigateFromHomeToStoreUsingMainMenu() { 30 | 31 | StorePage storePage = 32 | new HomePage(getDriver()). 33 | load(). 34 | getMyHeader(). 35 | navigateToStoreUsingMenu(); 36 | 37 | Assert.assertEquals(storePage.getTitle(), "Store"); 38 | 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/test/java/org/selenium/tests/SearchTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Rajat Verma 3 | * https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | * https://github.com/rajatt95 5 | * https://rajatt95.github.io/ 6 | * 7 | * Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | * Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | */ 10 | 11 | /***************************************************/ 12 | 13 | package org.selenium.tests; 14 | 15 | import org.selenium.annotations.FrameworkAnnotation; 16 | import org.selenium.base.BaseTest; 17 | import org.selenium.enums.AuthorType; 18 | import org.selenium.enums.CategoryType; 19 | import org.selenium.pages.StorePage; 20 | import org.testng.Assert; 21 | import org.testng.annotations.Test; 22 | 23 | public class SearchTest extends BaseTest { 24 | 25 | @FrameworkAnnotation(author = { AuthorType.RAJAT, AuthorType.PANKAJ }, category = { CategoryType.SANITY, 26 | CategoryType.BVT,CategoryType.REGRESSION }) 27 | @Test(groups = { "SANITY", "BVT", "REGRESSION" }) 28 | public void searchWithPartialMatch() { 29 | 30 | String searchFor = "Blue"; 31 | StorePage storePage = 32 | new StorePage(getDriver()). 33 | load(). 34 | enterTextInSearchField(searchFor). 35 | clickSearchBtn(); 36 | 37 | Assert.assertEquals(storePage.getTitle(), "Search results: “" + searchFor + "”"); 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/allure.properties: -------------------------------------------------------------------------------- 1 | #/** 2 | #* @author Rajat Verma 3 | #* https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | #* https://github.com/rajatt95 5 | #* https://rajatt95.github.io/ 6 | #* 7 | #* Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | #* Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | #*/ 10 | # 11 | #/***************************************************/ 12 | # 13 | allure.link.mylink.pattern=https://example.org/mylink/{} 14 | allure.link.issue.pattern=https://example.org/issue/{} 15 | allure.link.tms.pattern=https://example.org/tms/{} -------------------------------------------------------------------------------- /src/test/resources/int_config.properties: -------------------------------------------------------------------------------- 1 | #/** 2 | #* @author Rajat Verma 3 | #* https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | #* https://github.com/rajatt95 5 | #* https://rajatt95.github.io/ 6 | #* 7 | #* Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | #* Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | #*/ 10 | # 11 | #/***************************************************/ 12 | # 13 | baseUrl=https://int-askomdch.com/ 14 | username=dummyUser 15 | password=HidummyUser 16 | 17 | #RequestDetailsInExtentReport --> yes or no 18 | #If no -> Report will not have the Request details in case of API call 19 | #If yes -> Report will have the Request details in case of API call 20 | request_details_in_reports=yes 21 | 22 | #Override_ExtentReports --> yes or no 23 | #If no -> Report name will be like - Windows_10_Tue_Oct_05_02_30_46_IST_2021_AutomationReport.html 24 | #If yes -> Report name will be AutomationReport.html 25 | override_reports=yes 26 | 27 | #send_email_to_users --> yes or no 28 | #If yes -> then, provide your mail credentials -> src/main/java -> package org.selenium.java_Mail_API.EmailConfig; 29 | #This Email will be sent using Java mail API 30 | send_email_to_users=no 31 | 32 | #PassedStepsScreenshot --> yes or no 33 | passed_steps_screenshot=yes 34 | 35 | #FailedStepsScreenshot --> yes or no 36 | failed_steps_screenshot=yes 37 | 38 | #SkippedStepsScreenshot --> yes or no 39 | skipped_steps_screenshot=yes 40 | 41 | #retry failed test cases -> yes or no 42 | #It will try for 1 time if any Test case gets failed 43 | retry_failed_tests=yes 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/test/resources/myBillingAddress.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "Demo", 3 | "lastName": "User", 4 | "country": "India", 5 | "addressLineOne": "Pune", 6 | "city": "Pune", 7 | "state": "Maharashtra", 8 | "postalCode": "411001", 9 | "email": "abcd@gmail.com" 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/products.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1215, 4 | "name": "Blue Shoes" 5 | }, 6 | { 7 | "id": 1209, 8 | "name": "Denim Blue Jeans" 9 | }, 10 | { 11 | "id": 1205, 12 | "name": "Basic Blue Jeans" 13 | }, 14 | { 15 | "id": 1198, 16 | "name": "Anchor Bracelet" 17 | }, 18 | { 19 | "id": 1196, 20 | "name": "Blue Tshirt" 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Jenkins_CrossBrowser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Jenkins_CrossBrowser_Safari.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Jenkins_OneBrowser.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local_Firefox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local_GROUPING.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local_Only1TestCase.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local_Only1TestCase_WithSafari.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/test/resources/runners/testng_Local_Safari.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/stg_config.properties: -------------------------------------------------------------------------------- 1 | #/** 2 | #* @author Rajat Verma 3 | #* https://www.linkedin.com/in/rajat-v-3b0685128/ 4 | #* https://github.com/rajatt95 5 | #* https://rajatt95.github.io/ 6 | #* 7 | #* Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/) 8 | #* Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/) 9 | #*/ 10 | # 11 | #/***************************************************/ 12 | # 13 | baseUrl=https://askomdch.com/ 14 | username=dummyUser 15 | password=HidummyUser 16 | 17 | #RequestDetailsInExtentReport --> yes or no 18 | #If no -> Report will not have the Request details in case of API call 19 | #If yes -> Report will have the Request details in case of API call 20 | request_details_in_reports=yes 21 | 22 | #Override_ExtentReports --> yes or no 23 | #If no -> Report name will be like - Windows_10_Tue_Oct_05_02_30_46_IST_2021_AutomationReport.html 24 | #If yes -> Report name will be AutomationReport.html 25 | override_reports=yes 26 | 27 | #send_email_to_users --> yes or no 28 | #If yes -> then, provide your mail credentials -> src/main/java -> package org.selenium.java_Mail_API.EmailConfig; 29 | #This Email will be sent using Java mail API 30 | send_email_to_users=no 31 | 32 | #PassedStepsScreenshot --> yes or no 33 | passed_steps_screenshot=yes 34 | 35 | #FailedStepsScreenshot --> yes or no 36 | failed_steps_screenshot=yes 37 | 38 | #SkippedStepsScreenshot --> yes or no 39 | skipped_steps_screenshot=yes 40 | 41 | #retry failed test cases -> yes or no 42 | #It will try for 1 time if any Test case gets failed 43 | retry_failed_tests=yes 44 | 45 | 46 | --------------------------------------------------------------------------------