If else condition for go to next page in jmeter - if-statement

I need to use a if controller where i can put the condition for go to the next page(pagination) on the listing page of a ecommerce website. not so familiar with it. can anyone tell me that what condition should be here for that?

You should put all the logic which should be executed if function or variable is "true" as a child of the If Controller
If Controller (condition: "${SOME_VARIABLE}"=="Some Value")
HTTP Request (open a page)
So HTTP Request will be executed only if SOME_VARIABLE equals Some Value
See How to use JMeter's 'IF' Controller and get Pie guide for more information on using the IF Controller.
If you need to go though all pages of your e-commerce website perhaps it would be better to use While Controller instead

Related

Ember CLI path based on server response

I'm developing a substantial ember app, using Ember CLI, and I'm struggling with a few aspects of it.
What I want to do is:
Show a dropdown list of options
When the user picks an option, post their choice to the backend
The response from the server contains data based on what the user picked in the dropdown. After getting the server response I want to transition to a new route where the path ends with one of the values returned by the server.
For example:
/path/to/dropdown -- shows the dropdown for the user to pick from, which is then POSTed to the backend. The backend responds with, amongst other data:
slug: <stringValue>
This then transitions to:
/path/to/slug -- where slug is <stringValue>
So far I've got 1 & 2 above working, but I can't figure out how to make step 3 work. I've tried using a serialize function in the /path/to/slug route and the /path/to/dropdown controller, but it always returns undefined.
The AJAX call to the server, based on the user's dropdown choice, happens in the /path/to/dropdown controller.
I've set up the router as:
this.route('options', { path : ':slug' });
Would be great if someone could point me in the right direction; I hope my example is clear enough but let me know if not.
Thanks.
To be honest I don't understand why do you use this.route('options', { path : ':slug' });. You just created the only route for all possible options (in fact, for all urls of form /anything), but that's not what you want.
I think your solution is this.transitionToRoute(url_string) which is available in any controller. Check the api example there. But before you should declare all that routes in the router and create operating files for them, of course.
If you don't want to create a route for each possible slug, so then your route is pretty excellent, but at least I'd consider to add one more path section. For example, this.route('options', { path : '/slugs/:slug' });.
After that you can run transitionTo and pass data (in any format) to it. The data will be assigned to the route model and you will be able to use it in the SlugRoute (and SlugController, if you didn't redefined the setupControler method) as a this.get('model') variable.
If you want to run transition from the view, firstly you need to obtain the controller and send a special command to it.

Replace, not append to, the site's body content in Ember.js

I had the following idea: my page at example.org serves classic HTML from the server. Besides, EmberJS is loaded, too, and waiting to come into action:
as soon as somebody hits an ember route then, for example example.org/#/login, the current should be replaced by what the view renders for it. From then, the whole app should serve as one-page-app.
Is that a good idea? Anyway, I don't know how to get that started. Overriding View's appendTo method or setting the rootElement property as in http://emberjs.com/guides/configuring-ember/embedding-applications/ does not suffice because if that were the body, the view output is just appended thereā€¦
If your entire Ember application requires a user to be logged in, it is valid to have two separate "apps":
A regular non single-page application (server-side using rails, PHP or C#) with a sign up and login pages
A single-page application (i.e. Ember) send as soon as the user hits the login button in your regular app
You will have 2 index.html pages, one for each application (and it's okay to do that!). The URL of the Ember App could be under example.org/app/.... You will need to configure the router of the regular application to server your Ember App for all URLs starting with /app/.
Does that help? :)

How to change a URL in the Ember.js router before a route is assigned?

My Ember.js app requires backwards compatibility for links that went to specific file extensions. (i.e. .pdf) In other words, I an example link like this, to return the PDF:
http://www.example.com/docs/my.pdf
I'm trying to preprocess the URL to remove the .pdf before the Ember.js Router assigns a Route to it, by taking a substring, and assigning it back as the URL to process:
http://www.example.com/docs/my
Obviously, getting the substring is trivial, but I don't know how to inject the updated URL back into the Ember.js Router.
Your approach is non-ember compliant from the start. The solution isn't to update the URL, but to simply use the URL you want in the first place.
Instead of sending the user to
http://www.example.com/docs/my.pdf
Send them to
http://www.example.com/docs/my
And then within one of the related route hooks (beforeModel hook would be my preference), send the my.pdf file to the user.
You could just use transitionTo().
Alternatively this answer suggests using
Ember.HistoryLocation.replaceState(<string>);
or
router.replaceWith('index');

AngularJs - How to prevent route change on preloaded content

I'm writing a simple angularJS layer to a django app. On initial page load, the view content is already populated in the ng-view node. When I "manually" execute a route change (via ng-click callback), I do a request to the server to fetch the chromeless html content and overwrite the content of the ng-view node.
My issue is that on initial page load, the route change is executed and thus makes another call back to the server to fetch the same content that was pre-populated in the ng-view node.
I'm not sure if this is just the way Angular works or if it is that django uses trailing slashes and angular does not and thus thinks it is a different route?
Is there a way to prevent this from happening? Perhaps canceling the change in $routeChangeStart event?
Thanks! long time SO reader, first time poster.

Reload googlemaps after user clicks a link in Django

I am doing a project in Django and i want to have some google maps displayed in my site. So, i installed django-easy-maps and successfully used it in a sample template. So, i am ready with my maps.
The interface i want to implement is this
http://i49.tinypic.com/sowm74.png
I want to display the maps where the Hellow World! container is and with different links on the sidebar i want to refresh the map being displayed on user click without reloading the page.
I did some researching and it seems Ajax is the solution...
Can anybody tell me how i might achieve this (with or without Ajax ) ?
Sorry for sounding like a noob but i am fairly new to this.
The basic steps are:
Create a view for the Google Maps section to the right. This view does not return a full HTML page but only the HTML for that section (which contains your Google Maps map).
When the user clicks on a link on the left, use JavaScript to perform an ajax call to request that page. In short this means: attach an event handler to the onclick event of those links and in code you can perform an ajax call .Many people use a JavaScript library for this purpose, such as jQuery (which has $.ajax()).
You can then use JavaScript to put the received HTML inside the container on the right (using $.html()).