Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into M3-8707-tooltip-…
Browse files Browse the repository at this point in the history
…UI-package
  • Loading branch information
hkhalil-akamai committed Oct 22, 2024
2 parents 6fe8fd4 + b64a39d commit c7b1d8f
Show file tree
Hide file tree
Showing 119 changed files with 2,848 additions and 841 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ jobs:
path: ref_code_coverage.txt

current_branch:
if: github.event.pull_request.draft == false
# We want to make sure we only run on open PRs (not drafts), but also should run even if the base branch coverage job fails.
# If the base branch coverage job fails to create a report, the current branch coverage job will fail as well, but this may help us debug the CI on the current branch.
if: ${{ always() && github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
needs: base_branch

Expand Down
63 changes: 46 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ x-e2e-env:
# Cloud Manager-specific test configuration.
CY_TEST_SUITE: ${CY_TEST_SUITE}
CY_TEST_REGION: ${CY_TEST_REGION}
CY_TEST_FEATURE_FLAGS: ${CY_TEST_FEATURE_FLAGS}
CY_TEST_TAGS: ${CY_TEST_TAGS}
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}

Expand Down Expand Up @@ -80,14 +81,9 @@ x-e2e-runners:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e
depends_on:
web:
condition: service_healthy
env_file: ./packages/manager/.env
volumes: *default-volumes
# TODO Stop using entrypoint, use CMD instead.
# (Or just make `yarn` the entrypoint, but either way stop forcing `cy:e2e`).
entrypoint: ['yarn', 'cy:e2e']
entrypoint: 'yarn'

services:
# Serves a local instance of Cloud Manager for Cypress to use for its tests.
Expand All @@ -110,13 +106,56 @@ services:
timeout: 10s
retries: 10

# Cypress test runner service to run tests against a remotely-served Cloud instance.
#
# This is useful when testing against a standard Cloud Manager environment,
# like Production at cloud.linode.com, but can also be used to run tests against
# pre-Prod environments, PR preview links, and more.
cypress_remote:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}

# Cypress test runner service to run tests against a locally-served Cloud instance.
#
# This is useful when testing against a customized or in-development build of
# Cloud Manager.
cypress_local:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
depends_on:
web:
condition: service_healthy

# Cypress component test runner service.
#
# Unlike other Cloud Manager Cypress tests, these tests can be run without
# requiring a Cloud Manager environment.
cypress_component:
<<: *default-runner
environment:
CY_TEST_DISABLE_RETRIES: ${CY_TEST_DISABLE_RETRIES}
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}


# --> ! DEPRECATION NOTICE ! <--
# The services below this line are deprecated, and will be deleted soon.
# Don't build any pipelines or write any scripts that depend on these.
# Instead, opt to use `cypress_local` in places where you would've used `e2e`,
# use `cypress_remote` in places where you would've used `e2e_heimdall`, and
# use `cypress_component` in places where you would've used `component`.

# Generic end-to-end test runner for Cloud's primary testing pipeline.
# Configured to run against a local Cloud instance.
e2e:
<<: *default-runner
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}
entrypoint: ['yarn', 'cy:e2e']

# Component test runner.
# Does not require any Cloud Manager environment to run.
Expand All @@ -136,14 +175,4 @@ services:
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH}

region-1:
build:
context: .
dockerfile: ./packages/manager/Dockerfile
target: e2e
env_file: ./packages/manager/.env
volumes: *default-volumes
environment:
<<: *default-env
MANAGER_OAUTH: ${MANAGER_OAUTH_1}
entrypoint: ['yarn', 'cy:e2e']
11 changes: 6 additions & 5 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,13 @@ Environment variables related to the general operation of the Cloud Manager Cypr
| `CY_TEST_SUITE` | Name of the Cloud Manager UI test suite to run. Possible values are `core`, `region`, or `synthetic`. | `region` | Unset; defaults to `core` suite |
| `CY_TEST_TAGS` | Query identifying tests that should run by specifying allowed and disallowed tags. | `method:e2e` | Unset; all tests run by default |

###### Regions
These environment variables are used by Cloud Manager's UI tests to override region selection behavior. This can be useful for testing Cloud Manager functionality against a specific region.
###### Overriding Behavior
These environment variables can be used to override some behaviors of Cloud Manager's UI tests. This can be useful when testing Cloud Manager for nonstandard or work-in-progress functionality.
| Environment Variable | Description | Example | Default |
|----------------------|-------------------------------------------------|-----------|---------------------------------------|
| `CY_TEST_REGION` | ID of region to test (as used by Linode APIv4). | `us-east` | Unset; regions are selected at random |
| Environment Variable | Description | Example | Default |
|-------------------------|-------------------------------------------------|-----------|--------------------------------------------|
| `CY_TEST_REGION` | ID of region to test (as used by Linode APIv4). | `us-east` | Unset; regions are selected at random |
| `CY_TEST_FEATURE_FLAGS` | JSON string containing feature flag data | `{}` | Unset; feature flag data is not overridden |
###### Run Splitting
These environment variables facilitate splitting the Cypress run between multiple runners without the use of any third party services. This can be useful for improving Cypress test performance in some circumstances. For additional performance gains, an optional test weights file can be specified using `CY_TEST_SPLIT_RUN_WEIGHTS` (see `CY_TEST_GENWEIGHTS` to generate test weights).
Expand Down
35 changes: 31 additions & 4 deletions docs/tooling/analytics.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Adobe Analytics
# Analytics

## Adobe Analytics

Cloud Manager uses Adobe Analytics to capture page view and custom event statistics. To view analytics, Cloud Manager developers must follow internal processes to request access to Adobe Analytics dashboards.

## Writing a Custom Event
### Writing a Custom Event

Custom events live (mostly) in `src/utilities/analytics/customEventAnalytics.ts`. Try to write and export custom events in this file if possible, and import them in the component(s) where they are used.

A custom event will take this shape:

```tsx
// Component.tsx {file(s) where the event is called, for quick reference}
// OtherComponent.tsx
Expand All @@ -33,7 +36,7 @@ Examples
- `sendMarketplaceSearchEvent` fires when selecting a category from the dropdown (`label` is predefined) and clicking the search field (a generic `label` is used).
- `sendBucketCreateEvent` sends the region of the bucket, but does not send the bucket label.

## Writing Form Events
### Writing Form Events

Form events differ from custom events because they track user's journey through a flow and, optionally, branching flows. Form events live in `src/utilities/analytics/formEventAnalytics.ts`. Try to write and export custom events in this file if possible, and import them in the component(s) where they are used.

Expand All @@ -53,10 +56,34 @@ These are the form events we use:

See the `LinodeCreateForm` form events as an example.

## Locally Testing Page Views & Custom Events and/or Troubleshooting
### Locally Testing Page Views & Custom Events and/or Troubleshooting Adobe Analytics

1. Set the `REACT_APP_ADOBE_ANALYTICS_URL` environment variable in `.env`.
2. Use the browser tools Network tab, filter requests by "adobe", and check that successful network requests have been made to load the launch script and its extensions.
3. In the browser console, type `_satellite.setDebug(true)`.
4. Refresh the page. You should see Adobe debug log output in the console. Each page view change or custom event that fires should be visible in the logs.
5. When viewing dashboards in Adobe Analytics, it may take ~1 hour for analytics data to update. Once this happens, locally fired events will be visible in the dev dashboard.

## Pendo

Cloud Manager uses [Pendo](https://www.pendo.io/pendo-for-your-customers/) to capture analytics, guide users, and improve the user experience. To view Pendo dashboards, Cloud Manager developers must follow internal processes to request access.

### Set Up and Initialization

Pendo is configured in [`usePendo.js`](https://github.com/linode/manager/blob/develop/packages/manager/src/hooks/usePendo.ts). This custom hook allows us to initialize the Pendo analytics script when the [App](https://github.com/linode/manager/blob/develop/packages/manager/src/App.tsx#L56) is mounted.

Important notes:

- Pendo is only loaded if a valid `PENDO_API_KEY` is configured as an environment variable. In our development, staging, and production environments, `PENDO_API_KEY` is available at build time. See **Locally Testing Page Views & Custom Events and/or Troubleshooting Pendo** for set up with local environments.
- We load the Pendo agent from the CDN, rather than [self-hosting](https://support.pendo.io/hc/en-us/articles/360038969692-Self-hosting-the-Pendo-agent).
- We are hashing account and visitor IDs in a way that is consistent with Akamai's standards.
- At initialization, we do string transformation on select URL patterns to **remove sensitive data**. When new URL patterns are added to Cloud Manager, verify that existing transforms remove sensitive data; if not, update the transforms.
- Pendo is currently not using any client-side (cookies or local) storage.
- Pendo makes use of the existing `data-testid` properties, used in our automated testing, for tagging elements. They are more persistent and reliable than CSS properties, which are liable to change.

### Locally Testing Page Views & Custom Events and/or Troubleshooting Pendo

1. Set the `REACT_APP_PENDO_API_KEY` environment variable in `.env`.
2. Use the browser tools Network tab, filter requests by "pendo", and check that successful network requests have been made to load Pendo scripts. (Also visible in browser tools Sources tab.)
3. In the browser console, type `pendo.validateEnvironment()`.
4. You should see command output in the console, and it should include a hashed `accountId` and hashed `visitorId`. Each page view change or custom event that fires should be visible as a request in the Network tab.
5 changes: 5 additions & 0 deletions packages/api-v4/.changeset/pr-11129-fixed-1729536266478.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/api-v4": Fixed
---

Incorrect documentation on how to set a page size ([#11129](https://github.com/linode/manager/pull/11129))
2 changes: 1 addition & 1 deletion packages/api-v4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pagination and filter parameters to the API:

```js
// Return page 2 of Linodes, with a page size of 100:
getLinodes({ page: 2, pageSize: 100 });
getLinodes({ page: 2, page_size: 100 });

// Return all public Linode Images:
getImages({}, { is_public: true });
Expand Down
5 changes: 0 additions & 5 deletions packages/manager/.changeset/pr-11085-tests-1728657019139.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

Replace 'e2e', 'e2e_heimdall', and 'component' Docker Compose services with 'cypress_local', 'cypress_remote', and 'cypress_component' ([#11088](https://github.com/linode/manager/pull/11088))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11088-tests-1729535093463.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Allow overriding feature flags via CY_TEST_FEATURE_FLAGS environment variable ([#11088](https://github.com/linode/manager/pull/11088))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11088-tests-1729535165205.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Allow pipeline Slack notifications to be customized ([#11088](https://github.com/linode/manager/pull/11088))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11088-tests-1729535197632.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Show PR title in Slack CI notifications ([#11088](https://github.com/linode/manager/pull/11088))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

DBaaS GA summary tab enhancements ([#11091](https://github.com/linode/manager/pull/11091))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11093-fixed-1728898767762.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Disable Create Firewall button with tooltip text on empty state Landing Page for restricted users ([#11093](https://github.com/linode/manager/pull/11093))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11108-changed-1729059614823.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Disable Longview 'Add Client' button with tooltip text on landing page for restricted users. ([#11108](https://github.com/linode/manager/pull/11108))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Image Service Gen 2 final GA tweaks ([#11115](https://github.com/linode/manager/pull/11115))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add title / label for all global filters in ACLP ([#11118](https://github.com/linode/manager/pull/11118))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11122-added-1729183156879.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

Pendo documentation to our development guide ([#11122](https://github.com/linode/manager/pull/11122))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

DBaaS encourage setting access controls during create ([#11124](https://github.com/linode/manager/pull/11124))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11130-fixed-1729536728596.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Flaky DatabaseBackups.test.tsx in coverage job ([#11130](https://github.com/linode/manager/pull/11130))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11136-added-1729581444483.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

Add `hideFill` & `fillOpacity` properties to `AreaChart` component ([#11136](https://github.com/linode/manager/pull/11136))
1 change: 0 additions & 1 deletion packages/manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,3 @@ ENV CI=1
ENV NO_COLOR=1
ENV HOME=/home/node/
ENV CYPRESS_CACHE_FOLDER=/home/node/.cache/Cypress
ENTRYPOINT yarn cy:ci
2 changes: 2 additions & 0 deletions packages/manager/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { enableJunitReport } from './cypress/support/plugins/junit-report';
import { generateTestWeights } from './cypress/support/plugins/generate-weights';
import { logTestTagInfo } from './cypress/support/plugins/test-tagging-info';
import cypressViteConfig from './cypress/vite.config';
import { featureFlagOverrides } from './cypress/support/plugins/feature-flag-override';

/**
* Exports a Cypress configuration object.
Expand Down Expand Up @@ -91,6 +92,7 @@ export default defineConfig({
fetchAccount,
fetchLinodeRegions,
regionOverrideCheck,
featureFlagOverrides,
logTestTagInfo,
splitCypressRun,
enableJunitReport(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,21 @@ describe('Integration Tests for DBaaS Dashboard ', () => {

// Selecting a dashboard from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Dashboard')
.findByLabel('Dashboard')
.should('be.visible')
.type(`${dashboardName}{enter}`)
.should('be.visible');

// Select a time duration from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Time Duration')
.findByLabel('Time Range')
.should('be.visible')
.type(`${timeDurationToSelect}{enter}`)
.should('be.visible');

//Select a Engine from the autocomplete input.
ui.autocomplete
.findByLabel('Select an Engine')
.findByLabel('Database Engine')
.should('be.visible')
.type(`${engine}{enter}`)
.should('be.visible');
Expand All @@ -191,15 +191,15 @@ describe('Integration Tests for DBaaS Dashboard ', () => {

// Select a resource from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Resource')
.findByLabel('Database Clusters')
.should('be.visible')
.type(`${clusterName}{enter}`)
.click();
cy.findByText(clusterName).should('be.visible');

//Select a Node from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Node Type')
.findByLabel('Node Type')
.should('be.visible')
.type(`${nodeType}{enter}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ import { Interception } from 'cypress/types/net-stubbing';
const expectedGranularityArray = ['Auto', '1 day', '1 hr', '5 min'];
const timeDurationToSelect = 'Last 24 Hours';

const { metrics, id, serviceType, dashboardName, region, resource } =
widgetDetails.linode;
const {
metrics,
id,
serviceType,
dashboardName,
region,
resource,
} = widgetDetails.linode;

const dashboard = dashboardFactory.build({
label: dashboardName,
Expand Down Expand Up @@ -139,14 +145,14 @@ describe('Integration Tests for Linode Dashboard ', () => {

// Selecting a dashboard from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Dashboard')
.findByLabel('Dashboard')
.should('be.visible')
.type(`${dashboardName}{enter}`)
.should('be.visible');

// Select a time duration from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Time Duration')
.findByLabel('Time Range')
.should('be.visible')
.type(`${timeDurationToSelect}{enter}`)
.should('be.visible');
Expand All @@ -156,7 +162,7 @@ describe('Integration Tests for Linode Dashboard ', () => {

// Select a resource from the autocomplete input.
ui.autocomplete
.findByLabel('Select a Resource')
.findByLabel('Resources')
.should('be.visible')
.type(`${resource}{enter}`)
.click();
Expand Down
Loading

0 comments on commit c7b1d8f

Please sign in to comment.