User input login then continue directing through macros possible? - excel

I'm attempting to run a macro that's end result would be landing on the page with the needed information after a series of searches. So far, my macro opens the webpage, but it requires the user to input their username and password. Would it be possible for the macro to open the webpage, then the user would manually enter their login info, and finally my macro would take over again and lead them to the correct results?
I feel comfortable being able to get them from the post-login screen to the results, but am stuck on the login page.

Why not have the user first enter username and password and other relevant info, then the macro contacts the webpage submits user & password and just continues.

Related

Enter a user response through code

I'm currently working on Microsoft Botframework Node.js SDK.
I was wondering if there was a way to hard code a user response for a prompt through the code?
The scenario is to add/ remove people to the meeting. The dialog contains 2 waterfall functions. The first is used to handle card actions, and display the default prompt to enter a username to search for. The second function searches for the username and displays the results in a carousel. Selecting a user from the card adds the person to the meeting (handled in first waterfall function).
Once a user is added to the meeting, the first waterfall function displays the currently added people in the meeting with the option to remove, followed by the default prompt to search users. Since it expects a prompt response, the "remove" actions causes a break and the bot's response is: "I didn't understand. Please try again.".
So is it possible to hard code a null user response through the code when the "remove" action is triggered? Or is there any other way to bypass a prompt without any input from the user's end?

Superuser Can't Change User Profile

Despite being a Super User (Joomla 3.4), each time I try to modify a user's profile, e.g., edit their name or assign them to a different group, I get this message:
The passwords you entered do not match. Please enter your desired password in the password field and confirm your entry by entering it in the confirm password field.
I am not entering a password. It almost looks like Joomla (or my Mac) is autofilling the first password entry and wants me to fill in the confirming password entry.
Please advise.
delete the auto-filled password and save - this is a browser thing

Cucumber: Is it possible for a step to detect tags?

I am in the midst of writing a test suite for a password management page. For the scenarios, the majority should not actually change the password, but some do. I have used the tag #changePassword so that I can optionally run those scenarios or not.
The problem I run into is trying not to write duplicate steps if possible.
Simplified sample scenarios:
#changePassword
Scenario: successful change
Given the Manage Password page is loaded
And a new password is generated
When the old password is entered
And the new password is entered
And the confirm password is entered
And the OK button is clicked
Then the password has changed
Scenario: failed change (missing confirm)
Given the Manage Password page is loaded
And a new password is generated
When the old password is entered
And the new password is entered
And the OK button is clicked
Then the password change fails
The majority of the steps are identical between the two versions, the main variance that I am concerned with is the And a new password is generated step. In the first scenario, I want the new password to be saved as the user's password. In the second scenario I want the new password discarded at the end.
Something like: (psuedo-code)
And /^a new password is generated$/ do
old password = user's password
new password = generate random new password
confirm password = new password
if tag #changePassword is present
user's password is set as the new password
end
end
Is there anyway to make this possible? I can write a second step like And a new password to be saved is generated or something, but for readability and for the non-tech savvy co-workers, using the same step is the better option. (I have found in the past using different phrases to describe similar processes, that to the user accomplishes the exact same thing, has caused confusion. Trying to avoid workplace confusion if possible.)
Side note: Using Cucumber with Ruby (with Watir), if that makes any difference (does it?)
It's an ugly solution, but can you use a tagged hook to set a variable and then an if statement in the method that saves/doesn't save based on the value of that variable?

BDD - Cucumber: Is possible to disable Background logic for only one scenario in feature?

In a feature file have a Background and several Scenarios, but now need a Scenario related to same feature that don't have to run background logic, is possible to disable for only a scenario?
UPDATE - Add Example:
Feature: Sign Up
In order to access to protected parts of site
A user
Should sign up
Background:
Given I am on sign up page
And I am not logged in
Scenario: User sign up succesfully
When I sign up with valid fields
Then I should view dashboard page
Scenario: User altredy sign up
When I sign up with altredy registred user e-mail
Then I should view altredy sign up message and link to forgot password page
Scenario: User try to sign up with missing/wrong data
When I will try to sign up with missing/wrong data
Then I should error message
Scenario: User altredy sign in
#here disable background
Given I am logged in
When I am on sign up page
Then i should be redirect to dashboard page
Solution 1.
You could put that only Scenario in other Feature file where there's no background or it has it's own background
Solution 2.
Remove the background from the feature file and then put its logic on the step definitions, something like
Given 'I am on sign up page' do
some code here
end
Given 'I am not logged in' do
some code here
end
then on each first step
Given 'I sign up with valid fields' do
step 'I am on sign up page'
step 'I am not logged in'
the rest of your code for this step
end
Given 'I sign up with altredy registred user e-mail' do
step 'I am on sign up page'
step 'I am not logged in'
the rest of your code for this step
end
Given 'I will try to sign up with missing/wrong data' do
step 'I am on sign up page'
step 'I am not logged in'
the rest of your code for this step
end
This is not pretty though you would repeat those at least 3 times.
Solution 3.
You could get rid of that Scenario and paste it's steps in the first Scenario, something like
Scenario: User sign up succesfully
When I sign up with valid fields
Then I should view dashboard page #this is your Given I am logged in step
When I am on sign up page
Then i should be redirect to dashboard page
I would get rid of the background clause entirely - it's unnecessary detail. Your scenarios make perfect sense without it.
You can visit the signup page, and verify the user isn't already signed in, as part of your "When I sign up with valid fields" step definition.
Why don't you create a step definition that closes that session?
something like this:
Then(/^I close the browser$/) do
page.driver.quit
end
Then you do whatever you need in your subsequent steps
If you have this need then you have identified a new feature. So instead of trying to be clever with cucumber you can just take the simpler approach of being clever with naming your features.
With your example the scenario User already signed in clearly has nothing to do with signup, it belongs in a different feature e.g.
features
- signup.feature
- signed_up.feature
Other names for signed_up might be default_navigation, first_sign_in etc. etc.
Wanting a different background for a different part of a feature is always an indicator that you have two different bits of behaviour you are exploring.
Maybe you can name your feature files using numbers in which 0_exaple1.feature file you can run those test cases where you are using the Background and 1_exaple.feature file you can run those cases which you want to run without background and provide the same tag in both the feature file and give that tag in runner file
your runner file is something like this:
#CucumberOptions(
features = {"src/test/resources/features"},
plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"},
glue = {"com.company.comapnies.stepdefinitions"},
tags = "#test"
)
and under the feature folder, your file should be saved like this
feature
|_
0_example.feature
1_example.feature
and your 0_example.feature file like this:
Feature: Sign Up
In order to access to protected parts of site
A user
Should sign up
Background:
Given I am on sign up page
And I am not logged in
#test
Scenario: User sign up succesfully
When I sign up with valid fields
Then I should view dashboard page
and 1_example.feature file like:
Feature: Sign Up
In order to access protected parts of the site
A user
Should sign up
#test
Scenario: Run this scenario without background
Given: Launch the browser
And: Do something
So when you run your test runner file then it will automatically pick the #test tag, search in 0_example.feature first, and then, 1_example.feature file will start executing.
This is the only thing you can run in your framework as of now to prevent background runs.
Cheers!!!

How to handle User "confirmation" with Watir/Cucumber?

I'm new to Watir and I've having a little trouble getting logged in in my tests. I use authlogic as my authentication method of choice. When a User registers, they are sent an email with a confirmation link. Clicking this link confirms their account and they can then login.
The issue I'm having is how do I confirm the User when using Watir?
I have so far:
Given /I sign up/ do
BROWSER.goto("http://localhost:3000/register")
BROWSER.text_field(:id, "user_email").set("foo#bar.com")
BROWSER.text_field(:id, "user_name").set("Foo Bar)
BROWSER.text_field(:id, "user_password").set("foo bar")
BROWSER.text_field(:id, "user_password_confirmation").set("foo bar")
BROWSER.button(:id, "user_submit").click
end
Given /I am logged in via Watir/ do
BROWSER.goto("http://localhost:3000/login")
BROWSER.text_field(:id, "user_session_email").set("foo#bar.com)
BROWSER.text_field(:id, "user_session_password").set("foo bar")
BROWSER.button(:id, "user_session_submit").click
end
This correctly populates the fields and the User is saved. Now I try to confirm the User like so:
Given /I am confirmed/ do
User.last.confirmed!
end
Unfortunately this doesn't work. What am I missing?
I'm not familiar with waitir but I imagine given following steps:
Given I have signed up
When I confirm my account
Then my account should be confirmed
You could either keep track of the link you're expecting them to hit and actually test hitting that link to verify that the controller then sets the user as confirmed:
When /I confirm my account / do
BROWSER.goto("the_url_from_the_email")
# note that if you need to visit this link and click a button
# or something you will need to code that part as well
end
These steps would exercise the signup and confirmation code. I think if you wanted you'd either use these to compose a "Given I am logged in with a confirmed account" step as a precondition for other tests, or just use that same step to return a canned account.
Not sure that answers your original question really but as mentioned you haven't really said what's actually going wrong. I would assume that User.last.confirmed! isn't saving, or isn't saving the record you expect.

Resources