├── .editorconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── renovate.json └── workflows │ ├── .toolchains.xml │ ├── build.yml │ ├── codeql-analysis.yml │ └── codesee-arch-diagram.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assets ├── SendSignalCtrlC.exe ├── author.png ├── checkstyle │ ├── checkstyle.xml │ └── suppressions.xml ├── ffmpeg.JPG ├── sendCtrlC.JPG └── spotless │ ├── eclipse-formatter-settings.xml │ └── intellij-idea.importorder ├── lombok.config ├── pom.xml ├── selcukes-bom └── pom.xml ├── selcukes-collections ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── github │ │ └── selcukes │ │ └── collections │ │ ├── Clocks.java │ │ ├── DataComparator.java │ │ ├── DataTable.java │ │ ├── DecimalNumber.java │ │ ├── Lists.java │ │ ├── Maps.java │ │ ├── Maths.java │ │ ├── Reflections.java │ │ ├── Resources.java │ │ ├── Streams.java │ │ ├── StringHelper.java │ │ ├── TextTable.java │ │ ├── Try.java │ │ └── exception │ │ ├── DataStreamException.java │ │ └── DataTableException.java │ └── test │ └── java │ └── io │ └── github │ └── selcukes │ └── collections │ └── tests │ ├── ClocksTest.java │ ├── CollectionsTest.java │ ├── DataComparatorTest.java │ ├── DataTableTest.java │ ├── DecimalNumberTest.java │ ├── MathsTest.java │ ├── ReflectionTest.java │ ├── StringHelperTest.java │ └── TryTest.java ├── selcukes-commons ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── commons │ │ │ ├── Await.java │ │ │ ├── SelcukesBanner.java │ │ │ ├── SelcukesLifecycle.java │ │ │ ├── annotation │ │ │ └── Lifecycle.java │ │ │ ├── config │ │ │ ├── Config.java │ │ │ └── ConfigFactory.java │ │ │ ├── db │ │ │ ├── DataBaseConfig.java │ │ │ ├── DataBaseDriver.java │ │ │ └── DataBaseType.java │ │ │ ├── exception │ │ │ ├── CommandException.java │ │ │ ├── ConfigurationException.java │ │ │ ├── DriverConnectionException.java │ │ │ ├── EncryptionException.java │ │ │ ├── ExcelConfigException.java │ │ │ ├── NotifierException.java │ │ │ ├── RecorderException.java │ │ │ ├── SelcukesException.java │ │ │ ├── SnapshotException.java │ │ │ └── WebDriverBinaryException.java │ │ │ ├── exec │ │ │ ├── ExecResults.java │ │ │ ├── Shell.java │ │ │ └── StreamGuzzler.java │ │ │ ├── fixture │ │ │ ├── DriverFixture.java │ │ │ ├── SelcukesFixture.java │ │ │ └── TestResult.java │ │ │ ├── helper │ │ │ ├── ErrorCodes.java │ │ │ ├── ExceptionHelper.java │ │ │ ├── FileHelper.java │ │ │ ├── ImageUtil.java │ │ │ ├── Preconditions.java │ │ │ ├── RandomUtils.java │ │ │ ├── ServiceLoaderUtils.java │ │ │ ├── Singleton.java │ │ │ └── SingletonContext.java │ │ │ ├── http │ │ │ ├── WebClient.java │ │ │ └── WebResponse.java │ │ │ ├── listener │ │ │ ├── LifecycleListener.java │ │ │ ├── LifecycleManager.java │ │ │ └── TestLifecycleListener.java │ │ │ ├── logging │ │ │ ├── LogRecordListener.java │ │ │ ├── Logger.java │ │ │ ├── LoggerFactory.java │ │ │ ├── SelcukesColorFormatter.java │ │ │ └── SelcukesLoggerFormatter.java │ │ │ ├── os │ │ │ ├── Architecture.java │ │ │ ├── OsType.java │ │ │ └── Platform.java │ │ │ ├── properties │ │ │ ├── SelcukesRuntime.java │ │ │ └── SelcukesTestProperties.java │ │ │ └── security │ │ │ ├── ByteEncryptor.java │ │ │ ├── Encryptor.java │ │ │ └── StringEncryptor.java │ └── resources │ │ ├── banner.txt │ │ ├── error_codes.yaml │ │ ├── selcukes-logback.yaml │ │ ├── selcukes-watermark.png │ │ └── selcukes_logo.png │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── commons │ │ └── tests │ │ ├── AwaitTest.java │ │ ├── ConfigTest.java │ │ ├── DataBaseConfigTest.java │ │ ├── EncryptionTest.java │ │ ├── ExceptionHelperTest.java │ │ ├── FixtureTest.java │ │ ├── LogRecordTest.java │ │ ├── LoggerTest.java │ │ ├── PropertiesTest.java │ │ ├── RunCommandTest.java │ │ ├── ShellTest.java │ │ ├── SingletonContextTest.java │ │ ├── SingletonTest.java │ │ ├── WebClientTest.java │ │ └── helper │ │ ├── CollectionUtilsTest.java │ │ ├── PreconditionsTest.java │ │ └── RandomUtilsTest.java │ └── resources │ ├── sample.csv │ └── selcukes.yaml ├── selcukes-core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── core │ │ │ ├── driver │ │ │ ├── AppiumEngine.java │ │ │ ├── AppiumManager.java │ │ │ ├── AppiumOptions.java │ │ │ ├── BrowserOptions.java │ │ │ ├── CloudOptions.java │ │ │ ├── DesktopManager.java │ │ │ ├── DevicePool.java │ │ │ ├── DriverFactory.java │ │ │ ├── DriverManager.java │ │ │ ├── GridRunner.java │ │ │ ├── RemoteManager.java │ │ │ ├── RunMode.java │ │ │ └── WebManager.java │ │ │ ├── enums │ │ │ ├── DeviceType.java │ │ │ └── SwipeDirection.java │ │ │ ├── grid │ │ │ ├── SeleniumServer.java │ │ │ └── SeleniumService.java │ │ │ ├── helper │ │ │ └── ApiHelper.java │ │ │ ├── listener │ │ │ ├── EventCapture.java │ │ │ └── ResourceCleanupProvider.java │ │ │ ├── page │ │ │ ├── ApiPage.java │ │ │ ├── MobilePage.java │ │ │ ├── Page.java │ │ │ ├── Pages.java │ │ │ ├── WebAuthenticator.java │ │ │ ├── WebPage.java │ │ │ ├── WinPage.java │ │ │ └── ui │ │ │ │ ├── Dropdown.java │ │ │ │ ├── Locator.java │ │ │ │ └── PageElement.java │ │ │ ├── validation │ │ │ ├── ElementValidation.java │ │ │ ├── ObjectValidation.java │ │ │ ├── PageValidations.java │ │ │ ├── ResponseValidation.java │ │ │ └── Validation.java │ │ │ └── wait │ │ │ ├── WaitCondition.java │ │ │ └── WaitManager.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── io.github.selcukes.commons.listener.TestLifecycleListener │ │ └── selcukes-logback.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── core │ │ └── tests │ │ ├── DriverManagerTest.java │ │ ├── TestDriver.java │ │ ├── api │ │ └── ApiTest.java │ │ ├── mobile │ │ ├── AndroidCalculatorTest.java │ │ ├── MobileAppTest.java │ │ └── MobileBrowserTest.java │ │ ├── unit │ │ ├── ShadowRootTest.java │ │ └── ValidationTest.java │ │ ├── web │ │ ├── ClassicGridTest.java │ │ ├── CookiesTest.java │ │ ├── EventDriverTest.java │ │ ├── PrintTest.java │ │ ├── WebAuthTest.java │ │ └── WebTest.java │ │ └── win │ │ └── NotepadTest.java │ └── resources │ ├── android-app.apk │ ├── browser_stack.yaml │ └── selcukes.yaml ├── selcukes-databind ├── README.md ├── pom.xml └── src │ ├── main │ └── java │ │ └── io │ │ └── github │ │ └── selcukes │ │ └── databind │ │ ├── AbstractDataBind.java │ │ ├── DataBind.java │ │ ├── DataField.java │ │ ├── DataMapper.java │ │ ├── JsonData.java │ │ ├── XmlData.java │ │ ├── YamlData.java │ │ ├── annotation │ │ ├── DataFile.java │ │ ├── Interpolate.java │ │ └── Key.java │ │ ├── converters │ │ ├── BooleanConverter.java │ │ ├── Converter.java │ │ ├── Converters.java │ │ ├── DefaultConverter.java │ │ ├── DoubleConverter.java │ │ ├── IntegerConverter.java │ │ ├── LocalDateConverter.java │ │ ├── LocalDateTimeConverter.java │ │ └── StringConverter.java │ │ ├── csv │ │ └── CsvMapper.java │ │ ├── excel │ │ ├── ExcelCell.java │ │ ├── ExcelMapper.java │ │ ├── ExcelParser.java │ │ └── ExcelWriter.java │ │ ├── exception │ │ └── DataMapperException.java │ │ ├── properties │ │ ├── PropertiesLoader.java │ │ ├── PropertiesMapper.java │ │ ├── PropertiesParser.java │ │ └── PropertyField.java │ │ ├── substitute │ │ ├── DefaultSubstitutor.java │ │ ├── StringSubstitutor.java │ │ └── Substitutor.java │ │ ├── utils │ │ ├── DataFileHelper.java │ │ ├── DataSubstitutor.java │ │ ├── JsonQuery.java │ │ └── JsonUtils.java │ │ └── xml │ │ └── XmlMapper.java │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── databind │ │ └── tests │ │ ├── CreateDataFileTest.java │ │ ├── CreateDataFileWithAgsTest.java │ │ ├── CsvTest.java │ │ ├── ExcelMapperTest.java │ │ ├── ExcelWriterTest.java │ │ ├── JsonQueryTest.java │ │ ├── JsonUtilsTest.java │ │ ├── ListStringConverter.java │ │ ├── PropertiesMapperTest.java │ │ ├── PropertiesWriterTest.java │ │ ├── ReadDataFileTest.java │ │ ├── UpdateDataFileTest.java │ │ └── XmlTest.java │ └── resources │ ├── CustomerInfo.xml │ ├── TestData.xlsx │ ├── employee.csv │ ├── test_config.properties │ ├── test_sample.yml │ └── test_users.json ├── selcukes-excel-runner ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── excel │ │ │ ├── AbstractExcelDataProvider.java │ │ │ ├── ExcelDataFactory.java │ │ │ ├── ExcelDataProvider.java │ │ │ ├── ExcelTestRunner.java │ │ │ ├── MultiExcelData.java │ │ │ ├── ScenarioContext.java │ │ │ └── SingleExcelData.java │ └── resources │ │ └── selcukes-logback.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── excel │ │ ├── TestRunner.java │ │ ├── page │ │ └── CommonPage.java │ │ └── steps │ │ ├── Hooks.java │ │ └── MySteps.java │ └── resources │ ├── Google.xlsx │ ├── TestData.xlsx │ ├── TestSuite.xlsx │ ├── Yahoo.xlsx │ ├── features │ ├── Google.feature │ └── Yahoo.feature │ └── selcukes.yaml ├── selcukes-extent-reports ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── extent │ │ │ └── report │ │ │ ├── ExtentService.java │ │ │ ├── Reporter.java │ │ │ ├── SelcukesExtentAdapter.java │ │ │ └── TestSourcesModel.java │ └── resources │ │ └── selcukes-logback.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── extent │ │ └── report │ │ └── tests │ │ ├── TestRunner.java │ │ ├── pages │ │ └── Calculator.java │ │ └── steps │ │ ├── CalculatorSteps.java │ │ └── ReporterHooks.java │ └── resources │ ├── calculator.feature │ └── selcukes.yaml ├── selcukes-java └── pom.xml ├── selcukes-junit ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── junit │ │ │ ├── Selcukes.java │ │ │ └── listeners │ │ │ ├── SuiteListener.java │ │ │ └── TestListener.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── org.junit.platform.launcher.LauncherDiscoveryListener │ │ │ └── org.junit.platform.launcher.TestExecutionListener │ │ └── selcukes-logback.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── junit │ │ └── tests │ │ ├── SampleJunitTest.java │ │ ├── Steps.java │ │ └── TestRunner.java │ └── resources │ ├── features │ └── google │ │ └── sample.feature │ └── selcukes.yaml ├── selcukes-notifier ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── notifier │ │ │ ├── AbstractNotifier.java │ │ │ ├── IncomingWebHookRequest.java │ │ │ ├── Notifier.java │ │ │ ├── NotifierFactory.java │ │ │ ├── NotifierHelper.java │ │ │ ├── enums │ │ │ ├── NotifierEnum.java │ │ │ └── NotifierType.java │ │ │ ├── mail │ │ │ ├── EmailNotifier.java │ │ │ └── EmailNotifierImpl.java │ │ │ ├── slack │ │ │ ├── Attachment.java │ │ │ ├── Field.java │ │ │ ├── Slack.java │ │ │ ├── SlackFileUploader.java │ │ │ ├── SlackMessage.java │ │ │ ├── SlackMessageBuilder.java │ │ │ └── SlackUploader.java │ │ │ └── teams │ │ │ ├── Field.java │ │ │ ├── Images.java │ │ │ ├── MicrosoftTeams.java │ │ │ ├── MicrosoftTeamsBuilder.java │ │ │ ├── MicrosoftTeamsCard.java │ │ │ └── Section.java │ └── resources │ │ ├── selcukes-logback.yaml │ │ └── selcukes.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── notifier │ │ └── tests │ │ ├── EmailTest.java │ │ └── NotifierTest.java │ └── resources │ └── employee.csv ├── selcukes-reports ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── reports │ │ │ ├── cucumber │ │ │ ├── CucumberAdapter.java │ │ │ ├── CucumberListener.java │ │ │ ├── CucumberLiveReportAdapter.java │ │ │ ├── CucumberService.java │ │ │ ├── EventFiringCucumber.java │ │ │ └── LiveReportHelper.java │ │ │ ├── enums │ │ │ └── TestType.java │ │ │ ├── html │ │ │ └── HtmlReporter.java │ │ │ ├── listeners │ │ │ └── ReportServiceProvider.java │ │ │ └── screen │ │ │ ├── ScreenPlay.java │ │ │ ├── ScreenPlayBuilder.java │ │ │ ├── ScreenPlayImpl.java │ │ │ └── ScreenPlayResult.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── io.github.selcukes.commons.listener.TestLifecycleListener │ │ └── selcukes-logback.yaml │ └── test │ ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── reports │ │ └── tests │ │ ├── AppiumVideoTest.java │ │ ├── NotepadTest.java │ │ ├── RecorderTest.java │ │ ├── TestRunner.java │ │ ├── pages │ │ └── Calculator.java │ │ └── steps │ │ ├── CalculatorSteps.java │ │ └── ReporterHooks.java │ └── resources │ ├── calculator.feature │ └── selcukes.yaml ├── selcukes-snapshot ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── snapshot │ │ │ ├── DefaultPageSnapshot.java │ │ │ ├── PageSnapshot.java │ │ │ ├── Snapshot.java │ │ │ └── SnapshotImpl.java │ └── resources │ │ ├── screen-size.js │ │ └── selcukes-logback.yaml │ └── test │ └── java │ └── io │ └── github │ └── selcukes │ └── snapshot │ └── tests │ ├── HomePage.java │ └── NativeSnapshotTest.java ├── selcukes-testng ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── github │ │ │ │ └── selcukes │ │ │ │ └── testng │ │ │ │ ├── SelcukesTestNGRunner.java │ │ │ │ └── listeners │ │ │ │ ├── SelcukesListener.java │ │ │ │ └── TestListener.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.testng.ITestNGListener │ └── test │ │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── testng │ │ │ └── tests │ │ │ ├── CucumberRunner.java │ │ │ └── Steps.java │ │ └── resources │ │ ├── features │ │ └── google │ │ │ └── sample.feature │ │ └── selcukes.yaml └── testng.yaml ├── video-recorder ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── selcukes │ │ │ └── video │ │ │ ├── FFmpegRecorder.java │ │ │ ├── MonteRecorder.java │ │ │ ├── MonteRecorderBuilder.java │ │ │ ├── Recorder.java │ │ │ ├── RecorderFactory.java │ │ │ ├── VideoRecorder.java │ │ │ ├── config │ │ │ └── DefaultVideoOptions.java │ │ │ └── enums │ │ │ └── RecorderType.java │ └── resources │ │ └── selcukes-logback.yaml │ └── test │ └── java │ └── io │ └── github │ └── selcukes │ └── video │ └── tests │ └── VideoTest.java └── webdriver-binaries ├── README.md ├── pom.xml └── src ├── main ├── java │ └── io │ │ └── github │ │ └── selcukes │ │ └── wdb │ │ ├── BinaryInfo.java │ │ ├── WebDriverBinary.java │ │ ├── core │ │ ├── AbstractBinary.java │ │ ├── BinaryFactory.java │ │ ├── ChromeBinary.java │ │ ├── EdgeBinary.java │ │ ├── FirefoxBinary.java │ │ ├── IExplorerBinary.java │ │ └── OperaBinary.java │ │ ├── enums │ │ ├── DownloaderType.java │ │ └── DriverType.java │ │ ├── util │ │ ├── FileExtractUtil.java │ │ ├── UrlHelper.java │ │ ├── VersionHelper.java │ │ └── WebDriverBinaryUtil.java │ │ └── version │ │ ├── CacheManager.java │ │ ├── VersionComparator.java │ │ ├── VersionDetector.java │ │ └── VersionTokenizer.java └── resources │ └── selcukes-logback.yaml └── test └── java └── io └── github └── selcukes └── tests └── WebDriverBinaryTest.java /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | insert_final_newline = true 7 | 8 | [*.xml] 9 | indent_style = space 10 | indent_size = 4 11 | 12 | [*.{feature,yml}] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.md] 17 | trim_trailing_whitespace = false 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: RameshBabuPrudhvi 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: ':bug: bug' 6 | assignees: '' 7 | 8 | --- 9 | 14 | 15 | ### 👓 What did you see? 16 | 17 | 18 | 19 | ### ✅ What did you expect to see? 20 | 21 | 22 | 23 | ### 📦 Which tool/library version are you using? 24 | 25 | 26 | 27 | ### 🔬 How could we reproduce it? 28 | 29 | 39 | 40 | Steps to reproduce the behavior: 41 | 1. Install '...' version '...' 42 | 2. Create a file called '....' 43 | 3. Run command '....' 44 | 4. See error '....' 45 | 46 | 47 | 48 | ### 📚 Any additional context? 49 | 50 | 51 | 52 | ---- 53 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: ':zap: enhancement' 6 | assignees: '' 7 | 8 | --- 9 | 14 | 15 | ### 🤔 What's the problem you're trying to solve? 16 | 17 | 18 | 19 | ### ✨ What's your proposed solution? 20 | 21 | 22 | 23 | ### ⛏ Have you considered any alternatives or workarounds? 24 | 25 | 26 | 27 | ### 📚 Any additional context? 28 | 29 | 30 | 31 | ---- 32 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base", 4 | ":disableDependencyDashboard" 5 | ], 6 | "labels": [ 7 | ":robot: dependencies" 8 | ], 9 | "prHourlyLimit": 0, 10 | "packageRules": [ 11 | { 12 | "updateTypes": [ 13 | "minor", 14 | "patch" 15 | ], 16 | "automerge": true, 17 | "automergeType": "branch" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/.toolchains.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jdk 5 | 6 | 17 7 | openjdk 8 | 9 | 10 | ${JAVA_HOME} 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | schedule: 9 | - cron: '34 10 * * 1' 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: ubuntu-latest 15 | permissions: 16 | actions: read 17 | contents: read 18 | security-events: write 19 | 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | language: [ 'java' ] 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | - name: Set up Java 28 | uses: actions/setup-java@v4 29 | with: 30 | distribution: corretto 31 | java-version: 17 32 | - name: Initialize CodeQL 33 | uses: github/codeql-action/init@v3 34 | with: 35 | languages: ${{ matrix.language }} 36 | - name: Autobuild 37 | uses: github/codeql-action/autobuild@v3 38 | - name: Perform CodeQL Analysis 39 | uses: github/codeql-action/analyze@v3 40 | -------------------------------------------------------------------------------- /.github/workflows/codesee-arch-diagram.yml: -------------------------------------------------------------------------------- 1 | # This workflow was added by CodeSee. Learn more at https://codesee.io/ 2 | # This is v2.0 of this workflow file 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request_target: 8 | types: [opened, synchronize, reopened] 9 | 10 | name: CodeSee 11 | 12 | permissions: read-all 13 | 14 | jobs: 15 | codesee: 16 | runs-on: ubuntu-latest 17 | continue-on-error: true 18 | name: Analyze the repo with CodeSee 19 | steps: 20 | - uses: Codesee-io/codesee-action@v2 21 | with: 22 | codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} 23 | codesee-url: https://app.codesee.io 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE working files 2 | *.iml 3 | .idea/ 4 | .settings 5 | .project 6 | .classpath 7 | 8 | # Build directories 9 | target/ 10 | tmp/ 11 | temp/ 12 | test-output/ 13 | video-report/ 14 | 15 | # Log file 16 | *.log 17 | 18 | # Build & test droppings 19 | pom.xml.releaseBackup 20 | pom.xml.versionsBackup 21 | release.properties 22 | dependency-reduced-pom.xml 23 | 24 | # OS generated files 25 | .DS_Store* 26 | ehthumbs.db 27 | Icon? 28 | Thumbs.db 29 | 30 | 31 | -------------------------------------------------------------------------------- /assets/SendSignalCtrlC.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/assets/SendSignalCtrlC.exe -------------------------------------------------------------------------------- /assets/author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/assets/author.png -------------------------------------------------------------------------------- /assets/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /assets/ffmpeg.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/assets/ffmpeg.JPG -------------------------------------------------------------------------------- /assets/sendCtrlC.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/assets/sendCtrlC.JPG -------------------------------------------------------------------------------- /assets/spotless/intellij-idea.importorder: -------------------------------------------------------------------------------- 1 | # Organize import order using IntelliJ IDEA defaults 2 | # Escaped hashes sort static methods last: https://github.com/diffplug/spotless/issues/306 3 | 1= 4 | 2=javax 5 | 3=java 6 | 4=\# 7 | -------------------------------------------------------------------------------- /lombok.config: -------------------------------------------------------------------------------- 1 | config.stopBubbling = true 2 | lombok.addLombokGeneratedAnnotation = true 3 | lombok.log.fieldName = logger 4 | lombok.log.custom.declaration = io.github.selcukes.commons.logging.Logger io.github.selcukes.commons.logging.LoggerFactory.getLogger(TYPE) -------------------------------------------------------------------------------- /selcukes-collections/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | selcukes-parent 7 | io.github.selcukes 8 | 2.3.13-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | selcukes-collections 13 | 14 | selcukes-collections 15 | selcukes-collections 16 | 17 | 18 | 19 | io.github.selcukes 20 | selcukes-bom 21 | ${project.version} 22 | pom 23 | import 24 | 25 | 26 | 27 | 28 | 29 | org.projectlombok 30 | lombok 31 | provided 32 | 33 | 34 | org.testng 35 | testng 36 | test 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /selcukes-collections/src/main/java/io/github/selcukes/collections/Maths.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.collections; 18 | 19 | import lombok.experimental.UtilityClass; 20 | 21 | import java.math.BigDecimal; 22 | import java.util.function.BinaryOperator; 23 | 24 | @UtilityClass 25 | public class Maths { 26 | 27 | /** 28 | * Returns a binary operator that performs decimal calculations using the 29 | * specified operator. 30 | * 31 | * @param operator the binary operator to perform the 32 | * decimal calculation. 33 | * @return the binary operator that performs the 34 | * decimal calculation. 35 | * @throws IllegalArgumentException if the input is invalid. 36 | */ 37 | public BinaryOperator of(BinaryOperator operator) { 38 | return (s1, s2) -> { 39 | var number = new DecimalNumber(); 40 | var value1 = number.parseBigDecimal(s1); 41 | var value2 = number.parseBigDecimal(s2); 42 | var result = operator.apply(value1, value2); 43 | return number.format(result); 44 | }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-collections/src/main/java/io/github/selcukes/collections/exception/DataStreamException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.collections.exception; 18 | 19 | public class DataStreamException extends RuntimeException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DataStreamException() { 24 | super(); 25 | } 26 | 27 | public DataStreamException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public DataStreamException(String message) { 32 | super(message); 33 | } 34 | 35 | public DataStreamException(Throwable cause) { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /selcukes-collections/src/main/java/io/github/selcukes/collections/exception/DataTableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.collections.exception; 18 | 19 | public class DataTableException extends RuntimeException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public DataTableException() { 24 | super(); 25 | } 26 | 27 | public DataTableException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public DataTableException(String message) { 32 | super(message); 33 | } 34 | 35 | public DataTableException(Throwable cause) { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /selcukes-commons/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | selcukes-parent 7 | io.github.selcukes 8 | 2.3.13-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | selcukes-commons 13 | 14 | selcukes-commons 15 | selcukes-commons 16 | 17 | 18 | 19 | io.github.selcukes 20 | selcukes-bom 21 | ${project.version} 22 | pom 23 | import 24 | 25 | 26 | 27 | 28 | 29 | io.github.selcukes 30 | selcukes-databind 31 | 32 | 33 | org.projectlombok 34 | lombok 35 | provided 36 | 37 | 38 | org.testng 39 | testng 40 | test 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/SelcukesBanner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons; 18 | 19 | import io.github.selcukes.collections.Try; 20 | import io.github.selcukes.commons.helper.FileHelper; 21 | import lombok.experimental.UtilityClass; 22 | 23 | import java.util.StringJoiner; 24 | 25 | @UtilityClass 26 | public class SelcukesBanner { 27 | @SuppressWarnings("all") 28 | public void printBanner() { 29 | Try.of(() -> { 30 | String banner = FileHelper.readContent("banner.txt"); 31 | System.out.println(new StringJoiner(System.lineSeparator(), System.lineSeparator(), System.lineSeparator()) 32 | .add(banner) 33 | .toString()); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/annotation/Lifecycle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.annotation; 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 | @Target(ElementType.TYPE) 25 | @Retention(RetentionPolicy.RUNTIME) 26 | public @interface Lifecycle { 27 | Type type() default Type.METHOD; 28 | 29 | enum Type { 30 | METHOD, 31 | CLASS, 32 | NONE 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/db/DataBaseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.db; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Getter; 21 | 22 | @Getter 23 | @AllArgsConstructor 24 | public enum DataBaseType { 25 | MY_SQL("jdbc:mysql://{hostName}:{port}/{dataBaseName}"), 26 | SQL_SERVER("jdbc:sqlserver://{hostName}:{port};databaseName={dataBaseName}"), 27 | POST_GRE_SQL("jdbc:postgresql://{hostName}:{port}/{dataBaseName}"), 28 | ORACLE("jdbc:oracle:thin:@{hostName}:{port}:{dataBaseName}"), 29 | ORACLE_SERVICE_NAME("jdbc:oracle:thin:@{hostName}:{port}/{dataBaseName}"), 30 | IBM_DB2("jdbc:db2://{hostName}:{port}/{dataBaseName}"); 31 | private final String url; 32 | } 33 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/CommandException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class CommandException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public CommandException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public CommandException(String message) { 27 | super(message); 28 | } 29 | 30 | public CommandException(Throwable cause) { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class ConfigurationException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public ConfigurationException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public ConfigurationException(String message) { 27 | super(message); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/DriverConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class DriverConnectionException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public DriverConnectionException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | 26 | public DriverConnectionException(String message) { 27 | super(message); 28 | } 29 | 30 | public DriverConnectionException(Throwable cause) { 31 | super(cause); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/EncryptionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class EncryptionException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public EncryptionException() { 23 | super(); 24 | } 25 | 26 | public EncryptionException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | 30 | public EncryptionException(String message) { 31 | super(message); 32 | } 33 | 34 | public EncryptionException(Throwable cause) { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/ExcelConfigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class ExcelConfigException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public ExcelConfigException(String message) { 23 | super(message); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/NotifierException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class NotifierException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public NotifierException(String message, Throwable cause) { 23 | super(message, cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/RecorderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class RecorderException extends SelcukesException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public RecorderException(String message) { 24 | super(message); 25 | } 26 | 27 | public RecorderException(Throwable cause) { 28 | super(cause); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/SelcukesException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class SelcukesException extends RuntimeException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public SelcukesException() { 24 | super(); 25 | } 26 | 27 | public SelcukesException(String message, Throwable cause) { 28 | super(message, cause); 29 | } 30 | 31 | public SelcukesException(String message) { 32 | super(message); 33 | } 34 | 35 | public SelcukesException(Throwable cause) { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/SnapshotException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class SnapshotException extends SelcukesException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public SnapshotException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exception/WebDriverBinaryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exception; 18 | 19 | public class WebDriverBinaryException extends SelcukesException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public WebDriverBinaryException(Throwable cause) { 23 | super(cause); 24 | } 25 | 26 | public WebDriverBinaryException(String message) { 27 | super(message); 28 | } 29 | 30 | public WebDriverBinaryException(String message, Throwable cause) { 31 | super(message, cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/exec/ExecResults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.exec; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Data; 21 | 22 | import java.util.List; 23 | 24 | /** 25 | * A class that is used to store the results of a query execution. 26 | */ 27 | @Data 28 | @AllArgsConstructor 29 | public class ExecResults { 30 | private List output; 31 | private List error; 32 | private int returnCode; 33 | 34 | /** 35 | * Returns true if the error list is not empty. 36 | * 37 | * @return A boolean value. 38 | */ 39 | public boolean hasErrors() { 40 | return (!error.isEmpty()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/fixture/DriverFixture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.fixture; 18 | 19 | import lombok.experimental.UtilityClass; 20 | 21 | /** 22 | * It's a fixture that can be used to drive the application under test 23 | */ 24 | @UtilityClass 25 | public class DriverFixture { 26 | 27 | private final ThreadLocal DRIVER_THREAD = new InheritableThreadLocal<>(); 28 | 29 | /** 30 | * If the current thread has a driver fixture, return it. Otherwise, return 31 | * null. 32 | * 33 | * @return The driver object that is currently being used by the thread. 34 | */ 35 | public Object getDriverFixture() { 36 | return DRIVER_THREAD.get(); 37 | } 38 | 39 | /** 40 | * This function sets the driver object to the current thread. 41 | * 42 | * @param driver The driver object that is being used to run the tests. 43 | */ 44 | public void setDriverFixture(final Object driver) { 45 | DRIVER_THREAD.set(driver); 46 | } 47 | 48 | /** 49 | * This function removes the driver from the thread local storage. 50 | */ 51 | public void removeDriverFixture() { 52 | DRIVER_THREAD.remove(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/fixture/TestResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.fixture; 18 | 19 | import lombok.Builder; 20 | import lombok.Getter; 21 | 22 | @Builder 23 | @Getter 24 | public class TestResult { 25 | String name; 26 | String status; 27 | Throwable throwable; 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/helper/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.commons.helper; 20 | 21 | import io.github.selcukes.databind.annotation.DataFile; 22 | import lombok.Data; 23 | 24 | import java.util.Map; 25 | 26 | /** 27 | * This class contains a list of error codes that can be returned by the API. 28 | */ 29 | @Data 30 | @DataFile(fileName = "error_codes.yaml", streamLoader = true) 31 | public class ErrorCodes { 32 | private Map errors; 33 | 34 | /** 35 | * If the code is found in the errors map, return the value associated with 36 | * that key. Otherwise, return the default value. 37 | * 38 | * @param code The error code that you want to get the message for. 39 | * @return The error message associated with the error code. 40 | */ 41 | public String findSolution(final String code) { 42 | return this.errors.getOrDefault(code, 43 | "No solution found in error_codes.yaml. Please add a solution for this error code."); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/helper/Preconditions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.helper; 18 | 19 | import lombok.experimental.UtilityClass; 20 | 21 | @UtilityClass 22 | public class Preconditions { 23 | /** 24 | * Checks the given boolean condition, and throws an 25 | * {@code IllegalArgumentException} if the condition is not met (evaluates 26 | * to {@code false}). The exception will have the given error message. 27 | * 28 | * @param condition The condition to check 29 | * @param errorMessage The message for the 30 | * {@code IllegalArgumentException} that is 31 | * thrown if the check fails. 32 | * @throws IllegalArgumentException Thrown, if the condition is violated. 33 | */ 34 | public void checkArgument(final boolean condition, final String errorMessage) { 35 | if (!condition) { 36 | throw new IllegalArgumentException(errorMessage); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/listener/LifecycleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.listener; 18 | 19 | public interface LifecycleListener { 20 | } 21 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/listener/TestLifecycleListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.listener; 18 | 19 | import io.github.selcukes.commons.fixture.TestResult; 20 | 21 | public interface TestLifecycleListener { 22 | default void beforeSuite(TestResult result) { 23 | // do nothing 24 | } 25 | 26 | default void afterSuite(TestResult result) { 27 | // do nothing 28 | } 29 | 30 | default void beforeTest(TestResult result) { 31 | // do nothing 32 | } 33 | 34 | default void beforeAfterTest(TestResult result) { 35 | // do nothing 36 | } 37 | 38 | default void afterTest(TestResult result) { 39 | // do nothing 40 | } 41 | 42 | default void beforeStep(TestResult result) { 43 | // do nothing 44 | } 45 | 46 | default void afterStep(TestResult result) { 47 | // do nothing 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/logging/LogRecordListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.logging; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.Objects; 22 | import java.util.logging.Level; 23 | import java.util.logging.LogRecord; 24 | import java.util.stream.Stream; 25 | 26 | public final class LogRecordListener { 27 | private final ThreadLocal> logRecords = ThreadLocal.withInitial(ArrayList::new); 28 | 29 | void logRecordSubmitted(LogRecord logRecord) { 30 | this.logRecords.get().add(logRecord); 31 | } 32 | 33 | public Stream getLogRecords() { 34 | return this.logRecords.get().stream(); 35 | } 36 | 37 | public Stream getLogRecords(Level level) { 38 | Objects.requireNonNull(level, "Level must not be null"); 39 | return getLogRecords().filter(logRecord -> logRecord.getLevel() == level); 40 | } 41 | 42 | public void cleanUp() { 43 | logRecords.remove(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/logging/SelcukesColorFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.logging; 18 | 19 | import java.util.Map; 20 | import java.util.logging.Level; 21 | import java.util.logging.LogRecord; 22 | 23 | public class SelcukesColorFormatter extends SelcukesLoggerFormatter { 24 | private static final String COLOR_RESET = "\u001b[0m"; 25 | private static final String COLOR_SEVERE = "\u001b[91m"; 26 | private static final Map LEVEL_COLORS = Map.of( 27 | Level.SEVERE, COLOR_SEVERE, 28 | Level.WARNING, "\u001b[93m", 29 | Level.INFO, "\u001b[32m", 30 | Level.CONFIG, "\u001b[94m", 31 | Level.FINE, "\u001b[36m", 32 | Level.FINER, "\u001b[35m", 33 | Level.FINEST, "\u001b[90m"); 34 | 35 | private String getColoredMessage(final Level level, final String message) { 36 | String prefix = LEVEL_COLORS.getOrDefault(level, COLOR_SEVERE); 37 | return prefix + message + COLOR_RESET; 38 | } 39 | 40 | @Override 41 | public String format(LogRecord logRecord) { 42 | String message = super.format(logRecord); 43 | return getColoredMessage(logRecord.getLevel(), message); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/os/Architecture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.os; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Getter; 21 | 22 | @Getter 23 | @AllArgsConstructor 24 | public enum Architecture { 25 | X32(32), 26 | X64(64); 27 | 28 | final int value; 29 | } 30 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/java/io/github/selcukes/commons/os/OsType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.os; 18 | 19 | public enum OsType { 20 | WIN, 21 | MAC, 22 | LINUX 23 | } 24 | -------------------------------------------------------------------------------- /selcukes-commons/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | _ _ 2 | | | | | 3 | ___ ____ | | ____ _ _ | | _ ____ ___ 4 | /___) / _ )| | / ___)| | | || | / ) / _ ) /___) 5 | |___ |( (/ / | |( (___ | |_| || |< ( ( (/ / |___ | 6 | (___/ \____)|_| \____) \____||_| \_) \____)(___/ -------------------------------------------------------------------------------- /selcukes-commons/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-commons/src/main/resources/selcukes-watermark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-commons/src/main/resources/selcukes-watermark.png -------------------------------------------------------------------------------- /selcukes-commons/src/main/resources/selcukes_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-commons/src/main/resources/selcukes_logo.png -------------------------------------------------------------------------------- /selcukes-commons/src/test/java/io/github/selcukes/commons/tests/ExceptionHelperTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.commons.tests; 20 | 21 | import io.github.selcukes.commons.exception.SelcukesException; 22 | import io.github.selcukes.commons.helper.ExceptionHelper; 23 | import org.testng.annotations.Test; 24 | 25 | import java.io.IOException; 26 | 27 | public class ExceptionHelperTest { 28 | public void createException() { 29 | try { 30 | throw new IOException("Something Wrong"); 31 | } catch (Exception e) { 32 | throw new RuntimeException(e); 33 | } 34 | } 35 | 36 | public void createTest() { 37 | try { 38 | createException(); 39 | } catch (Exception e) { 40 | throw new SelcukesException("Element not Found", e); 41 | } 42 | } 43 | 44 | @Test(expectedExceptions = IOException.class) 45 | public void testException() { 46 | try { 47 | createTest(); 48 | } catch (Exception e) { 49 | ExceptionHelper.rethrowRootCause(e); 50 | } 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/java/io/github/selcukes/commons/tests/FixtureTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.tests; 18 | 19 | import io.github.selcukes.commons.fixture.SelcukesFixture; 20 | import org.testng.annotations.Test; 21 | 22 | public class FixtureTest { 23 | @Test(expectedExceptions = { AssertionError.class }) 24 | public void testVerification() { 25 | SelcukesFixture.setValidator("org.testng.Assert"); 26 | SelcukesFixture.fail("Hello"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/java/io/github/selcukes/commons/tests/ShellTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.tests; 18 | 19 | import io.github.selcukes.commons.exec.Shell; 20 | import org.testng.Assert; 21 | import org.testng.annotations.Test; 22 | 23 | import static org.testng.Assert.assertEquals; 24 | 25 | public class ShellTest { 26 | // For windows prefix "cmd.exe /c " 27 | private final String TEST_COMMAND = "echo Hello World!"; 28 | 29 | @Test 30 | public void testRunCommand() { 31 | var shell = new Shell(); 32 | var result = shell.runCommand(TEST_COMMAND); 33 | assertEquals(result.getOutput().get(0), "Hello World!"); 34 | } 35 | 36 | @Test 37 | public void testRunCommandAsync() throws Exception { 38 | Shell shell = new Shell(); 39 | var future = shell.runCommandAsync(TEST_COMMAND); 40 | var result = future.get(); 41 | assertEquals(result.getOutput().get(0), "Hello World!"); 42 | } 43 | 44 | @Test 45 | public void testStartAndKillProcess() { 46 | Process process = Shell.startProcess("ping localhost -t", "sample.txt"); 47 | Shell.killProcess("ping.exe"); 48 | Assert.assertFalse(process.isAlive()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/java/io/github/selcukes/commons/tests/helper/PreconditionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.tests.helper; 18 | 19 | import io.github.selcukes.commons.helper.Preconditions; 20 | import org.testng.annotations.Test; 21 | 22 | public class PreconditionsTest { 23 | 24 | @Test(expectedExceptions = IllegalArgumentException.class) 25 | public void checkArgAndThrowsException() { 26 | int age = -18; 27 | String message = "Age can't be zero or less than zero."; 28 | Preconditions.checkArgument(age > 0, message); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/java/io/github/selcukes/commons/tests/helper/RandomUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.commons.tests.helper; 18 | 19 | import io.github.selcukes.commons.helper.RandomUtils; 20 | import io.github.selcukes.commons.logging.Logger; 21 | import io.github.selcukes.commons.logging.LoggerFactory; 22 | import org.testng.annotations.Test; 23 | 24 | public class RandomUtilsTest { 25 | private final Logger logger = LoggerFactory.getLogger(getClass()); 26 | 27 | @Test 28 | public void randomTest() { 29 | logger.info(() -> RandomUtils.randomAscii(10)); 30 | logger.info(() -> RandomUtils.randomNumeric(10)); 31 | logger.info(() -> RandomUtils.randomAlphabetic(10)); 32 | logger.info(() -> RandomUtils.randomAlphaNumeric(10)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/resources/sample.csv: -------------------------------------------------------------------------------- 1 | com,cos,tan,sin,min 2 | 3,22,9,9,7 3 | -------------------------------------------------------------------------------- /selcukes-commons/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | excel: 8 | runner: fase 9 | suiteFile: "" 10 | dataFile: "" 11 | suiteName: "Smoke" 12 | cucumber: 13 | module: google 14 | features: src/test/resources/features/${module} 15 | glue: io.github.selcukes.testng.tests 16 | tags: 17 | plugin: 18 | web: 19 | remote: false 20 | cloud: 21 | browser: CHROME 22 | headLess: true 23 | serviceUrl: "http://127.0.0.1:4444" 24 | windows: 25 | serviceUrl: "http://127.0.0.1:4723" 26 | app: "C:\\Windows\\System32\\notepad.exe" 27 | mobile: 28 | remote: false 29 | cloud: BROWSER_STACK 30 | platform: Android 31 | browser: CHROME 32 | headLess: true 33 | serviceUrl: "http://127.0.0.1:4723" 34 | app: "src/test/resources/android-app.apk" 35 | reports: 36 | emailReport: true 37 | htmlReport: true 38 | path: 39 | video: 40 | recording: false 41 | type: FFMPEG 42 | ffmpegPath: 43 | watermark: false 44 | notifier: 45 | notification: false 46 | type: Teams 47 | webhookToken: WEBHOOKXXXX 48 | apiToken: APIXXXX 49 | channel: selcukes 50 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/driver/RemoteManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.driver; 18 | 19 | import org.openqa.selenium.Capabilities; 20 | import org.openqa.selenium.WebDriver; 21 | 22 | public interface RemoteManager { 23 | WebDriver createDriver(Capabilities capabilities); 24 | } 25 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/driver/RunMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.driver; 18 | 19 | import io.github.selcukes.commons.config.ConfigFactory; 20 | import lombok.experimental.UtilityClass; 21 | 22 | import static io.github.selcukes.collections.StringHelper.isNonEmpty; 23 | 24 | @UtilityClass 25 | public class RunMode { 26 | static boolean isCloudAppium() { 27 | String cloud = ConfigFactory.getConfig().getMobile().getCloud(); 28 | return isNonEmpty(cloud); 29 | } 30 | 31 | static boolean isLocalAppium() { 32 | return !ConfigFactory.getConfig().getMobile().isRemote(); 33 | } 34 | 35 | static boolean isRemoteBrowser() { 36 | return ConfigFactory.getConfig().getWeb().isRemote(); 37 | } 38 | 39 | static boolean isCloudBrowser() { 40 | String cloud = ConfigFactory.getConfig().getWeb().getCloud(); 41 | return isNonEmpty(cloud); 42 | } 43 | 44 | boolean isHeadlessWeb() { 45 | return ConfigFactory.getConfig().getWeb().isHeadLess(); 46 | } 47 | 48 | boolean isHeadlessMobile() { 49 | return ConfigFactory.getConfig().getMobile().isHeadLess(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/enums/DeviceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.enums; 18 | 19 | public enum DeviceType { 20 | BROWSER, 21 | DESKTOP, 22 | MOBILE 23 | } 24 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/enums/SwipeDirection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.enums; 18 | 19 | public enum SwipeDirection { 20 | UP, DOWN, RIGHT, LEFT 21 | } 22 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/page/ApiPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.page; 18 | 19 | import org.openqa.selenium.WebDriver; 20 | 21 | public class ApiPage implements Page { 22 | @Override 23 | public WebDriver getDriver() { 24 | return null; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/page/Pages.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.page; 18 | 19 | import io.appium.java_client.windows.WindowsDriver; 20 | import io.github.selcukes.core.driver.DriverManager; 21 | import io.github.selcukes.core.enums.DeviceType; 22 | import lombok.experimental.UtilityClass; 23 | import org.openqa.selenium.Capabilities; 24 | import org.openqa.selenium.WebDriver; 25 | 26 | @UtilityClass 27 | public class Pages { 28 | public synchronized WebPage webPage(Capabilities... capabilities) { 29 | WebDriver driver = DriverManager.createDriver(DeviceType.BROWSER, capabilities); 30 | return new WebPage(driver); 31 | } 32 | 33 | public synchronized WinPage winPage(Capabilities... capabilities) { 34 | WindowsDriver driver = DriverManager.createDriver(DeviceType.DESKTOP, capabilities); 35 | return new WinPage(driver); 36 | } 37 | 38 | public synchronized MobilePage mobilePage(Capabilities... capabilities) { 39 | WebDriver driver = DriverManager.createDriver(DeviceType.MOBILE, capabilities); 40 | return new MobilePage(driver); 41 | } 42 | 43 | public static synchronized ApiPage apiPage() { 44 | return new ApiPage(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/page/WebPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.page; 18 | 19 | import io.github.selcukes.commons.helper.FileHelper; 20 | import org.openqa.selenium.Pdf; 21 | import org.openqa.selenium.PrintsPage; 22 | import org.openqa.selenium.WebDriver; 23 | import org.openqa.selenium.print.PrintOptions; 24 | 25 | public class WebPage extends WebAuthenticator implements Page { 26 | final WebDriver driver; 27 | 28 | public WebPage(WebDriver driver) { 29 | super(driver); 30 | this.driver = driver; 31 | } 32 | 33 | @Override 34 | public WebDriver getDriver() { 35 | return driver; 36 | } 37 | 38 | public void printPage(String filePath) { 39 | PrintsPage pg = (PrintsPage) getDriver(); 40 | PrintOptions printOptions = new PrintOptions(); 41 | Pdf pdf = pg.print(printOptions); 42 | String pdfContent = pdf.getContent(); 43 | FileHelper.createFile(pdfContent, filePath); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-core/src/main/java/io/github/selcukes/core/page/WinPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.page; 18 | 19 | import io.appium.java_client.windows.WindowsDriver; 20 | import io.github.selcukes.core.driver.AppiumOptions; 21 | import io.github.selcukes.core.driver.DriverManager; 22 | import io.github.selcukes.core.enums.DeviceType; 23 | import lombok.CustomLog; 24 | import org.openqa.selenium.By; 25 | import org.openqa.selenium.WebDriver; 26 | import org.openqa.selenium.WebElement; 27 | 28 | @CustomLog 29 | public class WinPage implements Page { 30 | private WindowsDriver driver; 31 | 32 | public WinPage(WindowsDriver driver) { 33 | this.driver = driver; 34 | } 35 | 36 | @Override 37 | public WebDriver getDriver() { 38 | return driver; 39 | } 40 | 41 | public WinPage switchToWindowByTitle(String appTitle) { 42 | WebElement newWindowElement = find(By.name(appTitle)); 43 | driver = DriverManager.createDriver(DeviceType.DESKTOP, 44 | AppiumOptions.getWinAppOptions(newWindowElement)); 45 | return this; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /selcukes-core/src/main/resources/META-INF/services/io.github.selcukes.commons.listener.TestLifecycleListener: -------------------------------------------------------------------------------- 1 | io.github.selcukes.core.listener.ResourceCleanupProvider -------------------------------------------------------------------------------- /selcukes-core/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: SEVERE 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/TestDriver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests; 18 | 19 | import lombok.experimental.UtilityClass; 20 | import org.openqa.selenium.WebDriver; 21 | import org.openqa.selenium.chrome.ChromeDriver; 22 | import org.openqa.selenium.chrome.ChromeOptions; 23 | 24 | @UtilityClass 25 | public class TestDriver { 26 | public static WebDriver getChromeDriver() { 27 | var options = new ChromeOptions(); 28 | options.addArguments("--headless"); 29 | return new ChromeDriver(options); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/api/ApiTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.api; 18 | 19 | import io.github.selcukes.commons.http.WebResponse; 20 | import io.github.selcukes.core.page.ApiPage; 21 | import io.github.selcukes.core.page.Pages; 22 | import lombok.CustomLog; 23 | import lombok.Data; 24 | import org.testng.annotations.Test; 25 | 26 | @CustomLog 27 | public class ApiTest { 28 | @Test(enabled = false) 29 | public void authTest() { 30 | String user = "{\n" + 31 | " \"email\": \"eve.holt@reqres.in\",\n" + 32 | " \"password\": \"admin\"\n" + 33 | "}"; 34 | ApiPage page = Pages.apiPage(); 35 | WebResponse response = page.request("https://reqres.in/api/register") 36 | .post(user); 37 | page.assertThat().response(response).isOk(); 38 | logger.info(() -> "Token is: " + response.bodyAs(ResponseBody.class).getToken()); 39 | } 40 | 41 | @Data 42 | static class ResponseBody { 43 | String id; 44 | String token; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/mobile/MobileBrowserTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.mobile; 18 | 19 | import io.github.selcukes.commons.annotation.Lifecycle; 20 | import io.github.selcukes.core.page.MobilePage; 21 | import io.github.selcukes.core.page.Pages; 22 | import org.testng.annotations.Test; 23 | 24 | @Lifecycle 25 | public class MobileBrowserTest { 26 | 27 | @Test(enabled = false) 28 | public void mobileBrowserTest() { 29 | MobilePage page = Pages.mobilePage(); 30 | page.open("https://www.google.com/") 31 | .assertThat().title("Google"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/unit/ValidationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.unit; 18 | 19 | import io.github.selcukes.core.validation.Validation; 20 | import org.testng.annotations.Test; 21 | 22 | public class ValidationTest { 23 | @Test(threadPoolSize = 3, invocationCount = 5, expectedExceptions = { AssertionError.class }) 24 | public void testValidation() { 25 | Validation.failWithMessage(true, Thread.currentThread().getName() + " - Error Message 1"); 26 | Validation.failWithMessage(true, Thread.currentThread().getName() + " - Error Message 2"); 27 | Validation.failWithMessage(true, Thread.currentThread().getName() + " - Error Message 3"); 28 | Validation.failAll(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/web/CookiesTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.web; 18 | 19 | import io.github.selcukes.commons.annotation.Lifecycle; 20 | import io.github.selcukes.core.page.Pages; 21 | import io.github.selcukes.core.page.WebPage; 22 | import org.openqa.selenium.By; 23 | import org.testng.annotations.BeforeMethod; 24 | import org.testng.annotations.Test; 25 | 26 | @Lifecycle 27 | public class CookiesTest { 28 | WebPage page; 29 | 30 | @BeforeMethod 31 | public void setup() { 32 | page = Pages.webPage(); 33 | } 34 | 35 | @Test 36 | public void cookiesTest() { 37 | page.open("https://the-internet.herokuapp.com/") 38 | .click(By.linkText("JavaScript Alerts")); 39 | var cookie = page.cookies().get(0); 40 | var cookieName = page.cookie(cookie).getName(); 41 | page.verifyThat().object(cookieName).isEqualTo(cookie); 42 | 43 | page.deleteAllCookies(); 44 | var cookieSize = page.cookies().size(); 45 | page.verifyThat().object(cookieSize).isEqualTo(0); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/web/PrintTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.web; 18 | 19 | import io.github.selcukes.commons.annotation.Lifecycle; 20 | import io.github.selcukes.core.page.Pages; 21 | import io.github.selcukes.core.page.WebPage; 22 | import org.testng.annotations.BeforeMethod; 23 | import org.testng.annotations.Test; 24 | 25 | @Lifecycle 26 | public class PrintTest { 27 | WebPage page; 28 | 29 | @BeforeMethod 30 | public void setup() { 31 | page = Pages.webPage(); 32 | } 33 | 34 | @Test 35 | public void testPrint() { 36 | page.open("https://techyworks.blogspot.com/2022/03/get-browser-session-storage-data-using-selenium.html"); 37 | // page.printPage("target/print.pdf"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selcukes-core/src/test/java/io/github/selcukes/core/tests/web/WebTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.core.tests.web; 18 | 19 | import io.github.selcukes.commons.annotation.Lifecycle; 20 | import io.github.selcukes.core.page.Pages; 21 | import io.github.selcukes.core.page.WebPage; 22 | import org.testng.annotations.BeforeMethod; 23 | import org.testng.annotations.Test; 24 | 25 | @Lifecycle 26 | public class WebTest { 27 | WebPage page; 28 | 29 | @BeforeMethod 30 | public void setup() { 31 | page = Pages.webPage(); 32 | } 33 | 34 | @Test 35 | public void remoteWebTest() { 36 | page.open("https://www.google.com/") 37 | .assertThat().title("Google"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /selcukes-core/src/test/resources/android-app.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-core/src/test/resources/android-app.apk -------------------------------------------------------------------------------- /selcukes-core/src/test/resources/browser_stack.yaml: -------------------------------------------------------------------------------- 1 | url: "https://${browserstack.user}:${browserstack.key}@hub-cloud.browserstack.com/wd/hub" 2 | capabilities: 3 | deviceName: Google Pixel 6 4 | buildName: Selcukes BrowserStack Build 5 | sessionName: Selcukes BrowserStack Session 6 | environments: 7 | os_version: "12.0" 8 | deviceName: Google Pixel 6 9 | app: "selcukes_android-app.apk" -------------------------------------------------------------------------------- /selcukes-core/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | web: 8 | remote: true 9 | cloud: 10 | browser: CHROME 11 | headLess: true 12 | serviceUrl: "http://127.0.0.1:4444" 13 | serverJar: "https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.20.0/selenium-server-4.20.0.jar" 14 | windows: 15 | remote: true 16 | serviceUrl: "http://127.0.0.1:4723" 17 | app: "C:\\Windows\\System32\\notepad.exe" 18 | mobile: 19 | remote: true 20 | cloud: BROWSER_STACK 21 | platform: Android 22 | browser: CHROME 23 | headLess: true 24 | serviceUrl: "http://127.0.0.1:4723" 25 | app: "src/test/resources/android-app.apk" 26 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/DataBind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind; 20 | 21 | import java.io.InputStream; 22 | import java.nio.file.Path; 23 | 24 | interface DataBind { 25 | T parse(final Path path, final Class dataClass); 26 | 27 | T parse(final InputStream inputStream, final Class dataClass); 28 | 29 | void write(final Path path, final T value); 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/JsonData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind; 20 | 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | 23 | class JsonData extends AbstractDataBind { 24 | 25 | JsonData() { 26 | super(new ObjectMapper()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/XmlData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind; 20 | 21 | import com.fasterxml.jackson.dataformat.xml.XmlMapper; 22 | 23 | class XmlData extends AbstractDataBind { 24 | 25 | XmlData() { 26 | super(new XmlMapper()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/YamlData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind; 20 | 21 | import com.fasterxml.jackson.databind.ObjectMapper; 22 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; 23 | 24 | class YamlData extends AbstractDataBind { 25 | 26 | YamlData() { 27 | super(new ObjectMapper(new YAMLFactory())); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/annotation/DataFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind.annotation; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Target(ElementType.TYPE) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | public @interface DataFile { 29 | 30 | String fileName() default ""; 31 | 32 | String folderPath() default ""; 33 | 34 | boolean streamLoader() default false; 35 | 36 | String sheetName() default ""; 37 | } 38 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/annotation/Interpolate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.annotation; 18 | 19 | import io.github.selcukes.databind.substitute.DefaultSubstitutor; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Target({ ElementType.TYPE, ElementType.FIELD }) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | public @interface Interpolate { 29 | Class substitutor() default DefaultSubstitutor.class; 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/annotation/Key.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.annotation; 18 | 19 | import io.github.selcukes.databind.converters.StringConverter; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Target(ElementType.FIELD) 27 | @Retention(RetentionPolicy.RUNTIME) 28 | public @interface Key { 29 | String name(); 30 | 31 | String format() default ""; 32 | 33 | Class converter() default StringConverter.class; 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/BooleanConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | import static java.lang.Boolean.parseBoolean; 22 | 23 | /** 24 | * It converts a string to a boolean 25 | */ 26 | public class BooleanConverter extends DefaultConverter { 27 | @Override 28 | public Boolean convert(final String value) { 29 | return parseBoolean(value); 30 | } 31 | 32 | @Override 33 | public Type getType() { 34 | return Boolean.TYPE; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/Converter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | // A generic interface. 22 | public interface Converter { 23 | /** 24 | * Convert a String to a T. 25 | * 26 | * @param value The value to be converted 27 | * @return The return type is the same as the type of the parameter. 28 | */ 29 | T convert(String value); 30 | 31 | /** 32 | * Returns the type of the object. 33 | * 34 | * @return The type of the object. 35 | */ 36 | Type getType(); 37 | 38 | /** 39 | * If the format is null, then call the other convert function, otherwise, 40 | * call the other convert function. 41 | * 42 | * @param value The value to convert. 43 | * @param format The format of the value. 44 | * @return The default implementation of the convert method is being 45 | * returned. 46 | */ 47 | default T convert(final String value, final String format) { 48 | return convert(value); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/Converters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import lombok.experimental.UtilityClass; 20 | 21 | import java.util.List; 22 | import java.util.stream.Stream; 23 | 24 | import static io.github.selcukes.collections.Reflections.newInstance; 25 | 26 | @UtilityClass 27 | public class Converters { 28 | 29 | /** 30 | * It creates a list of converters by instantiating each class in the list 31 | * of classes passed in 32 | * 33 | * @return A list of Converter objects. 34 | */ 35 | @SuppressWarnings("unchecked") 36 | public static List> defaultConverters() { 37 | return Stream.of( 38 | BooleanConverter.class, 39 | StringConverter.class, 40 | IntegerConverter.class, 41 | DoubleConverter.class, 42 | LocalDateConverter.class, 43 | LocalDateTimeConverter.class) 44 | .map(cls -> (Converter) newInstance(cls)) 45 | .toList(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/DefaultConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | /** 22 | * It's a base class for all converters that converts a single type 23 | */ 24 | public abstract class DefaultConverter implements Converter { 25 | private final Type type; 26 | 27 | @SafeVarargs 28 | protected DefaultConverter(final T... values) { 29 | this.type = values.getClass().getComponentType(); 30 | } 31 | 32 | @Override 33 | public Type getType() { 34 | return type; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/DoubleConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import lombok.SneakyThrows; 20 | 21 | import java.lang.reflect.Type; 22 | import java.text.NumberFormat; 23 | import java.util.Locale; 24 | 25 | /** 26 | * It converts a string to a double 27 | */ 28 | public class DoubleConverter extends DefaultConverter { 29 | @SneakyThrows 30 | @Override 31 | public Double convert(final String value) { 32 | return NumberFormat.getInstance(Locale.getDefault()).parse(value).doubleValue(); 33 | } 34 | 35 | @Override 36 | public Type getType() { 37 | return Double.TYPE; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/IntegerConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import java.lang.reflect.Type; 20 | 21 | import static java.lang.Integer.parseInt; 22 | 23 | /** 24 | * "This class converts a String to an Integer." 25 | *

26 | * The class extends DefaultConverter, which is a class that implements the 27 | * Converter interface 28 | */ 29 | public class IntegerConverter extends DefaultConverter { 30 | @Override 31 | public Integer convert(final String value) { 32 | return parseInt(value); 33 | } 34 | 35 | @Override 36 | public Type getType() { 37 | return Integer.TYPE; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/LocalDateConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import io.github.selcukes.collections.Clocks; 20 | 21 | import java.time.LocalDate; 22 | 23 | import static io.github.selcukes.collections.Clocks.DATE_FORMAT; 24 | import static java.time.LocalDate.parse; 25 | 26 | /** 27 | * It converts a string to a `LocalDate` object 28 | */ 29 | public class LocalDateConverter extends DefaultConverter { 30 | @Override 31 | public LocalDate convert(final String value) { 32 | return convert(value, DATE_FORMAT); 33 | } 34 | 35 | @Override 36 | public LocalDate convert(final String value, final String format) { 37 | return parse(value, Clocks.dateTimeFormatter(format, DATE_FORMAT)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/LocalDateTimeConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | import io.github.selcukes.collections.Clocks; 20 | 21 | import java.time.LocalDateTime; 22 | 23 | import static io.github.selcukes.collections.Clocks.DATE_TIME_FORMAT; 24 | import static java.time.LocalDateTime.parse; 25 | 26 | /** 27 | * It converts a string to a `LocalDateTime` object 28 | */ 29 | public class LocalDateTimeConverter extends DefaultConverter { 30 | 31 | @Override 32 | public LocalDateTime convert(final String value) { 33 | return convert(value, DATE_TIME_FORMAT); 34 | } 35 | 36 | @Override 37 | public LocalDateTime convert(final String value, final String format) { 38 | return parse(value, Clocks.dateTimeFormatter(format, DATE_TIME_FORMAT)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/converters/StringConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.converters; 18 | 19 | /** 20 | * "This class converts a String to a String." 21 | *

22 | * The `DefaultConverter` class is a generic class that takes a single type 23 | * parameter. In this case, the type parameter is `String`. The 24 | * `DefaultConverter` class is an abstract class that requires you to implement 25 | * the `convert` method. The `convert` method takes a single parameter of type 26 | * `String` and returns a `String` 27 | */ 28 | public class StringConverter extends DefaultConverter { 29 | @Override 30 | public String convert(final String value) { 31 | return value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/exception/DataMapperException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind.exception; 20 | 21 | public class DataMapperException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | public DataMapperException() { 26 | super(); 27 | } 28 | 29 | public DataMapperException(String message, Throwable cause) { 30 | super(message, cause); 31 | } 32 | 33 | public DataMapperException(String message) { 34 | super(message); 35 | } 36 | 37 | public DataMapperException(Throwable cause) { 38 | super(cause); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/properties/PropertiesLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.properties; 18 | 19 | import io.github.selcukes.databind.exception.DataMapperException; 20 | 21 | import java.io.FileInputStream; 22 | import java.io.IOException; 23 | import java.nio.file.Path; 24 | import java.util.Properties; 25 | 26 | class PropertiesLoader { 27 | private PropertiesLoader() { 28 | } 29 | 30 | public static Properties getProperties(Path filePath) { 31 | var properties = new Properties(); 32 | try (var stream = new FileInputStream(filePath.toFile())) { 33 | properties.load(stream); 34 | } catch (IOException e) { 35 | throw new DataMapperException("Could not parse property file '" + filePath.toFile().getName() + "'", e); 36 | } 37 | return properties; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/substitute/DefaultSubstitutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.substitute; 18 | 19 | import java.util.Properties; 20 | 21 | /** 22 | * It does nothing 23 | */ 24 | public class DefaultSubstitutor implements Substitutor { 25 | public String replace(final Properties variables, final String key, final String format) { 26 | return variables.getProperty(key); 27 | } 28 | 29 | @Override 30 | public String replace(final String strToReplace, final String format) { 31 | return strToReplace; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/substitute/StringSubstitutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.substitute; 18 | 19 | import io.github.selcukes.collections.StringHelper; 20 | import io.github.selcukes.databind.utils.DataSubstitutor; 21 | 22 | import java.util.Properties; 23 | 24 | /** 25 | * It replaces all occurrences of ${key} with the value of the key in the 26 | * properties object 27 | */ 28 | public class StringSubstitutor extends DefaultSubstitutor { 29 | 30 | @Override 31 | public String replace(final Properties variables, final String key, final String format) { 32 | String value = variables.getProperty(key); 33 | return StringHelper.interpolate(value, matcher -> DataSubstitutor.substitute(matcher, format)); 34 | } 35 | 36 | @Override 37 | public String replace(final String strToReplace, final String format) { 38 | return StringHelper.interpolate(strToReplace, matcher -> DataSubstitutor.substitute(matcher, format)); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /selcukes-databind/src/main/java/io/github/selcukes/databind/substitute/Substitutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.substitute; 18 | 19 | import java.util.Properties; 20 | 21 | // A Java interface. 22 | public interface Substitutor { 23 | /** 24 | * Replace all occurrences of variables within the value associated with the 25 | * given key in the given properties, optionally formatting them 26 | * 27 | * @param variables The variables to use for replacement. 28 | * @param key The key to be replaced. 29 | * @param format The format of the string to be replaced. 30 | * @return A string with the value of the key in the properties 31 | * file. 32 | */ 33 | String replace(Properties variables, String key, final String format); 34 | 35 | /** 36 | * It replaces all occurrences of the string "strToReplace" with the string 37 | * "format". 38 | * 39 | * @param strToReplace The string to be replaced. 40 | * @param format The format of the string to be replaced. 41 | * @return A string with the format of the date. 42 | */ 43 | String replace(String strToReplace, final String format); 44 | } 45 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/java/io/github/selcukes/databind/tests/CreateDataFileWithAgsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.tests; 18 | 19 | import io.github.selcukes.collections.Clocks; 20 | import io.github.selcukes.databind.DataMapper; 21 | import io.github.selcukes.databind.annotation.DataFile; 22 | import lombok.Data; 23 | import org.testng.annotations.Test; 24 | 25 | public class CreateDataFileWithAgsTest { 26 | private static final String TIMESTAMP_FORMAT = "MM/dd/yyyy hh:mm:ss"; 27 | 28 | @Test(enabled = false) 29 | public void dataTest() { 30 | String currentDataTime = Clocks.dateTime(TIMESTAMP_FORMAT); 31 | Resolve resolve = new Resolve(); 32 | resolve.setChromeVersion("10.11.213"); 33 | resolve.setDataTime(currentDataTime); 34 | DataMapper.write(resolve); 35 | } 36 | 37 | @Data 38 | @DataFile(folderPath = "E:/New folder/WebDrivers") 39 | static class Resolve { 40 | String chromeVersion; 41 | String dataTime; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/java/io/github/selcukes/databind/tests/ExcelWriterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.tests; 18 | 19 | import io.github.selcukes.collections.DataTable; 20 | import io.github.selcukes.collections.Resources; 21 | import io.github.selcukes.databind.excel.ExcelMapper; 22 | import org.testng.annotations.Test; 23 | 24 | import java.util.LinkedHashMap; 25 | import java.util.Map; 26 | 27 | import static org.testng.Assert.assertEquals; 28 | 29 | public class ExcelWriterTest { 30 | @Test 31 | public void excelWrite() { 32 | DataTable input = DataTable.of( 33 | new LinkedHashMap<>(Map.of("ID", 1, "Name", "John Doe", "Age", 30, "IsEmployed", false)), 34 | new LinkedHashMap<>(Map.of("ID", 2, "Name", "Jane Smith", "Age", 40, "IsEmployed", false)), 35 | new LinkedHashMap<>(Map.of("ID", 3, "Name", "Tom", "Age", 35, "IsEmployed", false))); 36 | 37 | String fileName = Resources.ofTest("output.xlsx").toString(); 38 | String sheetName = "Sheet1"; 39 | ExcelMapper.write(input, fileName, sheetName); 40 | var output = ExcelMapper.parse(fileName, sheetName); 41 | assertEquals(output.toString(), input.toString()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/java/io/github/selcukes/databind/tests/JsonUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.tests; 18 | 19 | import io.github.selcukes.databind.utils.JsonUtils; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.LinkedHashMap; 23 | 24 | import static org.testng.Assert.assertEquals; 25 | 26 | public class JsonUtilsTest { 27 | 28 | @Test 29 | public void jsonTest() { 30 | var map = new LinkedHashMap<>(); 31 | map.put("a", "1"); 32 | map.put("b", "2"); 33 | map.put("c", "3"); 34 | String expected = "{\"a\":\"1\",\"b\":\"2\",\"c\":\"3\"}"; 35 | assertEquals(JsonUtils.toJson(map), expected); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/java/io/github/selcukes/databind/tests/ListStringConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.databind.tests; 18 | 19 | import io.github.selcukes.databind.converters.DefaultConverter; 20 | 21 | import java.util.Arrays; 22 | import java.util.List; 23 | 24 | public class ListStringConverter extends DefaultConverter> { 25 | @Override 26 | public List convert(final String value) { 27 | return Arrays.asList(value.split(",")); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/java/io/github/selcukes/databind/tests/UpdateDataFileTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.databind.tests; 20 | 21 | import io.github.selcukes.databind.DataMapper; 22 | import io.github.selcukes.databind.annotation.DataFile; 23 | import lombok.Data; 24 | import lombok.SneakyThrows; 25 | import org.testng.annotations.Test; 26 | 27 | import java.util.Map; 28 | import java.util.UUID; 29 | 30 | public class UpdateDataFileTest { 31 | @SneakyThrows 32 | @Test 33 | public void updateDataFile() { 34 | UUID uuid = UUID.randomUUID(); 35 | TestSample testSample = DataMapper.parse(TestSample.class); 36 | testSample.getUsers().get("user1").put("password", uuid.toString()); 37 | DataMapper.write(testSample); 38 | } 39 | 40 | @Data 41 | @DataFile(fileName = "test_sample.yml") 42 | static class TestSample { 43 | Map> users; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/CustomerInfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 2019-03-06T07:32:26 4 | CREATE 5 | 1258D20190306T073226 6 | SCD_SENT 7 | 8 | Central Pacific Bank 9 | 2100-31-12 10 |

11 | 125 Street 12 | 13 | Des moines 14 | USA 15 | IA 16 | 50303 17 |
18 | 19 | 20 | 1256 21 | test@test.com 22 | Ramesh 23 | Babu 24 | +15168978352 25 | Treasury 26 | +19087253123 27 | 28 | 29 | 5689 30 | test@test.com 31 | Mohan 32 | Babu 33 | +19011978123 34 | Treasury 35 | +19011253456 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/TestData.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-databind/src/test/resources/TestData.xlsx -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/employee.csv: -------------------------------------------------------------------------------- 1 | ID,Name ,Email ,Phone ,Country,Address,Mojo 2 | ,Rajeev Kumar Singh ,rajeevs@example.com,+91-9999999999,India, "12,Hello Street" 3 | ,Sachin Tendulkar,sachin@example.com,+91-9999999998,India,"34,é Street" 4 | ,Barak Obama,barak.obama@example.com,+1-1111111111,United States, 5 | ,Donald Trump,donald.trump@example.com,+1-2222222222,United States,"56,Rb's Street" 6 | , ,,,,, 7 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/test_config.properties: -------------------------------------------------------------------------------- 1 | userName=Ramesh 2 | password=cred 3 | isTest=true 4 | osName=${os.name} 5 | date=${date} 6 | sampleDate=12/12/2022 7 | test.count=50 8 | elements=ele1,ele2 9 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/test_sample.yml: -------------------------------------------------------------------------------- 1 | --- 2 | users: 3 | user1: 4 | username: "junk" 5 | password: "d9fb64d7-4c05-444b-8c8f-dd012cbaed33" 6 | user2: 7 | username: "spam" 8 | password: "40aafad2-1d24-4d6c-85e2-b7630dc17c57" 9 | -------------------------------------------------------------------------------- /selcukes-databind/src/test/resources/test_users.json: -------------------------------------------------------------------------------- 1 | { 2 | "users": [ 3 | { 4 | "username": "junk", 5 | "password": "7e49fab8-550b-44b2-959d-e991e897dff9" 6 | }, 7 | { 8 | "username": "spam", 9 | "password": "42e25964-e373-453f-b130-8e156ea779ec" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /selcukes-excel-runner/README.md: -------------------------------------------------------------------------------- 1 | # Selcukes Excel Runner 2 | 3 | To use add the `selcukes-excel-runner` dependency to your pom.xml: 4 | 5 | ```xml 6 | 7 | [...] 8 | 9 | io.github.selcukes 10 | selcukes-excel-runner 11 | ${selcukes-excel-runner.version} 12 | 13 | [...] 14 | 15 | 16 | ``` 17 | 18 | Refer [wiki](https://github.com/selcukes/selcukes-java/wiki/Selcukes-Excel-Runner) for documentation -------------------------------------------------------------------------------- /selcukes-excel-runner/src/main/java/io/github/selcukes/excel/ExcelDataFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel; 18 | 19 | import io.github.selcukes.collections.StringHelper; 20 | import io.github.selcukes.commons.config.ConfigFactory; 21 | import io.github.selcukes.commons.helper.Singleton; 22 | 23 | public class ExcelDataFactory { 24 | private ExcelDataFactory() { 25 | // Ignore this 26 | } 27 | 28 | /** 29 | * Returns an instance of the ExcelDataProvider implementation based on the 30 | * configuration specified in the application properties file. 31 | * 32 | * @return an instance of SingleExcelData or MultiExcelData, depending on 33 | * the configuration 34 | */ 35 | public static ExcelDataProvider getInstance() { 36 | String suiteFile = ConfigFactory.getConfig().getExcel().get("suiteFile"); 37 | return StringHelper.isEmpty(suiteFile) ? Singleton.instanceOf(SingleExcelData.class) 38 | : Singleton.instanceOf(MultiExcelData.class); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/main/java/io/github/selcukes/excel/ScenarioContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel; 18 | 19 | import io.cucumber.java.Scenario; 20 | import lombok.experimental.UtilityClass; 21 | 22 | @UtilityClass 23 | public class ScenarioContext { 24 | private static final ThreadLocal testName = new InheritableThreadLocal<>(); 25 | 26 | private String getFeatureName(Scenario scenario) { 27 | String featureName = scenario.getUri().getPath(); 28 | featureName = featureName.substring(featureName.lastIndexOf("/") + 1, featureName.indexOf(".")); 29 | return featureName; 30 | } 31 | 32 | public void setTestName(Scenario scenario) { 33 | testName.set(getFeatureName(scenario) + "::" + scenario.getName()); 34 | } 35 | 36 | public String getTestName() { 37 | return testName.get(); 38 | } 39 | 40 | public void removeTestName() { 41 | testName.remove(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/java/io/github/selcukes/excel/TestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel; 18 | 19 | public class TestRunner extends ExcelTestRunner { 20 | } 21 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/java/io/github/selcukes/excel/page/CommonPage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel.page; 18 | 19 | import io.github.selcukes.excel.ExcelDataFactory; 20 | 21 | import java.util.Map; 22 | 23 | public class CommonPage { 24 | 25 | public Map getScenarioData() { 26 | return ExcelDataFactory.getInstance().getScenarioData(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/java/io/github/selcukes/excel/steps/Hooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel.steps; 18 | 19 | import io.cucumber.java.After; 20 | import io.cucumber.java.Before; 21 | import io.cucumber.java.Scenario; 22 | import io.github.selcukes.excel.ScenarioContext; 23 | 24 | public class Hooks { 25 | 26 | @Before 27 | public void beforeTest(Scenario scenario) { 28 | ScenarioContext.setTestName(scenario); 29 | } 30 | 31 | @After 32 | public void afterTest(Scenario scenario) { 33 | ScenarioContext.removeTestName(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/java/io/github/selcukes/excel/steps/MySteps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.excel.steps; 18 | 19 | import io.cucumber.java.en.Given; 20 | import io.cucumber.java.en.Then; 21 | import io.github.selcukes.excel.page.CommonPage; 22 | import lombok.CustomLog; 23 | 24 | @CustomLog 25 | public class MySteps { 26 | private final CommonPage commonPage; 27 | 28 | public MySteps(CommonPage commonPage) { 29 | this.commonPage = commonPage; 30 | } 31 | 32 | @Given("I open {} page") 33 | public void openPage(String page) { 34 | logger.info(() -> page); 35 | 36 | } 37 | 38 | @Then("I see {string} in the title") 39 | public void title(String page) { 40 | logger.info(() -> page); 41 | } 42 | 43 | @Given("I kinda open {} page") 44 | public void kinda(String page) { 45 | logger.info(() -> page); 46 | } 47 | 48 | @Then("I am very happy") 49 | public void happy() { 50 | commonPage.getScenarioData() 51 | .forEach((k, v) -> logger.info(() -> String.format("Key: [%s] Values: [%s]%n", k, v))); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/Google.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-excel-runner/src/test/resources/Google.xlsx -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/TestData.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-excel-runner/src/test/resources/TestData.xlsx -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/TestSuite.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-excel-runner/src/test/resources/TestSuite.xlsx -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/Yahoo.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selcukes/selcukes-java/99d3a807e3992370a8ca1a00a4ea2d8e1cece8b3/selcukes-excel-runner/src/test/resources/Yahoo.xlsx -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/features/Google.feature: -------------------------------------------------------------------------------- 1 | Feature: Google 2 | 3 | Scenario Outline: Google Login - 4 | Given I open Google page 5 | Then I see "Google" in the title 6 | Examples: 7 | | Scenario | 8 | | Example 1 | 9 | | Example 2 | 10 | 11 | Scenario: Different kind of opening 12 | Given I kinda open Google page 13 | Then I am very happy -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/features/Yahoo.feature: -------------------------------------------------------------------------------- 1 | Feature: Yahoo 2 | 3 | Scenario Outline: Yahoo Login - 4 | Given I open Yahoo page 5 | Then I see "Yahoo" in the title 6 | Examples: 7 | | Scenario | 8 | | Example 1 | 9 | | Example 2 | 10 | | Example 3 | 11 | 12 | Scenario: Yahoo Home 13 | Given I kinda open Yahoo page 14 | Then I am very happy 15 | -------------------------------------------------------------------------------- /selcukes-excel-runner/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | excel: 8 | runner: true 9 | suiteFile: "TestSuite.xlsx" 10 | dataFile: "TestData.xlsx" 11 | suiteName: "Smoke" 12 | cucumber: 13 | module: 14 | features: src/test/resources/features 15 | glue: io.github.selcukes.excel.steps 16 | tags: 17 | plugin: 18 | reports: 19 | emailReport: true 20 | htmlReport: true 21 | path: target 22 | fileName: TestReport 23 | timestamp: false 24 | -------------------------------------------------------------------------------- /selcukes-extent-reports/README.md: -------------------------------------------------------------------------------- 1 | # Selcukes Extent Report 2 | 3 | To use add the `selcukes-extent-reports` dependency to your pom.xml: 4 | 5 | ```xml 6 | 7 | [...] 8 | 9 | io.github.selcukes 10 | selcukes-extent-reports 11 | ${selcukes-extent-reports.version} 12 | 13 | [...] 14 | 15 | 16 | ``` 17 | 18 | Refer [wiki](https://github.com/selcukes/selcukes-java/wiki/Selcukes-Extent-Report) for documentation -------------------------------------------------------------------------------- /selcukes-extent-reports/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-extent-reports/src/test/java/io/github/selcukes/extent/report/tests/TestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.extent.report.tests; 18 | 19 | import io.github.selcukes.testng.SelcukesTestNGRunner; 20 | 21 | public class TestRunner extends SelcukesTestNGRunner { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /selcukes-extent-reports/src/test/java/io/github/selcukes/extent/report/tests/steps/CalculatorSteps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.extent.report.tests.steps; 20 | 21 | import io.cucumber.java.en.Given; 22 | import io.cucumber.java.en.Then; 23 | import io.cucumber.java.en.When; 24 | import io.github.selcukes.commons.Await; 25 | import io.github.selcukes.extent.report.tests.pages.Calculator; 26 | import org.testng.Assert; 27 | 28 | public class CalculatorSteps { 29 | private Calculator calc; 30 | 31 | @Given("a calculator I just turned on") 32 | public void setup() { 33 | calc = new Calculator(); 34 | } 35 | 36 | @When("I add {int} and {int}") 37 | public void add(int arg1, int arg2) { 38 | calc.push(arg1); 39 | calc.push(arg2); 40 | calc.push("+"); 41 | } 42 | 43 | @When("I subtract {int} to {int}") 44 | public void subtract(int arg1, int arg2) { 45 | calc.push(arg1); 46 | calc.push(arg2); 47 | calc.push("-"); 48 | } 49 | 50 | @Then("the result is {double}") 51 | public void theResultIs(double expected) { 52 | Assert.assertEquals(expected, calc.value()); 53 | Await.until(5); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /selcukes-extent-reports/src/test/java/io/github/selcukes/extent/report/tests/steps/ReporterHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.extent.report.tests.steps; 18 | 19 | import io.cucumber.java.After; 20 | import io.cucumber.java.AfterStep; 21 | import io.cucumber.java.Before; 22 | import io.cucumber.java.BeforeStep; 23 | import io.cucumber.java.Scenario; 24 | import lombok.CustomLog; 25 | 26 | @CustomLog 27 | public class ReporterHooks { 28 | 29 | @Before 30 | public void beforeTest(Scenario scenario) { 31 | 32 | // .initSnapshot(driver); //Initialise Full page screenshot 33 | logger.info(() -> "Starting Scenario .." + scenario.getName()); 34 | } 35 | 36 | @BeforeStep 37 | public void beforeStep() { 38 | logger.info(() -> "Before Step"); 39 | 40 | } 41 | 42 | @AfterStep 43 | public void afterStep() { 44 | 45 | // getReport().attachScreenshot(); //Attach Full page screenshot 46 | 47 | } 48 | 49 | @After 50 | public void afterTest(Scenario scenario) { 51 | logger.info(() -> "Completed Scenario .." + scenario.getName()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /selcukes-extent-reports/src/test/resources/calculator.feature: -------------------------------------------------------------------------------- 1 | Feature: Basic Arithmetic 2 | 3 | Background: A Calculator 4 | Given a calculator I just turned on 5 | 6 | Scenario: Addition 7 | When I add 4 and 5 8 | Then the result is 9 9 | 10 | Scenario: Subtraction 11 | When I subtract 7 to 2 12 | Then the result is 5 13 | 14 | @parallel 15 | Scenario Outline: Sum of and 16 | When I add and 17 | Then the result is 18 | 19 | Examples: Single digits 20 | | arg1 | arg2 | sum | 21 | | 1 | 2 | 3 | 22 | | 3 | 7 | 10 | 23 | | 6 | 8 | 14 | 24 | | 8 | 7 | 15 | 25 | -------------------------------------------------------------------------------- /selcukes-extent-reports/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | cucumber: 8 | module: 9 | features: src/test/resources/ 10 | glue: io.github.selcukes.extent.report.tests.steps 11 | tags: 12 | plugin: 13 | reports: 14 | emailReport: true 15 | htmlReport: true 16 | path: target 17 | fileName: TestReport 18 | timestamp: false -------------------------------------------------------------------------------- /selcukes-junit/src/main/java/io/github/selcukes/junit/Selcukes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.junit; 18 | 19 | import org.junit.platform.commons.annotation.Testable; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ ElementType.TYPE }) 28 | @Testable 29 | public @interface Selcukes { 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-junit/src/main/java/io/github/selcukes/junit/listeners/SuiteListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.junit.listeners; 18 | 19 | import io.github.selcukes.commons.fixture.SelcukesFixture; 20 | import io.github.selcukes.commons.properties.SelcukesRuntime; 21 | import lombok.CustomLog; 22 | import org.junit.platform.launcher.LauncherDiscoveryListener; 23 | import org.junit.platform.launcher.LauncherDiscoveryRequest; 24 | 25 | @CustomLog 26 | public class SuiteListener implements LauncherDiscoveryListener { 27 | 28 | @Override 29 | public void launcherDiscoveryStarted(LauncherDiscoveryRequest request) { 30 | SelcukesFixture.setValidator("org.junit.jupiter.api.Assertions"); 31 | SelcukesRuntime.loadOptions(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-junit/src/main/resources/META-INF/services/org.junit.platform.launcher.LauncherDiscoveryListener: -------------------------------------------------------------------------------- 1 | io.github.selcukes.junit.listeners.SuiteListener -------------------------------------------------------------------------------- /selcukes-junit/src/main/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener: -------------------------------------------------------------------------------- 1 | io.github.selcukes.junit.listeners.TestListener -------------------------------------------------------------------------------- /selcukes-junit/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-junit/src/test/java/io/github/selcukes/junit/tests/SampleJunitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.junit.tests; 18 | 19 | import lombok.CustomLog; 20 | import org.junit.jupiter.api.Test; 21 | 22 | @CustomLog 23 | class SampleJunitTest { 24 | @Test 25 | void sampleTest() { 26 | logger.info(() -> "This is sample test"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /selcukes-junit/src/test/java/io/github/selcukes/junit/tests/Steps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.junit.tests; 18 | 19 | import io.cucumber.java.en.Then; 20 | import io.cucumber.java.en.When; 21 | import lombok.CustomLog; 22 | 23 | @CustomLog 24 | public class Steps { 25 | @When("the Maker starts a game") 26 | public void theMakerStartsAGame() { 27 | logger.info(() -> "the Maker starts a game"); 28 | 29 | } 30 | 31 | @Then("the Maker waits for a Breaker to join") 32 | public void theMakerWaitsForABreakerToJoin() { 33 | logger.info(() -> "the Maker waits for a Breaker to join"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /selcukes-junit/src/test/java/io/github/selcukes/junit/tests/TestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.junit.tests; 18 | 19 | import org.junit.platform.suite.api.IncludeEngines; 20 | import org.junit.platform.suite.api.SelectClasses; 21 | import org.junit.platform.suite.api.Suite; 22 | 23 | @Suite 24 | @IncludeEngines({ "junit-jupiter" }) // This will ensure cucumber tests not 25 | // executed twice. 26 | @SelectClasses(SampleJunitTest.class) 27 | class TestRunner { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /selcukes-junit/src/test/resources/features/google/sample.feature: -------------------------------------------------------------------------------- 1 | Feature: Sample Guess the word 2 | 3 | @ex 4 | Scenario: Google starts a game 5 | When the Maker starts a game 6 | Then the Maker waits for a Breaker to join 7 | 8 | @ex1 9 | Scenario: Google starts a game 10 | When the Maker starts a game -------------------------------------------------------------------------------- /selcukes-junit/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | cucumber: 8 | module: google 9 | features: src/test/resources/features/${module} 10 | glue: io.github.selcukes.junit.tests 11 | tags: 12 | plugin: 13 | reports: 14 | emailReport: false 15 | htmlReport: true 16 | path: target 17 | fileName: TestReport 18 | timestamp: false 19 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/IncomingWebHookRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier; 18 | 19 | import io.github.selcukes.commons.http.WebClient; 20 | 21 | public interface IncomingWebHookRequest { 22 | static WebClient forUrl(String webHookUrl) { 23 | return new WebClient(webHookUrl); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/Notifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier; 18 | 19 | public interface Notifier { 20 | Notifier scenarioName(String title); 21 | 22 | Notifier scenarioStatus(String status); 23 | 24 | Notifier stepDetails(String message); 25 | 26 | Notifier errorMessage(String error); 27 | 28 | Notifier path(String path); 29 | 30 | void pushNotification(); 31 | } 32 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/NotifierHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.notifier; 20 | 21 | import lombok.experimental.UtilityClass; 22 | 23 | @UtilityClass 24 | public class NotifierHelper { 25 | public String getThemeColor(String stepStatus) { 26 | String messageColor = null; 27 | switch (stepStatus) { 28 | case "FAILED": 29 | messageColor = "FF0000"; // Red 30 | break; 31 | case "PASSED": 32 | messageColor = "36a64f"; // Green 33 | break; 34 | case "SKIPPED": 35 | messageColor = "FFA500"; // Orange 36 | break; 37 | default: 38 | } 39 | return messageColor; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/enums/NotifierEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.notifier.enums; 20 | 21 | import lombok.AllArgsConstructor; 22 | import lombok.Getter; 23 | 24 | @Getter 25 | @AllArgsConstructor 26 | public enum NotifierEnum { 27 | PRETEXT("Selcukes Automation Report"), 28 | CALL_BACK("Callback"), 29 | AUTHOR("Ramesh"), 30 | TECHYWORKS("https://techyworks.blogspot.com/"), 31 | FOOTER_TEXT("Test Start Time"), 32 | FOOTER_ICON("https://techyworks.blogspot.com/favicon.ico"), 33 | WEB_HOOKS_URL("https://hooks.slack.com/services/"), 34 | SLACK_API_URL("https://slack.com/api/files.upload?token="), 35 | PROJECT("Project"), 36 | ENVIRONMENT("Environment"), 37 | ATTACHMENT("Attachments"), 38 | MESSAGE_CARD("MessageCard"), 39 | TIME_STAMP("Time Stamp"), 40 | EXCEPTION("Exception"); 41 | final String value; 42 | } 43 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/enums/NotifierType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.notifier.enums; 20 | 21 | public enum NotifierType { 22 | SLACK, 23 | TEAMS 24 | } 25 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/slack/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.slack; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.Builder; 21 | 22 | import java.io.Serializable; 23 | 24 | @Builder 25 | record Field(String title, String value, @JsonProperty("short") Boolean shortValue) implements Serializable { 26 | } 27 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/slack/Slack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.slack; 18 | 19 | import io.github.selcukes.notifier.AbstractNotifier; 20 | import io.github.selcukes.notifier.Notifier; 21 | 22 | public class Slack extends AbstractNotifier { 23 | 24 | @Override 25 | public Notifier pushNotification( 26 | String scenarioTitle, String scenarioStatus, String message, String error, String screenshotPath 27 | ) { 28 | SlackMessageBuilder slackMessageBuilder = new SlackMessageBuilder(); 29 | slackMessageBuilder.sendMessage(scenarioTitle, scenarioStatus, error, screenshotPath); 30 | SlackUploader slackUploader = new SlackUploader(); 31 | slackUploader.uploadFile(screenshotPath); 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/slack/SlackFileUploader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.slack; 18 | 19 | import lombok.AllArgsConstructor; 20 | import lombok.Builder; 21 | import lombok.Data; 22 | import lombok.NoArgsConstructor; 23 | 24 | @Data 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @Builder 28 | public class SlackFileUploader { 29 | private String channel; 30 | private String token; 31 | private String filePath; 32 | private String fileName; 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/slack/SlackMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.slack; 18 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Builder; 22 | import lombok.Getter; 23 | import lombok.Setter; 24 | 25 | import java.io.Serializable; 26 | import java.util.List; 27 | 28 | @AllArgsConstructor 29 | @Builder(builderClassName = "Builder") 30 | @Getter 31 | @Setter 32 | public class SlackMessage implements Serializable { 33 | private String username; 34 | private String text; 35 | @JsonProperty("icon_url") 36 | private String iconUrl; 37 | @JsonProperty("icon_emoji") 38 | private String iconEmoji; 39 | private String channel; 40 | private List attachments; 41 | } 42 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/slack/SlackUploader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.slack; 18 | 19 | import io.github.selcukes.commons.config.ConfigFactory; 20 | import io.github.selcukes.notifier.IncomingWebHookRequest; 21 | import io.github.selcukes.notifier.enums.NotifierEnum; 22 | 23 | import java.nio.file.Paths; 24 | 25 | public class SlackUploader { 26 | 27 | public void uploadFile(String filePath) { 28 | SlackFileUploader slackFileUploader = SlackFileUploader.builder() 29 | .channel(ConfigFactory.getConfig().getNotifier().getChannel()) 30 | .token(ConfigFactory.getConfig().getNotifier().getApiToken()) 31 | .filePath(filePath) 32 | .fileName("Sample") 33 | .build(); 34 | 35 | String url = String.join("", 36 | NotifierEnum.SLACK_API_URL.getValue(), 37 | slackFileUploader.getToken(), 38 | "&channels=", 39 | slackFileUploader.getChannel(), 40 | "&pretty=1"); 41 | IncomingWebHookRequest.forUrl(url) 42 | .post(Paths.get(slackFileUploader.getFilePath())); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/teams/Field.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.teams; 18 | 19 | import lombok.Builder; 20 | import lombok.Data; 21 | 22 | @Data 23 | @Builder 24 | public class Field { 25 | private final String name; 26 | private final String value; 27 | } 28 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/teams/Images.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.teams; 18 | 19 | import lombok.Builder; 20 | import lombok.Data; 21 | 22 | @Data 23 | @Builder 24 | public class Images { 25 | private String image; 26 | } 27 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/teams/MicrosoftTeams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.teams; 18 | 19 | import io.github.selcukes.notifier.AbstractNotifier; 20 | import io.github.selcukes.notifier.Notifier; 21 | 22 | public class MicrosoftTeams extends AbstractNotifier { 23 | 24 | @Override 25 | public Notifier pushNotification( 26 | String scenarioTitle, String scenarioStatus, String message, String error, String screenshotPath 27 | ) { 28 | MicrosoftTeamsBuilder teamsBuilder = new MicrosoftTeamsBuilder(); 29 | teamsBuilder.sendMessage(scenarioTitle, scenarioStatus, message, error, screenshotPath); 30 | return this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/teams/MicrosoftTeamsCard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.teams; 18 | 19 | import com.fasterxml.jackson.annotation.JsonInclude; 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 22 | import lombok.Builder; 23 | import lombok.Data; 24 | 25 | import java.util.List; 26 | 27 | @Data 28 | @Builder 29 | @JsonInclude(JsonInclude.Include.NON_NULL) 30 | @JsonPropertyOrder({ "@context", "@type", "themeColor", "title", "text" }) 31 | public class MicrosoftTeamsCard { 32 | 33 | @JsonProperty("sections") 34 | private final List
sections; 35 | @Builder.Default 36 | @JsonProperty("@context") 37 | private String context = "https://schema.org/extensions"; 38 | @JsonProperty("@type") 39 | private String type; 40 | @JsonProperty("themeColor") 41 | private String themeColor; 42 | @JsonProperty("title") 43 | private String title; 44 | @JsonProperty("text") 45 | private String text; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/java/io/github/selcukes/notifier/teams/Section.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.teams; 18 | 19 | import lombok.Builder; 20 | import lombok.Data; 21 | 22 | import java.util.List; 23 | 24 | @Data 25 | @Builder 26 | public class Section { 27 | private final List facts; 28 | private final String activityTitle; 29 | private final String activitySubtitle; 30 | private final String activityText; 31 | private final String activityImage; 32 | private final List images; 33 | @Builder.Default 34 | private boolean markdown = true; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /selcukes-notifier/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.devtools.level: SEVERE 10 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 11 | 12 | # Default file output is in user's home directory. 13 | java.util.logging.FileHandler.pattern: selcukes.log 14 | java.util.logging.FileHandler.limit: 50000 15 | java.util.logging.FileHandler.count: 1 16 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 17 | java.util.logging.FileHandler.level: FINE 18 | 19 | # Limit the message that are printed on the console to INFO and above. 20 | java.util.logging.ConsoleHandler.level: FINE 21 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 22 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-notifier/src/main/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes Automation Report 4 | env: QA01 5 | notifier: 6 | notification: false 7 | type: teams 8 | webhookToken: WEBXXX 9 | apiToken: APIXXXX 10 | channel: selcukes 11 | authorIcon: https://avatars0.githubusercontent.com/u/2510294?s=400&u=5d6412ba1dd13052992ff66317ae28d007a971d3&v=4 12 | mail: 13 | host: smtp.gmail.com 14 | port: 465 15 | username: test@gmail.com 16 | password: rkxynldqlpxdxota 17 | from: test@gmail.com 18 | to: test@gmail.com 19 | cc: test@gmail.com 20 | bcc: test@gmail.com 21 | 22 | -------------------------------------------------------------------------------- /selcukes-notifier/src/test/java/io/github/selcukes/notifier/tests/EmailTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.tests; 18 | 19 | import io.github.selcukes.notifier.NotifierFactory; 20 | import org.testng.annotations.Test; 21 | 22 | public class EmailTest { 23 | @Test(enabled = false) 24 | public void mailTest() { 25 | String subject = "Test Report"; 26 | String body = "This is the body of the test report."; 27 | NotifierFactory.emailNotifier() 28 | .sendMail(subject, body, "src/test/resources/employee.csv"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /selcukes-notifier/src/test/java/io/github/selcukes/notifier/tests/NotifierTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.notifier.tests; 18 | 19 | import io.github.selcukes.notifier.NotifierFactory; 20 | import org.testng.annotations.Test; 21 | 22 | public class NotifierTest { 23 | @Test(enabled = false) 24 | public void testNotifications() { 25 | NotifierFactory.getNotifier() 26 | .scenarioName("This is sample scenario") 27 | .scenarioStatus("FAILED") 28 | .stepDetails("This is sample test step") 29 | .errorMessage("NullPointerException") 30 | .path("") 31 | .pushNotification(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-notifier/src/test/resources/employee.csv: -------------------------------------------------------------------------------- 1 | ID,Name ,Email ,Phone ,Country,Address,Mojo 2 | ,Rajeev Kumar Singh ,rajeevs@example.com,+91-9999999999,India, "12,Hello Street" 3 | ,Sachin Tendulkar,sachin@example.com,+91-9999999998,India,"34,é Street" 4 | ,Barak Obama,barak.obama@example.com,+1-1111111111,United States, 5 | ,Donald Trump,donald.trump@example.com,+1-2222222222,United States,"56,Rb's Street" 6 | , ,,,,, 7 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/java/io/github/selcukes/reports/cucumber/CucumberService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.cucumber; 18 | 19 | import io.cucumber.plugin.event.Status; 20 | 21 | public interface CucumberService { 22 | void beforeTest(); 23 | 24 | void beforeScenario(); 25 | 26 | void beforeStep(); 27 | 28 | void afterStep(String step, boolean status); 29 | 30 | void afterScenario(String scenario, Status status); 31 | 32 | void afterTest(); 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/java/io/github/selcukes/reports/cucumber/EventFiringCucumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.cucumber; 18 | 19 | import lombok.experimental.UtilityClass; 20 | 21 | @UtilityClass 22 | public class EventFiringCucumber { 23 | private CucumberService regService; 24 | 25 | public void register(CucumberService service) { 26 | regService = service; 27 | } 28 | 29 | public CucumberService getService() { 30 | return (regService == null) ? new CucumberAdapter() : regService; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/java/io/github/selcukes/reports/cucumber/LiveReportHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.cucumber; 18 | 19 | import io.github.selcukes.commons.http.WebClient; 20 | import io.github.selcukes.commons.http.WebResponse; 21 | import io.github.selcukes.databind.utils.JsonUtils; 22 | import lombok.CustomLog; 23 | import lombok.SneakyThrows; 24 | import lombok.experimental.UtilityClass; 25 | 26 | @CustomLog 27 | @UtilityClass 28 | public class LiveReportHelper { 29 | @SneakyThrows 30 | public void publishResults(Object object, String key) { 31 | logger.debug(() -> JsonUtils.toPrettyJson(object)); 32 | String url = "http://localhost:9200/%s/results"; 33 | WebClient client = new WebClient(String.format(url, key)); 34 | WebResponse response = client.post(object); 35 | logger.debug(response::body); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/java/io/github/selcukes/reports/enums/TestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.enums; 18 | 19 | public enum TestType { 20 | CUCUMBER, 21 | TESTNG, 22 | JUNIT 23 | } 24 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/java/io/github/selcukes/reports/screen/ScreenPlayBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.screen; 18 | 19 | import io.github.selcukes.commons.fixture.DriverFixture; 20 | import lombok.experimental.UtilityClass; 21 | import org.openqa.selenium.WebDriver; 22 | 23 | @UtilityClass 24 | public class ScreenPlayBuilder { 25 | 26 | public ScreenPlay getScreenPlay(WebDriver driver) { 27 | return new ScreenPlayImpl(driver); 28 | } 29 | 30 | public ScreenPlay getScreenPlay() { 31 | return new ScreenPlayImpl((WebDriver) DriverFixture.getDriverFixture()); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /selcukes-reports/src/main/resources/META-INF/services/io.github.selcukes.commons.listener.TestLifecycleListener: -------------------------------------------------------------------------------- 1 | io.github.selcukes.reports.listeners.ReportServiceProvider -------------------------------------------------------------------------------- /selcukes-reports/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-reports/src/test/java/io/github/selcukes/reports/tests/TestRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.tests; 18 | 19 | import io.github.selcukes.testng.SelcukesTestNGRunner; 20 | 21 | public class TestRunner extends SelcukesTestNGRunner { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /selcukes-reports/src/test/java/io/github/selcukes/reports/tests/steps/CalculatorSteps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Ramesh Babu Prudhvi. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | * 17 | */ 18 | 19 | package io.github.selcukes.reports.tests.steps; 20 | 21 | import io.cucumber.java.en.Given; 22 | import io.cucumber.java.en.Then; 23 | import io.cucumber.java.en.When; 24 | import io.github.selcukes.commons.Await; 25 | import io.github.selcukes.reports.tests.pages.Calculator; 26 | import org.testng.Assert; 27 | 28 | public class CalculatorSteps { 29 | private Calculator calc; 30 | 31 | @Given("a calculator I just turned on") 32 | public void setup() { 33 | calc = new Calculator(); 34 | } 35 | 36 | @When("I add {int} and {int}") 37 | public void add(int arg1, int arg2) { 38 | calc.push(arg1); 39 | calc.push(arg2); 40 | calc.push("+"); 41 | } 42 | 43 | @When("I subtract {int} to {int}") 44 | public void subtract(int arg1, int arg2) { 45 | calc.push(arg1); 46 | calc.push(arg2); 47 | calc.push("-"); 48 | } 49 | 50 | @Then("the result is {double}") 51 | public void theResultIs(double expected) { 52 | Assert.assertEquals(expected, calc.value()); 53 | Await.until(2); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /selcukes-reports/src/test/java/io/github/selcukes/reports/tests/steps/ReporterHooks.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.reports.tests.steps; 18 | 19 | import io.cucumber.java.After; 20 | import io.cucumber.java.AfterStep; 21 | import io.cucumber.java.Before; 22 | import io.cucumber.java.BeforeStep; 23 | import io.cucumber.java.Scenario; 24 | import lombok.CustomLog; 25 | 26 | @CustomLog 27 | public class ReporterHooks { 28 | 29 | @Before 30 | public void beforeTest(Scenario scenario) { 31 | 32 | logger.info(() -> "Starting Scenario .." + scenario.getName()); 33 | } 34 | 35 | @BeforeStep 36 | public void beforeStep() { 37 | logger.info(() -> "Before Step"); 38 | 39 | } 40 | 41 | @AfterStep 42 | public void afterStep() { 43 | logger.info(() -> "After Step"); 44 | } 45 | 46 | @After 47 | public void afterTest(Scenario scenario) { 48 | logger.info(() -> "Completed Scenario .." + scenario.getName()); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /selcukes-reports/src/test/resources/calculator.feature: -------------------------------------------------------------------------------- 1 | Feature: Basic Arithmetic 2 | 3 | Background: A Calculator 4 | Given a calculator I just turned on 5 | 6 | Scenario: Addition 7 | When I add 4 and 5 8 | Then the result is 9 9 | 10 | Scenario: Subtraction 11 | When I subtract 7 to 2 12 | Then the result is 5 13 | 14 | @abc 15 | Scenario Outline: Several additions 16 | When I add and 17 | Then the result is 18 | 19 | Examples: Single digits 20 | | a | b | c | 21 | | 1 | 2 | 3 | 22 | | 3 | 7 | 10 | 23 | | 6 | 8 | 14 | 24 | | 8 | 7 | 15 | -------------------------------------------------------------------------------- /selcukes-reports/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | projectName: Selcukes 2 | env: Dev 3 | proxy: false 4 | baseUrl: 5 | excel: 6 | runner: false 7 | fileName: src/test/resources/TestData.xlsx 8 | suiteName: "Smoke" 9 | cucumber: 10 | module: 11 | features: src/test/resources/ 12 | glue: io.github.selcukes.reports.tests.steps 13 | tags: 14 | plugin: 15 | web: 16 | remote: true 17 | browser: CHROME 18 | headLess: true 19 | serviceUrl: "http://127.0.0.1:8080" 20 | windows: 21 | serviceUrl: "http://127.0.0.1:4723" 22 | app: "C:\\Windows\\System32\\notepad.exe" 23 | mobile: 24 | serviceUrl: "http://127.0.0.1:4723" 25 | app: "ApiDemos-debug.apk" 26 | reports: 27 | emailReport: flase 28 | htmlReport: true 29 | path: target 30 | fileName: index 31 | timestamp: false 32 | video: 33 | recording: false 34 | type: MONTE 35 | ffmpegPath: 36 | watermark: false 37 | notifier: 38 | notification: false 39 | type: slack 40 | webhookToken: WEBHOOKXXXX 41 | apiToken: APIXXXX 42 | channel: selcukes 43 | authorIcon: https://github.com/rameshbabuprudhvi.png -------------------------------------------------------------------------------- /selcukes-snapshot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | selcukes-parent 7 | io.github.selcukes 8 | 2.3.13-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | 13 | selcukes-snapshot 14 | selcukes-snapshot 15 | Selcukes Snapshot 16 | 17 | 18 | 19 | io.github.selcukes 20 | selcukes-bom 21 | ${project.version} 22 | pom 23 | import 24 | 25 | 26 | 27 | 28 | 29 | io.github.selcukes 30 | selcukes-commons 31 | 32 | 33 | org.testng 34 | testng 35 | provided 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | provided 41 | 42 | 43 | org.seleniumhq.selenium 44 | selenium-java 45 | provided 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /selcukes-snapshot/src/main/resources/screen-size.js: -------------------------------------------------------------------------------- 1 | (() => { 2 | const fullWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth, document.body.offsetWidth, document.documentElement.offsetWidth, document.body.clientWidth, document.documentElement.clientWidth); 3 | const fullHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight); 4 | const viewWidth = window.innerWidth; 5 | const viewHeight = window.innerHeight; 6 | const exceedViewport = fullWidth > viewWidth || fullHeight > viewHeight; 7 | return {fullWidth, fullHeight, viewHeight, exceedViewport}; 8 | })(); 9 | -------------------------------------------------------------------------------- /selcukes-snapshot/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.devtools.level: SEVERE 10 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 11 | 12 | # Default file output is in user's home directory. 13 | java.util.logging.FileHandler.pattern: selcukes.log 14 | java.util.logging.FileHandler.limit: 50000 15 | java.util.logging.FileHandler.count: 1 16 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 17 | java.util.logging.FileHandler.level: FINE 18 | 19 | # Limit the message that are printed on the console to INFO and above. 20 | java.util.logging.ConsoleHandler.level: FINE 21 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 22 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /selcukes-testng/src/main/resources/META-INF/services/org.testng.ITestNGListener: -------------------------------------------------------------------------------- 1 | io.github.selcukes.testng.listeners.TestListener 2 | io.github.selcukes.testng.listeners.SelcukesListener -------------------------------------------------------------------------------- /selcukes-testng/src/test/java/io/github/selcukes/testng/tests/CucumberRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.testng.tests; 18 | 19 | import io.github.selcukes.testng.SelcukesTestNGRunner; 20 | 21 | public class CucumberRunner extends SelcukesTestNGRunner { 22 | } 23 | -------------------------------------------------------------------------------- /selcukes-testng/src/test/java/io/github/selcukes/testng/tests/Steps.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.testng.tests; 18 | 19 | import io.cucumber.java.en.Then; 20 | import io.cucumber.java.en.When; 21 | 22 | public class Steps { 23 | @When("the Maker starts a game") 24 | public void theMakerStartsAGame() { 25 | System.out.println("the Maker starts a game"); 26 | 27 | } 28 | 29 | @Then("the Maker waits for a Breaker to join") 30 | public void theMakerWaitsForABreakerToJoin() { 31 | System.out.println("the Maker waits for a Breaker to join"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /selcukes-testng/src/test/resources/features/google/sample.feature: -------------------------------------------------------------------------------- 1 | Feature: Sample Guess the word 2 | 3 | @ex 4 | Scenario: Maker starts a game 5 | When the Maker starts a game 6 | Then the Maker waits for a Breaker to join 7 | 8 | @ex1 9 | Scenario: Maker starts a game 10 | When the Maker starts a game -------------------------------------------------------------------------------- /selcukes-testng/src/test/resources/selcukes.yaml: -------------------------------------------------------------------------------- 1 | # Selcukes Environment Properties 2 | --- 3 | projectName: Selcukes 4 | env: Dev 5 | proxy: false 6 | baseUrl: 7 | cucumber: 8 | module: google 9 | features: src/test/resources/features/${module} 10 | glue: io.github.selcukes.testng.tests 11 | tags: 12 | plugin: 13 | reports: 14 | emailReport: false 15 | htmlReport: true 16 | path: target 17 | fileName: TestReport 18 | timestamp: false 19 | -------------------------------------------------------------------------------- /selcukes-testng/testng.yaml: -------------------------------------------------------------------------------- 1 | name: Cucumber Test Suite 2 | tests: 3 | - name: Google Module Test 4 | preserveOrder: true 5 | parameters: { 6 | selcukes.module: "google" 7 | } 8 | classes: 9 | - name: io.github.selcukes.testng.tests.CucumberRunner 10 | - name: Yahoo Module Test 11 | preserveOrder: true 12 | parameters: { 13 | selcukes.module: "yahoo" 14 | } 15 | classes: 16 | - name: io.github.selcukes.testng.tests.CucumberRunner 17 | - name: No Module Test 18 | preserveOrder: true 19 | classes: 20 | - name: io.github.selcukes.testng.tests.CucumberRunner 21 | - name: Tags Test 22 | preserveOrder: true 23 | parameters: { 24 | selcukes.tags: "@abc" 25 | } 26 | classes: 27 | - name: io.github.selcukes.testng.tests.CucumberRunner -------------------------------------------------------------------------------- /video-recorder/src/main/java/io/github/selcukes/video/Recorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.video; 18 | 19 | import java.io.File; 20 | 21 | public interface Recorder { 22 | /** 23 | * This method will start the recording of the execution. 24 | */ 25 | void start(); 26 | 27 | /** 28 | * This method will stop and save's the recording. 29 | */ 30 | File stopAndSave(String filename); 31 | 32 | /** 33 | * This method will delete the recorded file,if the test is pass. 34 | */ 35 | void stopAndDelete(); 36 | } 37 | -------------------------------------------------------------------------------- /video-recorder/src/main/java/io/github/selcukes/video/VideoRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.video; 18 | 19 | import io.github.selcukes.commons.os.Platform; 20 | import io.github.selcukes.video.config.DefaultVideoOptions; 21 | 22 | public interface VideoRecorder extends Recorder { 23 | 24 | static DefaultVideoOptions videoConfig() { 25 | DefaultVideoOptions.DefaultVideoOptionsBuilder optionsBuilder = DefaultVideoOptions.builder(); 26 | if (Platform.isLinux()) { 27 | optionsBuilder.ffmpegFormat("x11grab"); 28 | optionsBuilder.ffmpegDisplay(":0.0"); 29 | } 30 | return optionsBuilder.build(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /video-recorder/src/main/java/io/github/selcukes/video/config/DefaultVideoOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.video.config; 18 | 19 | import io.github.selcukes.commons.config.Config; 20 | import lombok.Builder; 21 | import lombok.Data; 22 | import lombok.EqualsAndHashCode; 23 | 24 | import java.awt.Dimension; 25 | import java.awt.Toolkit; 26 | 27 | @EqualsAndHashCode(callSuper = true) 28 | @Data 29 | @Builder 30 | public class DefaultVideoOptions extends Config { 31 | @Builder.Default 32 | String videoFolder = "video-report"; 33 | @Builder.Default 34 | int frameRate = 24; 35 | @Builder.Default 36 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 37 | @Builder.Default 38 | String ffmpegFormat = "gdigrab"; 39 | @Builder.Default 40 | String ffmpegDisplay = "desktop"; 41 | @Builder.Default 42 | String pixelFormat = "yuv420p"; 43 | } 44 | -------------------------------------------------------------------------------- /video-recorder/src/main/java/io/github/selcukes/video/enums/RecorderType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.video.enums; 18 | 19 | public enum RecorderType { 20 | MONTE, 21 | FFMPEG 22 | } 23 | -------------------------------------------------------------------------------- /video-recorder/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter -------------------------------------------------------------------------------- /video-recorder/src/test/java/io/github/selcukes/video/tests/VideoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.video.tests; 18 | 19 | import io.github.selcukes.commons.Await; 20 | import io.github.selcukes.commons.os.Platform; 21 | import io.github.selcukes.video.Recorder; 22 | import io.github.selcukes.video.RecorderFactory; 23 | import io.github.selcukes.video.enums.RecorderType; 24 | import org.testng.Assert; 25 | import org.testng.annotations.Test; 26 | 27 | import java.io.File; 28 | 29 | public class VideoTest { 30 | @Test 31 | public void recordVideo() { 32 | if (Platform.isWindows()) { 33 | Recorder recorder = RecorderFactory.getRecorder(RecorderType.MONTE); 34 | recorder.start(); 35 | Await.until(5); 36 | File file = recorder.stopAndSave("test"); 37 | Assert.assertTrue(file.getAbsolutePath().contains("mp4")); 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /webdriver-binaries/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | selcukes-parent 7 | io.github.selcukes 8 | 2.3.13-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | webdriver-binaries 13 | 14 | webdriver-binaries 15 | Automatically downloads and configures Selenium WebDriver binary files 16 | 17 | **/VersionComparator.java 18 | 19 | 20 | 21 | 22 | io.github.selcukes 23 | selcukes-bom 24 | ${project.version} 25 | pom 26 | import 27 | 28 | 29 | 30 | 31 | 32 | io.github.selcukes 33 | selcukes-commons 34 | 35 | 36 | org.seleniumhq.selenium 37 | selenium-java 38 | provided 39 | 40 | 41 | org.testng 42 | testng 43 | test 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /webdriver-binaries/src/main/java/io/github/selcukes/wdb/BinaryInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.wdb; 18 | 19 | public record BinaryInfo(String binaryProperty, String binaryPath) { 20 | } 21 | -------------------------------------------------------------------------------- /webdriver-binaries/src/main/java/io/github/selcukes/wdb/enums/DownloaderType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.wdb.enums; 18 | 19 | public enum DownloaderType { 20 | ZIP("zip"), 21 | TAR("tar.gz"), 22 | JAR("jar"); 23 | final String name; 24 | 25 | DownloaderType(String name) { 26 | this.name = name; 27 | } 28 | 29 | public String getName() { 30 | return name; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /webdriver-binaries/src/main/java/io/github/selcukes/wdb/enums/DriverType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Ramesh Babu Prudhvi. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.selcukes.wdb.enums; 18 | 19 | public enum DriverType { 20 | CHROME("chrome"), 21 | FIREFOX("gecko"), 22 | IEXPLORER("ie"), 23 | EDGE("edge"), 24 | OPERA("opera"); 25 | 26 | final String name; 27 | 28 | DriverType(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getName() { 33 | return name; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /webdriver-binaries/src/main/resources/selcukes-logback.yaml: -------------------------------------------------------------------------------- 1 | # To add the FileHandler, use the following line. 2 | handlers: java.util.logging.FileHandler, java.util.logging.ConsoleHandler 3 | 4 | #.level: INFO 5 | .level: INFO 6 | 7 | # For example, set the io.github.selcukes.core logger to only log SEVERE 8 | io.github.selcukes.level: ALL 9 | io.github.selcukes.handler: java.util.logging.ConsoleHandler 10 | 11 | # Default file output is in user's home directory. 12 | java.util.logging.FileHandler.pattern: target/selcukes.log 13 | java.util.logging.FileHandler.limit: 50000 14 | java.util.logging.FileHandler.count: 1 15 | java.util.logging.FileHandler.formatter: io.github.selcukes.commons.logging.SelcukesLoggerFormatter 16 | java.util.logging.FileHandler.level: FINE 17 | 18 | # Limit the message that are printed on the console to INFO and above. 19 | java.util.logging.ConsoleHandler.level: FINE 20 | #java.util.logging.ConsoleHandler.formatter : java.util.logging.SimpleFormatter 21 | java.util.logging.ConsoleHandler.formatter: io.github.selcukes.commons.logging.SelcukesColorFormatter --------------------------------------------------------------------------------