retailmenot / scaffold Goto Github PK
View Code? Open in Web Editor NEWA Java based Selenium WebDriver abstraction
License: MIT License
A Java based Selenium WebDriver abstraction
License: MIT License
Any merge commit to master should trigger the deploy job. In this case, type = push is not triggering the build since we are doing merges.
Merges should trigger the build.
This ticket is for looking into a way we could verify a page is the correct page we're expecting prior to returning the page object. We could use a generic method under navigation that will check to ensure it's navigated to the right page prior to returning the new object. This could also relate somewhat to ticket #8 .
We could do this by checking for the page header, for example, on that new page. If it throws a NoSuchElementFoundException, we could try to do the navigation again. If failing for several times, throw an error that states the page could not be verified?
We don't want the page verification to be too obstructive so we will need to spend some time thinking about options.
In order for test results to appear as a pass/fail in Sauce, we need to implement the update_job method in the Sauce Labs REST API, as seen here.
There are several outdated lib versions in our pom. We should update everything to latest including, but not limited to:
We should create a new annotation that allows users implementing scaffold to have just one annotation instead of three on their BaseTest file.
E.G, on an implementing project "AutomationCodeBase" :
@Execution(ExecutionMode.CONCURRENT)
@ExtendWith(SpringExtension.class)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.NONE,
classes = { AutomationCodeBaseConfig.class, ScaffoldConfig.class }
)
public class BaseTest extends ScaffoldBaseTest { ... }
This is a bit heavy and having a single annotation that bubbles all of these configurations up would be helpful.
We should manually do the initial push of artifacts out to the maven repo. This should be done only for this initial release. Any further pushes should be handled by a build.
The SauceLabs Platform Configurator lists iOS as a platform. We should add this to the Platform
enum to support iOS testing.
Platform
enumWhen the CI attempts to deploy artifacts, the gpg credentials don't work
gpg: no default secret key: bad passphrase
gpg: signing failed: bad passphrase
The gpg creds should work. The pipeline includes a settings file with the proper configuration.
CI does not have permissions to push to github repo.
Travis CI should have the access.
Somewhat related to #11 , we should create a Maven Archetype and push it to the maven repo. This will allow users to quickly and efficiently get started with a new project without having to worry about the organization and formatting of their codebase.
We should think about what exactly is going to be created with this archetype. Should we create an archetype that provides similar purpose to what the example code base does? In this case, having a runnable example from the moment you create the new project with the archetype. Or, should we only worry about the package structure and some default files like the application.properties file?
I think open discussion is warranted regarding what we would like to see with the archetype.
there is a test for value.isBlank instead of !value.isBlank
The TestContextSetting
interface contains a collection of constant values that are currently being used along with the BaseTestContext singleton for adding and getting settings to the WebDriverContext
.
Over half of these are not being used:
We should take a look and see if these values are required. Even further, we should determine if the TestContextSetting is necessary at all.
Currently, when a test fails due to an unexpected error on the UI, the test will fail in a couple of ways:
Instead of having these errors at the top level by default, we should first check to see if there are any errors displayed on the UI first and report those prior to reporting an element couldn't be found or if there's a problem with the WebDriver.
An example failure:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[data-qa='some-link']"}
(Session info: chrome=71.0.3578.80)
(Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
...
This error appeared during the Navigation class so we can assume that there is a problem with navigation; but, we don't know the exact reason why there was a problem with navigation. We must first look at the sauce labs dashboard to view the video from the test run. In this example above, we found that there was a problem with the UI and it displayed a generic error message; therefore, the element we were looking for could not be found.
Not being able to find an element on a page, as it's doing now, infers that the automation did not encounter any issues with the UI and that it simply wasn't able to find the element; which is not entirely the most truthful case.
As a bonus to this, if we could also report any errors in the console, this would help out tremendously for debugging purposes.
I'm not sure there's a one sized fits all solution for this. There are a lot of different potential cases for where we would like to see this kind of behavior.
One potential thing to consider is figuring out a way that we can generalize this to apply to multiple element types. Thankfully, the way our strongly typed elements are set up right now, they all inherit off of a parent class.
I think, in general, it is possible to just check the dom for any instances of an attribute on an element of "is-error". Maybe we can check the console?
We should create a codebase that demonstrates how to use Scaffold. This will be most helpful for new users and exist as the "model home" of how to implement.
This demo could base should provide a clear example of how to do all of the things, including but not limited to:
With separation of concerns in mind, we should move the navigate method from the WebDriverWrapper
to the WebDriverNavigation
method. Inherently, I think this makes the most sense as the WebDriverNavigation
is supposed to be responsible only for anything navigation related.
/**
* Navigate to a specified URL
*
* @return as a {@link Navigation}
*/
public Navigation navigate() {
return this.driver.navigate();
}
We should also think about moving anything else navigation related outside of the navigation method.
WebDriverWrapper
to WebDriverNavigation
WebDriverNavigation
where it won't impede the ScaffoldBaseTest
and any implementing BaseTest
file from implementing projectsThe script right now is always pushing a release.
We should only be releasing on a new conventional commit and always have the build run testing.
Currently, the AbstractWebElement
class implements a Scaffold interface called BaseWebElement
. Right now, this interface is supposed to be a clone of the WebElement
, from Selenium, but uses our strongly typed elements. It also protects the codebase from any major changes to the Selenium API.
However, there are currently some features in the BaseWebElement
that are missing from the WebElement
interface. This ticket is to update this class and interface to accurately clone the WebElement
. For example, the isSelected() method is not being used.
We should make the current public getWebElement()
method private and either rename this method or the existing protected getWebElement
method to give us a better idea on what is going on.
Also, keep in mind that we have an AbstractClickable
class that is used by elements such as ButtonWebElement
. We should still ensure that we're encapsulating actions for elements correctly.
BaseWebElement
should have all of the same functionality from WebElement
providedclick()
in the AbstractClickable
class.getWebElement()
methods to accurately reflect the actions they are performing and also change their access accordingly.Right now, we are using Junit Jupiter's @Test
and @DisplayName
on our test cases. We could wrap both of these annotation to a single @Test
annotation on Scaffold so we can write the DisplayName of the test inline with @Test
.
@DisplayName
currently provides value in formatting the SauceLabs Dashboard test results with a String other than the test method name.
For example, a single @Test
annotation that looks like this:
@Test("Clicking Go Should Do the Thing")
public void testGoButton() {
insertLogicHere();
assertion;
}
@DisplayName
with the @Test
annotation@Test
annotation if they do not want to use @DisplayName
After our initial manual release of 1.0.0-beta artifacts, we need to create automated builds that will handle the release for us.
We won't be using the maven-release-plugin for this tool. @tklovett presented a pretty solid idea by just releasing with scm. These links are good references:
For our CI tool, let's think about using gitlab. In this ticket, investigate the setup required for using it.
h1. Summary
Whenever a user interacts with Scaffold's strongly typed elements, e.g. a click() or getText(), it uses the AbstractWebElement
's protected getWebElement(boolean throwExceptionIfNotFound)
method.
While this method does provide some error handling from other methods that use it, it doesn't provide any additional clues for cases where an element wasn't found due to some potential issue with javascript or an unforeseen error that is provided by the browser console.
This ticket is to add console log reporting. As noted in issue #8 , here is a stack overflow article that goes into detail on how we can pull logs: https://stackoverflow.com/questions/25431380/capturing-browser-logs-with-selenium-webdriver-using-java.
We don't need to do anything too fancy right now. My thought behind this is that we can just let lombok report these errors as log.error
when and if they exist during the protected getWebElement(boolean throwExceptionIfNotFound)
catch block of a NoSuchElementException
. Just this alone will enhance our error reporting for failed tests.
h1. A/C
When combining the maven goals to set the version and run the deploy, it's using the DEV (local) version for the deploy.
The maven goals should be separate steps. 'Twas working like this before.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.