PDA

View Full Version : 2.2 EA saving page-object through inspector removes existing



StigOHara
20 Aug 2017, 10:55 PM
I have a pageobject file. When I want to add some stuff to this, I go to Inspector. The inspector opens with the existing page object, but not all previous settings are 'verified'. So I want to save the page object under a different name. When I do this and save, the old pageobject is being overwritten / renamed. This is unexpected for me. I expected to have a new page object besides the old one.

When manually creating a second page object, same thing happens. One of the pageobject is being used as the 'existing' one and when saving it with a different name, the original is gone.

[edit]
just discovered that the inspector remembers the last name of a page object it has worked with. But the outcome is still surprising for me.


I have a pageobject file, called Index.js with some definitions in it.
I open Inspector, do some modifications, put NewPage as a new name and save
I now have NewPage.js
I revert the situation, and put back (manually) my original Index.js file
I open Inspector again, the name of the page pre-filled is now NewPage (ok, the last name I used, even though that page does not exist)
I do some modifications and save
I now have two files: Index.js and NewPage.js

joel.watson
21 Aug 2017, 6:39 AM
Hi--

Thanks for the detailed description.

Currently, page objects are associated (ultimately) by their URLs. So if you are using the Inspect feature for the same URL on multiple occasions, any edits will be for the page object associated with that URL, and any name changes are simply "renames" (as opposed to creating a new page object).

Admittedly, there is a gap with the use case of manually modifying the page object name on the file system. I will file an improvement request for that so we can fill in that gap.

Also, we are planning, in future releases, to support more ad-hoc creation of page objects so that the use case you describe will be better supported.

Thanks!
Joel

StigOHara
21 Aug 2017, 11:26 PM
Thank you Joel,

That is a little surprising to associate a page object to a URL. I think a lot of user have a single-page app, where a single URL takes care of the whole application. So, in my case, there is this application with about 50 different modules. I would like very much to have a separate page for all these modules. Let's hope this ad-hoc solution will see the light of day very soon!

regards,

joel.watson
22 Aug 2017, 2:47 AM
Thank you Joel,

That is a little surprising to associate a page object to a URL. I think a lot of user have a single-page app, where a single URL takes care of the whole application. So, in my case, there is this application with about 50 different modules. I would like very much to have a separate page for all these modules. Let's hope this ad-hoc solution will see the light of day very soon!

regards,

Hi--

Associating page objects with individual pages is a pretty common pattern, but we do recognize the need for being able to associate page objects with particular "states" of a single-page web application as well...so hopefully we will soon be able to add more options for page object creation in a future release.

Thanks!
Joel