Add e2e coverage for additional scopes requests
See original GitHub issue#1566 introduced a more incremental way to request write scopes only when necessary. At the moment this is only used by Analytics, but shortly will be used by Tag Manager as well (#1608), and potentially further modules in the future.
While this has been tested and will be shipped without e2e tests in 1.9.0 (due to time constraints), we should have some e2e tests to cover these cases, since it’s not something that can reasonably be covered with Jest.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- There should be new e2e tests for the following:
- Creating an Analytics account (via proxy & provisioning API) when not having the
https://www.googleapis.com/auth/analytics.provisionscope yet. Expected experience:- The user sees a notice above the button that explains they will need to grant additional permissions.
- Upon clicking the button, they’re redirected to OAuth (should be mocked).
- When returning, their original action is automatically invoked, without requiring them to click the button again.
- They should be redirected to the Analytics TOS
(can be mocked to an immediate success redirect to Site Kit (...?gatoscallback=1...)). They should end up on the dashboard.
- Creating an Analytics property when not having the
https://www.googleapis.com/auth/analytics.editscope yet. Expected experience:- Upon clicking the button, a dialog opens informing the user that they will need to grant additional permissions.
- Once they click that button, they’re redirected to OAuth (should be mocked).
- When returning, their original action is automatically invoked, without requiring them to click the button again.
- They should end up on the dashboard.
- Creating an Analytics view when not having the
https://www.googleapis.com/auth/analytics.editscope yet. Expected experience should match the one for creating an Analytics property above.
- Creating an Analytics account (via proxy & provisioning API) when not having the
Implementation Brief
- Create a new
write-scope-requests.test.jsintests/e2e/specs/modules/analytics - Implement a new
describeforAnalytics write scope requests - In a
beforeAll, ensure that any oAuth requests are intercepted and successfully returned. See this example. Also ensure that any requests to the Analytics TOS as are also mocked and returned successfully. - In the
beforeEach, ensure that the Analytics module is set up by adding the following helpers:activatePlugin( 'e2e-tests-oauth-callback-plugin' )setSiteVerification()setSearchConsoleProperty()setupAnalytics()
- Write tests fulfilling the requirements as indicated in the AC.
QA Brief
Changelog entry
- N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Add Coverage to e2e tests #6286 - angular/angular-cli - GitHub
E2E tests takes more time to run than unit tests so if you have lot of e2e tests covering each and every case...
Read more >E2E Testing Part 4: Code-Coverage - SAP Blogs
Inside this 4th part we will implement code-coverage for e2e tests and realize integration tests using testcafe. UI Code Coverage for E2E tests....
Read more >Best Practices for Creating End-to-End Tests - Datadog
Best practices for creating end-to-end tests · Define your test coverage · Build meaningful tests for key application workflows. Break workflows ...
Read more >A Complete End to End (E2E) Testing Tutorial - LambdaTest
A comprehensive end to end Testing tutorial that covers what E2E Testing is, its importance, benefits, and how to perform it with real-time...
Read more >Context-based Code Coverage (now with more .NET!) - Medium
We do this by analyzing incoming requests. If the Scope agent detects that an incoming request is originating from an instrumented test, then ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@felixarntz I’ve updated the AC for the first case (account provisioning) as mentioned above to only test up until the redirect to the TOS. This is because it would require more substantial changes to only test the
gatoscallbackhandler which is already well tested in PHPUnit.Code here looks good to me and the tests behave appropriately, so moving to approval.