anything similar to set_preferences for calabash ios - calabash

I am testing a scenario where on third visit the 'give the feedback' form appears.
For android I've used the set_preference method to set the variable ( 'VisitCount' => 2) .Then I am just visiting once and then I see the 'give the feedback' form.This works perfectly fine.
However for iOS I didn't find anything similar . Can anyone suggest how I can do this.

Related

ember-bootstrap errors when rendering a form

I have a problem using ember-bootstrap to render a form. When the route is visited nothing is rendered and in the console the message
appears.
The project is a Bootstrap 3 project and I have just installed ember-boostrap. To do that I did the following :
ember install ember-bootstrap
ember generate ember-bootstrap --preprocessor=sass
ember generate ember-bootstrap --bootstrap-version=3
From reading the doco I believe that was the correct sequence of commands ?
I then created a new route and in the template I put the following :
{{#bs-form formLayout=formLayout model=this onSubmit=(action "submit") as |form|}}
{{form.element controlType="email" label="Email" placeholder="Email" property="email" required=true}}
{{form.element controlType="password" label="Password" placeholder="Password" property="password" required=true helpText="Minimum 6 characters"}}
{{form.element controlType="radio" label="Radio" property="radio" options=radioOptions optionLabelPath="label"}}
{{form.element controlType="checkbox" label="Checkbox" property="checkbox"}}
{{form.element controlType="textarea" label="Textarea" property="textarea"}}
{{bs-button defaultText="Submit" type="primary" buttonType="submit"}}
{{/bs-form}}
{{outlet}}
Which is the sample template from the form component in the ember-bootstrap doco .
As I said when I go to visit the the new route I get nothing rendered and the error message shown above.
I feel like I must have overlooked some part of the directions ... is there something obviously missing ?
EDIT IN RESPONSE TO ANSWER FROM REAL_ATE
So to respond to the points raised by by Chris (real_ate) below. I'm using Ember 3.8 .
Now I was really pleased to feature on the excellent "May I Ask A Question" and I hadn't yet watched this weeks so I went off to watch. It seemed really odd that you were getting a different error than I was so I decided to start a new project and attempt my own reconstruction.
What I found was that I got exactly the error you saw (others can view that segment of the vid here) and not the one I had shown the screen shot of.
So I'm pretty puzzled about this but it does confirm your finding.
My best guess is this ... at about the same time I had been working through some issues with another addon and to document the process I had taken some screen dumps of those errors. I believe I may have picked the wrong screen dump and pasted it into the question. Oddly enough Chris mentioned something at the start of the segment about me not having actually copied the stacktrace but instead having used a screen shot of the stacktrace - perhaps if I'd actually copied the stacktrace I would have been less likely to do what, it seems likely, I did.
So ... for the sake of posterity the initial error was ...
Uncaught Error: Assertion Failed: An action named 'submit' was not found in <est#controller:login::ember231>
at assert (index.js:163)
at makeClosureAction (glimmer.js:6069)
at action (glimmer.js:5995)
at Object.evaluate (runtime.js:266)
at AppendOpcodes.evaluate (runtime.js:72)
at LowLevelVM.evaluateSyscall (runtime.js:3471)
at LowLevelVM.evaluateInner (runtime.js:3417)
at LowLevelVM.evaluateOuter (runtime.js:3409)
at VM.next (runtime.js:5530)
at TemplateIteratorImpl.next (runtime.js:5632)
Which was resolved by providing a 'submit' action on a controller created for the purpose and that then revealed a different issue with the example .hbs from ember-bootstrap including formLayout=formLayout which doesn't exist unless you've defined it and the error for that looks like this ...
Uncaught Error: Assertion Failed: must provide a valid `formLayout` attribute.
at Object.assert (index.js:163)
at Class.<anonymous> (bs-form.js:11)
at ComputedProperty.get (metal.js:2966)
at _get (metal.js:1591)
at RootPropertyReference.compute (glimmer.js:535)
at RootPropertyReference.value (glimmer.js:384)
at SimpleClassNameBindingReference.compute (glimmer.js:4002)
at SimpleClassNameBindingReference.value (reference.js:367)
at ClassListReference.value (runtime.js:1283)
at ComponentElementOperations.flush (runtime.js:1645)
... that was resolved as I described in my answer below .
So thanks to Chris and Jen and sorry for the misleading question .
Well I'm going to answer this myself for the sake of others who might have the same issue. I got some help from the add-on maintainer via the Emberjs discord and to quote him ...
The examples on ember-bootstrap.com are unfortunately not very smart,
in that they show bounded properties as such and not with the actual
value. For example that formLayout=formLayout only makes sense if
you also have a formLayout property on your controller. If that's
not the case (which I assume), formLayout will be undefined. Can you
try removing that and see if it helps? (or replace with a constant
value like formLayout="horizontal")
I did what he suggested and it resolved the problem.
thanks for the question and for giving such a complete example of how to recreate the problem.
I spent some time trying to recreate the problem that you have but I couldn't find the same issue and I wasn't able to get it to error in the same way as you described. I even tried this in an older version of Ember to see if it was something to do with that and it didn't help.
One thing that I did learn when I was trying this out was that the initialisation that you're doing as 3 different steps can actually be done on all one line:
ember install ember-bootstrap --preprocessor=sass --bootstrap-version=3
It shows an error that --preprocessor is not a known parameter for ember-cli but it still works as expected 😂
We also hit into the same issue where we needed to define formLayout for the form to get it to work, but the error we saw wasn't the same as the one you had 🤔 Could you tell us what version of Ember you're working on?
I can see that you have answered your own question already but I would still be interested in getting to the bottom of the error that you saw (if you're interested)
This question was answered as part of "May I Ask a Question" Season 2 Episode 3. If you would like to see us discuss this answer in full you can check out the video here: https://youtu.be/nQsG1zjl8H4

Integrating Ember_simple_auth with acceptance tests (using Mirage)

I created a basic test app that uses the OMDb API (The Open Movie Database), and with some help from SO posters everything is working fine.
I added ember-simple-auth (version 1.0.0) to the project, and got the dev side of things going. Basically there's a simple login screen to get into the main app. It's working as expected.
However, my two basic acceptance tests are now not working. After adding the ember-simple-auth components and functionality to the app, to the acceptance test file I added:
import { currentSession, authenticateSession, invalidateSession } from 'movie-example/tests/helpers/ember-simple-auth';
and in a test itself, I added:
authenticateSession();
The test now fails, saying:
Cannot read property '__container__' of undefined
Moreover, if I comment out the import line and the authenticateSession() call, the test still fails, but because the DOM is apparently completely empty.
The whole thing is available in a repo if anyone is curious/willing: git#github.com:bdrsgg/ember-movie-example.git (branch = feature/ember-simple-auth)
I assume there's some configuration issue I'm getting wrong, or something like that. Appreciate any help anyone can offer.
EDITED TO ADD:
The issue definitely seems to center on authentication. For example, if I remove the AuthenticatedRouteMixin calls from the routes, and leave out authenticateSession() calls, the tests pass.
Turned out I was just not declaring an earlier application variable correctly. Long story short, when I changed authenticateSession() to authenticateSession(this.application), things worked as expected.

Devise does not set notice messages

My app is rather barebones right now, so it might be a very stupid mistake by my side. I'm testing with cucumber signing out with devise
Scenario: User signs out
Given I am logged in
When I sign out
Then I should see a signed out message
Everything is pretty standard, I've set devise to accept get requests for signing out, and from my logs everything appears to work as expected. Only problem is the last step, the flash/notice message doesn't show up, which is very weird (as always with devise, I don't know who's setting what and where...).
This is my layout view:
%body
- unless notice.blank?
%p.notice= notice
- unless alert.blank?
%p.alert= alert
= yield
What I see is a completely blank page... I've already checked locales, the message is there. The sign_out call is the standard one. Flash messages appear to be completely empty (blank).
What course of action would you suggest I take in order to debug this?

paging via graph api?

i have been working on a new app to display feeds posted from a certain app, which is working fine, however, it only shows 25 results and after that it shows a paging array like so:
[paging] => Array
(
[previous] => https://graph.facebook.com/100000229028365/home?method=GET&access_token=AAACOrxawWZCgBACwTDcb79QOtboPgAhLGLT4d31vkKEqQTVHgj91a6QGQ9mUFhdpScma4ZCdmpZB7HNnpGj0itAht4oVJqJLyIRMVy4VFnGfQ07WZCKz&limit=25&since=1321212154
[next] => https://graph.facebook.com/100000229028365/home?method=GET&access_token=AAACOrxawWZCgBACwTDcb79QOtboPgAhLGLT4d31vkKEqQTVHgj91a6QGQ9mUFhdpScma4ZCdmpZB7HNnpGj0itAht4oVJqJLyIRMVy4VFnGfQ07WZCKz&limit=25&until=1321209616
)
i have tried to implament this into my app without success.
can anyone show me an example how to use this to produce pagnation for my app?
pretty stuck now =os
Im pretty sure all you need to do is take the previous link and do a graph call with that to get the next 25, alternatively the less desirable method would be to change the limit when you do a graph call or if you dont use one when you do a call specify ?limit=100 and this will get 100 results

Facebook Group invite via Graph API

I about to built a little online game in Action Script 3. At the moment everything is working pretty fine and there is just one thing left to do that makes me going crazy. After every Level of the Game the user should notified about his success and in case that the success was good enough, the user should be invited to a facebook group. At the Moment i have got an Facebook App, Authentification and Authorisation are working and what still is to manage is the invitation itself.
Does anybody know if there is a way to make this happen, and if so, how could it be done? Thanks a lot for a reply!
greetings!
So, after having a nice day of »facebook api investigation« i would sum up the things i found out:
I'm quite sure that there is no way to make an group invitation via the graph api. The best result i could reach was an Error that told me: »requires the manage_groups permission«.
Consequently I added this permission to the login method and »tada«: the app didn't work anymore, just told me that there is an error with the app and I should try later again.
The code for getting this great message looked like this:
FB.api( "//members","POST", { name : "user name" }, function( response ){
//the great error appears here in the response
} );
I also was looking for something in the facebook.connect api but could not find something related to the problem i tried to solve.
If there is anybody who knows something better to try, i would very interested.
Greeting Philipp
Looks like "manage_groups" is not available to the public, (yet?). I'm following this and this discussion about it, as "manage_groups" seems to be required to invite a user to a group, but is not listed in the Facebook reference of extended permissions.