I have 2 pages in my app. Page 1 allows the user to select a pupil and then the app shows Page 2.
On Page 2 I have a Drive Picker widget that allows the user to choose images that will be copied to a specific folder (depends on what was selected on Page 1).
If the user closes the picker on Page 2 after picking files and then opens it again without visiting Page 1 first, the Drive Picker remembers which specific folder they had navigated to and allows them to continue.
If the user visits Page 1 again first to select a different pupil and then comes back to Page 2 and uses the Picker, it seems as if the Picker gets reset and shows the user the root of their Drive again. I want to avoid this behaviour so that the user can continue to select files from their last visit (in the same session) to Page 2.
Is there anyway to access the last visited folder of the picker and store that say in a page property and then make the picker use that property the next time it is opened?
I have become a little confused as well with the options that are available to the widget and the options that are surfaced through the result object. I confess that I've tried to search stack overflow for more information on how to use result object, but cannot surface much so all of my scripts use the widget.selectedDocuments way.
You can use sessionStorage() to keep variables between pages.
It is a client side function and does not support "custom action" as far as i know, but the following functions can fix that.
function get_ss(name){return sessionStoreage.getItem(name);}
function set_ss(name, val){sessionStorage.setItem(name, val);}
when navigating from page 1 you can use a custom action to get pupil and set it in sessionStorage then navigate to page2
"Custom Action=" set_ss("pupil", app.pages.Page1.decendents.PupilName.value); app.showPage(app.pages.Page2); //going from memory on the navigation code
You can add "var pupil = get_ss("pupil");" where ever you need it from there.
Related
I have an /explore page allowing the user to filter product iD based on different select (category, type). It works via building (firestore) query parameters dynamically based on the selected values. The results are shown on that same /explore page.
If a user clicks on a product, it opens a dynamically generated page and everything works well. However, while clicking the back button it goes back to the /explore page with the default values/query (not the ones with the previous query).
Example :
Default /explore showing all the sneakers
user applies filters for brand and color => it triggers a dynamically generated query and renders it on /explore
user clicks on one specific sneaker
user clicks on the back button and lands on Default /explore (without the queries)
However, I would like the user to land back on the /explore with brand and color filters...
Any ideas on how to do that ?
Thanks,
Max
I just started developing a test automation for an iOS app using Appium. I have to click several buttons in the app one after another with different XPath/Accessability ids.
I wondered, when to use the wait.until(ExpectedConditions.visibilityOf Element) expression.
Example:
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//XCUIElementTypeApplication[#name=\"app\"]/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeTabBar/XCUIElementTypeButton[3]")));
Should I check every time before I click a button if this button is actually visible or existing on the current state of the app or is this just unnecessary and time-wasting?
In my opinion, you should use ExpectedConditions in two case:
Screen load takes long, so you not ending up trying to click something that has not loaded yet. If you find your tests flaky (sometimes pass some times fails) then this probably the main reason why it happens
If you have something like ajax on your screen you want to make sure the data is changed on the page. (Example is you created a post on Facebook, and want to make sure content displayed)
I am trying to figure out ways to authenticate a user and load the application (while showing a preloader) in Adobe Air [desktop application, and not web based flex app].
This is what I have been able to achieve so far:- A window asks for login details, once validated I make the login window invisible and open an instance of the application's main window. There are 2 problems with this:-
I have to open a new window (2 windows in total). It would rather look better if I was able to simply show the login form in one state and the main application view in another state. I tried that too, but the problem is that besides the view component, flash does execute all the actionscript and keeps the other state ready. There is some application view centric actionscript which starts throwing null reference errors etc. On top of that, the whole things takes a while to show up as both views are created, though only 1 of them is shown
I'd like to show a preloader once the user is authenticated, until the main application view is loaded
In a nutshell, this is what I am trying to do:-
Load the login window as fast as possible and stop there (actionscript in other parts of the application should not run)
Post authentication, load the main view of the application. Show a preloader until the loading is done
Load the main view in the same window (rather than opening a new window and making the login one invisible)
Need help and direction as to how this could be executed.
Thanks!
UPDATE 1
Ok, so now I've managed to consolidate the functionality in a single window. however, the transition between states is not a smooth one.
State 1 is the login screen. If the user enters the correct login credentials, State 2 of the view becomes active.
Now for State 2 to load (its a bunch of UI components and a grid with loads of data) it takes time. Until then, the application blanks out and then all of it is shown in a jerk. Can the transition be made much smoother? Just showing 'Loading...' would suffice. Because State 2 won't show up until all of it has been constructed and State 1 dies away as soon as I change the current state to State 2. Is there any way to monitor the progress and changing the state only when the next state has been loaded!
UPDATE 2
Ok, I got the transition animation to work between states. However, there still exists a problem with the transition switch. The problem is that the state I switch to after login has been verified has a lot of components and shows a lot of data.
Is there a way I can attach Listeners (if any), which I can fire when the state loading is complete and view has been generated! The current jerk like effect in the transition is because the state has changed but the view has not completed yet.
State Change to State 2 is not smooth as State 2 loads about 10000 rows of data from database. Is there a way I can change the state visibly for the user, after state 2 has been completely drawn out and has pulled in all data? creationComplete doesn't help much here.
In short, is there a way to start loading a state from an initial state and make it visible only when its complete loaded? i.e. can I fire an event from state 1 to load state 2, but to visibly transition to state 2 only when state 2 is completely loaded..
UPDATE 3
After a week of firefighting, posting a bounty and scavenging through the web I have still not been able to fix this! My application window becomes unresponsive for the time the UI is created and data is loaded. In Windows, it even shows 'Not Responding' at the window title bar for about 5 seconds. So its the UI getting stuck because the data is taking some time to be fetched and loaded - all of this happens in a single thread by default.
How do people who develop based on Adobe Air do this? I've mostly always seen a loading screen before the actual game is loaded - and when its loaded, its fully functional. There has to be a way!
The time consuming problem of loading 10000 rows in a grid can come in any web based language in any web application because web application needs to run in the environment of a web browser which has its own resource limitation.
So what I would suggest is that you don't load all 10000 records at loading the view. Instead load 1000 records first and then keep a link or button with label "Next" or "Show More" like and on that click bring the next bunch of 1000 records from the database. This way you can accomplish your task.
Thanks,
Jigar Oza
I have a page which contains an iframe. The iframe can take user's input (via button click or menu selection) and display content accordingly.
What I need is, when a user manipulates the iframe, the browser push each set of iframe parameters into history; and when the user click at back button, the iframe will reload its content using the saved parameters from the previous history entry. I have a piece of code doing the reloading as shown below.
The strange thing is, when I make multiple settings on the iframe (hence multiple state entries added to history), and then click at back, it'll work like this,
Say that I have state 4, 3, 2 in history and I'm now at state 5
the first click restore to state 4 (the "----state changed----" logging message is printed
the second click reloads the iframe with default content. The "----state changed----" is not printed; the reloading code is not called.
the third click restore to state 3
the fourth click is like the 2nd click
the 5th click restore to state 2
So after each click that successfully restore the state, it takes two clicks to trigger the popstate event (I tried statechanged event, too, with same result) and restore to another previous state.
Anyone know what's going on here? Thanks in advance.
History.Adapter.bind(window, "popstate",
function (event) {
console.log("----state changed------", History.getState());
console.log("----state data------",History.getState().data.state);
//code to do reload an iframe to its proper state
});
So I stumbled on this same issue. The situation we had was using history.pushState() to update the URL and then after that changing the src attribute of an <iframe>. By changing the src of the <iframe>, we are implicitly telling the browser to add to its history that the iframe had changed. Thus...
When we pressed back the first time, window.history's popstate is
triggered on the <iframe>'s src attribute and is reverted back to it's previous state.
Pressing back a second time triggers the popstate event for the state you originally pushed onto the stack
Our solution involved that when we decided to update the URL and push the state onto the stack, when we wanted to update the <iframe>, we used jQuery to replace the <iframe> list so...
$("#iFrameID").replaceWith(('<iframe id="iFrameID" src="' + location + '"></iframe>'
By doing this, we removed the side effect of the browser history getting polluted with our update to the <iframe> tag.
I had the same problem.Instead of navigating the user to the previous page on the website, the back button navigated the user to the previous page inside the iframe. This code below will help you to solve your problem:
iframe.contentWindow.location.replace(href)
Our users can currently select a number of funds from a page and go to another page to see the funds compared on a chart. I now have to present the user with an option to produce a print-friendly fact sheet page for each fund in the chart.
The requirement is that each page will open in a new window (or tab), and be minimised so as not to be 'too intrusive' when they're opened. Can somebody suggest how I could go about this? This also means that the user will have to go to each window or tab to print the page.
They also want the print dialog box open in each of the new windows so the user doesn't have to open it. Is this possible, for the print dialog to open at the page load? If so, can somebody suggest how - JavaScript?
I disagree that (up to) 10 new windows can ever be anything but intrusive! Ideally I could send these new pages directly to the print queue. Is this possible?
Otherwise, I could Generate a page dynamically for each fund, strip out the contents of the page body and add the content for that fund to a large single page print-friendly factsheet. Does anyone have experience in this kind of work? Any pointers?
several points
you cant control new tabs vs new windows, this is a browser setting.
if its tabs, you can only have one print dialog per browser instance (depends on browser, but generally speaking). It tends to be modal.
you can call window.print() on page load to trigger the print dialog automatically, but its not very user-friendly
Whats the problem with creating a print friendly css and simply having a print button on the page that calls window.print();