roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Need to track downloaded file instead of page source in spec/features/plans/exports_spec.rb

Open pengyin-shan opened this issue 3 years ago • 1 comments

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0) 3.0.4 and 3.1.0

Expected behaviour:

The expect part of this rspec test is to check if the plan title is in the generated file (i.e. csv, pdf, HTML, text and docx).

Actual behaviour:

Currently we are using expect(page.source).to have_text(plan.title) to validate the content. But the page.source is actually the original download page instead of the generated content. (i.e. cabayra is not jumping to the downloaded content after the click_button 'Download Plan' action).

However, this test actually passes because the page title exists in the download page (shown as the header). So we got tests passed but fail to validate what we need.

Steps to reproduce: you can run p page.source after the click_button 'Download Plan' to see the page source. Even after the button is clicked, the page is still the downloaded page

Please correct me if I misunderstand the idea of this test. I wonder if the same issue might also happen to some other tests.

pengyin-shan avatar May 20 '22 16:05 pengyin-shan

Verified again on Feb 2023 on v4.0.2. The problem is still there.

pengyin-shan avatar Feb 27 '23 22:02 pengyin-shan