Espresso - Assert EditText - android-studio

I want to check whether the text "Search YouTube" is present.
Find the image here
I have tried this, but doesn't work
onView(withText("Search YouTube")).check(matches(isDisplayed()));

Related

Microsoft Project Siena - How to make button1 navigate to a certain page if text1 equals "XX"?

Microsoft Project Siena - How to make button1 navigate to a certain page if text1 equals "XX"?
Hello everyone,
So what I want is when you click a 'button' it will navigate to a page where you can enter in a password aka text in (for example the 'text1' field) then on the same page will be a 'button', when you click the 'button' it will check to see if there is certain text in 'text1' and if the text matches it will navigate to whatever page I want it to.
Is any of this possible?
If so, how exactly?
Keep in mind I would like to do this while inside of 'Microsoft Project Siena' meaning I do not have any other 'app' making tools installed currently.
Thank you and kinds regards,
-Sean D.
::UPDATE::
Some things I have already tried on my own:
I have another button that changes the visibility to true once a timer equals 5000, so I tried the same type of thing but it doesn't seem to be changing the visibility when the correct text is entered, for example:
If(Text1!Text!Value=test1234, true)
not even this works:
If(Text1!Value=test1234, true)
That is what I have in the visibility formula, but like I said it doesn't work.
But yet when this is used with a timer like so:
If(Timer1_1!Value=5000, true)
After you navigate to the page and 5 seconds later the button appears and it works great.
Any ideas?
I figured it out:
If(Text1!Text="test1234", true)
did the job!
-Sean
Also if you want to clear out the password "InputText" then you'll have to do something like this:
Navigate(Screen1, ScreenTransition!Fade);UpdateContext({text_pwd: "abc"});UpdateContext({text_pwd: ""})
Put that on the button for navigate and it will navigate to the "Screen1" and clear out the password text, then change the Default property of the password "InputText" to text_pwd or what ever you would like to name it.
Goodluck!
-Sean

hardcoded string “Button”, should use #string resource

I am new in Android app development and using Java language.
My problem is every time I make a TextView or Button there is a triangle with the exclamation mark below them.
and when I click it I saw a message saying:
hardcoded string “Button”, should use #string resource
I have two activities, in my main activity there is a Button that when you click it you will go in second activity.
But when I go to my main.java to make a code for the button. There's always the above shown error. I think the eclipse can't find the id of my button and same for my TextView they have same error message.
Here is the code I made:
Button b = FindViewById(R.id.button1);
I also add:
Button b = (Button) FindViewById(R.id.button1);
I am using the latest eclipse classic and ADT august issue. The platform is Android 4.1 API 16.
You shouldn't hardcode the "text" on the widgets use the strings resources ie., strings in the strings.xml to set the text. Declare the "text" you want to display as a string in strings.xml and access it using #string/your_string_name in the layout file.
Notice the id of the button, which is rounded in red. You have to use this id when you want to call it in a method, for an example
Button b = (Button) FindViewById(R.id.button1);
Furthermore, check whether your graphical layout matches with the image I have provided.
Just try your code again with these changes.
Your main.java would look like this.
I am a newbie too, but I believe I got this. So basically what's happening here, java wants you to put your hardcodes in string.xml. so that when accessing it, you will use the given methods below before:
.
But this is how it should be.
Let's start by string.xml
Then come back to your activity_main.xml

Cucumber with Extjs4 choose radio step not working

I'm Working on Ruby on rail 3.1 with Netzke 0.7.4 and Cucumber.
I use Cucumber with Netzke it work great but I have found some problem on choose radio step.
I use this step.
When /^(?:|I )choose "([^"]*)"$/ do |field|
choose(field)
end
It show this error message.
And choose 'Yes' for GST field
cannot choose field, no radio button with id, name, or label 'Yes' found (Capybara::ElementNotFound)
(eval):2:in `choose'
It's look like choose(locator) method can't find any radio button on my page.
That very strange because it have only 2 radio on page.
Question is how can I do with this radio?
Thanks.
Finally I have found answer I search check box instead of combo box and it work.
Is ExtJs 4 transform check box to radio?

Watir : How do we capture the subitems displayed by doing mouseover on a particular item

I am trying to work with mouseover on a particular Item in my application by using the following command
{
ie.text_field(:xpath, "//a[contains(text(),'Deal')]").fire_event('onmouseover')
}
On doing mouseover on a item, two subitems are displayed.
Is there any way to capture the sub items which are part of the Item by doing mouseover with which we can report that our test is pass or fail.
Please suggest.
Additional Information :
If we take example,On the StackOver flow page, If i do mouseover on my name, i get a window where i see activity, privileges, Logout and other stuff. This is really what i was looking for. Is there a way to capture the items displayed on the window on doing mouseover.
I also tried to capture the subitems with the following :
{
text=ie.text_field(:xpath, "//a[contains(text(),'Deal')]").fire_event('onmouseover')
puts(text.inspect)
}
On doing this "text" value is displayed as 'nil'.
My general tactic for such things is a combination of using IRB and the IE Developer tool, or Firebug.
using IRB, type out (or cut and paste) the watir statement to fire the onmouseover command to the proper element on the page.
Then have the developer tool rescan the DOM (there's a little refresh icon you can click) The use the tool to point to an element to point to one of the items in the stuff exposed by the onmouseover. Using the info from that, you can then figure out how to address those elements to get the text from the proper div, etc.
If I do that here to the info that opens up when I float the mouse over my name I can find out that it is a table of class "profile-recent-summary" Furthermore I can then look at the way the table is made up and see for example that the 'today' reputation value is in the second cell on that row.. The row also has the text 'reputation' in it.. so
browser.table(:class, 'profile-recent-summary').row(:text, /reputation/).cell(:index, 2).flash
Should flash the cell I want (index might be 1 if using firewatir or webdriver) I can then replace the .flash with something else like .text if I want to get the text from that cell (which is actually inside a link that sits in the cell)..
without seeing your code, I would 'inspect' the element that you are trying to verify and when_present (text) assert that its true

cucumber testing for codemirror

I want to write cucumber test (bdd) for filling in codemirror with "abcd". But I cannot write
When I fill in "myFrame" with "abcd"
The codemirror hides the textarea and the text area is replaced by iframe. If there would have been text area, I would have simply written
When I fill in "myFrame" with "abcd"
But I don't know how to write test for filling in codemirror. May be I need to add custom step. If I could any how know to insert data into iframe, I think my problem would be solved. I am open to suggestions.
There exists a CodeMirror property on the wrapper DIV (which has class CodeMirror).
So you can execute the script :
$('.CodeMirror')[0].CodeMirror.setValue('Your value')

Resources