Giter VIP home page Giter VIP logo

wasiqb / coteafs-selenium Goto Github PK

View Code? Open in Web Editor NEW
78.0 78.0 35.0 22.99 MB

:computer: Selenium WebDriver wrapper framework in Java for clean and maintainable tests.

Home Page: https://wasiqb.github.io/projects/selenium/

License: Apache License 2.0

Java 100.00%
automation-framework automation-test cross-browser hacktoberfest java selenium selenium-webdriver software-testing test-automation testing-tools

coteafs-selenium's Introduction

wasiqb-banner

Hi there, I'm Wasiq Amjad Bhamla ๐Ÿ‘‹

Linkedin Badge Website Badge Twitter Badge YouTube Channel Subscribers

  • ๐Ÿ”ญ Iโ€™m currently working on? ... different awesome open source projects.
  • ๐ŸŒฑ Iโ€™m currently learning? ... React and other new tools
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on? ... Any test automation related open source projects.
  • ๐Ÿ’ฌ Ask me about anything related to? ... Automation testing, techniques, and tools.
  • ๐Ÿ“ซ How to reach me: https://wasiqbhamla.github.io/website/
  • โšก Fun fact: I like playing Chess and Carrom.

๐Ÿ“Š Profile stats

Wasiq's GitHub Stats Top Langs

๐ŸŽ‰ Check out some of my repositories

ReadMe Card ReadMe Card ReadMe Card ReadMe Card

coteafs-selenium's People

Contributors

dependabot[bot] avatar fossabot avatar jayeshd7 avatar mfaisalkhatri avatar wasiqb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coteafs-selenium's Issues

Add kotlin bindings to coteafs-selenium

Kotlin allow you to do much more with less. Kotlin as language is interoperable, concise and secure. Being a programming language that runs on the virtual machine of Java (JVM); allows an open interaction with the Java code and therefore with the frameworks and libraries available for Java in an almost transparent way.

Kotlin takes the best of Java and Scala, the response times are similar as working with Java natively, which is a considerable advantage over Scala

Refactor IScreenAction.

Describe the bug

  • Rename method saveScreenshot to attachScreenshot.
  • Add method saveScreenshot with no param.
  • Add method saveScreenshot with path param.

Update README

README needs to be updated so new visitors are able to understand the usage of the framework.

Unnecessary cast to IMouseAction.

Describe the bug

When using find or finds method on a parent IElementAction, then it is mandatory to cast it as IMouseAction if that elements method is having return type as IMouseAction.

To Reproduce

public IMouseActions navbar (final String name) {
  return (IMouseActions) navbar ().finds (By.cssSelector ("li > a"))
    .stream ()
    .filter (m -> m.text ()
      .trim ()
      .equals (name))
    .findFirst ()
    .get ();
}

Expected behaviour

Casting should be done automatically.

Need to Add community specifc files.

Following files needs to be added to the repository for encouraging contribution by the community:

  • README
  • LICENSE
  • ISSUE_TEMPLETE
  • CODE_OF_CONDUCT
  • PULL_REQUEST_TEMPLETE
  • CONTRIBUTING
  • Repo Description

Some interface should have generic param and default implementation.

Is your feature request related to a problem? Please describe.

Currently there is no generic param declared on some interfaces. This is a problem when extending the same in coteafs-appium project.

Describe the solution you'd like

Following are the interfaces which needs a default implementation class with generic params if needed.

  • IDriver
  • IDriverAction
  • IWebDriver
  • IWebDriverAction
  • IElementAction
  • IMouseAction
  • IKeyboardAction
  • ITextboxAction
  • ISelectboxAction

Configuration file support is required

Following config is required to be supported:

  • URL
  • Browser
  • Hub URL
  • Screen state
  • Screen Resolution
  • Highlight element
  • Delay before click
  • Delay after click
  • Delay before key press
  • Delay after key press
  • Delay before mouse move
  • Delay after mouse move
  • Page load time out
  • Script load time out
  • Implicit wait
  • Explicit wait
  • Capture screenshot on error
  • Screenshot path
  • Screenshot prefix
  • Screenshot extension

Driver manager settings required.

Is your feature request related to a problem? Please describe.

Currently there is no control for the user on WebDriverManager on how and where it should download the driver exe.

Describe the solution you'd like

It is required to allow user the control on WebDriverManager, like:

  • Download path
  • Version of Driver
  • Force cache
  • Force download
  • Driver exe URL
  • Proxy settings (Will be done on demand).

More settings can be handled later if requested.

When PageFactory.init is removed from a particular class, Framework automatically switches to the base class where init is called.

When PageFactory.init is removed from a particular page, Framework automatically switches to the first Page where init is called.

Steps:

  1. Create a Page object for MainPage of Website and call PageFactory.init in this class.
    02, Create another Page Object for SignOut and do not call PageFactory.init in this class.

Acceptance Criteria:
Proper error/exception should be thrown in this case and framework should not switch to base class where init method is called.

Logging facility is required

It is required to log user interaction in a log file. Following files should be created:

  • All - It will log all debug traces along with info.
  • Main - It will log only the info about the actions being performed.
  • Error - It will only log errors that occurred during the run.

Logs should not be:

  • More than 5 MB in size, if more new file should be generated archiving old files.
  • Maintaining logs for different days in same file. A new file should get generated and old logs should get archived.
  • Override logs created on previous execution. A new log should be created and previous run logs should be marked and archived.

Perform maximum logging to capture each events. TestNG listeners should be used for logging run-time test events.

Update JavaDocs for all public class, methods and constants.

Is your feature request related to a problem? Please describe.

Currently there is no javadoc description on any of the public classes, enums, interfaces, methods, constants.

Describe the solution you'd like

Need to add detailed description on all the public accessible objects and methods.

Browser Element builder is required

A builder class is required to build browser element in a hierarchical structure and store following attributes:

  • Name
  • Parent
  • Tag Name
  • Hash of Attributes
  • Index

Browser base required

A base class named Browser should be created which has following features:

  • Driver is created depending on the config file.
  • It should support all the main browsers.
    • Chrome
    • Firefox
  • It should support quitting or closing the browser.

Browser Stack Integration

Selenium Tests should run successfully on Cross Platform and different browsers through Browser Stack site.

Abstract action class is required

An abstract class is required where we can define individual page flows which will help in reducing duplicate codes. It will have following properties:

  • Input value for each fields
  • Abstract method perform.

WaitStrategy needs to be added to find method in Element action

Is your feature request related to a problem? Please describe.

Currently wait strategy is only implemented in onElement method.

Describe the solution you'd like

Now same is required to be added on find and finds methods in IElementActions interface.

how to setup "Parallel execution of tests on different browsers" using this framework?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.
##@WasiqB

BrowserPage class is required

This class is responsible for the following:

  • It will allow browser specific actions like:
    • Navigate to
    • Forward
    • Back
    • Refresh
    • Title
    • Screenshot
    • Switch to
    • Open windows
    • Alerts
  • It will allow to interact with a specific element with actions like:
    • Click
    • Double click
    • Right click
    • Enter text
    • Append text
    • Clear
    • Hover
    • Drag and drop
    • Check and Uncheck
    • Send key events
    • Attribute value
  • It should allow inline element verifications like:
    • Equals to
    • Not equals to
    • Contains
    • Does not contains
    • Is empty
    • Is not empty
    • Starts with
    • Ends with
    • Is visible
    • Is enabled
    • Is hidden
    • Is missing
    • Is disabled
    • Is selected
    • Is focused

WebDriver manager Configuration.

Instend of putting all Webdriver like chrome driver ,gecko driver into drivers folders with respect to OS.
we can get the OS First then based on that we can use webdriverManaged dependency in pom.xml

io.github.bonigarcia
webdrivermanager
3.4.0
test

and use it via
WebDriverManager.chromedriver().setup();
WebDriverManager.firefoxdriver().setup();

Selenium Grid support.

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

User has to create separate config files for different remote settings.

Describe the bug
Multiple remote configuration should be handled in the single config file. Currently, user has to create separate config files for running tests on different remote configuration settings.

To Reproduce
In selenium-config file if user wants to run tests in selenium grid for chrome as well as firefox browsers. In this case, user is allowed enter only either chrome or firefox settings in the selenium-config file for the other a new config file has to be created.

Error encountered when using Actions class pause method.

Following error is encountered when using pause method of Actions class:

[12:29:58.234] [ERROR] - Error occurred: actions
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Wasiqs-MacBook-Pro.local', ip: 'fe80:0:0:0:404:9092:6fb0:addf%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.4', java.version: '1.8.0_202'
Driver info: driver.version: EventFiringWebDriver (DriverListner:335) 
[12:29:58.234] [ERROR] - Error occurred: org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:218) (DriverListner:337) 
[12:29:58.235] [ERROR] - Error occurred: org.openqa.selenium.remote.http.AbstractHttpCommandCodec.encode(AbstractHttpCommandCodec.java:117) (DriverListner:337) 
[12:29:58.235] [ERROR] - Error occurred: org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:152) (DriverListner:337) 
[12:29:58.235] [ERROR] - Error occurred: org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) (DriverListner:337) 
[12:29:58.236] [ERROR] - Error occurred: org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) (DriverListner:337) 
[12:29:58.236] [ERROR] - Error occurred: org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:614) (DriverListner:337) 
[12:29:58.237] [ERROR] - Error occurred: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) (DriverListner:337) 
[12:29:58.237] [ERROR] - Error occurred: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) (DriverListner:337) 
[12:29:58.237] [ERROR] - Error occurred: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) (DriverListner:337) 
[12:29:58.238] [ERROR] - Error occurred: java.lang.reflect.Method.invoke(Method.java:498) (DriverListner:337) 
[12:29:58.238] [ERROR] - Error occurred: org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105) (DriverListner:337) 
[12:29:58.239] [ERROR] - Error occurred: com.sun.proxy.$Proxy27.perform(Unknown Source) (DriverListner:337) 
[12:29:58.239] [ERROR] - Error occurred: org.openqa.selenium.support.events.EventFiringWebDriver.perform(EventFiringWebDriver.java:360) (DriverListner:337) 
[12:29:58.239] [ERROR] - Error occurred: org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:640) (DriverListner:337) 
[12:29:58.239] [ERROR] - Error occurred: org.openqa.selenium.interactions.Actions.perform(Actions.java:596) (DriverListner:337) 
[12:29:58.240] [ERROR] - Error occurred: com.github.wasiqb.coteafs.selenium.core.ElementAction.pause(ElementAction.java:365) (DriverListner:337)

Instead use Thread.sleep.

Tests do not run on Firefox/Edge browser even when browser specified in testng.xml

Steps to reproduce:

  1. Update the parameter for browser as follows:
    a. Test - Browser - Chrome
    b. Test - Browser - Firefox
    c. Test - Browser - Edge
    (testng.xml file attached for reference).
  2. Run the tests as TestNG suite.

TestNG.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" thread-count = "1" parallel="tests">
	<test name="ChromeTest">
		<parameter name="browser" value="Chrome">
			<classes>
				<class name="com.wizonsoft.tests.RegisterUserTests" />
				<class name="com.wizonsoft.tests.SignoutTests" />
			</classes>
		</parameter>
	</test>
	<test name="FirefoxTest">
		<parameter name="browser" value="FIREFOX">
			<classes>
				<class name="com.wizonsoft.tests.RegisterUserTests" />
				<class name="com.wizonsoft.tests.SignoutTests" />
			</classes>
		</parameter>
	</test>
	<test name="EdgeTest">
		<parameter name="browser" value="EDGE">
			<classes>
				<class name="com.wizonsoft.tests.RegisterUserTests" />
				<class name="com.wizonsoft.tests.SignoutTests" />
			</classes>
		</parameter>
	</test>
</suite> <!-- Suite -->

Here, All the tests run in Chrome browser only, even when different browsers are specified.

Acceptance Criteria:
Tests should run correctly as per the browser specified in the testng.xml file.

Error Message on assertion: The method verifyDisplayed() from the type IVerifyElement refers to the missing type BooleanSubject

Following error message is displayed when user tries to assert on element object:
The method verifyDisplayed() from the type IVerifyElement refers to the missing type BooleanSubject

Steps:

  1. Create a class for page object and locate element for signIn link.
  2. Try to use signIn().verifyIsDisplayed().isTrue() in actions class.

Currently, user is not allowed to use assertion and above error message is displayed.

Acceptance Criteria:
User should be allowed to use assertion successfully without any error.

Video record UI test execution.

As a test engineer, I want to video record my Web App tests to see the exact point of failure along with what action steps were executed when the app failed.

Need to update the selenium tests so that it can be run in all supported browsers.

Selenium tests needs to be updated so that it can be run in all supported browsers.
Currently, the website "Guru99 bank Project" used for running tests has support for Chrome browser only, hence the tests are not successful in Firefox and IE browsers.
Selenium tests will now be conducted on "Saucedemo.com" which supports Chrome,IE as well as Firefox browsers.

Allow to set screen resolution.

Currently, when screen state is set as NORMAL, NPE is encountered.

java.lang.NullPointerException
	at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.setSize(RemoteWebDriver.java:798)
	at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWindow.setSize(EventFiringWebDriver.java:748)
	at com.github.wasiqb.coteafs.selenium.core.Browser.lambda$setScreenSize$2(Browser.java:140)
	at com.github.wasiqb.coteafs.selenium.core.Browser.manageWindow(Browser.java:126)
	at com.github.wasiqb.coteafs.selenium.core.Browser.setScreenSize(Browser.java:140)

All Elements should have alias marking option.

Is your feature request related to a problem? Please describe.

Currently all elements action is logged but it is very difficult to identify what element is under action.

[17:01:26.645] [INFO ] - Writing text [mngr26593]... (DriverListner:116) 
[17:01:27.823] [INFO ] - Writing text [abc@123]... (DriverListner:116) 
[17:01:29.031] [INFO ] - Clicking on Element... (DriverListner:122)

Describe the solution you'd like

To identify what element is under operation, it is needed to have alias feature available.

New method isRunning is needed in IServiceAction interface.

Is your feature request related to a problem? Please describe.

In IServiceAction interface, we can start and stop the service but cannot check if the service is running or not.

Describe the solution you'd like

A new method isRunning needs to be added to handle that.

Add code style enforcement

Is your feature request related to a problem? Please describe.

Currently there is no enforcement on coding style which will cause style mismatch among the contributors. Looking at the growth of the project, it'll be ideal to have code style cop configured which will fail the build in case of style mismatch.

Describe the solution you'd like

In phase 1, the coding style will be configured in this project, later on it will be moved to parent project.

Use stable Selenium WebDriver instead of Alpha.

Is your feature request related to a problem? Please describe.

Since alpha release is not stable and is subject to constant changes, it is needed to use stable Selenium WebDriver.

Describe the solution you'd like

Use Selenium WebDriver 3.141.59 instead of 4.0.0-alpha2

Edge Browser is not working.

Following error logs are generated when user tries to run tests in Edge Browser:

io.github.bonigarcia.wdm.WebDriverManagerException: io.github.bonigarcia.wdm.WebDriverManagerException: MicrosoftWebDriver.exe should be installed in an elevated command prompt executing: dism /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
	at io.github.bonigarcia.wdm.WebDriverManager.handleException(WebDriverManager.java:715)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:540)
	at io.github.bonigarcia.wdm.WebDriverManager.setup(WebDriverManager.java:260)
	at com.github.wasiqb.coteafs.selenium.core.Browser.setupEdgeDriver(Browser.java:169)
	at com.github.wasiqb.coteafs.selenium.core.Browser.setupDriver(Browser.java:153)
	at com.github.wasiqb.coteafs.selenium.core.Browser.start(Browser.java:225)
	at com.github.wasiqb.coteafs.selenium.core.BrowserTest.setupTest(BrowserTest.java:43)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
	at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
	at org.testng.TestRunner.beforeRun(TestRunner.java:529)
	at org.testng.TestRunner.run(TestRunner.java:497)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
	at org.testng.SuiteRunner.run(SuiteRunner.java:364)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
	at org.testng.TestNG.runSuites(TestNG.java:1049)
	at org.testng.TestNG.run(TestNG.java:1017)
	at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: io.github.bonigarcia.wdm.WebDriverManagerException: MicrosoftWebDriver.exe should be installed in an elevated command prompt executing: dism /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
	at io.github.bonigarcia.wdm.WebDriverManager.checkInsiderVersion(WebDriverManager.java:599)
	at io.github.bonigarcia.wdm.WebDriverManager.manage(WebDriverManager.java:499)
	... 29 more

Page delegator is needed.

As an Automation engineer, I would need to continue writing my steps without initialising other pages in the flow.

Support for iFrame is required.

As an automation engineer, I should be able to switch between iframes using coteafs-selenium framework.

Currently, IFrame support is not available in this framework.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.