I'm using the Selenium IDE to create some test scenario's. I want to create a scenario where a user tries to visit a certain url without logging in. But the webpage should redirect the user to the login screen instead, since the user needs to login first But I can't find any information about redirecting with the Selenium IDE.
Check this out. That will prevent javascript redirect:
getEval | window.location.href = 'http://your.page';
storeLocation | url
while | storedVars['url'] != 'http://your.page'
storeLocation | url
endWhile
getEval | window.stop();
You need Selenium IDE flow control for that.
if you just need to check that redirection happens:
open | http://your.page
pause | 5000
storeLocation | url
verifyEval | storedVars['url'] == 'http://crocodile.page' | true
If you need something else try to make your question a little bit more detailed. It is hard to understand what are you trying to do.
Related
Description:
As a test developer, I would like to use a single scenario to test 3 different environments.
Simplified Scenario example:
#smoke
Scenario: Login to the login page and assert that the user is logged in
Given User navigates to the page
And User enters valid login credentials
When User clicks on the login button
Then Landing page can be seen
Data ( These are grabbed from a property file - converted to POJO ) :
Env1.class
url = www.environment1.com
username = john
password = doe1
Env2.class
url = www.environment2.com
username = john2
password = doe2
Env2.class
url = www.environment3.com
username = john3
password = doe3
Test Setup
Each environment has its own test runner ( failsafe )
Each environment runs in parallel.
Test runs and is built via ~mvn clean verify
Tests are property file dependant as environments may change.
Potential solution:
Is there a way to pass POJOs in the Example Table? or Cucumber's data table?
I am new to BDD and Cucumber - any help would be great. Thank you.
TLDR: is there a way to pass the Prop File variable in the Examples Table in Cucumber?
| URL | Username | Password |
| env1.getUrl | env1.getUsername | env1.getPassword |
So it'll be
#smoke
Scenario: Login to the login page and assert that the user is logged in
Given User navigates to the page <URL>
And User enters valid login credentials <Username> and <Password>
When User clicks on the login button
Then Landing page can be seen
You can use the scenario outline to run the same scenario with different data for each run. But it will be not parallel. It is sequential. The feature file is,
#smoke
Scenario Outline: Login to the login page and assert that the user is logged in
Given User navigates to the page <URL>
And User enters valid login credentials <Username> and <Password>
When User clicks on the login button
Then Landing page can be seen
Example:
|URL |UserName|Passowrd|
|www.environment1.com|john1 |doe1 |
|www.environment2.com|john2 |doe2 |
|www.environment2.com|john3 |doe3 |
You can use a single runner class. No need to use either property file nor pojo class.
You can achieve that using cucumber extension for BDD2. By using it you can have external examples or you can use properties in example as below:
| URL | Username | Password |
| ${env1.getUrl} | {env1.getUsername} | ${env1.getPassword} |
Alternate is you can use CSV or XML data provider.
In order to use pojo, you need to modify your step definition to accept either DataTable or POJO as argument. When accepting POJO as argument you need to write transformer.
When you use cucumber extension you can also use QAFTestStep which accepts POJO without addition effort. Here you can find step examples and feature file.
The home page of our site has an iframe that allows users to enter their username, password, and then submit that information to login to a patient portal. I created a test with TestCafe that enters the credentials, and submits the credentials, then just checks for the title on the landing page of the patient portal, for example, Homepage/iframe creds -> Patient Portal Title. (See example code below).
import { Selector } from 'testcafe';
fixture `jmh login - Logout tests`
.page `<the test home page url>`;
test('JMH Home login simple testcafe', async t => {
await t
.switchToIframe('.login-frame')
.typeText(Selector('#username'), "<someusername>")
.typeText(Selector('#password'), "<somepassword>")
.click(Selector('#submitButton'))
.wait(2000)
.debug()
.switchToMainWindow()
.navigateTo('<the test home page>') // Force to re-log
// mychart
.expect(Selector("title").innerText).eql('MyChart - Home')
.expect(Selector(".acctname").innerText).eql("<name>" + " " + "<lastname>")
// logouts
.click(Selector('.menuicon .menuname')) // click logout
.expect(Selector("title").innerText).eql('Sign On');
});
Each time the test is run, the user credentials are entered, then the "Log in" button is selected, but when the request is made, the main window is redirected to Oauth, and TestCafe never makes it to the landing page, but instead I see the following error...
✖ JMH Home login simple testcafe
1) AssertionError: expected 'Sign On' to deeply equal 'MyChart -
Home'
Browser: Chrome 78.0.3904 / Mac OS X 10.15.1
15 | //.navigateTo('<test home page>') // Force to re-log
16 | //.click(Selector('#dTlogin')) //mychart login on home
17 | .navigateTo('<test landing page url>') // Force to re-log
18 |
19 | // mychart
> 20 | .expect(Selector("title").innerText).eql('MyChart - Home')
21 | .expect(Selector(".acctname").innerText).eql("<name>" + " " + "<lastname>")
22 |
23 | // logouts
24 | .click(Selector('.menuicon .menuname')) // click logout
25 | .expect(Selector("title").innerText).eql('Sign On');
at eql (/Users/me/ebiz_code/qa/portal-automation-tests/test-cafe/tests/jmh-login.js:20:46)
at test (/Users/me/ebiz_code/qa/portal-automation-tests/test-cafe/tests/jmh-login.js:6:1)
at <anonymous> (/usr/local/lib/node_modules/testcafe/src/api/wrap-test-function.js:17:28)
at TestRun._executeTestFn (/usr/local/lib/node_modules/testcafe/src/test-run/index.js:263:19)
at TestRun.start (/usr/local/lib/node_modules/testcafe/src/test-run/index.js:312:24)
1/1 failed (24s)
It seems like TestCafe is blocking the redirects from getting to the landing page, or losing track of the main window, as the landing page is never displayed in the test run, but is displayed each time the test is run manually. If I log from the Oauth Pingfederate login page (not the iframe creds) using TestCafe, I do see the correct landing page, and I can perform assertions on the landing page within TestCafe.
Any ideas about why this iframe-based login doesn't work?
I reproduced the issue using this information. We need some time to examine it. Could you please try another login way? Check out this test code:
await t
.maximizeWindow()
.click(Selector('#dTlogin')) // go to the login page
.typeText(Selector('#username'), "<someusername>")
.typeText(Selector('#password'), "<somepassword>")
.click(Selector('#submitButton'))
.wait(2000)
.navigateTo('https://your-page/') // navigate back to your page
You can also use Role in your scenario.
Please tell me if you are able to continue your test with the above login code.
wanted to execute below scenario multiple time with different set of user name and password without using scenario outline. As I am new to this world so need some guidance
Data source - excel file
Language - JAVA
#login
Scenario: Login with correct credential
Given open browser & enter user name and password
When validate user credential
Then application should open
And Logout to application & close browser
Scenario: Login with correct credential
Given open browser & enter user name and password
And enter<superuser> in ....
And enter<superUserPassword> in ....
Then click "dadada" button
And verify application should open
And Logout to application & close browser
Examples:
|superuser | superUserPassword |
|"superUser1" |"superPassword1" |
|"superUser2" |"superPassword2" |
|"superUser3" |"superPassword3" |
I'm having some difficulty with sending a simple GET request via Postman (An application extension in google chrome) to my Laravel 5.2 server. Here are some details to what I'm doing:
Route here:
Next is the code containing the route
Code here (within the laravel routes.php file):
Finally the error that gets thrown
Error Here
I've gone through multiple tutorials (if resources are needed I will post them on request) and videos and yet I think I may have overlooked something. I've even dived into the source code of Laravel's Route handler but it doesn't even get to the method:
$request->send();
located within the public\index.php file on line 56.
When I perform the:
php artisan route:list
I get the following response:
+--------+----------+-----------------------+------+--------------------------------------------------------+-----------------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-----------------------+------+------------------------------------------------------------------------------+-------------+
| | POST | here | | Closure | web |
| | GET|HEAD | user/:id/validate| | \Controllers\UserController#getOAuthValidation | web,api |
+--------+----------+-----------------------+------+--------------------------------------------------------+-----------------------------------+
If ANYONE can shed some light on this I would greatly appreciate it.
strange. Your routes file is /user/validate but your route is expecting an id.
I'm assuming that the validate method requires an id field in its signature?
Remove that, or change your postman get to /user/1/validate
I can login on my IMAP server using my username, but can't using username#company.com (related: Dovecot Authentication failed if trying login with #domain) . Same thing happens for SMTP with exim4.
How can I setup dovecot (IMAP) and exim4 (SMTP) to allow username#company.com as the login?
EDIT: I'm using driver = passwd for the userdb, and driver = pam for the passdb.
I had the same question, and similar reasons. This may not be the best wa but I used a test account, lets call it 'user' for the sake of illustration and, copied the user's line in /etc/passwd (I'm on a Ubuntu cloud server), and changed the name on the copied line-- just adding the fqdn so the user UID has two names: 'user#mydomain.com' and the original, just 'user'. I setup the account first on Thunderbird with just 'user' to login to dovecot and exim, tested send/recieve ok. Then changed the login on Thunderbird for both servers to 'user#mydomain.com'. I had to re-enter the password, but it appears to have worked spectacularly well. It tested send/recieve ok, and otherwise appears the same as before. Now, I'm short on time so I set the password separately for both accounts, but I'm not sure that part is necessary. I'll have to check later, but I think pam looks up passwords matched to the PID (if I'm wrong about that, please someone tell me!). Anyway, more testing later. I'll let you know if there are deleterious side-effects. Aside: it may be possible to simply add the full email address as an alias in /etc/alias but I haven't tested that, and I just thought of it. Anyone try that one, leave a comment! Thanks! Ciao...
You have to create users in complete form of user#domain.tld.
Setup login autocompletion by #hostname if domain part is omitted, before dovecot-auth invocation.
As far as there is lot of dovecot/exim howtos, there is no ready-to-use recipe for your case.
You can change your SQL query to use only the first part before the # sign by using the substring_index() function. Conveniently, this string search query will return the whole string if there is no # sign. This means that if the customer enters "user#domain.com", it will use the correct value (just the "local_part"), and if the customer enters just "user", it will return the whole string.
Example:
mysql> select substring_index('user#example.net','#',1);
+-------------------------------------------+
| substring_index('user#example.net','#',1) |
+-------------------------------------------+
| user |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql> select substring_index('user','#',1);
+-------------------------------+
| substring_index('user','#',1) |
+-------------------------------+
| user |
+-------------------------------+
1 row in set (0.00 sec)