Skip to content

Make React related integration tests work #1072

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

Closed
0pdd opened this issue Jul 11, 2019 · 5 comments
Closed

Make React related integration tests work #1072

0pdd opened this issue Jul 11, 2019 · 5 comments
Assignees
Labels
ADR/needed A decision has been made and it needs to be documented area/integration tests techdebt
Milestone

Comments

@0pdd
Copy link

0pdd commented Jul 11, 2019

The puzzle 1057-d01039f1 from #1057 has to be resolved:

mystamps/pom.xml

Line 1061 in 6b40dca

<!-- @todo #1057 Make React related integration tests work -->

The puzzle was created by @php-coder on 23-Jun-19.

@0pdd 0pdd added the techdebt label Jul 11, 2019
@php-coder php-coder changed the title Make React related integration tests work --> Make React related integration tests work Jul 11, 2019
@php-coder php-coder added this to the 0.4.1 milestone Jul 11, 2019
@php-coder
Copy link
Owner

At this moment, they fail with:

Import a series sale with invalid url                                 | FAIL |
ReferenceError: "Headers" is not defined. (http://127.0.0.1:8080/public/react-dom/16.8.6/umd/react-dom.production.min.js#17)

Most likely, this will be fixed with a new version of Selenium and htmlunit (see #1001)

@php-coder
Copy link
Owner

php-coder commented Sep 12, 2019

Most likely, this will be fixed with a new version of Selenium and htmlunit (see #1001)

No, it wasn't or at least not fully.

ReferenceError: "Headers" is not defined.

This one can be workarounded with

--- src/main/frontend/src/components/SeriesSaleImportForm.js
+++ src/main/frontend/src/components/SeriesSaleImportForm.js
@@ -40,9 +40,10 @@ class SeriesSaleImportForm extends React.Component {
                        validationErrors: []
                });

-               const headers = new Headers();
-               headers.set('Content-Type', 'application/json; charset=UTF-8');
-               headers.set(this.props.csrfHeaderName, this.props.csrfTokenValue);
+               const headers = new Headers([
+                       [ 'Content-Type', 'application/json; charset=UTF-8' ],
+                       [ this.props.csrfHeaderName, this.props.csrfTokenValue ]
+               ]);

                const request = new Request(
                        this.props.url,

But after that there will be another error: ReferenceError: "fetch" is not defined I've submited HtmlUnit/htmlunit#78 for that.

@php-coder php-coder modified the milestones: 0.4.1, 0.4.2 Sep 12, 2019
@php-coder
Copy link
Owner

We can try to use axios instead or wait until #966 will be solved.

@php-coder php-coder modified the milestones: 0.4.2, next Nov 6, 2019
@php-coder
Copy link
Owner

php-coder commented Mar 5, 2020

With axios everything works except sendKeys() that might fail: HtmlUnit/htmlunit#142

@php-coder php-coder modified the milestones: next, 0.4.3 Mar 5, 2020
php-coder added a commit that referenced this issue Mar 7, 2020
php-coder added a commit that referenced this issue Mar 7, 2020
… with empty required field" test.

Allow to user to submit an empty field in order to be able to validate server-side validation.

Part of #1072
php-coder added a commit that referenced this issue Mar 7, 2020
…mlunit bug.

sendKeys() was failing with "StringIndexOutOfBoundsException: start > length()" exception when we
fill a field a second time. Opening a page on every test fixes that as there is no state left from a
previous test.

Workaround for HtmlUnit/htmlunit#142

Part of #1072
php-coder added a commit that referenced this issue Mar 7, 2020
@php-coder
Copy link
Owner

Done.

@php-coder php-coder added the ADR/needed A decision has been made and it needs to be documented label Jan 2, 2021
php-coder added a commit that referenced this issue Jan 19, 2021
…around htmlunit bug."

This reverts commit 943afba.

The original bug was fixed in htmlunit 2.38.0 so we could revert this commit when we did an update
in c7e61df commit (#1251)

Relate to #1072
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR/needed A decision has been made and it needs to be documented area/integration tests techdebt
Projects
None yet
Development

No branches or pull requests

2 participants