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

Multi-Page application support for PWA #1556

Merged
merged 10 commits into from
May 13, 2021

Conversation

kbalasub
Copy link
Contributor

This PR adds support for multi-page applications (MPAs) to be recognized as Progressive Web Apps(PWAs) without having to configure each page. With this change you can configure PWA properties once at the project level or even at the localization level in the tree (e.g., us/en). When you access any page within the MPA this solution will traverse up the tree to see if any parent page has PWA properties configured and if so use those properties to show up as a PWA with the installable icon in the browser.

@codecov
Copy link

codecov bot commented May 11, 2021

Codecov Report

Merging #1556 (32a9b3a) into development (3e9e721) will decrease coverage by 0.00%.
The diff coverage is 88.88%.

Impacted file tree graph

@@                Coverage Diff                @@
##             development    #1556      +/-   ##
=================================================
- Coverage          86.66%   86.66%   -0.01%     
- Complexity          2072     2073       +1     
=================================================
  Files                197      197              
  Lines               5580     5585       +5     
  Branches             825      825              
=================================================
+ Hits                4836     4840       +4     
- Misses               301      302       +1     
  Partials             443      443              
Impacted Files Coverage Δ Complexity Δ
...cm/core/components/internal/models/v2/PWAImpl.java 82.00% <88.88%> (-0.23%) 15.00 <4.00> (+1.00) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e9e721...32a9b3a. Read the comment docs.

adminAuthor.getUrl("/");

// Manifest
GraniteAssert.assertRegExFind(content, "<link rel=\"manifest\" href=\".*/content/foo/us/en/manifest.webmanifest\" crossorigin=\"use-credentials\"/>");
Copy link
Member

Choose a reason for hiding this comment

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

Added support for context path, would fail in our testing pipeline otherwise as we always use a context path.

assertEquals("staleWhileRevalidate", swconfigJson.get("pwaCachestrategy").getAsString());
assertNotNull(swconfigJson.get("pwaPrecache").getAsJsonArray());
assertNotNull(swconfigJson.get("pwaCachingpaths").getAsJsonArray());
//assertNotNull(swconfigJson.get("pwaOfflineClientlibs").getAsJsonArray());
Copy link
Member

Choose a reason for hiding this comment

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

Added better handling of JSON as the previous was failing in my local development environment.

Copy link
Member

Choose a reason for hiding this comment

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

You might want to expand assertions by walking the expected tree.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -55,4 +64,47 @@ public void testBrandSlug() throws ClientException {
content = adminAuthor.doGet("/content/core-components/simple-page/simple-subpage.html", 200).getContent();
GraniteAssert.assertRegExFind(content, "<title>Simple SubPage \\| Core Components</title>");
}

@Test
public void testPWAProperties() throws ClientException {
Copy link
Member

Choose a reason for hiding this comment

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

These tests should probably be skipped on 6.4 and 6.5 if the PWA features were not backported. @msagolj, any pointers here?

Copy link
Contributor

@msagolj msagolj May 12, 2021

Choose a reason for hiding this comment

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

  • create an empty Interface named e.g. IgnoreOn64 and IgnoreOn65
  • Mark tests to ignore with @Category({IgnoreOn64.class, IgnoreOn65.class})
  • In the Jenkinsfile we then have to add a .withCategoryFilter("IgnoreOn64") etc. for the corresponding IntergrationTestRun configurations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. @msagolj Grateful if you could update the JenkinsFile accordingly.

Copy link
Member

@vladbailescu vladbailescu left a comment

Choose a reason for hiding this comment

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

I reduced the service worker assertions because the previous test was failing on my environment.

Also, please see inline comments!

@sonarcloud
Copy link

sonarcloud bot commented May 13, 2021

SonarCloud Quality Gate failed.

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 0 Code Smells

No Coverage information No Coverage information
7.7% 7.7% Duplication

@vladbailescu vladbailescu merged commit cf4ba77 into adobe:development May 13, 2021
vladbailescu added a commit that referenced this pull request May 13, 2021
* Multi-Page application support for PWA
* IT tests for PWA
* Added ignores for 64 and 65

Co-authored-by: fauchere <fauchere@adobe.com>
Co-authored-by: Vlad <vlad@bailescu.ro>
@vladbailescu vladbailescu added this to the 2.16.2 milestone May 13, 2021
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.

None yet

3 participants