Skip to content
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 1914647 - Using browser tests to collect JSON for live messages #370

Merged
merged 16 commits into from
Sep 16, 2024

Conversation

sarahhjchung
Copy link
Collaborator

@sarahhjchung sarahhjchung commented Sep 3, 2024

Bug 1914647

Changes made:

  • Added live message data for releases 123-129
  • Added a script to merge all the release JSON data
  • Documented steps on how to run browser tests and commit JSON data into Skylight in CONTRIBUTING.md

Things to consider for future patches:

Copy link

netlify bot commented Sep 3, 2024

Deploy Preview for fxms-skylight ready!

Name Link
🔨 Latest commit ddfde3e
🔍 Latest deploy log https://app.netlify.com/sites/fxms-skylight/deploys/66e84a045b9ff700088049ce
😎 Deploy Preview https://deploy-preview-370--fxms-skylight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (🟢 up 11 from production)
Accessibility: 97 (🟢 up 8 from production)
Best Practices: 92 (🟢 up 9 from production)
SEO: 89 (🟢 up 7 from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@sarahhjchung sarahhjchung changed the title [WIP] Bug 1914647 - Document steps on running browser tests to collect JSON for live messages [WIP] Bug 1914647 - Using browser tests to collect JSON for live messages Sep 4, 2024
@sarahhjchung sarahhjchung changed the title [WIP] Bug 1914647 - Using browser tests to collect JSON for live messages Bug 1914647 - Using browser tests to collect JSON for live messages Sep 4, 2024
@sarahhjchung sarahhjchung marked this pull request as ready for review September 4, 2024 20:32
@sarahhjchung sarahhjchung requested a review from dmose September 4, 2024 20:32
Copy link
Member

@dmose dmose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. r=dmose, once this import script aborts if it sees that the keys aren't in reverse order.

// Add any message data with an id that does not already exist in data.json
for (let i = 0; i < json_data.length; i++) {
if (!json_result.find((x) => x.id === json_data[i].id)) {
json_result.push(json_data[i]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the first version read always wins (which is fine if releases stay in decreasing order) - abort script if wrong order, comment near this code that it depends on this ordering
  • the preview will always be of the latest released version, even though metrics will cover multiple (possibly all) versions (future epic)
  • will need similar algorithm for merge looker data with this data and eventually remote settings data (can be part of spike PR - make note in spike PR)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of aborting script, I just ended up sorting the list in descending order

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that this will need to be checked once if/when we add dot-versions (129.0.1), since I'm not sure how sort's default collation order will handle that...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also had to update the script to start with a basically empty data.json (including the default about welcome message that we need to manually add) to account for when newer releases are being added so that they are prioritized first and not being overwritten.

@dmose
Copy link
Member

dmose commented Sep 11, 2024

Before you land, could you add in 130 as well, since it's the current release version?

I'd also be interested in your thoughts on how we keep this up-to-date. Might just be a repeating calendar entry or something...

@sarahhjchung
Copy link
Collaborator Author

Yeah, I feel like a repeating calendar entry for every release makes the most sense

});
console.log(availableReleases);

const manualMessages = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why this needs to be manual, and how we go about updating it with each new release? My suspicion is that even if we need to do some kind of hack to get the data, that hack probably wants to go in the browser test itself, so that we always get the current version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just talked to @AllegroFox and we figured out how to get the about welcome default message data into the browser test! I'll be pushing my changes soon

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've rebased my new changes to the browser test and you can see them here https://phabricator.services.mozilla.com/D201646

Copy link
Member

@dmose dmose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, looks good, once the noted changes have been made. r=dmose

I've got some stuff in my calendar for early October to see if we can automate ticket creation for this with JIRA. I'll either do that in October, or fall back to manual calendaring.

JSON.stringify([]),
);

availableReleases.map((release) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of making the code easier to read, how about changing this from an anonymous lambda function to a named function with comments describing the expected behavior?

CONTRIBUTING.md Outdated
mv /tmp/file.json ./{VERSION_NUM}-release.json
```

6. Run [`lib/mergeASRouterData.js`](/lib/mergeASRouterData.js) using node to merge all the release data into one file. Make sure you include the latest version number you've just collected data from into the `availableReleases` array inside the script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this into two steps, with the first being to edit the script and add the version number, and the second step to run the script.

CONTRIBUTING.md Outdated

6. Run [`lib/mergeASRouterData.js`](/lib/mergeASRouterData.js) using node to merge all the release data into one file. Make sure you include the latest version number you've just collected data from into the `availableReleases` array inside the script.

**❗Important note**: Make sure to update the template for the `MR_WELCOME_DEFAULT` message inside `data.json` to "defaultaboutwelcome". This is currently a manual step we must perform to ensure that the message preview for this unique message is working.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be deleted now, correct?

@sarahhjchung sarahhjchung merged commit 41ac399 into main Sep 16, 2024
4 checks passed
@sarahhjchung sarahhjchung deleted the browser-tests branch September 16, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants