-
Notifications
You must be signed in to change notification settings - Fork 665
Add a support page #9529
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
Add a support page #9529
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9529 +/- ##
==========================================
- Coverage 89.16% 89.11% -0.06%
==========================================
Files 286 285 -1
Lines 29071 28920 -151
==========================================
- Hits 25922 25772 -150
+ Misses 3149 3148 -1 ☔ View full report in Codecov by Sentry. |
@Turbo87 I've only created the support route for now, and haven't placed it anywhere yet. I believe we want to replace "Email Support" under the "Get Help" section in the footer with this. I'm unsure whether we should simply add a "Get help" mailto link to the categorized support list or differentiate it with a horizontal separator and a subheader like "If you couldn't find a category above." followed by the "Get help" mailto link. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also introduced data-testid="some-id"
in this PR instead of the data-test-some-id
format. data-testid
is becoming more popular recently, which also enables getByTestId
in playwright and the potential benefit of removing data-testid
in production (further implementation is required) if desired. This comes with a minor drawback of being slightly more verbose in qunit tests.
export default class SupportController extends Controller { | ||
queryParams = ['inquire', 'name']; | ||
|
||
@tracked inquire; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is in a controller I think the property keeps its value across page navigations. in other words: if you press the "report crate" button the property will be set, if you navigate away from the page, then you press the support link in the footer, you will not get to the overview state, but to the "report crate" state again. I'm not 100% sure about this, but we should probably add a test to ensure that navigating to /support
without query params resets the state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing I noticed is that, if you're on the support page with query, if the support link in footer is defined as <LinkTo @route="support" />
it will still inherit those query params. There doesn't seem to be a simple way to avoid this inheritance in the template. You need to use hash to manual overwrite all query params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if there's a way to test this without <LinkTo @route="support"/>
. We already have <LinkTo @route="support" @query={{hash inquire=null crate=null }}>Support</LinkTo>
that reset the query params by setting their values to null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about playwright, but in the Ember.js test suite visit('/support')
might be sufficient as it does not reload the whole app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I just commented out resetController
and expected the following to fail, but it didn't 😅 .
test('should not retain query params when exiting and then returning', async function (assert) {
await visit('/support?inquire=crate-violation');
assert.strictEqual(currentURL(), '/support?inquire=crate-violation');
assert
.dom('[data-test-id="support-main-content"] section')
.exists({ count: 1 })
.hasAttribute('data-test-id', 'crate-violation-section');
await visit('/');
assert.strictEqual(currentURL(), '/');
await visit('/support');
assert.strictEqual(currentURL(), '/support');
assert
.dom('[data-test-id="support-main-content"] section')
.exists({ count: 1 })
.hasAttribute('data-test-id', 'inquire-list-section');
});
However, if there's a <LinkTo @route="support">
, I can see that the generated URL has sticky query params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting, maybe I was wrong then :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out how to test this in qunit but not playwright. I don't know how to mock the route in playwright QQ.
that is already done for |
Thanks for pointing this out. I didn't know that before. Yes, I suppose this is a common pattern in newer testing frameworks like testing-library, cypress, and playwright, etc. Do you suggest we stick to the |
yeah, I think that would be best for now. I'd rather convert the whole codebase to the other pattern at once, instead of having to deal with two concepts in parallel when possible. one thing to note, we use things like |
Hmm, I'm not sure if I fully understand your question, but I think this can be easily achieved using a template like |
I think I've found a possible solution. Since the |
The custom test id is also compatible with `ember-test-selectors`
The page is inspired by npm's support page.
c63f3aa
to
85d18ee
Compare
A report form will be displayed on the support page. The user must input a crate name, select reasons, and provide detailed information (required when the "other" reason is chosen) before submitting.
The report form's crate field should be automatically filled when navigating from the report button in the CrateSidebar.
To display a correct support link (without query params) in the support page, it is necessary to overwrite query params.
85d18ee
to
e85a97d
Compare
@eth3lbert is this PR in draft state intentionally or is it ready for review/merging? |
Yes, this is almost done. We just need to implement this
The simplest and most intuitive way would be to simply place a mailto link after the Or do you expect this to be done in a separate PR? |
I'm fine with either path :) |
This makes the support link in the footer testable and eliminates the need to manually update query params when new ones are added.
aa4fe32
to
ba869e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a support page that allows user to select a support type from a list and fill in required information. It also moves "Email Support" from the footer to the support page.
The support page is inspired by npm's support page1. When a user clicks the "report violation" link, a report form will be displayed. The user must input a crate name, select reasons, and provide detailed information (required when "other" is chosen) before submitting. The name field in the report form should be automatically filled when navigating from the report button in the
CrateSidebar
.Related #9496 .
Closes #9478 .
Footnotes
https://www.npmjs.com/support ↩