-
Notifications
You must be signed in to change notification settings - Fork 13
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
[BUG] Attachments not found #34
Comments
So might not be a bug. A couple of things:
reporter: [
[
"monocart-reporter",
{
name: "Playwright Monocart Report",
outputFile: _monoCartReporterOutputFile,
attachmentPath: (currentPath: any, extras: any) => {
console.log(currentPath, extras, path);
return "somethig?"; // allows you to remap where attachments should be located?
// return `https://cenfun.github.io/monocart-reporter/${relativePath}`;
},
},
],
], Not sure what this could be used for but I used it with some
So perhaps this bug can be closed and at best there's a chance for an improvment:
What do you think @cenfun ? |
Actually, I'm not sure how to make this work. I keep going back and forth thinking if this is a bug or not. The problem I have is that now I need to be careful in how I configure the directories so that the html report is at the same level as playwright's The other thing I noticed is that the |
It is recommended that const outputDir = `./tests/test-results/`;
module.exports = {
outputDir: outputDir,
reporter: [
['monocart-reporter', {
name: `My Test Report ${date}`,
outputFile: `${outputDir}/index.html`
}]
]
}; In this way, do you want |
reporter: [
["html", { outputFolder: _htmlReporterDir }]
] The reason I like the If
So for I understand it might not be worth giving the flexibility to the user to configure |
1, I haven't heard about 2, yes, the html output folder clashes with the tests output folder, my idea is that put html dir under output dir as a sub dir: import path from 'path';
const name = 'multiple-html';
const outputDir = path.resolve(`./docs/${name}`);
export default {
testDir: `../../tests/${name}`,
outputDir: outputDir,
reporter: [
['list'],
['html', {
open: 'never',
outputFolder: path.resolve(outputDir, 'html'),
outputFile: 'index.html'
}],
['monocart-reporter', {
name,
outputFile: path.resolve(outputDir, 'index.html')
}]
]
};
any thought? |
I think the tab is better and allows for in place comparison. Meaning when I swap from one tab to another the image is always in the same place and allows for quick understanding of what changed. The slider also helps with the visual difference:
This structure won't work because, as you've said, the report won't have "access" to the output files from playwright which are at So at this point I see at least 2 options: A) We accept that the above structure is not valid, to allow for playwright output files to be accessed the B) We want to allow more flexibility for the user to select any folder structure he so wishes. This potentially involves more code changes and I think it means copying the attachments from playwright's output dir into I'm fine with either option. I usually tend to prefer flexibility but I understand it comes at a cost and as such a simple message to identify the bad config might be the way to go here. |
Tried it, love it 🤗 I do think it makes it much easier to spot differences because you can swap from tab to tab and get a feel for the difference. A couple of things that would be nice to haves:
Thanks a lot for these updates @cenfun |
I feel like I'm hijacking the initial question for this issue and asking for other things but since we've started talking about some nice to haves on The However I do think it's much nicer to be able to just expand the step and see it in context. |
1, we can sort as "Diff" "Actual" "Expected" 2, if we do that, it will be exactly the same as the official html report. before doing that, could you please try holding and releasing the mouse on the image? it will quickly switch image previews between them. or tell us the benefits of the image slider. 3, I thought about this feature before. but there are 2 small problems, it takes time to collect the code snippets for all steps, and the code snippets will increase the size of the report file. So before doing that I would like to know, in what cases we need to check the code snippets for a successful step? Thanks, |
I just didn't know about the hold/release on images. I'd suggest perhaps adding a label above the tabs (or somewhere) explaining that behaviour to the user? Some short phrase to let users know they can do just what you told me.
Feel free to close this issue. |
for 2, Yes, I thought there should be some notes for the user, but I don't know where to put it, maybe in tooltip? And I am a bit confused about what the content of the notes is because I am not a Engilish native speaker, can you help me? Thanks |
The tooltip idea is great. For the phrasing I would do something like:
I did something a bit more verbose because I think this behaviour is not that common so I felt better to add an example. |
thanks, monocart-reporter@1.6.32 released. |
I can confirm it's working as expected. Awesome 👍 This issue morphed from attachments not found, to improving the images. I should have created another issue for that to make things clearer. Apologies for that. Regarding the original purpose of this issue: |
Hi,
It seems attachments are not being fetched properly depending on how you setup your playwright
outputDir
and monocart-reporteroutputFile
.If I setup my
playwright.config.ts
as such:And have an automatic fixture as such:
Then I run a test that produces a snapshot and I have this output:
Notice that both the HTML report and the global coverage report share the same base dir
tests/test-results/reporters/monocart/
and as such I can navigate from theindex.html
to the global code coverage report:http://localhost:8090/index.html
tohttp://localhost:8090/coverage/index.html
However the screenshot attachments and the code coverage attachments display as
not found
. When I try to access the test code coverage it tries to go tohttp://localhost:8090/coverage-8aefe567157b61ce7446/index.html
and because the pathcoverage-8aefe567157b61ce7446/index.html
does not exist attests/test-results/reporters/monocart
it can't find the file. That path is attests/test-results/
.The same happens for the screenshots. If I try to go to a screenshot it tries to go to
http://localhost:8090/find-institution-example-basic-test-chromium/basic-test-1-expected.png
and it cant find the path/find-institution-example-basic-test-chromium/basic-test-1-expected.png
attests/test-results/reporters/monocart
so it fails. The path is attests/test-results/
.It seems to me that the attachments path uses playwright
s
outputDirto store data instead of the directory relative to where the monocart html report is at which is indicated by
outputFile` and then there's a mismatch in where files should be ? Do you think this is a bug or am I misusing the configuration?Let me know if you need more info.
The text was updated successfully, but these errors were encountered: