I'm new to Calabash and trying to create Steps definition for below the feature file with respective scenarios (QA looks like a possible duplicate but no answer found in SOF) How to generate the step definition using UIAutomator viewer tool. error screenshot attached for ref Any help on this issue would be appreciated.
Feature: Valid Login
Scenario: Login with valid mobile number
When I see "Login/Signup" screen
And I enter "72046606**" in "etMobilNumber" text field
And I click on "Login/Signup" button
And I enter "WebDriver12" in "etPassword" text field
And I click on "Login" button
And I wait
Then I see "Enter mPIN" screen
Scenario: Login with valid mPIN
When I see "Enter mPIN" screen
And I click on "2" button
And I click on "3" button
And I click on "6" button
And I click on "9" button
And I wait
Then I see "J****" text
Scenario: Launch Money Transfer screen
When I see "J*****" screen
And I click on "MoneyTransfer" button
And I click on "Send Money" text
And I wait
Then I see "Send Money" text
Feature file:
Feature: Login
Scenario: I should login via valid credentials
When I enter mobile number "7204660611" into mobile number input field with "ID"
Then I see "Login/Signup" button as enable
And I tap "Login/Signup" button
Then I wait 60 seconds
Then I see "Password" field
And I enter Password "WebDriver12" input Password input field with "ID"
Then I tap "Login" button
Then I should get new page
Step Definition:
require 'calabash-android/calabash_steps'
When(/^I enter mobile number "([^"]*)" into mobile number input field with "([^"]*)"$/) do |mobileNumber, etMobileNumber|
enter_text("* marked:'etMobileNumber'","***34*****")
end
Then(/^I see "([^"]*)" button as enable$/) do |arg1|
if query("* marked:'btnSignin'",:enabled).first.eql?true
else
raise "FAILED!!! Invalid Mobile number"
end
end
Then(/^I tap "([^"]*)" button$/) do |arg1|
touch("* marked:'btnSignin'")
end
Then(/^I wait (\d+) seconds$/) do |arg1|
wait_for_element_exists("* marked:'etPassword'")
end
Then(/^I see "([^"]*)" field$/) do |arg1|
if query("* marked:'etPassword'",:enabled).first.eql?true
else
fail "Failed!! Password field not present"
end
end
Then(/^I enter Password "([^"]*)" input Password input field with "([^"]*)"$/) do |arg1, arg2|
enter_text("* marked:'etPassword'","WebD*****")
end
Then(/^I should get new page$/) do
wait_for_element_exists("* marked:'Enter mPIN'")
end
Related
Making login function with string validation with VueJS
Here is my code: Link
Problem occurs in this follow,
both input keep with empty and click Login button
error msg Enter your username and Enter your password appear
enter something in one of these input
ex) entering xxxx in password area
click Login button
Problem happens
value of password input area disappears
I'd like to keep value in input box every time Login button clicked till both input value are correct.
How can I fix it?
Form validation function are written in Login.vue
Register (add) value prop in Form.vue component:
props: {
// ...your registered props
// add below
value: {
type: String,
default: "",
},
},
Why?
Because right now it is not reactive. So when parent changes value child component does not react.
I'm using Access 2007 at work and trying to build a database. I'd like to know if it's possible to have two different buttons on the "Main Menu" form that open the same "Data Entry" form. BUT, one button automatically goes to a new blank record for data entry, and the other button prompts the user to enter a specific ID # (tied to a field in the form) and then the form will open on that record. This would be for updating that specific record.
Is this possible? I am a beginner with VBA code. If this is possible with later versions of Access but not 2007, please let me know.
Create two buttons on the form. Let us name them as addRecBtn and openRecBtn let us say the form you are trying to open is tmpFrmName. So the first button will open the form in Data Entry Mode, the second one will open the form in normal edit mode.
The code should be something like,
Private Sub addRecBtn_Click()
DoCmd.OpenForm "tmpFrmName", DataMode:=acFormAdd
End Sub
The second form will first have to get the number you are trying to open, for example let us call it the numberID. So your code would be.
Private Sub openRecBtn_Click()
Dim numID As Long
numID = InputBox("Please enter the ID : ")
If DCount("*", "yourTable", "numberID = " & numID) <> 0 Then
DoCmd.OpenForm "tmpFrmName", WhereCondition:="numberID = " & numID
Else
MsgBox "The numberID : " & numID & " does not exist, please try again !"
End If
End Sub
You may be able to use DoCmd.OpenForm with different options to accomplish both your goals.
"one button automatically goes to a new blank record for data entry"
DoCmd.OpenForm FormName:="YourForm", View:=acNormal, DataMode:=acFormAdd
"the other button prompts the user to enter a specific ID # (tied to a field in the form) and then the form will open on that record"
Dim strWhere As String
strWhere = "[id]=" & Me.txtId
Debug.Print strWhere ' <- inspect this in the Immediate window
DoCmd.OpenForm FormName:="YourForm", View:=acNormal, WhereCondition=strWhere
The first form includes a text box named txtId, which contains the ID value you want to make current in the second form (YourForm).
Yes, it's possible.
My advice would be to do it with several functions - put the "shared" functionality in one (eg open the form), and then for the differences, make two functions which call the shared one
eg
function openForm()
{
//Do open form stuff
}
function promptForID()
{
openForm();
//Do stuff that prompts for ID
}
function blankRecord()
{
openForm();
//Do stuff that sets up a blank record
}
In relation to my question posted here:
MS Access Form where user name is selected from list
I have created a form used as an employee time sheet. Users double click this form and another form pops up where they select their user name from a combo box and the main time sheet form loads up specifically for their user name. They are able to add new records, and also view their previous submissions by scrolling through the "Previous" and "Next" records.
However, when a user opens up the form, their last record displays. Also, when a new record is saved, that new record continues to display unless a user clicks the "New (blank) record" button.
Can someone help me modify the VBA code in the form to allow for:
1) A blank record to automatically load when the form is opened up
2) A blank record to automatically load when a new record is saved/modified.
This is the pop up window - form that pops up when you select the main data entry form:
This is the code behind the pop up form (above):
Private Sub Form_Current()
If VBA.Strings.Len(txtUN & "") = 0 Then DoCmd.OpenForm "frm_UserName", acNormal, , , , acDialog
If VBA.Strings.Len(txtUsername & "") = 0 Then txtUsername = txtUN
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
On Error GoTo Err_BeforeUpdate
If Me.Dirty Then
If MsgBox("Do you want to save?", vbYesNo + vbQuestion, _
"Save Record") = vbNo Then
Me.Undo
End If
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
MsgBox Err.Number & " " & Err.Description
Resume Exit_BeforeUpdate
End Sub
This is the main data entry form [Specialist - Timesheet Entry]:
This is the code behind the [Specialist - Timesheet Entry] form:
Option Compare Database
Private Sub cboUserName_AfterUpdate()
Forms![Specialist - Timesheet Entry].txtUN = cbousername
Forms![Specialist - Timesheet Entry].Filter = "user_full_name = '" & cbousername & "'"
Forms![Specialist - Timesheet Entry].FilterOn = True
'Forms![Specialist - Timesheet Entry].Requery
'DoCmd.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
If (VBA.Strings.Len(cbousername & "") = 0) Then
MsgBox "You must supply a user name before proceeding.", , "ERROR: Missing Info."
Cancel = True
End If
End Sub
Once the [Specialist - Timesheet Entry] is selected, the [form_UserName] pops up. You must select a user name from the list, and hit the "X" button. Once the "X" button is selected than the data entry form [Specialist - Timesheet Entry] will appear for a user to enter the necessary fields. I am also looking for the user to not have to hit the "X" button in order to initiate the [Specialist - Timesheet Entry] form. Ideally once the user selects the user name from the drop down list in the pop up, i'd like the form to close automatically and generate the [Specialist - Timesheet Entry] form.
I think I have something for you here.
I share the same sentiment as OverMind - I'm iffy about the Me.Dirty code. I don't think it's necessary. All you need to do is click the dropdown, select a name and open a form that is filtered using the selected name. Same thing goes for the Form_BeforeUpdate event. You're not actually modifying any data, you're just clicking and selecting. I recommend removing both of those events.
If you don't mind, I reworked this a little since I don't have the entire application in front of me. Try the following (there's a few parts):
1.) frm_UserName
Comment your existing code in the cboUserName_AfterUpdate event and add this line:
DoCmd.OpenForm "Specialist - Timesheet Entry"
'Open the main timesheet form and set the filter based on the dropdown selection in the previous form.
Forms![Specialist - Timesheet Entry].Filter = "Username = '" & Forms![frm_UserName].cboUserName.Column(1) & "'"
'Turn the filter on.
Forms![Specialist - Timesheet Entry].FilterOn = True
'Set the username textbox to the selected record.
Forms![Specialist - Timesheet Entry].txtUN = Me.cboUserName.Column(1)
'Jump to a new record even though the form is filtered.
Forms![Specialist - Timesheet Entry].SetFocus
DoCmd.GoToRecord , , acNewRec
'Close the previous form - we no longer need it.
DoCmd.Close acForm, "frm_UserName"
This will open the Timesheet - Specialist Entry from frm_UserName form "automatically load [a blank record] when the Timesheet form is opened up" using a the selection as the filter.
2.) Specialist - Timesheet Entry
Create a new procedure in the Form Open event and add this code:
Private Sub Form_Open(Cancel As Integer)
DoCmd.OpenForm "frm_UserName", acNormal, , , , acDialog
End Sub
Next, create a new procedure in the Save button Click event and add this code:
Private Sub cmdSave_Click()
'Save the record.
RunCommand acCmdSaveRecord
'Load a new record after the save.
DoCmd.GoToRecord , , acNewRec
End Sub
This will automatically load a blank record when a new record is saved/modified.
I do hope this helps. If you have any questions at all, please let me know. I'd be glad to help even further. I also have a working copy available...
To add multiple steps before submit form. like:
Registration page:
Step 1 - Enter first, last name and email (validate on click of next button and show next step)
Step 2 - Enter Password and Confirm password and submit
Step 1 and step 2 are separate DIV's (Show/hide on Next Click)
You can give a try of this JS snippet:
var formToValidate = $('place the id of the form, that I want to validate');
var validator = new Validation(formToValidate);
if(validator.validate()) {
/* The logic, that you want to execute if you pass the validation. */
......
......
}
Good luck!
Is it somehow possible to unmask a PasswordTextBox? I would like to have a textbox to enter a password and a checkbox, which says Show Password. If the user clicks the checkbox, the content of the Passwordcheckbox becomes unmasked. I could build a custom component using TextBox but it somehow seems the wrong path.
This is how you can do it, on selecting the checkbox do -
passwordBox.getElement().setAttribute("type", "text");
Set it back to password when u want to undo it.
Try this:
passwdTextBox.getElement().setAttribute("type", "text");
This changes the type of input element from "password" to "text".