Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#41.update.neo.5.1 #42

Merged
merged 19 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
build
/.allure/
dev-*.properties
temp-*.properties
.idea
141 changes: 114 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,98 @@
# Introduction
This repository is a Showcase project to demonstrate the usage of several features of the [Neodymium Library](https://github.com/Xceptance/neodymium-library).

To use Neodymium features in test development as intended from the very beginning on without struggling around with several required configurations each show case explains the approach technology, the implementation options as well as the belonging configuration next to where it is implemented. The reader gets also some recommendation about when an approach should be used or even not.
This repository is a Showcase project to demonstrate the usage of several features of
the [Neodymium Library](https://github.com/Xceptance/neodymium-library).

To use Neodymium features in test development as intended from the very beginning on without struggling around with
several required configurations each showcase explains the approach technology, the implementation options as well as
the belonging configuration next to where it is implemented. The reader gets also some recommendation about when an
approach should be used or even not.

# Show cases
Below is a summary of the show cases. Deeper documentation can be found in the show case code next to each show case. It is also possible to execute a show case after [setting up the Chrome WebDriver](https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver). Just run the show case of interest as a JUnit test from with the IDE.
# Showcases

Below is a summary of the showcases. Deeper documentation can be found in the showcase code next to each showcase. It is
also possible to execute them
after [setting up the Chrome WebDriver](https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver).
Just run the showcase of interest as a JUnit test from with the IDE.

## 1. Shadow DOM
The `showcase.neodymium.tests.shadowdom` package contains use cases for the shadow DOM automation. Please also have a look at our [wiki](https://github.com/Xceptance/neodymium-library/wiki/Shadow-DOM-Testing) for more information.

The `showcase.neodymium.tests.shadowdom` package contains use cases for the shadow DOM automation. Please also have a
look at our [wiki](https://github.com/Xceptance/neodymium-library/wiki/Shadow-DOM-Testing) for more information.

* `ShadowDomTextTest.java` demonstrates a simple use case on how to automatically test shadow DOM elements.
* `ShadowDomCheckboxTest.java` contains more sophisticated use cases for shadow DOM including nested shadow DOMs.

## 2. Localization
The tests in the `showcase.neodymium.tests.localization` package highlight how the [localization](https://github.com/Xceptance/neodymium-library/wiki/Localization) feature of Neodymium is used. Note that all the translated wordings and their keys can be found in the `config/localization.yaml` file.

The tests in the `showcase.neodymium.tests.localization` package highlight how
the [localization](https://github.com/Xceptance/neodymium-library/wiki/Localization) feature of Neodymium is used. Note
that all the translated wordings and their keys can be found in the `config/localization.yaml` file.

## 3. PDF Download
In the `showcase.neodymium.tests.pdf` package is a basic test for downloading and checking a PDF file. In this test, we use the PDFBox framework for handling a PDF file. To download such a file, we use Selenide's `download` function It downloads a file directly via a given link.
Afterwards, the PDF file is loaded with the PDFBox framework, so we can access the text and verify it.

## 4. Web slider
The `showcase.neodymium.tests.slider` package contains use cases to drag and drop a web slider into different directions e.g. horizontal and vertical. The function provided by Neodymium can also be used to drag and drop any element that supports this.
In the `showcase.neodymium.tests.pdf` package is a basic test for downloading and checking a PDF file. In this test, we
use the PDFBox framework for handling a PDF file. To download such a file, we use Selenide's `download` function It
downloads a file directly via a given link.
Afterward, the PDF file is loaded with the PDFBox framework, so we can access the text and verify it.

## 4. Web slider

The `showcase.neodymium.tests.slider` package contains use cases to drag and drop a web slider into different directions
e.g. horizontal and vertical. The function provided by Neodymium can also be used to drag and drop any element that
supports this.

## 5. Basic authentication

The `showcase.neodymium.tests.basicauth` package contains several approaches how to set up basic authentication within
your test automation project.

## 5. Basic authentication
The `showcase.neodymium.tests.basicauth` package contains several approaches how to setup basic authentication within your test automation project.

* `SelenideBasicAuthenticationTest.java` demonstrates how to perform a standard basic authentication via URL.
* `NeodymiumLocalProxyBasicAuthenticationTest.java` shows what is needed to perform an automatic authentication via the embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyBasicAuthenticationHostTest.java` shows what is needed to perform a manual authentication via the embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java` shows how to secure the traffic with an automatic generated certificate via the embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyCertificateAuthenticationTest.java` shows how to secure the traffic by providing an own certificate via the embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyBasicAuthenticationTest.java` shows what is needed to perform an automatic authentication via the
embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyBasicAuthenticationHostTest.java` shows what is needed to perform a manual authentication via the
embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyGenerateCertificateAuthenticationTest.java` shows how to secure the traffic with an automatic
generated certificate via the embedded local proxy provided by Neodymium.
* `NeodymiumLocalProxyCertificateAuthenticationTest.java` shows how to secure the traffic by providing an own
certificate via the embedded local proxy provided by Neodymium.

## 6. XcMailr Plugin
The `showcase.neodymium.tests.xcmailr` package contains a simple test case for the XcMailr plugin for Neodymium. You can find more information about it by consulting the `README.md` of the XcMailr plugin which can be found [here](https://github.com/Xceptance/neodymium-plugin-xcmailr).
This test case requires some effort in setting up the test environment since there is no publicly free XcMailr service available. Hence you need to set up an instance of the [XCMailr](https://github.com/Xceptance/XCMailr) on your own or get in contact with [Xceptance](https://www.xceptance.com/en/contact/) if you are in need for using such a service within your test. The remaining setup is described within the test case and shouldn't be to challenging.

The `showcase.neodymium.tests.xcmailr` package contains a simple test case for the XcMailr plugin for Neodymium. You can
find more information about it by consulting the `README.md` of the XcMailr plugin which can be
found [here](https://github.com/Xceptance/neodymium-plugin-xcmailr).
This test case requires some effort in setting up the test environment since there is no publicly free XcMailr service
available. Hence, you need to set up an instance of the [XCMailr](https://github.com/Xceptance/XCMailr) on your own or
get in contact with [Xceptance](https://www.xceptance.com/en/contact/) if you are in need for using such a service
within your test. The remaining setup is described within the test case and shouldn't be to challenging.

## 7. Mobile Test
In the `showcase.neodymium.tests.responsive` package is a basic test case to test a mobile device. In order to test a cell phone for example, the emulation of various mobile devices integrated in Chrome can be used.

## 8. Random test data
In the `showcase.neodymium.tests.responsive` package is a basic test case to test a mobile device. In order to test a
cell phone for example, the emulation of various mobile devices integrated in Chrome can be used.

## 8. Random test data

The `showcase.neodymium.tests.random` package contains the selection of random web elements from a website under test.

* `FixedRandomTest.java` shows how a random test can be run again in the same way.
* `RandomJobOffersTest.java` demonstrates the selection of different job offers.
* `RandomProductCategoryTest.java` demonstrates the selection of different products at random.

## 9. Logging with log4j2
The `showcase.neodymium.tests.logging` package shows how log4j2 can be used for logging. The configuration is specified in the log4j2.properties file. Logging can be set differently for console output and log files. With two test cases it is shown that it is even possible to define the logging per test.
## 9. Logging with log4j2

The `showcase.neodymium.tests.logging` package shows how log4j2 can be used for logging. The configuration is specified
in the log4j2.properties file. Logging can be set differently for console output and log files. With two test cases it
is shown that it is even possible to define the logging per test.

## 10. iFrame
This show case in the `showcase.neodymium.tests.iframe` package explains with an example implementation how to test a web site using frames. Selenide offers a straight forward approach to handle such frames and within Neodymium this is simply applied.

This showcase in the `showcase.neodymium.tests.iframe` package explains with an example implementation how to test a
website using frames. Selenide offers a straight forward approach to handle such frames and within Neodymium this is
simply applied.

## 11. Test data access

The various options for providing test data are shown in the package `showcase.neodymium.tests.data`.

* `AccessDataViaDataObjectsTest.java` demonstrates how to perform a data access via POJO.
Expand All @@ -60,6 +101,52 @@ The various options for providing test data are shown in the package `showcase.n
* `AccessDataViaJsonPathTest.java` shows data access by means of Json Path.
* `DataFilePriotityTest.java` shows the priority when accessing different file formats.

## 12. Separate browser sessions

In the package `showcase.neodymium.tests.browsersession` are two tests demonstrating the different session handling for
the setup und cleanup for a test, where `DifferentBrowserSessionTest.java` uses different sessions for each and
`SameBrowserSessionTest.java` uses the same session.
For more information take a look at our [wiki](https://github.com/Xceptance/neodymium/wiki/Seperate-Browser-Sessions).

## 13. JSON assertions

`showcase.neodymium.tests.jsonassertion.JsonAssertionTest.java` shows how to compare JSON files and demonstrates the
improved visibility of the differences in the allure report. More information are in
the [reports section](https://github.com/Xceptance/neodymium/wiki/Reports#add-json-compare-to-report) of our wiki.

## 14. Lighthouse reports

Due to the steadily increasing importance of accessibility Google Lighthouse is now part of our test framework and can
be used to get an accessibility score for the desired websites. To demonstrate the usage the showcase
`showcase.neodymium.tests.lighthouse.LighthouseTest.java` was created.
Further reading: [lighthouse section](https://github.com/Xceptance/neodymium/wiki/Reports#lighthouse)
wurzelkuchen marked this conversation as resolved.
Show resolved Hide resolved

## 15. Popup blocker

Since random popups can be annoying for test automation, the showcase
`showcase.neodymium.tests.popupblocker.PopupBlockerTest.java` demonstrates the popup blocker of Neodymium. For more
information see the
[popup blocker](https://github.com/Xceptance/neodymium/wiki/Popup-Blocker) wiki section.

## 16. Advanced screenshots

Neodymium gives testers the opportunity to customize screenshots, like taking full page screenshots and changing the
colour of the highlighting. In [advanced screenshots](https://github.com/Xceptance/neodymium/wiki/Advanced-Screenshots)
the feature is documented and the usage is shown in the showcase
`showcase.neodymium.tests.screenshot.AdvancedScreenshotTest.java`.

## 17. URL validation

To prevent the test automation to reach sites that are out of scope or should not be tested, it is possible to define
include and exclude lists in the `neodymium.config`. The setup and usage of those lists is demonstrated in the showcases
in the package `showcase.neodymium.tests.urlvalidation`.

## 18.
wurzelkuchen marked this conversation as resolved.
Show resolved Hide resolved

It is possible to add custom values to differentiate between environments or profiles within your test runs, enhancing
the granularity of your test environment information. A very basic example can be found in the showcase
`showcase.neodymium.tests.customenvironmentdata.CustomEnvironmentDataTest`.

## License
MIT

MIT
4 changes: 2 additions & 2 deletions config/localization.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
COMMENT:
DESCRIPTION: This comment section is added for the show case only to explain how to use Neodymium Localization.
DESCRIPTION: This comment section is added for the showcase only to explain how to use Neodymium Localization.
RELATED SHOWCASE: NeodymiumLocalizationShowcase

default:
Expand All @@ -15,4 +15,4 @@ de:

de_AT:
homepage:
subtitle: Wir begleiten Sie auf Ihrem Weg zum besten Produkt.
subtitle: Wir begleiten Sie auf Ihrem Weg zum besten Produkt.
9 changes: 4 additions & 5 deletions config/neodymium.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
# MANDATORY SETTINGS
#
# Chrome WebDriver
# To run any show case the Chrome WebDriver must be installed before.
# To run any showcase the Chrome WebDriver must be installed before.
# See: https://github.com/Xceptance/neodymium-library/wiki/How-to-set-up-a-WebDriver
# Configure
# Configure
# neodymium.webDriver.chrome.pathToDriverServer = c:/path/to/chromedriver.exe
#
# The following long value will be use to initialize Neodymiums Random instance.
# The following long value will be use to initialize Neodymiums Random instance.
#neodymium.context.random.initialValue = 123456789

# Neodymium allows to set a default locale to support the most common test cases
Expand All @@ -20,7 +20,7 @@ neodymium.locale = en_US

# Neodymium can run an embedded proxy in the test execution process
# HTTP Basic access Authentication information is automatically added to the HTTP header
# RELATED SHOW CASES:
# RELATED SHOWCASES:
# - NeodymiumLocalProxyBasicAuthentication
# - SelenideBasicAuthentication
# - NeodymiumLocalProxyCertificateAuthentication
Expand All @@ -35,4 +35,3 @@ neodymium.localproxy.certificate.archiveFile = ./config/Certificate.pfx
neodymium.localproxy.certificate.archivetype = PKCS12
neodymium.localproxy.certificate.name = e6f60fbd-f9f3-436f-aba5-452861ae4570
neodymium.localproxy.certificate.password = MITMCertificatePassword
#
Loading