├── webtester-support-assertj3 ├── .gitignore └── src │ ├── test │ ├── resources │ │ └── logback.xml │ └── java │ │ └── info │ │ └── novatec │ │ └── testit │ │ └── webtester │ │ └── support │ │ └── assertj │ │ └── assertions │ │ └── AbstractWebTesterAssertTest.java │ └── main │ └── java │ └── info │ └── novatec │ └── testit │ └── webtester │ └── support │ └── assertj │ └── assertions │ ├── pagefragments │ └── PageFragmentAssert.java │ └── AbstractWebTesterAssert.java ├── webtester-support-spring4 └── src │ └── test │ └── resources │ ├── banner.txt │ ├── spring-environment.properties │ ├── testit-webtester.properties │ └── logback.xml ├── webtester-support-spring5 └── src │ └── test │ └── resources │ ├── banner.txt │ ├── spring-environment.properties │ ├── testit-webtester.properties │ └── logback.xml ├── webtester-core └── src │ ├── test │ ├── resources │ │ ├── configurations │ │ │ ├── base_cfg.properties │ │ │ ├── test_cfg.properties │ │ │ └── classpath-properties-file.properties │ │ ├── html │ │ │ ├── empty.html │ │ │ ├── utils │ │ │ │ └── _image.png │ │ │ ├── pagefragments │ │ │ │ ├── _frameContent.html │ │ │ │ ├── _image.png │ │ │ │ ├── _targetPage.html │ │ │ │ ├── div.html │ │ │ │ ├── span.html │ │ │ │ ├── paragraph.html │ │ │ │ ├── link.html │ │ │ │ ├── iframe.html │ │ │ │ ├── listItem.html │ │ │ │ ├── form.html │ │ │ │ ├── image.html │ │ │ │ ├── genericList.html │ │ │ │ ├── checkbox.html │ │ │ │ ├── annotations │ │ │ │ │ └── attribute-injection.html │ │ │ │ ├── numberField.html │ │ │ │ ├── radioButton.html │ │ │ │ ├── tableField.html │ │ │ │ ├── genericElement.html │ │ │ │ ├── tableRow.html │ │ │ │ ├── passwordField.html │ │ │ │ └── headline.html │ │ │ ├── browser │ │ │ │ ├── empty.html │ │ │ │ └── alert.html │ │ │ ├── _style.css │ │ │ ├── nested-page-fragments.html │ │ │ ├── features │ │ │ │ ├── identify-using.html │ │ │ │ ├── wait-annotation.html │ │ │ │ ├── must-be-with-wait.html │ │ │ │ └── page-fragment-caching.html │ │ │ ├── annotations │ │ │ │ └── visible.html │ │ │ └── conditions │ │ │ │ ├── conditions_readonly.html │ │ │ │ └── conditions_readonly.xhtml │ │ ├── testit-webtester.properties │ │ └── logback.xml │ └── java │ │ ├── utils │ │ ├── ExceptionThrowingRunnable.java │ │ └── events │ │ │ ├── MultiEventCollectingListener.java │ │ │ └── SingleEventCollectingListener.java │ │ └── info │ │ └── novatec │ │ └── testit │ │ └── webtester │ │ ├── events │ │ ├── browser │ │ │ ├── ClosedWindowEventTest.java │ │ │ ├── ClosedBrowserEventTest.java │ │ │ ├── RefreshedPageEventTest.java │ │ │ ├── MaximizedWindowEventTest.java │ │ │ ├── NavigatedBackwardsEventTest.java │ │ │ ├── NavigatedForwardsEventTest.java │ │ │ ├── SwitchedToDefaultContentEventTest.java │ │ │ ├── OpenedUrlEventTest.java │ │ │ ├── AcceptedAlertEventTest.java │ │ │ ├── DeclinedAlertEventTest.java │ │ │ ├── SwitchedToWindowEventTest.java │ │ │ ├── SetWindowSizeEventTest.java │ │ │ ├── SetWindowPositionEventTest.java │ │ │ ├── TookScreenshotEventTest.java │ │ │ └── SavedSourceCodeEventTest.java │ │ ├── ExceptionEventTest.java │ │ └── AbstractEventTest.java │ │ ├── pagefragments │ │ └── identification │ │ │ └── producers │ │ │ ├── IdTest.java │ │ │ ├── NameTest.java │ │ │ ├── TagNameTest.java │ │ │ ├── XPathTest.java │ │ │ ├── LinkTextTest.java │ │ │ ├── ClassNameTest.java │ │ │ ├── CssSelectorTest.java │ │ │ ├── IdEndsWithTest.java │ │ │ ├── IdStartsWithTest.java │ │ │ └── PartialLinkTextTest.java │ │ ├── waiting │ │ └── WaitingActionTest.java │ │ ├── browser │ │ ├── proxy │ │ │ └── NoProxyConfigurationTest.java │ │ └── operations │ │ │ └── AlertHandlerIntTest.java │ │ └── conditions │ │ ├── values │ │ └── EqualToTest.java │ │ ├── collections │ │ └── NotEmptyTest.java │ │ ├── pagefragments │ │ ├── SelectedTest.java │ │ ├── EnabledTest.java │ │ ├── VisibleTest.java │ │ ├── DisabledTest.java │ │ ├── PresentTest.java │ │ ├── InvisibleTest.java │ │ └── AttributeTest.java │ │ └── syntax │ │ ├── HasTest.java │ │ └── NotTest.java │ └── main │ └── java │ └── info │ └── novatec │ └── testit │ └── webtester │ ├── pagefragments │ ├── Div.java │ ├── Span.java │ ├── ListItem.java │ ├── OrderedList.java │ ├── Paragraph.java │ ├── UnorderedList.java │ ├── UrlField.java │ ├── EmailField.java │ ├── TextField.java │ ├── SearchField.java │ ├── TelephoneField.java │ ├── PasswordField.java │ ├── Headline.java │ ├── identification │ │ ├── InvalidByProducerException.java │ │ └── producers │ │ │ ├── Id.java │ │ │ ├── Name.java │ │ │ ├── XPath.java │ │ │ ├── TagName.java │ │ │ ├── LinkText.java │ │ │ ├── ClassName.java │ │ │ ├── PartialLinkText.java │ │ │ └── CssSelector.java │ ├── TableField.java │ ├── IFrame.java │ ├── mapping │ │ └── MappingException.java │ ├── TextArea.java │ ├── Form.java │ ├── annotations │ │ └── Mappings.java │ └── Link.java │ ├── internal │ ├── annotations │ │ ├── CreatesPage.java │ │ ├── ReturnsName.java │ │ ├── ReturnsBrowser.java │ │ └── ReturnsWebElement.java │ ├── exceptions │ │ └── IllegalSignatureException.java │ ├── configuration │ │ ├── DefaultValue.java │ │ ├── Documentation.java │ │ └── TypeDefinition.java │ ├── implementation │ │ ├── exceptions │ │ │ ├── UnsupportedReturnTypeException.java │ │ │ ├── NoDefaultConstructorException.java │ │ │ └── DynamicImplementationException.java │ │ ├── PageFactory.java │ │ ├── pagefragments │ │ │ ├── StaticWebElementSupplier.java │ │ │ ├── exceptions │ │ │ │ ├── PageFragmentCreationException.java │ │ │ │ └── PageFragmentMustBeInterfaceException.java │ │ │ └── DynamicWebElementSupplier.java │ │ └── pages │ │ │ ├── BasePage.java │ │ │ └── exceptions │ │ │ ├── PageCreationException.java │ │ │ └── PageMustBeInterfaceException.java │ ├── postconstruct │ │ ├── PostConstructInvocationException.java │ │ └── PostConstructMustBeConditionException.java │ ├── OffersBrowserGetter.java │ ├── OffersPageCreation.java │ └── ClasspathUtils.java │ ├── config │ ├── exceptions │ │ ├── SetNullValuesException.java │ │ └── InvalidValueTypeException.java │ ├── ConfigurationException.java │ ├── ConfigurationAdapter.java │ ├── exporters │ │ └── SystemPropertyConfigurationExporter.java │ └── adapters │ │ ├── LocalFileConfigurationAdapter.java │ │ └── GlobalFileConfigurationAdapter.java │ ├── waiting │ ├── WaitActionFailedException.java │ ├── InterruptionException.java │ ├── Sleeper.java │ ├── TimeoutException.java │ ├── ConditionParameterMismatchException.java │ ├── CurrentThreadSleeper.java │ └── WaitAction.java │ ├── events │ ├── AbstractEvent.java │ ├── browser │ │ ├── ClosedBrowserEvent.java │ │ ├── ClosedWindowEvent.java │ │ ├── RefreshedPageEvent.java │ │ ├── MaximizedWindowEvent.java │ │ ├── SwitchedToDefaultContentEvent.java │ │ ├── NavigatedForwardsEvent.java │ │ ├── NavigatedBackwardsEvent.java │ │ ├── SetWindowPositionEvent.java │ │ └── SetWindowSizeEvent.java │ ├── EventListener.java │ ├── ExceptionEvent.java │ ├── Event.java │ └── pagefragments │ │ └── EnterPressedEvent.java │ ├── WebTesterException.java │ ├── css │ └── CssProperties.java │ ├── browser │ ├── proxy │ │ ├── NoProxyConfiguration.java │ │ └── ProxyConfiguration.java │ └── operations │ │ └── BaseBrowserOperation.java │ └── conditions │ ├── pagefragments │ ├── Enabled.java │ ├── Present.java │ ├── Visible.java │ ├── Disabled.java │ ├── Invisible.java │ ├── Selected.java │ ├── Attribute.java │ ├── SelectedText.java │ ├── VisibleTextEquals.java │ ├── SelectedIndex.java │ ├── SelectedValue.java │ └── VisibleTextContains.java │ ├── collections │ └── NotEmpty.java │ ├── Condition.java │ ├── values │ └── EqualTo.java │ └── syntax │ ├── Not.java │ ├── Is.java │ └── Has.java ├── logo.png ├── development └── intellij-formatter-settings.jar ├── webtester-support-junit5 └── src │ ├── test │ ├── resources │ │ ├── testit-webtester.properties │ │ └── logback.xml │ └── java │ │ ├── utils │ │ └── TestBrowserFactory.java │ │ └── info │ │ └── novatec │ │ └── testit │ │ └── webtester │ │ └── junit5 │ │ └── extensions │ │ └── eventlisteners │ │ └── CustomEventListener.java │ └── main │ └── java │ └── info │ └── novatec │ └── testit │ └── webtester │ └── junit5 │ ├── internal │ ├── DefaultTestClassModelFactory.java │ └── TestClassModelFactory.java │ ├── WebTesterJUnitSupportException.java │ └── extensions │ ├── TestClassFormatException.java │ ├── NoManagedBrowserException.java │ ├── configuration │ ├── unmarshaller │ │ ├── DefaultUnmarshaller.java │ │ ├── LongUnmarshaller.java │ │ ├── DoubleUnmarshaller.java │ │ ├── FloatUnmarshaller.java │ │ ├── StringUnmarshaller.java │ │ ├── BooleanUnmarshaller.java │ │ └── IntegerUnmarshaller.java │ ├── StaticConfigurationValueFieldsNotSupportedException.java │ └── NoConfigurationUnmarshallerFoundException.java │ ├── NoTestClassException.java │ ├── UnknownConfigurationKeyException.java │ ├── NoManagedBrowserForNameException.java │ ├── eventlisteners │ └── StaticEventListenerFieldsNotSupportedException.java │ ├── browsers │ ├── NonUniqueBrowserNameException.java │ └── NoBrowserFactoryException.java │ └── pages │ └── StaticPageFieldsNotSupportedException.java ├── .gitignore ├── webtester-support-junit4 └── src │ ├── main │ └── java │ │ └── info │ │ └── novatec │ │ └── testit │ │ └── webtester │ │ └── junit │ │ ├── exceptions │ │ ├── NoStaticPrimaryBrowserException.java │ │ ├── IllegalTestClassStructureException.java │ │ ├── WebTesterJUnitSupportException.java │ │ ├── NoBrowserFactoryProvidedException.java │ │ ├── NotOfInjectableFieldTypeException.java │ │ ├── NoUniquePrimaryBrowserException.java │ │ ├── NoManagedBrowserException.java │ │ └── NoPrimaryBrowserException.java │ │ ├── runner │ │ └── internal │ │ │ ├── MethodTestBrowser.java │ │ │ └── ClassTestBrowser.java │ │ └── annotations │ │ └── Primary.java │ └── test │ ├── resources │ ├── testit-webtester.properties │ └── logback.xml │ └── java │ └── utils │ └── TestBrowserFactory.java ├── docker-compose.yml ├── webtester-documentation └── src │ └── main │ └── asciidoc │ └── chapters │ ├── utility-by-producers.asciidoc │ ├── support-module-assertj3.asciidoc │ ├── annotations-named.asciidoc │ ├── annotations-action.asciidoc │ ├── kotlin.asciidoc │ └── annotations-mark.asciidoc ├── webtester-support-hamcrest └── src │ └── test │ ├── resources │ └── logback.xml │ └── java │ └── info │ └── novatec │ └── testit │ └── webtester │ └── support │ └── hamcrest │ └── matchers │ └── pagefragments │ ├── EnabledMatcherTest.java │ ├── VisibleMatcherTest.java │ ├── DisabledMatcherTest.java │ ├── PresentMatcherTest.java │ ├── InvisibleMatcherTest.java │ ├── SelectedMatcherTest.java │ ├── TagMatcherTest.java │ └── OptionsMatcherTest.java ├── webtester-kotlin └── src │ └── test │ └── resources │ └── html │ ├── testKotlin.html │ └── _style.css └── NOTICE /webtester-support-assertj3/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /webtester-support-spring4/src/test/resources/banner.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webtester-support-spring5/src/test/resources/banner.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/configurations/base_cfg.properties: -------------------------------------------------------------------------------- 1 | testkey=foo -------------------------------------------------------------------------------- /webtester-core/src/test/resources/configurations/test_cfg.properties: -------------------------------------------------------------------------------- 1 | testkey=bar -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testIT-WebTester/webtester2-core/HEAD/logo.png -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/configurations/classpath-properties-file.properties: -------------------------------------------------------------------------------- 1 | property.key1=foo 2 | property.key2=bar 3 | -------------------------------------------------------------------------------- /webtester-support-spring4/src/test/resources/spring-environment.properties: -------------------------------------------------------------------------------- 1 | test.property.key1 = value 1 from spring environment 2 | -------------------------------------------------------------------------------- /webtester-support-spring5/src/test/resources/spring-environment.properties: -------------------------------------------------------------------------------- 1 | test.property.key1 = value 1 from spring environment 2 | -------------------------------------------------------------------------------- /development/intellij-formatter-settings.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testIT-WebTester/webtester2-core/HEAD/development/intellij-formatter-settings.jar -------------------------------------------------------------------------------- /webtester-support-junit5/src/test/resources/testit-webtester.properties: -------------------------------------------------------------------------------- 1 | host=localhost 2 | port=8080 3 | 4 | stringValue = Hello World! 5 | booleanValue = true 6 | -------------------------------------------------------------------------------- /webtester-support-spring4/src/test/resources/testit-webtester.properties: -------------------------------------------------------------------------------- 1 | test.property.key1 = value 1 from webtester 2 | test.property.key2 = value 2 from webtester 3 | -------------------------------------------------------------------------------- /webtester-support-spring5/src/test/resources/testit-webtester.properties: -------------------------------------------------------------------------------- 1 | test.property.key1 = value 1 from webtester 2 | test.property.key2 = value 2 from webtester 3 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/utils/_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testIT-WebTester/webtester2-core/HEAD/webtester-core/src/test/resources/html/utils/_image.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | .project 3 | .classpath 4 | .eclipse-pmd 5 | .idea/ 6 | *.iml 7 | **/.settings/ 8 | **/.metadata/ 9 | **/target/ 10 | target 11 | /chromedriver 12 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/_frameContent.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Frame Content 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/testIT-WebTester/webtester2-core/HEAD/webtester-core/src/test/resources/html/pagefragments/_image.png -------------------------------------------------------------------------------- /webtester-core/src/test/java/utils/ExceptionThrowingRunnable.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | @FunctionalInterface 4 | public interface ExceptionThrowingRunnable { 5 | 6 | void run() throws Exception; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/browser/empty.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/_targetPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Target Page 5 | 6 | 7 |

Welcome to the target page!

8 | 9 | 10 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/browser/alert.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Alert Test Page

8 | 9 | 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/Div.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "div") 7 | public interface Div extends PageFragment { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/Span.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "span") 7 | public interface Span extends PageFragment { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/ListItem.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "li") 7 | public interface ListItem extends PageFragment { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/OrderedList.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "ol") 7 | public interface OrderedList extends GenericList { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/Paragraph.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "p") 7 | public interface Paragraph extends PageFragment { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/UnorderedList.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "ul") 7 | public interface UnorderedList extends GenericList { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/annotations/CreatesPage.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | 7 | @Retention(RetentionPolicy.RUNTIME) 8 | public @interface CreatesPage { 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/annotations/ReturnsName.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | 7 | @Retention(RetentionPolicy.RUNTIME) 8 | public @interface ReturnsName { 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/annotations/ReturnsBrowser.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | 7 | @Retention(RetentionPolicy.RUNTIME) 8 | public @interface ReturnsBrowser { 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/annotations/ReturnsWebElement.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.annotations; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | 7 | @Retention(RetentionPolicy.RUNTIME) 8 | public @interface ReturnsWebElement { 9 | } 10 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/UrlField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "url" }) 7 | public interface UrlField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/EmailField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "email" }) 7 | public interface EmailField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/TextField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "", "text"}) 7 | public interface TextField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/SearchField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "search" }) 7 | public interface SearchField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/TelephoneField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "tel" }) 7 | public interface TelephoneField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/PasswordField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "input", attribute = "type", values = { "password" }) 7 | public interface PasswordField extends GenericTextField { 8 | } 9 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NoStaticPrimaryBrowserException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | @SuppressWarnings("serial") 4 | public class NoStaticPrimaryBrowserException extends IllegalTestClassStructureException { 5 | 6 | public NoStaticPrimaryBrowserException(String message) { 7 | super(message); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/exceptions/IllegalSignatureException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.exceptions; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | public class IllegalSignatureException extends WebTesterException { 7 | 8 | public IllegalSignatureException(String message) { 9 | super(message); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/IllegalTestClassStructureException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | @SuppressWarnings("serial") 4 | public class IllegalTestClassStructureException extends WebTesterJUnitSupportException { 5 | 6 | public IllegalTestClassStructureException(String message) { 7 | super(message); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | hub: 2 | image: selenium/hub:3.14 3 | ports: 4 | - "4444:4444" 5 | firefox: 6 | image: selenium/node-firefox:3.14 7 | links: 8 | - hub 9 | additionalFirefox: 10 | image: selenium/node-firefox:3.14 11 | links: 12 | - hub 13 | chrome: 14 | image: selenium/node-chrome:3.14 15 | links: 16 | - hub 17 | additionalChrome: 18 | image: selenium/node-chrome:3.14 19 | links: 20 | - hub 21 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/Headline.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "h1") 7 | @Mapping(tag = "h2") 8 | @Mapping(tag = "h3") 9 | @Mapping(tag = "h4") 10 | @Mapping(tag = "h5") 11 | @Mapping(tag = "h6") 12 | public interface Headline extends PageFragment { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/testit-webtester.properties: -------------------------------------------------------------------------------- 1 | events.enabled = true 2 | actions.deceleration = 0 3 | folders.screenshots = target/screenshots 4 | folders.page-sources = target/sourcecode 5 | folders.logs = target/logs 6 | markings.enabled = false 7 | markings.used.background = #ffd2a5 8 | markings.used.outline = #916f22 9 | markings.read.background = #90ee90 10 | markings.read.outline = #008000 11 | wait.timeout = 1 12 | wait.interval = 50 13 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/test/resources/testit-webtester.properties: -------------------------------------------------------------------------------- 1 | ## custom properties 2 | 3 | custom.integer = 42 4 | custom.string = foo bar 5 | 6 | #ConfigurationValueInjectorTest 7 | test.string = foo bar 8 | test.integer = 1 9 | test.long = 2 10 | test.float = 1.0 11 | test.double = 2.0 12 | test.boolean = true 13 | 14 | #WebTesterJUnitRunnerIntTest 15 | host=localhost 16 | port=8080 17 | 18 | stringValue = Hello World! 19 | booleanValue = true 20 | -------------------------------------------------------------------------------- /webtester-documentation/src/main/asciidoc/chapters/utility-by-producers.asciidoc: -------------------------------------------------------------------------------- 1 | === By-Producers 2 | 3 | The utility class `ByProducers` provides several factory methods for creating 4 | `ByProducer` instances. These are used by WebTester as an abstraction over 5 | Selenium's `By` classes. They are relevant to the following (sub-)systems: 6 | 7 | [source, java] 8 | ---- 9 | // Ad-Hoc finding of page fragment 10 | browser.findBy(ByProducers.id("username")); 11 | ---- 12 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/WebTesterJUnitSupportException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class WebTesterJUnitSupportException extends WebTesterException { 8 | 9 | protected WebTesterJUnitSupportException(String message) { 10 | super(message); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/configuration/DefaultValue.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.configuration; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.FIELD) 11 | public @interface DefaultValue { 12 | String value(); 13 | } 14 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/configuration/Documentation.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.configuration; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.FIELD) 11 | public @interface Documentation { 12 | String value(); 13 | } 14 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/configuration/TypeDefinition.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.configuration; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.FIELD) 11 | public @interface TypeDefinition { 12 | String value(); 13 | } 14 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-assertj3/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-hamcrest/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-spring4/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-support-spring5/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/config/exceptions/SetNullValuesException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.config.exceptions; 2 | 3 | import info.novatec.testit.webtester.config.ConfigurationException; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class SetNullValuesException extends ConfigurationException { 8 | 9 | public SetNullValuesException(String key) { 10 | super("Null value is not allowed when setting a property! [property:" + key + ']'); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/internal/DefaultTestClassModelFactory.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.internal; 2 | 3 | /** 4 | * Default implementation of {@link TestClassModelFactory}. 5 | * 6 | * @since 2.1 7 | */ 8 | public class DefaultTestClassModelFactory implements TestClassModelFactory { 9 | 10 | @Override 11 | public TestClassModel create(Class testClass) { 12 | return TestClassModel.fromTestClass(testClass); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/ClosedWindowEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class ClosedWindowEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | ClosedWindowEvent event = new ClosedWindowEvent(); 13 | assertThat(event.describe()).isEqualTo("closed window"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/ClosedBrowserEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class ClosedBrowserEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | ClosedBrowserEvent event = new ClosedBrowserEvent(); 13 | assertThat(event.describe()).isEqualTo("closed browser"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/RefreshedPageEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class RefreshedPageEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | RefreshedPageEvent event = new RefreshedPageEvent(); 13 | assertThat(event.describe()).isEqualTo("refreshed the page"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-kotlin/src/test/resources/html/testKotlin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Kotlin Test Page

9 |

This page contains elements for testing the WebTester with Kotlin.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 |
An empty text field
20 | 21 |

22 |
23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/MaximizedWindowEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class MaximizedWindowEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | MaximizedWindowEvent event = new MaximizedWindowEvent(); 13 | assertThat(event.describe()).isEqualTo("maximized window"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/config/ConfigurationException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.config; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class ConfigurationException extends WebTesterException { 8 | 9 | protected ConfigurationException(String message) { 10 | super(message); 11 | } 12 | 13 | protected ConfigurationException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/WaitActionFailedException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | public class WaitActionFailedException extends WebTesterException { 6 | 7 | private static final String MESSAGE = "WaitAction '%s' could not be performed!"; 8 | 9 | protected WaitActionFailedException(Class action, Throwable cause) { 10 | super(String.format(MESSAGE, action), cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/InterruptionException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | /** 7 | * This {@link WebTesterException} is thrown in case a wait operation is interrupted. 8 | * 9 | * @see Wait 10 | * @see WaitUntil 11 | * @since 2.0 12 | */ 13 | public class InterruptionException extends WebTesterException { 14 | 15 | public InterruptionException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/exceptions/UnsupportedReturnTypeException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.exceptions; 2 | 3 | import java.lang.reflect.Method; 4 | 5 | 6 | public class UnsupportedReturnTypeException extends DynamicImplementationException { 7 | 8 | private static final String MESSAGE = "Return type of method '%s' is not supported!"; 9 | 10 | public UnsupportedReturnTypeException(Method method) { 11 | super(String.format(MESSAGE, method)); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/NavigatedBackwardsEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class NavigatedBackwardsEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | NavigatedBackwardsEvent event = new NavigatedBackwardsEvent(); 13 | assertThat(event.describe()).isEqualTo("navigated back in the browser history"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/NavigatedForwardsEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class NavigatedForwardsEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | NavigatedForwardsEvent event = new NavigatedForwardsEvent(); 13 | assertThat(event.describe()).isEqualTo("navigated forward in the browser history"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/_style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | background-color: #fefefe; 4 | } 5 | h1 { 6 | font-size: 30px; 7 | } 8 | h2 { 9 | font-size: 24px; 10 | } 11 | h3 { 12 | font-size: 18px; 13 | } 14 | hr { 15 | border-style: dotted; 16 | border-width: 1px; 17 | } 18 | table { 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: #bbbbbb; 22 | } 23 | td { 24 | border-style: solid; 25 | border-width: 1px; 26 | border-color: #dedede; 27 | padding: 10px 10px 10px 10px; 28 | } 29 | -------------------------------------------------------------------------------- /webtester-kotlin/src/test/resources/html/_style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | background-color: #fefefe; 4 | } 5 | h1 { 6 | font-size: 30px; 7 | } 8 | h2 { 9 | font-size: 24px; 10 | } 11 | h3 { 12 | font-size: 18px; 13 | } 14 | hr { 15 | border-style: dotted; 16 | border-width: 1px; 17 | } 18 | table { 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: #bbbbbb; 22 | } 23 | td { 24 | border-style: solid; 25 | border-width: 1px; 26 | border-color: #dedede; 27 | padding: 10px 10px 10px 10px; 28 | } 29 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NoBrowserFactoryProvidedException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | @SuppressWarnings("serial") 4 | public class NoBrowserFactoryProvidedException extends IllegalTestClassStructureException { 5 | 6 | private static final String MESSAGE = 7 | "You have to provide a BrowserFactory to use by annotation the Browser field with @CreateUsing!"; 8 | 9 | public NoBrowserFactoryProvidedException() { 10 | super(MESSAGE); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/WebTesterJUnitSupportException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | /** 7 | * This is the base exception class of all exception thrown by the WebTester JUnit 5 support module. 8 | * 9 | * @since 2.1 10 | */ 11 | public class WebTesterJUnitSupportException extends WebTesterException { 12 | 13 | protected WebTesterJUnitSupportException(String message) { 14 | super(message); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/exceptions/NoDefaultConstructorException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.exceptions; 2 | 3 | public class NoDefaultConstructorException extends DynamicImplementationException { 4 | 5 | private static final String MESSAGE = "Class '%s' does not have an accessible default constructor!"; 6 | 7 | public NoDefaultConstructorException(Class type, Throwable cause) { 8 | super(String.format(MESSAGE, type.getCanonicalName()), cause); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/postconstruct/PostConstructInvocationException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.postconstruct; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | public class PostConstructInvocationException extends WebTesterException { 7 | 8 | private static final String MESSAGE = "Invocation of @PostConstruct annotated method failed! See cause for details:"; 9 | 10 | public PostConstructInvocationException(Throwable cause) { 11 | super(MESSAGE,cause); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/SwitchedToDefaultContentEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class SwitchedToDefaultContentEventTest { 9 | 10 | @Test 11 | public void descriptionIsGeneratedCorrectly() { 12 | SwitchedToDefaultContentEvent event = new SwitchedToDefaultContentEvent(); 13 | assertThat(event.describe()).isEqualTo("switched to default content"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/TestClassFormatException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions; 2 | 3 | import info.novatec.testit.webtester.junit5.WebTesterJUnitSupportException; 4 | 5 | 6 | /** 7 | * This is the base class for all exceptions regarding the format of a test class. 8 | * 9 | * @since 2.1 10 | */ 11 | public class TestClassFormatException extends WebTesterJUnitSupportException { 12 | 13 | protected TestClassFormatException(String message) { 14 | super(message); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/OffersBrowserGetter.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal; 2 | 3 | import info.novatec.testit.webtester.browser.Browser; 4 | import info.novatec.testit.webtester.internal.annotations.ReturnsBrowser; 5 | 6 | 7 | public interface OffersBrowserGetter { 8 | 9 | /** 10 | * Returns the {@link Browser browser} this instance was created from. 11 | * 12 | * @return the browser of this instance 13 | * @see Browser 14 | * @since 2.0 15 | */ 16 | @ReturnsBrowser 17 | Browser browser(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/exceptions/DynamicImplementationException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.exceptions; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | public class DynamicImplementationException extends WebTesterException { 7 | 8 | protected DynamicImplementationException(String message) { 9 | super(message); 10 | } 11 | 12 | protected DynamicImplementationException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | testIT - WebTester 2 | Copyright 2013 NovaTec Consulting GmbH 3 | 4 | This product includes software developed at 5 | NovaTec Consulting GmbH (http://www.novatec-gmbh.de/). 6 | 7 | This product is licensed to you under the Apache License, Version 2.0 8 | (the "License"). You may not use this product except in compliance with 9 | the License. 10 | 11 | This product may include a number of subcomponents with separate 12 | copyright notices and license terms. Your use of the source code for 13 | these subcomponents is subject to the terms and conditions of the 14 | subcomponent's license, as noted in the LICENSE file. 15 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/InvalidByProducerException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | /** 7 | * This exception is thrown if a {@link ByProducer} could not be initialized. 8 | * 9 | * @see ByProducers 10 | * @since 2.0 11 | */ 12 | public class InvalidByProducerException extends WebTesterException { 13 | 14 | public InvalidByProducerException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/PageFactory.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation; 2 | 3 | import info.novatec.testit.webtester.browser.Browser; 4 | import info.novatec.testit.webtester.internal.implementation.pages.ByteBuddyPageFactory; 5 | import info.novatec.testit.webtester.pages.Page; 6 | 7 | 8 | public interface PageFactory { 9 | 10 | T createInstanceOf(Class pageType); 11 | 12 | static PageFactory createInstanceFor(Browser browser) { 13 | return new ByteBuddyPageFactory(browser); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NotOfInjectableFieldTypeException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | import java.lang.reflect.Field; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class NotOfInjectableFieldTypeException extends IllegalTestClassStructureException { 8 | 9 | public NotOfInjectableFieldTypeException(Field field) { 10 | super("the configuration value field '" + field 11 | + "' is not of an injectable type! Injectable types are: Boolean, Integer, Long, Float, Double and String"); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/Sleeper.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | /** 4 | * Implementations of this interface can be used to trigger a 'sleep' state for a certain amount of time. 5 | * 6 | * @since 2.0 7 | */ 8 | public interface Sleeper { 9 | /** 10 | * Sleep for the given amount of milliseconds. 11 | * 12 | * @param milliseconds the milliseconds to sleep 13 | * @throws InterruptionException in case the sleep operation is interrupted 14 | * @since 2.0 15 | */ 16 | void sleep(long milliseconds) throws InterruptionException; 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/AbstractEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events; 2 | 3 | import java.time.LocalDateTime; 4 | 5 | /** 6 | * Base class for all events. 7 | *

8 | * It stores the event's creation timestamp as a property. 9 | * 10 | * @see Event 11 | * @see EventListener 12 | * @see EventSystem 13 | * @since 2.0 14 | */ 15 | public abstract class AbstractEvent implements Event { 16 | 17 | private final LocalDateTime timestamp = LocalDateTime.now(); 18 | 19 | @Override 20 | public LocalDateTime getTimestamp() { 21 | return timestamp; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-support-assertj3/src/main/java/info/novatec/testit/webtester/support/assertj/assertions/pagefragments/PageFragmentAssert.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.support.assertj.assertions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.PageFragment; 4 | 5 | 6 | /** 7 | * Contains assertions for all {@link PageFragment page fragments}. 8 | * 9 | * @since 2.0 10 | */ 11 | public class PageFragmentAssert extends AbstractPageFragmentAssert { 12 | 13 | public PageFragmentAssert(PageFragment actual) { 14 | super(actual, PageFragmentAssert.class); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/internal/TestClassModelFactory.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.internal; 2 | 3 | /** 4 | * Implementations of this interface are used to create {@link TestClassModel} instances. 5 | * 6 | * @since 2.1 7 | */ 8 | public interface TestClassModelFactory { 9 | 10 | /** 11 | * Creates a new {@link TestClassModel} for the given {@code testClass}. 12 | * 13 | * @param testClass the class to create the model from 14 | * @return the created model 15 | * @since 2.1 16 | */ 17 | TestClassModel create(Class testClass); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/TimeoutException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | /** 7 | * This {@link WebTesterException} is thrown in case a wait operation timed out. 8 | * 9 | * @see Wait 10 | * @see WaitUntil 11 | * @since 2.0 12 | */ 13 | public class TimeoutException extends WebTesterException { 14 | 15 | public TimeoutException(String message) { 16 | super(message); 17 | } 18 | 19 | public TimeoutException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/NoManagedBrowserException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions; 2 | 3 | import info.novatec.testit.webtester.browser.Browser; 4 | 5 | 6 | /** 7 | * This exception is thrown in case at least one managed {@link Browser} is needed in order to execute the operations of an 8 | * extension but non was defined. 9 | * 10 | * @since 2.1 11 | */ 12 | public class NoManagedBrowserException extends TestClassFormatException { 13 | 14 | public NoManagedBrowserException() { 15 | super("There is no managed browser to use!"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NoUniquePrimaryBrowserException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | import info.novatec.testit.webtester.junit.annotations.Primary; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class NoUniquePrimaryBrowserException extends IllegalTestClassStructureException { 8 | 9 | private static final String MESSAGE = 10 | "There is no unique primary browser! @" + Primary.class.getSimpleName() + " must not be declared more then once!"; 11 | 12 | public NoUniquePrimaryBrowserException() { 13 | super(MESSAGE); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/WebTesterException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester; 2 | 3 | /** 4 | * Base exception type for all exceptions directly thrown by WebTester. 5 | * 6 | * @since 2.0 7 | */ 8 | @SuppressWarnings("serial") 9 | public class WebTesterException extends RuntimeException { 10 | 11 | protected WebTesterException(String message) { 12 | super(message); 13 | } 14 | 15 | protected WebTesterException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | protected WebTesterException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/nested-page-fragments.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

ContentArea Test

9 | 10 |
11 |
12 | 13 |
14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/div.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

DIV Test Page

9 |

This page contains elements for testing the functionality of the Div page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A DIV
This is a DIV
Not a DIVThis is not a DIV
26 | 27 |

28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/css/CssProperties.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.css; 2 | 3 | import lombok.experimental.UtilityClass; 4 | 5 | 6 | /** 7 | * This class provides constants for CSS property names used by WebTester's features. 8 | * 9 | * @see StyleChanger 10 | * @since 2.0 11 | */ 12 | @UtilityClass 13 | public class CssProperties { 14 | 15 | public static final String BACKGROUND_COLOR = "backgroundColor"; 16 | 17 | public static final String OUTLINE_COLOR = "outlineColor"; 18 | public static final String OUTLINE_STYLE = "outlineStyle"; 19 | public static final String OUTLINE_WIDTH = "outlineWidth"; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/DefaultUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | public class DefaultUnmarshaller implements ConfigurationUnmarshaller { 9 | 10 | @Override 11 | public boolean canHandle(Class type) { 12 | return false; 13 | } 14 | 15 | @Override 16 | public Optional unmarshal(Configuration config, String key) { 17 | return Optional.empty(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/config/exceptions/InvalidValueTypeException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.config.exceptions; 2 | 3 | import java.util.Collection; 4 | 5 | import org.apache.commons.lang.StringUtils; 6 | 7 | import info.novatec.testit.webtester.config.ConfigurationException; 8 | 9 | 10 | @SuppressWarnings("serial") 11 | public class InvalidValueTypeException extends ConfigurationException { 12 | 13 | public InvalidValueTypeException(Class type, Collection> supportedTypes) { 14 | super("Unsupported value type: " + type + " - allowed types are: " + StringUtils.join(supportedTypes, ", ")); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/span.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

SPAN Test Page

9 |

This page contains elements for testing the functionality of the Span page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A SPANThis is a SPAN
Not a SPAN
This is not a SPAN
26 | 27 |

28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/utils/events/MultiEventCollectingListener.java: -------------------------------------------------------------------------------- 1 | package utils.events; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import info.novatec.testit.webtester.events.Event; 7 | import info.novatec.testit.webtester.events.EventListener; 8 | 9 | 10 | class MultiEventCollectingListener implements EventListener { 11 | 12 | private List events = new ArrayList<>(); 13 | 14 | @Override 15 | public void eventOccurred(Event event) { 16 | events.add(event); 17 | } 18 | 19 | @SuppressWarnings("unchecked") 20 | public List getEvents() { 21 | return ( List ) events; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NoManagedBrowserException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | import info.novatec.testit.webtester.junit.runner.WebTesterJUnitRunner; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class NoManagedBrowserException extends IllegalTestClassStructureException { 8 | 9 | private static final String MESSAGE = 10 | "There are no manged browsers! Without at least one managed browser some features of the " 11 | + WebTesterJUnitRunner.class.getSimpleName() + " can't be used."; 12 | 13 | public NoManagedBrowserException() { 14 | super(MESSAGE); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/browser/proxy/NoProxyConfiguration.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.browser.proxy; 2 | 3 | import org.openqa.selenium.Proxy; 4 | 5 | import info.novatec.testit.webtester.browser.BrowserFactory; 6 | 7 | 8 | /** 9 | * Default implementation of a {@link ProxyConfiguration proxy configuration} 10 | * doing nothing to with {@link Proxy proxy} object. 11 | * 12 | * @see Proxy 13 | * @see ProxyConfiguration 14 | * @see BrowserFactory 15 | * @since 2.0 16 | */ 17 | public class NoProxyConfiguration implements ProxyConfiguration { 18 | 19 | @Override 20 | public void configureProxy(Proxy proxy) { 21 | // do nothing 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pagefragments/StaticWebElementSupplier.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pagefragments; 2 | 3 | import java.util.function.Supplier; 4 | 5 | import org.openqa.selenium.WebElement; 6 | 7 | import lombok.EqualsAndHashCode; 8 | 9 | 10 | @EqualsAndHashCode 11 | public class StaticWebElementSupplier implements Supplier { 12 | 13 | private final WebElement webElement; 14 | 15 | public StaticWebElementSupplier(WebElement webElement) { 16 | this.webElement = webElement; 17 | } 18 | 19 | @Override 20 | public WebElement get() { 21 | return webElement; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/Id.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#id(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class Id implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.id(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "ID"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/paragraph.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Paragraph Test Page

9 |

This page contains elements for testing the functionality of the Paragraph page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A Paragraph

This is a Paragraph

Not a ParagraphThis is not a Paragraph
26 | 27 |

28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pages/BasePage.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pages; 2 | 3 | import info.novatec.testit.webtester.browser.Browser; 4 | import info.novatec.testit.webtester.pages.Page; 5 | 6 | 7 | public class BasePage implements Page { 8 | 9 | private final Browser browser; 10 | 11 | public BasePage(Browser browser) { 12 | this.browser = browser; 13 | } 14 | 15 | @Override 16 | public Browser browser() { 17 | return browser; 18 | } 19 | 20 | @Override 21 | public T create(Class pageClass) { 22 | return browser().create(pageClass); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/TableField.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 4 | 5 | 6 | @Mapping(tag = "th") 7 | @Mapping(tag = "td") 8 | public interface TableField extends PageFragment { 9 | 10 | /** 11 | * Returns whether ot not this {@link TableField} is a header field. 12 | * Header fields are identified by their tag name (TH). 13 | * 14 | * @return true if this is a header filed 15 | * @see TableField 16 | * @since 2.0 17 | */ 18 | default boolean isHeaderField() { 19 | return "th".equalsIgnoreCase(getTagName()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/ConditionParameterMismatchException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | import info.novatec.testit.webtester.conditions.Condition; 5 | 6 | 7 | public class ConditionParameterMismatchException extends WebTesterException { 8 | 9 | private static final String MESSAGE = "Condition '%s' can't handle parameter of type '%s'!"; 10 | 11 | protected ConditionParameterMismatchException(Class conditionType, Class parameterType, 12 | Throwable cause) { 13 | super(String.format(MESSAGE, conditionType, parameterType), cause); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/link.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Image Test Page

9 |

This page contains elements for testing the functionality of the Image page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A simple linkLink to Target Page
Not a LinkThis is not a Link
26 | 27 |

28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pages/exceptions/PageCreationException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pages.exceptions; 2 | 3 | import info.novatec.testit.webtester.internal.implementation.exceptions.DynamicImplementationException; 4 | import info.novatec.testit.webtester.pages.Page; 5 | 6 | 7 | public class PageCreationException extends DynamicImplementationException { 8 | 9 | private static final String MESSAGE = "Could not create instance of '%s':"; 10 | 11 | public PageCreationException(Class pageType, Throwable cause) { 12 | super(String.format(MESSAGE, pageType.getCanonicalName()), cause); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/postconstruct/PostConstructMustBeConditionException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.postconstruct; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | 5 | 6 | public class PostConstructMustBeConditionException extends WebTesterException { 7 | 8 | private static final String MESSAGE = 9 | "Invocation of @PostConstructMustBe annotated method failed! See cause for details:"; 10 | 11 | public PostConstructMustBeConditionException(String message) { 12 | super(message); 13 | } 14 | 15 | public PostConstructMustBeConditionException(Throwable cause) { 16 | super(MESSAGE, cause); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/Name.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#name(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class Name implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.name(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Name"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

IFrame Test Page

9 |

This page contains elements for testing the functionality of the IFrame Test Page page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
A simple IFrame
Not an IFrameThis is not a IFrame
26 | 27 |

28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/XPath.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#xpath(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class XPath implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.xpath(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "XPath"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/IdTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class IdTest { 10 | 11 | Id cut = new Id(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("someId"); 16 | assertThat(by).isInstanceOf(By.ById.class); 17 | assertThat(by).hasToString("By.id: someId"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("ID"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/OffersPageCreation.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal; 2 | 3 | import info.novatec.testit.webtester.internal.annotations.CreatesPage; 4 | import info.novatec.testit.webtester.pages.Page; 5 | 6 | 7 | public interface OffersPageCreation { 8 | 9 | /** 10 | * Creates an instance of the given {@link Page page} class. 11 | * 12 | * @param the type of the page object to return 13 | * @param pageClass the page object class to be initialized 14 | * @return an initialize page object of the given class 15 | * @see Page 16 | * @since 2.0 17 | */ 18 | @CreatesPage 19 | T create(Class pageClass); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/TagName.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#tagName(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class TagName implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.tagName(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Tag Name"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-support-junit4/src/main/java/info/novatec/testit/webtester/junit/exceptions/NoPrimaryBrowserException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit.exceptions; 2 | 3 | import info.novatec.testit.webtester.junit.annotations.Primary; 4 | 5 | 6 | @SuppressWarnings("serial") 7 | public class NoPrimaryBrowserException extends IllegalTestClassStructureException { 8 | 9 | private static final String MESSAGE = 10 | "There are more then one managed browsers. For the feature you wanted to use a primary browser needs to be declared. Use @" 11 | + Primary.class.getSimpleName() + " to declare on of your browsers as primary."; 12 | 13 | public NoPrimaryBrowserException() { 14 | super(MESSAGE); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/LinkText.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#linkText(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class LinkText implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.linkText(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Link Text"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/NameTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class NameTest { 10 | 11 | Name cut = new Name(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("name"); 16 | assertThat(by).isInstanceOf(By.ByName.class); 17 | assertThat(by).hasToString("By.name: name"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("Name"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/waiting/WaitingActionTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | class WaitingActionTest { 8 | 9 | @Test 10 | void doesntAllowNullForActionCondition() { 11 | assertThrows(NullPointerException.class, () -> new WaitingAction(null, null)); 12 | } 13 | 14 | @Test 15 | void doNothingReturnsFalseAndNull() { 16 | WaitingAction result = WaitingAction.doNothing(); 17 | assertAll( 18 | () -> assertFalse(result.getActionCondition().get()), 19 | () -> assertNull(result.getAction()) 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/ClassName.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#className(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class ClassName implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.className(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Class Name"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/OpenedUrlEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class OpenedUrlEventTest { 9 | 10 | @Test 11 | public void urlCanBeRetrieved() { 12 | OpenedUrlEvent event = new OpenedUrlEvent("http://foo.bar"); 13 | assertThat(event.getUrl()).isEqualTo("http://foo.bar"); 14 | } 15 | 16 | @Test 17 | public void descriptionIsGeneratedCorrectly() { 18 | OpenedUrlEvent event = new OpenedUrlEvent("http://foo.bar"); 19 | assertThat(event.describe()).isEqualTo("opened url: 'http://foo.bar'"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-documentation/src/main/asciidoc/chapters/support-module-assertj3.asciidoc: -------------------------------------------------------------------------------- 1 | === AssertJ 3 Assertions 2 | 3 | The support module `webtester-support-assertj3` provides AssertJ 3 assertion 4 | implementations for many properties of page fragments: 5 | 6 | * `ButtonAssert` 7 | * `GenericTextFieldAssert` 8 | * `MultiSelectAssert` 9 | * `PageFragmentAssert` 10 | * `SelectableAssert` 11 | * `SingleSelectAssert` 12 | 13 | All of these can be accessed through a single utility class named 14 | `WebTesterAssertions`. Which extends AssertJ's Assertions class and therefore 15 | provides all of AssertJ's default assertions as well. 16 | 17 | [source, java] 18 | ---- 19 | TextField username = ...; 20 | WebTesterAssertions.assertThat(username).hasText("fooUser"); 21 | ---- 22 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/IFrame.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.pagefragments.annotations.Attribute; 6 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 7 | 8 | 9 | @Mapping(tag = "iframe") 10 | public interface IFrame extends PageFragment { 11 | 12 | /** 13 | * Returns the src attribute's value as an optional string. 14 | * 15 | * @return the optional value of the src attribute 16 | * @see Attribute 17 | * @see Optional 18 | * @since 2.0 19 | */ 20 | @Attribute("src") 21 | Optional getSourcePath(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/TagNameTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class TagNameTest { 10 | 11 | TagName cut = new TagName(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("tag"); 16 | assertThat(by).isInstanceOf(By.ByTagName.class); 17 | assertThat(by).hasToString("By.tagName: tag"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("Tag Name"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/XPathTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class XPathTest { 10 | 11 | XPath cut = new XPath(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("//div/a[1]"); 16 | assertThat(by).isInstanceOf(By.ByXPath.class); 17 | assertThat(by).hasToString("By.xpath: //div/a[1]"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("XPath"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/listItem.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

ListItem Test Page

9 |

This page contains elements for testing the functionality of the ListItem page fragment classes.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
An a list item 19 |
    20 |
  1. This is a list item
  2. 21 |
22 |
Not a list itemThis is not a list item
30 | 31 |

32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pages/exceptions/PageMustBeInterfaceException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pages.exceptions; 2 | 3 | import info.novatec.testit.webtester.internal.implementation.exceptions.DynamicImplementationException; 4 | import info.novatec.testit.webtester.pages.Page; 5 | 6 | 7 | public class PageMustBeInterfaceException extends DynamicImplementationException { 8 | 9 | private static final String MESSAGE = 10 | "The page '%s' is not an interface! Only interfaces can be implemented by WebTester."; 11 | 12 | public PageMustBeInterfaceException(Class type) { 13 | super(String.format(MESSAGE, type.getCanonicalName())); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/PartialLinkText.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#partialLinkText(String)}. 10 | * 11 | * @see ByProducer 12 | * @since 2.0 13 | */ 14 | public class PartialLinkText implements ByProducer { 15 | 16 | @Override 17 | public By createBy(String value) { 18 | return By.partialLinkText(value); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "Partial Link Text"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/LinkTextTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class LinkTextTest { 10 | 11 | LinkText cut = new LinkText(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("a link"); 16 | assertThat(by).isInstanceOf(By.ByLinkText.class); 17 | assertThat(by).hasToString("By.linkText: a link"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("Link Text"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Form Test Page

9 |

This page contains elements for testing the functionality of the Form page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
A Form 19 |
20 | 21 | 22 |
23 |
Not a FormThis is not a DIV
31 | 32 |

33 |
34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/browser/proxy/NoProxyConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.browser.proxy; 2 | 3 | import static org.mockito.Mockito.verifyNoInteractions; 4 | 5 | import org.junit.Test; 6 | import org.junit.runner.RunWith; 7 | import org.mockito.InjectMocks; 8 | import org.mockito.Mock; 9 | import org.mockito.junit.MockitoJUnitRunner; 10 | import org.openqa.selenium.Proxy; 11 | 12 | @RunWith(MockitoJUnitRunner.class) 13 | public class NoProxyConfigurationTest { 14 | 15 | @Mock 16 | Proxy proxy; 17 | @InjectMocks 18 | NoProxyConfiguration cut; 19 | 20 | @Test 21 | public void proxyIsNotTouchedInAnyWay() { 22 | cut.configureProxy(proxy); 23 | verifyNoInteractions(proxy); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-documentation/src/main/asciidoc/chapters/annotations-named.asciidoc: -------------------------------------------------------------------------------- 1 | === @Named 2 | 3 | This annotation can be added to `@IdentifyUsing` annotated `PageFragment` 4 | returning methods of `Page` or `PageFragment` subclasses in order to override 5 | the name of the returned fragment. 6 | 7 | _Collections of fragments can't be named at the moment!_ 8 | 9 | This is useful in cases where the element IDs are not very clear or event 10 | cryptic. The name is used in any logs where the fragment is referenced. As well 11 | as events fired by the framework. 12 | 13 | *Example* 14 | 15 | [source, java] 16 | ---- 17 | public interface FooPage extends Page { 18 | 19 | @Named("The Foo Widget 42") 20 | @IdentifyUsing("#foo") 21 | FooWidget widget(); 22 | 23 | ... 24 | 25 | } 26 | ---- 27 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/NoTestClassException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions; 2 | 3 | import org.junit.jupiter.api.extension.Extension; 4 | import org.junit.jupiter.api.extension.ExtensionContext; 5 | 6 | import info.novatec.testit.webtester.junit5.WebTesterJUnitSupportException; 7 | 8 | 9 | /** 10 | * This exception is thrown in case any of WebTester's {@link Extension Extensions} is executed with {@link ExtensionContext} 11 | * without a test class. 12 | * 13 | * @since 2.1 14 | */ 15 | public class NoTestClassException extends WebTesterJUnitSupportException { 16 | 17 | public NoTestClassException() { 18 | super("There is no test class in the extension context!"); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/ClassNameTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class ClassNameTest { 10 | 11 | ClassName cut = new ClassName(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("some-class"); 16 | assertThat(by).isInstanceOf(By.ByClassName.class); 17 | assertThat(by).hasToString("By.className: some-class"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("Class Name"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/CssSelectorTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class CssSelectorTest { 10 | 11 | CssSelector cut = new CssSelector(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("#id"); 16 | assertThat(by).isInstanceOf(By.ByCssSelector.class); 17 | assertThat(by).hasToString("By.cssSelector: #id"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("CSS Selector"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/AcceptedAlertEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class AcceptedAlertEventTest { 9 | 10 | @Test 11 | public void alertMessageCanBeRetrieved() { 12 | AcceptedAlertEvent event = new AcceptedAlertEvent("hello world"); 13 | assertThat(event.getAlertMessage()).isEqualTo("hello world"); 14 | } 15 | 16 | @Test 17 | public void descriptionIsGeneratedCorrectly() { 18 | AcceptedAlertEvent event = new AcceptedAlertEvent("hello world"); 19 | assertThat(event.describe()).isEqualTo("accepted an alert with message: 'hello world'"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/DeclinedAlertEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class DeclinedAlertEventTest { 9 | 10 | @Test 11 | public void alertMessageCanBeRetrieved() { 12 | DeclinedAlertEvent event = new DeclinedAlertEvent("hello world"); 13 | assertThat(event.getAlertMessage()).isEqualTo("hello world"); 14 | } 15 | 16 | @Test 17 | public void descriptionIsGeneratedCorrectly() { 18 | DeclinedAlertEvent event = new DeclinedAlertEvent("hello world"); 19 | assertThat(event.describe()).isEqualTo("declined an alert with message: 'hello world'"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/image.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Image Test Page

9 |

This page contains elements for testing the functionality of the Image page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
A simple image 19 | 20 | some image 21 | 22 |
Not an ImageThis is not an Image
30 | 31 |

32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/UnknownConfigurationKeyException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions; 2 | 3 | import lombok.Getter; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * This exception is thrown in case no value for a given key could be found in a {@link Configuration}. 10 | * 11 | * @since 2.1 12 | */ 13 | @Getter 14 | public class UnknownConfigurationKeyException extends TestClassFormatException { 15 | 16 | /** The unknown configuration key. */ 17 | private final String key; 18 | 19 | public UnknownConfigurationKeyException(String key) { 20 | super("No value found for configuration key: '" + key + "'"); 21 | this.key = key; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pagefragments/exceptions/PageFragmentCreationException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pagefragments.exceptions; 2 | 3 | import info.novatec.testit.webtester.internal.implementation.exceptions.DynamicImplementationException; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | public class PageFragmentCreationException extends DynamicImplementationException { 8 | 9 | private static final String MESSAGE = "Could not create instance of '%s':"; 10 | 11 | public PageFragmentCreationException(Class pageFragmentType, Throwable cause) { 12 | super(String.format(MESSAGE, pageFragmentType.getCanonicalName()), cause); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/SwitchedToWindowEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class SwitchedToWindowEventTest { 9 | 10 | @Test 11 | public void windowHandleCanBeRetrieved() { 12 | SwitchedToWindowEvent event = new SwitchedToWindowEvent("handle"); 13 | assertThat(event.getNameOrHandle()).isSameAs("handle"); 14 | } 15 | 16 | @Test 17 | public void descriptionIsGeneratedCorrectly() { 18 | SwitchedToWindowEvent event = new SwitchedToWindowEvent("handle"); 19 | assertThat(event.describe()).isEqualTo("switched to frame using name or handle: 'handle'"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Enabled.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | /** 8 | * {@link Condition} to be used in order to check if a {@link PageFragment page fragment} is enabled. 9 | * 10 | * @see Condition 11 | * @see PageFragment#isEnabled() 12 | * @since 2.0 13 | */ 14 | public class Enabled implements Condition { 15 | 16 | @Override 17 | public boolean test(PageFragment canBeDisabled) { 18 | return canBeDisabled.isEnabled(); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "enabled"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Present.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | /** 8 | * {@link Condition} to be used in order to check if a {@link PageFragment page fragment} is present. 9 | * 10 | * @see Condition 11 | * @see PageFragment#isPresent() 12 | * @since 2.0 13 | */ 14 | public class Present implements Condition { 15 | 16 | @Override 17 | public boolean test(PageFragment pageFragment) { 18 | return pageFragment.isPresent(); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "present"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Visible.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | /** 8 | * {@link Condition} to be used in order to check if a {@link PageFragment page fragment} is visible. 9 | * 10 | * @see Condition 11 | * @see PageFragment#isVisible() 12 | * @since 2.0 13 | */ 14 | public class Visible implements Condition { 15 | 16 | @Override 17 | public boolean test(PageFragment pageFragment) { 18 | return pageFragment.isVisible(); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "visible"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/features/identify-using.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

@IdentifyUsing Test Page

9 |

This page contains elements for testing the functionality of the @IdentifyUsing annotation.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
First TextField
Second TextField
Third TextField
30 | 31 |

32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Disabled.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | /** 8 | * {@link Condition} to be used in order to check if a {@link PageFragment page fragment} is disabled. 9 | * 10 | * @see Condition 11 | * @see PageFragment#isDisabled() 12 | * @since 2.0 13 | */ 14 | public class Disabled implements Condition { 15 | 16 | @Override 17 | public boolean test(PageFragment canBeDisabled) { 18 | return canBeDisabled.isDisabled(); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "disabled"; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/mapping/MappingException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.mapping; 2 | 3 | import info.novatec.testit.webtester.WebTesterException; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 6 | import info.novatec.testit.webtester.pagefragments.annotations.Mappings; 7 | 8 | 9 | /** 10 | * This exception is thrown in case a {@link PageFragment} instance does not comply with the defined {@link Mapping}. 11 | * 12 | * @see Mapping 13 | * @see Mappings 14 | * @since 2.0 15 | */ 16 | public class MappingException extends WebTesterException { 17 | 18 | public MappingException(String message) { 19 | super(message); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/IdEndsWithTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class IdEndsWithTest { 10 | 11 | IdEndsWith cut = new IdEndsWith(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy(":partial-id"); 16 | assertThat(by).isInstanceOf(By.ByCssSelector.class); 17 | assertThat(by).hasToString("By.cssSelector: [id$='\\:partial\\-id']"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("ID Ends With"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/CurrentThreadSleeper.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | 6 | /** 7 | * This implementation of {@link Sleeper} will execute the sleep on the current {@link Thread}. 8 | * 9 | * @see Sleeper 10 | * @since 2.0 11 | */ 12 | @Slf4j 13 | class CurrentThreadSleeper implements Sleeper { 14 | 15 | @Override 16 | public void sleep(long milliseconds) throws InterruptionException { 17 | try { 18 | log.trace("sleeping for {}ms ...", milliseconds); 19 | Thread.sleep(milliseconds); 20 | log.trace("... done sleeping"); 21 | } catch (java.lang.InterruptedException e) { 22 | throw new InterruptionException(e); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/NoManagedBrowserForNameException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions; 2 | 3 | import lombok.Getter; 4 | 5 | import info.novatec.testit.webtester.browser.Browser; 6 | 7 | 8 | /** 9 | * This exception is thrown in case there is no managed {@link Browser} with a given name when execution an extension. 10 | * 11 | * @since 2.1 12 | */ 13 | @Getter 14 | public class NoManagedBrowserForNameException extends TestClassFormatException { 15 | 16 | /** The name of the browser that wasn't found. */ 17 | private final String name; 18 | 19 | public NoManagedBrowserForNameException(String name) { 20 | super("There is no managed browser with the name: " + name); 21 | this.name = name; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/IdStartsWithTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class IdStartsWithTest { 10 | 11 | IdStartsWith cut = new IdStartsWith(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("partial-id:"); 16 | assertThat(by).isInstanceOf(By.ByCssSelector.class); 17 | assertThat(by).hasToString("By.cssSelector: [id^='partial\\-id\\:']"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("ID Starts With"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/genericList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

GenericList Test Page

9 |

This page contains elements for testing the functionality of the GenericList page fragment class.

10 | 11 |
12 |

13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
An ordered list without items
    An unordered list without items
      Not a ListThis is not a List
      30 | 31 |

      32 |
      33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/waiting/WaitAction.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.waiting; 2 | 3 | /** 4 | * Action interface (SAM) based on the {@link Runnable} interface. 5 | * It is not intended to be directly implemented but instead used to run a lambda provieded method. 6 | * 7 | * Example usage: 8 | *
       9 |  * public void preparingMethod() {
      10 |  *     executingMethod(() -> doSomething());
      11 |  * }
      12 |  *
      13 |  * public void executingMethod(UIAction action) {
      14 |  *     action.perform();
      15 |  * }
      16 |  * 
      17 | * 18 | * @see WaitingAction 19 | * @see Waiter 20 | * @since 2.8 21 | */ 22 | @FunctionalInterface 23 | public interface WaitAction { 24 | 25 | /** 26 | * SAM for execution. 27 | * 28 | * @since 2.8 29 | */ 30 | void perform(); 31 | } 32 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/pagefragments/identification/producers/PartialLinkTextTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | import org.openqa.selenium.By; 7 | 8 | 9 | public class PartialLinkTextTest { 10 | 11 | PartialLinkText cut = new PartialLinkText(); 12 | 13 | @Test 14 | public void producesCorrectBy() { 15 | By by = cut.createBy("partial link"); 16 | assertThat(by).isInstanceOf(By.ByPartialLinkText.class); 17 | assertThat(by).hasToString("By.partialLinkText: partial link"); 18 | } 19 | 20 | @Test 21 | public void hasCorrectToString() { 22 | assertThat(cut).hasToString("Partial Link Text"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-documentation/src/main/asciidoc/chapters/annotations-action.asciidoc: -------------------------------------------------------------------------------- 1 | === @Action 2 | 3 | This annotation can be added to methods of `Page` or `PageFragment` subclasses 4 | in order to mark these methods as actions. Currently the only effect of this 5 | annotation the option to delay the execution of annotated methods by setting the 6 | property `actions.deceleration` to a certain amount of milliseconds. 7 | 8 | *Examples* 9 | 10 | [source, java] 11 | ---- 12 | // actions work on pages... 13 | public interface FooPage extends Page { 14 | 15 | @Action 16 | default void doSomething() { 17 | ... 18 | } 19 | 20 | } 21 | 22 | // ... as well as on page fragments 23 | public interface BarFragment extends PageFragment { 24 | 25 | @Action 26 | default void doSomething() { 27 | ... 28 | } 29 | 30 | } 31 | ---- 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pagefragments/exceptions/PageFragmentMustBeInterfaceException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pagefragments.exceptions; 2 | 3 | import info.novatec.testit.webtester.internal.implementation.exceptions.DynamicImplementationException; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | public class PageFragmentMustBeInterfaceException extends DynamicImplementationException { 8 | 9 | private static final String MESSAGE = 10 | "The page fragment '%s' is not an interface! Only interfaces can be implemented by WebTester."; 11 | 12 | public PageFragmentMustBeInterfaceException(Class type) { 13 | super(String.format(MESSAGE, type.getCanonicalName())); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/features/wait-annotation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Feature: Mouse Utilities 5 | 6 | 7 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 |
      Will become visible after 500ms 23 | 24 |
      27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/LongUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link Long} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class LongUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return Long.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getLongProperty(key); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/collections/NotEmpty.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.collections; 2 | 3 | import java.util.Collection; 4 | 5 | import info.novatec.testit.webtester.conditions.Condition; 6 | import info.novatec.testit.webtester.pagefragments.PageFragment; 7 | 8 | 9 | /** 10 | * {@link Condition} to be used in order to check if a collection of {@link PageFragment page fragments} is NOT empty. 11 | * 12 | * @see Condition 13 | * @since 2.3 14 | */ 15 | public class NotEmpty implements Condition> { 16 | 17 | @Override 18 | public boolean test(Collection pageFragments) { 19 | return !pageFragments.isEmpty(); 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return "not empty"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/checkbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      Checkbox Test Page

      9 |

      This page contains elements for testing the functionality of the Checkbox page fragment class.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
      A selected checkbox
      A de-selected checkbox
      Not a Checkbox
      30 | 31 |

      32 |
      33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/DoubleUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link Double} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class DoubleUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return Double.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getDoubleProperty(key); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/FloatUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link Float} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class FloatUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return Float.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getFloatProperty(key); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/identification/producers/CssSelector.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments.identification.producers; 2 | 3 | import org.openqa.selenium.By; 4 | 5 | import info.novatec.testit.webtester.pagefragments.identification.ByProducer; 6 | 7 | 8 | /** 9 | * This {@link ByProducer} produces a {@link By} using {@link By#cssSelector(String)}. 10 | *

      11 | * Important: Don't forget to escape special characters when using this selector! 12 | * 13 | * @see ByProducer 14 | * @since 2.0 15 | */ 16 | public class CssSelector implements ByProducer { 17 | 18 | @Override 19 | public By createBy(String value) { 20 | return By.cssSelector(value); 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "CSS Selector"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/annotations/attribute-injection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      Attribute Injection Test Page

      9 |

      This page contains elements for testing the @Attribute annotation.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 30 | 31 | 32 |
      Attributed DIV 19 |
      27 | A DIV with different attributes: boolean, int, long, float, double, string 28 |
      29 |
      33 | 34 |

      35 |
      36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/StringUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link String} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class StringUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return String.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getStringProperty(key); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/eventlisteners/StaticEventListenerFieldsNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.eventlisteners; 2 | 3 | import java.lang.reflect.Field; 4 | 5 | import lombok.Getter; 6 | 7 | import info.novatec.testit.webtester.junit5.extensions.TestClassFormatException; 8 | 9 | 10 | /** 11 | * This exception is thrown in case a static field was wrongfully annotated with the {@link Registered} annotation. 12 | * 13 | * @since 2.2 14 | */ 15 | @Getter 16 | public class StaticEventListenerFieldsNotSupportedException extends TestClassFormatException { 17 | 18 | public StaticEventListenerFieldsNotSupportedException(Field field) { 19 | super("@" + Registered.class.getSimpleName() + " page fields must not be static: " + field); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/ClosedBrowserEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.Browser; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a browser was closed. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see Browser#close() 17 | * @since 2.0 18 | */ 19 | @SuppressWarnings("serial") 20 | public class ClosedBrowserEvent extends AbstractEvent { 21 | 22 | @Override 23 | public String describe() { 24 | return "closed browser"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/numberField.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      NumberField Test Page

      9 |

      This page contains elements for testing the functionality of the NumberField page fragment class.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
      An empty number field
      A number field with a preset value
      Not a number field
      30 | 31 |

      32 |
      33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Invisible.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | 6 | 7 | /** 8 | * {@link Condition} to be used in order to check if a {@link PageFragment page fragment} is invisible. 9 | * 10 | * @see Condition 11 | * @see PageFragment#isVisible() 12 | * @since 2.0 13 | */ 14 | public class Invisible implements Condition { 15 | 16 | private Visible visible = new Visible(); 17 | 18 | @Override 19 | public boolean test(PageFragment pageFragment) { 20 | return !visible.test(pageFragment); 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "invisible"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/BooleanUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link Boolean} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class BooleanUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return Boolean.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getBooleanProperty(key); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/configuration/unmarshaller/IntegerUnmarshaller.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.configuration.unmarshaller; 2 | 3 | import java.util.Optional; 4 | 5 | import info.novatec.testit.webtester.config.Configuration; 6 | 7 | 8 | /** 9 | * {@link ConfigurationUnmarshaller} which returns {@link Integer} values. 10 | * 11 | * @see ConfigurationUnmarshaller 12 | * @since 2.1 13 | */ 14 | public class IntegerUnmarshaller implements ConfigurationUnmarshaller { 15 | 16 | @Override 17 | public boolean canHandle(Class type) { 18 | return Integer.class.equals(type); 19 | } 20 | 21 | @Override 22 | public Optional unmarshal(Configuration config, String key) { 23 | return config.getIntegerProperty(key); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/EventListener.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events; 2 | 3 | /** 4 | * Defines a listener that can be registered at the {@link DispatchingEventSystem event system}. 5 | *

      6 | * If an {@link Event event} is reported by the system the {@link #eventOccurred(Event)} method of all registered 7 | * listeners is invoked. 8 | * 9 | * @see Event 10 | * @see DispatchingEventSystem 11 | * @since 2.0 12 | */ 13 | public interface EventListener { 14 | 15 | /** 16 | * This method will be called if any {@link Event event} is reported by the {@link DispatchingEventSystem event system}. 17 | * 18 | * @param event the {@link Event event} that occurred. 19 | * @see Event 20 | * @see DispatchingEventSystem 21 | * @since 2.0 22 | */ 23 | void eventOccurred(Event event); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/annotations/visible.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

      @Visible Test Page

      6 |

      This page contains elements for testing the functionality of 7 | the @Visible annotation.

      8 | 9 |
      10 |
      11 |
      12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 | 28 |
      A simple text field
      Multiple text fields - one invisible 22 |
      23 |
      24 | 25 |
      29 | 30 |
      31 |
      32 |
      33 | 34 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/radioButton.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      RadioButton Test Page

      9 |

      This page contains elements for testing the functionality of the RadioButton page fragment class.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
      A selected radio button
      A de-selected radio button
      Not a radio button
      30 | 31 |

      32 |
      33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/browsers/NonUniqueBrowserNameException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.browsers; 2 | 3 | import lombok.Getter; 4 | 5 | import info.novatec.testit.webtester.browser.Browser; 6 | import info.novatec.testit.webtester.junit5.extensions.TestClassFormatException; 7 | 8 | 9 | /** 10 | * This exception is thrown in case there is more than one {@link Managed} {@link Browser} field declared. 11 | * 12 | * @since 2.1 13 | */ 14 | @Getter 15 | public class NonUniqueBrowserNameException extends TestClassFormatException { 16 | 17 | private final String name; 18 | 19 | public NonUniqueBrowserNameException(String name) { 20 | super("Every browser needs a unique name! There are multiple browsers declared for: " + name); 21 | this.name = name; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/features/must-be-with-wait.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Feature: @PostConstructMustBe Trigger 5 | 6 | 7 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/ClosedWindowEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.CurrentWindow; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a window was closed. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see CurrentWindow#close() 17 | * @since 2.0 18 | */ 19 | @SuppressWarnings("serial") 20 | public class ClosedWindowEvent extends AbstractEvent { 21 | 22 | @Override 23 | public String describe() { 24 | return "closed window"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/conditions/values/EqualToTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.values; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class EqualToTest { 9 | 10 | @Test 11 | public void equalValuesEvaluatesToTrue() { 12 | EqualTo equalTo = new EqualTo<>("foo"); 13 | assertThat(equalTo.test("foo")).isTrue(); 14 | } 15 | 16 | @Test 17 | public void unequalValuesEvaluatesToFalse() { 18 | EqualTo equalTo = new EqualTo<>("foo"); 19 | assertThat(equalTo.test("bar")).isFalse(); 20 | } 21 | 22 | @Test 23 | public void toStringIsGeneratedCorrectly() { 24 | EqualTo equalTo = new EqualTo<>("foo"); 25 | assertThat(equalTo).hasToString("equalTo('foo')"); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/RefreshedPageEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.CurrentWindow; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a page was refreshed. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see CurrentWindow#refresh() 17 | * @since 2.0 18 | */ 19 | @SuppressWarnings("serial") 20 | public class RefreshedPageEvent extends AbstractEvent { 21 | 22 | @Override 23 | public String describe() { 24 | return "refreshed the page"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/implementation/pagefragments/DynamicWebElementSupplier.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal.implementation.pagefragments; 2 | 3 | import java.util.function.Supplier; 4 | 5 | import org.openqa.selenium.By; 6 | import org.openqa.selenium.SearchContext; 7 | import org.openqa.selenium.WebElement; 8 | 9 | 10 | public class DynamicWebElementSupplier implements Supplier { 11 | 12 | private final Supplier searchContextSupplier; 13 | private final By by; 14 | 15 | public DynamicWebElementSupplier(Supplier searchContextSupplier, By by) { 16 | this.searchContextSupplier = searchContextSupplier; 17 | this.by = by; 18 | } 19 | 20 | @Override 21 | public WebElement get() { 22 | return searchContextSupplier.get().findElement(by); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/MaximizedWindowEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.CurrentWindow; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a window was maximized. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see CurrentWindow#maximize() 17 | * @since 2.0 18 | */ 19 | @SuppressWarnings("serial") 20 | public class MaximizedWindowEvent extends AbstractEvent { 21 | 22 | @Override 23 | public String describe() { 24 | return "maximized window"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/conditions/conditions_readonly.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 |

      Condition: ReadOnly Test Page

      15 |

      This page contains elements for testing the functionality of the Wait API Condition 'ReadOnly'.

      16 | 17 |
      18 |

      19 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 |
      Will be read-only until checkbox is checked
      25 | 26 | 27 |
      28 |
      32 | 33 |

      34 |
      35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /webtester-support-assertj3/src/test/java/info/novatec/testit/webtester/support/assertj/assertions/AbstractWebTesterAssertTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.support.assertj.assertions; 2 | 3 | import org.assertj.core.api.Assertions; 4 | import org.junit.jupiter.api.Nested; 5 | import org.junit.jupiter.api.Test; 6 | 7 | 8 | class AbstractWebTesterAssertTest { 9 | 10 | @Nested 11 | class AssertionsProvideFluentApi { 12 | 13 | @Test 14 | void and() { 15 | TestAssert original = new TestAssert("foo"); 16 | TestAssert returned = original.and(); 17 | Assertions.assertThat(returned).isSameAs(original); 18 | } 19 | 20 | } 21 | 22 | private static class TestAssert extends AbstractWebTesterAssert { 23 | 24 | TestAssert(String actual) { 25 | super(actual, TestAssert.class); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /webtester-documentation/src/main/asciidoc/chapters/kotlin.asciidoc: -------------------------------------------------------------------------------- 1 | == Kotlin 2 | 3 | Since version 2.3 WebTester supports the use of Kotlin. Up until then the 4 | declarative nature of WebTester would not work with the way Kotlin is implementing 5 | default methods on interfaces. 6 | 7 | In order to work with Kotlin, you must add the `webtester-kotlin` module to your 8 | test dependencies. Within this module you'll find two classes: 9 | 10 | * `info.novatec.testit.webtester.kotlin.pages.Page` 11 | * `info.novatec.testit.webtester.kotlin.pagefragments.PageFragment` 12 | 13 | Both of these are alias classes for their corresponding Java counterparts. 14 | In addition to providing a more Kotlin-esk API, their use will also act as 15 | a flag for WebTester to consider Kotlin when it's generating code. 16 | 17 | Other than using these special classes when creating pages and page fragments, 18 | everything else should work the same as with Java. 19 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/browser/proxy/ProxyConfiguration.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.browser.proxy; 2 | 3 | import org.openqa.selenium.Proxy; 4 | 5 | import info.novatec.testit.webtester.browser.BrowserFactory; 6 | 7 | 8 | /** 9 | * Classes implementing this interface are used to configure a {@link Proxy 10 | * proxy}. They can be provided when initializing a browser via a 11 | * {@link BrowserFactory factory}. 12 | * 13 | * @see Proxy 14 | * @see BrowserFactory 15 | * @see NoProxyConfiguration 16 | * @since 2.0 17 | */ 18 | public interface ProxyConfiguration { 19 | 20 | /** 21 | * This is called after the {@link Proxy proxy} object was initialized by 22 | * the framework. The given proxy should be configured as needed. 23 | * 24 | * @param proxy the proxy object to configure 25 | * @since 2.0 26 | */ 27 | void configureProxy(Proxy proxy); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/tableField.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      TableField Test Page

      9 |

      This page contains elements for testing the functionality of TableField page fragment class.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
      A table with multiple fields 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
      foobar
      foobar
      29 |
      Not a TableFieldThis is not a TableField
      37 | 38 |

      39 |
      40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /webtester-support-junit5/src/main/java/info/novatec/testit/webtester/junit5/extensions/pages/StaticPageFieldsNotSupportedException.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.junit5.extensions.pages; 2 | 3 | import java.lang.reflect.Field; 4 | 5 | import lombok.Getter; 6 | 7 | import info.novatec.testit.webtester.junit5.extensions.TestClassFormatException; 8 | 9 | 10 | /** 11 | * This exception is thrown in case a static field was wrongfully annotated with the {@link Initialized} annotation. 12 | * 13 | * @since 2.1 14 | */ 15 | @Getter 16 | public class StaticPageFieldsNotSupportedException extends TestClassFormatException { 17 | 18 | /** The static field in question. */ 19 | private final Field field; 20 | 21 | public StaticPageFieldsNotSupportedException(Field field) { 22 | super("@" + Initialized.class.getSimpleName() + " page fields must not be static: " + field); 23 | this.field = field; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/conditions/pagefragments/Selected.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.pagefragments; 2 | 3 | import info.novatec.testit.webtester.conditions.Condition; 4 | import info.novatec.testit.webtester.pagefragments.PageFragment; 5 | import info.novatec.testit.webtester.pagefragments.traits.Selectable; 6 | 7 | 8 | /** 9 | * {@link Condition} to be used in order to check if the {@link Selectable selectable} {@link PageFragment page fragment} is 10 | * selected. 11 | * 12 | * @see Condition 13 | * @see Selectable 14 | * @see Selectable#isSelected() 15 | * @since 2.0 16 | */ 17 | public class Selected implements Condition { 18 | 19 | @Override 20 | public boolean test(Selectable selectable) { 21 | return selectable.isSelected(); 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "selected"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/browser/operations/BaseBrowserOperation.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.browser.operations; 2 | 3 | import org.openqa.selenium.WebDriver; 4 | 5 | import lombok.NonNull; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | import info.novatec.testit.webtester.browser.Browser; 9 | import info.novatec.testit.webtester.config.Configuration; 10 | import info.novatec.testit.webtester.events.EventSystem; 11 | 12 | @RequiredArgsConstructor 13 | class BaseBrowserOperation { 14 | 15 | @NonNull 16 | private final Browser browser; 17 | 18 | Browser browser() { 19 | return browser; 20 | } 21 | 22 | Configuration configuration() { 23 | return browser.configuration(); 24 | } 25 | 26 | WebDriver webDriver() { 27 | return browser.webDriver(); 28 | } 29 | 30 | EventSystem events() { 31 | return browser().events(); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/conditions/collections/NotEmptyTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.conditions.collections; 2 | 3 | import static java.util.Collections.emptyList; 4 | import static java.util.Collections.singletonList; 5 | import static org.assertj.core.api.Assertions.assertThat; 6 | import static org.mockito.Mockito.mock; 7 | 8 | import org.junit.jupiter.api.Test; 9 | 10 | import info.novatec.testit.webtester.pagefragments.PageFragment; 11 | 12 | 13 | class NotEmptyTest { 14 | 15 | NotEmpty cut = new NotEmpty(); 16 | 17 | @Test 18 | void emptyCollectionEvaluatesToFalse() { 19 | boolean result = cut.test(emptyList()); 20 | assertThat(result).isFalse(); 21 | } 22 | 23 | @Test 24 | void collectionWithOneElementEvaluatesToTrue() { 25 | boolean result = cut.test(singletonList(mock(PageFragment.class))); 26 | assertThat(result).isTrue(); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/SwitchedToDefaultContentEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.FocusSetter; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a switch to the default content occurred. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see FocusSetter#onDefaultContent() 17 | * @since 2.0 18 | */ 19 | @SuppressWarnings("serial") 20 | public class SwitchedToDefaultContentEvent extends AbstractEvent { 21 | 22 | @Override 23 | public String describe() { 24 | return "switched to default content"; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/internal/ClasspathUtils.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.internal; 2 | 3 | public final class ClasspathUtils { 4 | 5 | public static final String KOTLIN_PAGE_CLASS = "info.novatec.testit.webtester.kotlin.pages.Page"; 6 | public static final String KOTLIN_PAGE_FRAGMENT_CLASS = 7 | "info.novatec.testit.webtester.kotlin.pagefragments.PageFragment"; 8 | 9 | public static final boolean KOTLIN_AVAILABLE = isClassAvailable("kotlin.KotlinVersion"); 10 | public static final boolean KOTLIN_MODULE_LOADED = 11 | isClassAvailable(KOTLIN_PAGE_CLASS) && isClassAvailable(KOTLIN_PAGE_FRAGMENT_CLASS); 12 | 13 | private static boolean isClassAvailable(String className) { 14 | try { 15 | Class.forName(className); 16 | return true; 17 | } catch (ClassNotFoundException e) { 18 | return false; 19 | } 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /webtester-core/src/test/resources/html/pagefragments/genericElement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

      GenericElement Test Page

      9 |

      This page contains elements for testing the functionality of the GenericElement page fragment class.

      10 | 11 |
      12 |

      13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 36 | 37 | 38 |
      A Button 19 | 20 |
      A TextField 25 | 26 |
      A Form 31 |
      32 | 33 | 34 |
      35 |
      39 | 40 |

      41 |
      42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /webtester-core/src/test/java/info/novatec/testit/webtester/events/browser/SetWindowSizeEventTest.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import static org.assertj.core.api.Assertions.assertThat; 4 | 5 | import org.junit.Test; 6 | 7 | 8 | public class SetWindowSizeEventTest { 9 | 10 | @Test 11 | public void widthCanBeRetrieved() { 12 | SetWindowSizeEvent event = new SetWindowSizeEvent(10, 15); 13 | assertThat(event.getWidth()).isEqualTo(10); 14 | } 15 | 16 | @Test 17 | public void heightCanBeRetrieved() { 18 | SetWindowSizeEvent event = new SetWindowSizeEvent(10, 15); 19 | assertThat(event.getHeight()).isEqualTo(15); 20 | } 21 | 22 | @Test 23 | public void descriptionIsGeneratedCorrectly() { 24 | SetWindowSizeEvent event = new SetWindowSizeEvent(10, 15); 25 | assertThat(event.describe()).isEqualTo("set window size: width=10, height=15"); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/NavigatedForwardsEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.Navigator; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a navigate forward was executed. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see Navigator#forwards() 17 | * @see Navigator#forwards(int) 18 | * @since 2.0 19 | */ 20 | @SuppressWarnings("serial") 21 | public class NavigatedForwardsEvent extends AbstractEvent { 22 | 23 | @Override 24 | public String describe() { 25 | return "navigated forward in the browser history"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/events/browser/NavigatedBackwardsEvent.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.events.browser; 2 | 3 | import info.novatec.testit.webtester.browser.operations.Navigator; 4 | import info.novatec.testit.webtester.events.AbstractEvent; 5 | import info.novatec.testit.webtester.events.Event; 6 | import info.novatec.testit.webtester.events.EventListener; 7 | import info.novatec.testit.webtester.events.EventSystem; 8 | 9 | 10 | /** 11 | * This {@link Event event} occurs whenever a navigate backwards was executed. 12 | * 13 | * @see Event 14 | * @see EventListener 15 | * @see EventSystem 16 | * @see Navigator#backwards() 17 | * @see Navigator#backwards(int) 18 | * @since 2.0 19 | */ 20 | @SuppressWarnings("serial") 21 | public class NavigatedBackwardsEvent extends AbstractEvent { 22 | 23 | @Override 24 | public String describe() { 25 | return "navigated back in the browser history"; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/TextArea.java: -------------------------------------------------------------------------------- 1 | package info.novatec.testit.webtester.pagefragments; 2 | 3 | import info.novatec.testit.webtester.pagefragments.annotations.Attribute; 4 | import info.novatec.testit.webtester.pagefragments.annotations.Mapping; 5 | 6 | 7 | @Mapping(tag = "textarea") 8 | public interface TextArea extends GenericTextField