I am getting Exception in thread:
Exception in thread "main" cucumber.runtime.CucumberException: No back ends were found. Please make sure you have a backend module on your CLASS PATH.
I am new for Cucumber BDD framework ,running following feature file.
Feature: feature to test login scenario
Scenario: Check login is successful with valid credentials
Given User is on login page
When User enters login and password
And Clicks on login button
Then User navigated to home page
I have added following dependencies, tried with different adding version, but still not working.
Kindly provide your help.
Related
I have a web application currently deployed on Wildfly 22, using JSF 2.3 and OpenJDK 11.
I'm currently migrating the login page from j_security_check to a programmatically login, following BalusC example on this post:
Performing user authentication in Java EE / JSF using j_security_check
I'm not posting the login code, because it's exactly like BalusC post.
The login process is working just fine, except when the session-timeout expires on the login page. In other words, when the user requests a protected resource, the login page is presented. If the session expires before the login form is submitted a ViewExpiredException is thrown and an error is presented to the user.
I understand this is the expected behaviour, however it's not the desired situation for the end-user.
I managed to minimize this situation using OmniFaces's ViewExpiredExceptionHandler.
This way, when a ViewExpiredException is thrown, the OmniFaces handler will catch it and redirects to the current URL with the query string.
In other words, the user tries to login after the session expires and the login page is presented again to the user.
I managed to use the #{flash['org.omnifaces.view_expired'] eq true} so that a nice message is presented to the user, explaining that a timeout occurred.
Is there any way to workaround this situation, and performing a successful login even when the session expires, so that the user doesn't have to enter his credentials twice?
Thanks for your help!
Is there any way to workaround this situation, and performing a successful login even when the session expires, so that the user doesn't have to enter his credentials twice?
Yes, by using stateless JSF by setting transient attribute of <f:view> to true.
<f:view transient="true">
<h:form>
...
<h:commandButton ... action="#{requestScopedBean.login}" />
</h:form>
</f:view>
Do note that the backing bean must be #RequestScoped, not #ViewScoped or broader.
See also:
What is the usefulness of statelessness in JSF?
Handle ViewExpiredException in the background and restore form values
JSF without #ViewScoped
I have implemented a shared Test Context between Cucumber Step Definitions using PicoContainer.
Please find the complete code which I have written in the below shared drive.
https://drive.google.com/file/d/1bBxOJDW7auqN_CX9tc0KEDo-TiPzew6m/view?usp=sharing
Before implementing PicoContainer i have only one Step definition class after implementing it I created two separate step def classes for Home Page and Login Page.
Please find the below feature which i am automating. After i implemented share Test Context only first scenario is running successfully, while running Second scenario New browser is opening then failing it with NullPointerException.
Feature: Login Action
Scenario Outline: Successful Login with Valid Credentials
Given User is on Home Page
When User Navigate to LogIn Page
And User enters "<username>" and "<password>"
Then Message displayed Login Successfully
Examples:
| username | password |
| username#gmail.com | userpassword |
Scenario: Successful LogOut
When User LogOut from the Application
Then Message displayed LogOut Successfully
Please help me to fix this issue..
We have Auth0 enabled for a site and it has been working well for quite some time.
All of a sudden when I enter the site and get redirected to Auth0 to enter my crendentials (and press login), I get faced with a screen with the following message.
An unhandled exception occurred while processing the request.
Exception: Unable to unprotect the message.State.
MoveNext AggregateException: Unhandled remote failure.
MoveNext
If I repeatedly refresh my site with /signin-auth0 at the end of the url the same error screen is shown.
Now when I repeated all steps from start (meaning entering my site) it all of a sudden work. What's this error anyway?
This was resolved by the Auth0 team as a bug in Auth0's transmission of the state parameter for social logins, notably Google. Things should be working normally again.
I'm very new to liferay and am creating a hook on the login.events.pre event. My users will be signing in to the website by using their phone number, so I have to do some validations on the status of their phone line before letting liferay create a session for the user. I've already created the portlet and am able to execute some java code before letting liferay take care of the login validation, but I'm not sure how to stop the whole process if my validation fails. In other words, if I find out that the users phone line is suspended, I don't want liferay to allow them to sign in, even if the right login info has been provided by the user. Is it possible to do this in the login.events.pre event in liferay?
In this case you can invalidate the Session and redirect it to some customized error page in your hook.
Below piece of code might be helpful.
//Below code to get the current session
HttpSession session = null;
session=request.getSession(false);
//Below code to invalidate the session and to redirect to your customized error page
session.invalidate();
response.sendRedirect("/errorPage.html");
I'm working on application tests and have found an issue.
My app. has an authenticate(email, password) action inside the
Security controller and when invoked, from the login page, with a
valid e-mail and invalid password it sends me back to the login page
with an error message, located in the flash scope.
The app. test code follows :
Response response =
GET("/security/authenticate?email=validUser&password=invalid", true);
String pattern = "invalid password";
assertContentMatch(pattern, response);
When this code is run throws the next exception :
A java.lang.RuntimeException has been caught,
java.net.MalformedURLException: no protocol: /login
Did some research and found that :
the exception is thrown when a new URL object creation is attempted,
to be able for redirection, using an invalid URL. In this case no
protocol is present
looking at app. test in samples apps. GET is used without
redirection, meaning that after GET only the http code is verified but
no attempt to follow the redirection
Has anyone had this same issue also ?
Any open bug to look for info or add my 2 cents ?
Here you can find a description of the problem as well as code snippet to work around the issue:
https://play.lighthouseapp.com/projects/57987/tickets/1553-functionaltestget-with-redirect-crashes