Skip to content

Commit

Permalink
Merge branch 'develop' into M3-8158-replace-gravatar-with-new-avatars
Browse files Browse the repository at this point in the history
  • Loading branch information
mjac0bs committed Sep 10, 2024
2 parents 6a3eca7 + f83b918 commit e8a6afa
Show file tree
Hide file tree
Showing 81 changed files with 2,068 additions and 680 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ x-e2e-env:
CY_TEST_SPLIT_RUN_TOTAL: ${CY_TEST_SPLIT_RUN_TOTAL}
CY_TEST_SPLIT_RUN_INDEX: ${CY_TEST_SPLIT_RUN_INDEX}

# Cypress performance.
CY_TEST_ACCOUNT_CACHE_DIR: ${CY_TEST_ACCOUNT_CACHE_DIR}

# Cypress reporting.
CY_TEST_JUNIT_REPORT: ${CY_TEST_JUNIT_REPORT}
CY_TEST_USER_REPORT: ${CY_TEST_USER_REPORT}
Expand All @@ -63,6 +66,7 @@ x-e2e-env:
x-e2e-volumes:
&default-volumes
- ./.git:/home/node/app/.git
- ./cache:/home/node/app/cache
- ./packages/manager:/home/node/app/packages/manager
- ./packages/validation:/home/node/app/packages/validation
- ./packages/api-v4:/home/node/app/packages/api-v4
Expand Down
8 changes: 8 additions & 0 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ Environment variables related to Cypress logging and reporting, as well as repor
| `CY_TEST_FAIL_ON_MANAGED` | Fail affected tests when Managed is enabled | `1` | Unset; disabled by default |
| `CY_TEST_GENWEIGHTS` | Generate and output test weights to the given path | `./weights.json` | Unset; disabled by default |
###### Performance
Environment variables that can be used to improve test performance in some scenarios.
| Environment Variable | Description | Example | Default |
|---------------------------------|-----------------------------------------------|--------------------|----------------------------|
| `CY_TEST_ACCOUNT_CACHE_DIR` | Directory containing test account cache data | `./cache/accounts` | Unset; disabled by default |
### Writing End-to-End Tests
1. Look here for [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices)
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10835-changed-1724705534485.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Update image related copy as part of Image Service Gen2 ([#10835](https://github.com/linode/manager/pull/10835))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10852-tests-1724937535185.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add new tests for for selecting "All" Scopes ([#10852](https://github.com/linode/manager/pull/10852))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10867-tests-1725460656929.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add `CY_TEST_ACCOUNT_CACHE_DIR` environment variable to enable retrieval of test account cache data ([#10867](https://github.com/linode/manager/pull/10867))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10867-tests-1725482924721.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Allow tests to fall back on cached account data when API request fails ([#10867](https://github.com/linode/manager/pull/10867))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

Resolve "Incomplete string escape or encoding" codeQL alert in `generate-ansibleConfig.ts` ([#10887](https://github.com/linode/manager/pull/10887))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10889-tests-1725485099504.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Update remaining Linode Create Cypress tests run against Linode Create v2 ([#10889](https://github.com/linode/manager/pull/10889))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10892-tests-1725546783401.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Clean up feature flag mocks ([#10892](https://github.com/linode/manager/pull/10892))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10899-changed-1725595024930.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Lower Events historical data fetching to 7 days ([#10899](https://github.com/linode/manager/pull/10899))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10904-added-1725873382370.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
---

DisplayPrice Story ([#10904](https://github.com/linode/manager/pull/10904))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10907-tests-1725898460559.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Cypress integration test for Object Storage Gen2: E1 Endpoint ([#10907](https://github.com/linode/manager/pull/10907))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10910-changed-1725910840891.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

"contact support" links to new support ticket in event messages ([#10910](https://github.com/linode/manager/pull/10910))
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('Personal access tokens', () => {
* - Confirms that user is shown the token secret upon successful PAT creation
* - Confirms that new personal access token is shown in list
* - Confirms that user can open and close "View Scopes" drawer
* - Confirm that the “Child account access” grant is not visible in the list of permissions.
* - Upon clicking “Create Token”, assert that the outgoing API request payload contains "scopes" value as defined in token.
*/
it('can create personal access tokens', () => {
const token = appTokenFactory.build({
Expand Down Expand Up @@ -63,6 +65,9 @@ describe('Personal access tokens', () => {
.findByTitle('Add Personal Access Token')
.should('be.visible')
.within(() => {
// Confirm that the “Child account access” grant is not visible in the list of permissions.
cy.findAllByText('Child Account Access').should('not.exist');

// Confirm submit button is disabled without specifying scopes.
ui.buttonGroup
.findButtonByTitle('Create Token')
Expand Down Expand Up @@ -147,7 +152,12 @@ describe('Personal access tokens', () => {
});

// Confirm that new PAT is shown in list and "View Scopes" drawer works.
cy.wait('@getTokens');
// Upon clicking “Create Token”, assert that the outgoing API request payload contains "scopes" value as defined in token.
cy.wait('@getTokens').then((xhr) => {
const actualTokenData = xhr.response?.body.data;
const actualTokenScopes = actualTokenData[0].scopes;
expect(actualTokenScopes).to.equal(token.scopes);
});
cy.findByText(token.label)
.should('be.visible')
.closest('tr')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { mockGetAccount, mockUpdateAccount } from 'support/intercepts/account';
import { accountFactory } from 'src/factories/account';
import type { Account } from '@linode/api-v4';
import { ui } from 'support/ui';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { TAX_ID_HELPER_TEXT } from 'src/features/Billing/constants';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import type { Flags } from 'src/featureFlags';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';

/* eslint-disable sonarjs/no-duplicate-string */
const accountData = accountFactory.build({
Expand Down Expand Up @@ -72,11 +67,10 @@ const checkAccountContactDisplay = (accountInfo: Account) => {
describe('Billing Contact', () => {
beforeEach(() => {
mockAppendFeatureFlags({
taxId: makeFeatureFlagData<Flags['taxId']>({
taxId: {
enabled: true,
}),
},
});
mockGetFeatureFlagClientstream();
});
it('Edit Contact Info', () => {
// mock the user's account data and confirm that it is displayed correctly upon page load
Expand Down
68 changes: 39 additions & 29 deletions packages/manager/cypress/e2e/core/general/gdpr-agreement.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { ui } from 'support/ui';
import { fbtClick, getClick } from 'support/helpers';
import { regionFactory } from '@src/factories';
import { linodeFactory, regionFactory } from '@src/factories';
import { randomString, randomLabel } from 'support/util/random';
import { mockGetRegions } from 'support/intercepts/regions';
import { mockGetAccountAgreements } from 'support/intercepts/account';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';

import type { Region } from '@linode/api-v4';
import { mockCreateLinode } from 'support/intercepts/linodes';

const mockRegions: Region[] = [
regionFactory.build({
Expand Down Expand Up @@ -102,15 +96,7 @@ describe('GDPR agreement', () => {
cy.get('[data-testid="eu-agreement-checkbox"]').should('not.exist');
});

it('needs the agreement checked to validate the form', () => {
// This test does not apply to Linode Create v2 because
// Linode Create v2 allows you to press "Create Linode"
// without checking the GDPR checkbox. (The user will
// get a validation error if they have not agreed).
mockAppendFeatureFlags({
linodeCreateRefactor: makeFeatureFlagData(false),
});
mockGetFeatureFlagClientstream();
it('needs the agreement checked to submit the form', () => {
mockGetRegions(mockRegions).as('getRegions');
mockGetAccountAgreements({
privacy_policy: false,
Expand All @@ -120,26 +106,50 @@ describe('GDPR agreement', () => {
const linodeLabel = randomLabel();

cy.visitWithLogin('/linodes/create');
cy.wait(['@getAgreements', '@getRegions']);
cy.wait(['@getRegions']);

// Paris should have the agreement
ui.regionSelect.find().click();
ui.regionSelect.findItemByRegionId('fr-par').click();
cy.get('[data-testid="eu-agreement-checkbox"]').should('be.visible');

// Fill out the form
fbtClick('Shared CPU');
getClick('[id="g6-nanode-1"]');
getClick('#linode-label').clear().type(linodeLabel);
cy.get('#root-password').type(rootpass);
cy.wait('@getAgreements');

cy.findByText('Shared CPU').click();

cy.get('[id="g6-nanode-1"]').click();

cy.findByLabelText('Linode Label').clear().type(linodeLabel);

// expect the button to be disabled
cy.get('[data-qa-deploy-linode="true"]').should('be.disabled');
cy.findByLabelText('Root Password').type(rootpass);

cy.get('[data-testid="eu-agreement-checkbox"]')
.scrollIntoView()
.should('be.visible');

cy.findByText('Create Linode')
.scrollIntoView()
.should('be.enabled')
.should('be.visible')
.click();

cy.findByText(
'You must agree to the EU agreement to deploy to this region.'
).should('be.visible');

// check the agreement
getClick('#gdpr-checkbox');
cy.get('#gdpr-checkbox').click();

cy.findByText(
'You must agree to the EU agreement to deploy to this region.'
).should('not.exist');

mockCreateLinode(linodeFactory.build()).as('createLinode');

cy.findByText('Create Linode')
.should('be.enabled')
.should('be.visible')
.click();

// expect the button to be enabled
cy.get('[data-qa-deploy-linode="true"]').should('not.be.disabled');
cy.wait('@createLinode');
});
});
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import 'cypress-file-upload';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { ui } from 'support/ui';
import {
randomItem,
Expand Down Expand Up @@ -48,9 +44,8 @@ describe('close support tickets', () => {
}

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockGetSupportTickets([mockTicket]);
mockGetSupportTicket(mockTicket).as('getSupportTicket');
mockGetSupportTicketReplies(mockTicket.id, []).as('getReplies');
Expand Down Expand Up @@ -107,9 +102,8 @@ describe('close support tickets', () => {
}

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockGetSupportTickets([mockTicket]);
mockGetSupportTicket(mockTicket).as('getSupportTicket');
mockGetSupportTicketReplies(mockTicket.id, []).as('getReplies');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
/* eslint-disable sonarjs/no-duplicate-string */
import 'cypress-file-upload';
import { interceptGetProfile } from 'support/intercepts/profile';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { ui } from 'support/ui';
import {
randomItem,
Expand Down Expand Up @@ -69,9 +65,8 @@ describe('open support tickets', () => {
*/
it('can open a support ticket', () => {
mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(false),
supportTicketSeverity: false,
});
mockGetFeatureFlagClientstream();

const image = 'test_screenshot.png';
const ticketDescription = 'this is a test ticket';
Expand Down Expand Up @@ -159,9 +154,8 @@ describe('open support tickets', () => {
}

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockCreateSupportTicket(mockTicket).as('createTicket');
mockGetSupportTickets([]);
mockGetSupportTicket(mockTicket);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { interceptGetProfile } from 'support/intercepts/profile';
import {
mockAppendFeatureFlags,
mockGetFeatureFlagClientstream,
} from 'support/intercepts/feature-flags';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import {
randomItem,
randomLabel,
Expand Down Expand Up @@ -38,9 +34,8 @@ describe('support tickets landing page', () => {
*/
it('shows the empty message when there are no tickets.', () => {
mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(false),
supportTicketSeverity: false,
});
mockGetFeatureFlagClientstream();

interceptGetProfile().as('getProfile');

Expand Down Expand Up @@ -92,9 +87,8 @@ describe('support tickets landing page', () => {
const mockTickets = [mockTicket, mockAnotherTicket];

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockGetSupportTickets(mockTickets);

cy.visitWithLogin('/support/tickets');
Expand Down Expand Up @@ -156,9 +150,8 @@ describe('support tickets landing page', () => {
}

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockGetSupportTickets([mockTicket]);
mockGetSupportTicket(mockTicket).as('getSupportTicket');
mockGetSupportTicketReplies(mockTicket.id, []).as('getReplies');
Expand Down Expand Up @@ -251,9 +244,8 @@ describe('support tickets landing page', () => {
}

mockAppendFeatureFlags({
supportTicketSeverity: makeFeatureFlagData(true),
supportTicketSeverity: true,
});
mockGetFeatureFlagClientstream();
mockGetSupportTickets([mockTicket]);
mockGetSupportTicket(mockTicket).as('getSupportTicket');
mockGetSupportTicketReplies(mockTicket.id, []).as('getReplies');
Expand Down
Loading

0 comments on commit e8a6afa

Please sign in to comment.