Too long filenames when diff fails and test has many selectors + selectorExpansion
- Dominant language
- JavaScript
- Stars
- 7.2k
- Forks
- 621
- PR merge metrics
- No merged PRs in 30d
Description
I've run into an issue with getting two long file names when backstopjs generates a failed-diff*.png image. The problem seems to be that for these files the `{selectorLabel}` part are made up of all selectors instead of only the "current".
Here is some json to describe my setup
```
[
{ /.../, "selectors": [ "#Component1 .demo", "#Component2 .demo", /.../ ], "selectorExpansion: true" }
]
```
reference file names are then generated as follows because component 1 currently has 2 demos and Component 2 has three demos;
```
/.../_Component1demo_/.../.png
/.../_Component1demo__n1__/.../.png
/.../_Component2demo_/.../.png
/.../_Component2demo__n1__/.../.png
/.../_Component2demo__n2__/.../.png
```
However, when I run my tests and get a fail, the failed diff image is named like this;
`failed_diff/.../_Component1demo__Component2demo/.../.png`
You can imagine that this filename gets very long as I have many components... Is this a bug or is there some reason for this? Is it not supported to use `selectorExpansion` in tests with multiple `selectors`?
If I knew that my number of demos per component will not change I could have just used `.demo` as my selector, but then whenever we add a demo for some component, all the following reference images would have their "n"-number shifted up... With this setup I will only have that issue "within" the scope of each component.
My reason for this setup is that with a single page (or just a few pages) the test run only has to make a few requests to my application instead of making for example one request per component. This is desired, as it makes the whole test run faster.
Any input to this issue is much appreciated.
Contributor guide
Assessment
This issue has not been assessed yet.