-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New device agnostic option to avoid the suffix in the snapshots #35
Conversation
Is there anyone looking at pull requests for this project? |
I didn't realise this when I commented on the issue, but this is too confusing because And there's no nice way to do this with the option mask, because if we add a new Perhaps it might work if we bump the major library version to follow semantic versioning, but that still doesn't solve the problem that people will wonder why all their tests are failing once they update. |
@alanzeino I don't know if I understood everything you commented. But, if people update right now with the fix I did they will have to add an option called If they still avoid using any option the default behavior will be used. |
Sorry, should've been clearer. The confusing part is that there will be two options; I believe that in general the reason why the original library never made device scale something you can remove, is because the original authors would have considered that to be a fundamental part of the file name. In short looking at this more now, I don't think we can make the change in a way that works for existing code. |
I would like to have this. Personally, I am manually adding the device name to the identifier, so the 2x/3x suffix is useless. In addition, the actual implementation does not allow to modify the order of the agnostic suffixes/prefixes, or which separators to use (underscore, dots, brackets..). I would rewrite the implementation, so instead of having different flags for the different suffixes/prefixes, we can pass a formatter, which allows to modify the order and the separators (similar to the date formatters). |
sounds good, what do you think @alanzeino ? I can change my implementation to some kind of formatter block that optionally anyone can send to format the file name of the screenshot in any scenario the developer using the lib could chose. |
It's a good idea, but again let's trade off that idea against supporting the current users. If we add that formatting block approach, we have to deprecate the So we're at 3.0 now. If we follow semantic versioning, we deprecate I have some clarifying questions too, just so I understand where you're coming from:
@acecilia So you are adding 'iPhone X' and 'iPhone SE' and 'iPhone 7' to your test file names?
@acecilia when you wrote this did you mean that when you take say, an iPhone SE and an iPhone 6 (which are both 2x scale), that they generate different snapshots so therefore the scale is not useful here? If I understand correctly, this could also be resolved by making |
(Just investigating device names a bit more, seems like you can't get a more precise name when using the simulator. What I suggested above might not work. Will keep looking.) |
@alanzeino the main problem for me is that the framework does not allow for a flexible customization of the file names (I dont like the separators and order that the framework is using), so what I did is pass my own identifier, created using DeviceKit:
It looks like this:
And a real example:
As you can see, the things I could not get rid off is the test name and the resolution suffix. My ideal snapshot name would be:
IMHO what makes sense to me is one of this options (in order of preference):
|
@acecilia One thing I've already mentioned on #14 is that in general, this library wasn't designed for the purpose of wanting to make a repository of nicely named screenshots. However in that issue we're going to allow for the folder name to be overridden, since that seems like a useful addition and solves the issue where sometimes the folder name includes redundant information which could be omitted. I'm happy to consider changes that resolve issues with the library where the issue leads to a bug during testing but issues where a user has a custom workflow that is outside the goals and original intent of the project are a little less likely to make it into master. People are free to fork and make changes that make their workflow better and point their If we continue down this path we have to 100% acknowledge that we need to make the change in a way that makes sense for users of the API and agree on how we deprecate the older API. I'm not interested in just adding stuff and leaving/supporting old ways of doing things in the API as well. So again if the issue is that there's a bug where the Can we resolve this by improving the name used when passing the |
Implementing 100% custom name files by allowing to remove the test name and the resolution indicator will not break any API, it will be an incremental change, so you dont need to deprecate anything. It will not require to change main version number. |
Unfortunately long term we will need to deprecate something because this API is already pretty bloated with both |
…seAgnosticOptionScreenScale
Another option for us to think: optional env vars in the scheme, like the setting for the directories of the reference images. Something like: |
@alanzeino and @acecilia if you guys agree I will can implement a environemnt var based solution. :) |
An update here. In #64 we're going to add a new option mask to replace |
Adding an option to the agnostic snapshots to avoid the addition of the suffixes regarding dimension.
If accepted it will resolve #30