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

#9433: mod commit message modal #9520

Merged
merged 13 commits into from
Nov 15, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ export class PageEditorPage extends BasePageObject {
// cleaned up after the test. Future work is adding affordance to clean up saved
// mods, with an option to avoid cleanup for certain mods.
await this.modListingPanel.activeModListItem.saveButton.click();

// Since 2.2.1, Page Editor shows commit message dialog when saving an existing mod
const saveDialog = this.getByRole("dialog");
await expect(saveDialog).toBeVisible();
await saveDialog
.getByRole("textbox", { name: "Message" })
.fill("Commit message");
await saveDialog.getByRole("button", { name: "Save" }).click();
await expect(saveDialog).toBeHidden();

await expect(
this.page.getByRole("status").filter({ hasText: "Saved mod" }),
).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ options:
metadata:
id: >-
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
version: 1.0.0
version: 1.0.1
name: New Mod
description: Created by playwright test for adding starter bricks to a mod
variables:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ Index: add-context-menu-starter-brick-to-mod
id: >-
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
name: New Mod
version: 1.0.0
- version: 1.0.1
+ version: 1.0.2
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ Index: add-quick-bar-starter-brick-to-mod
id: >-
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
name: New Mod
version: 1.0.0
- version: 1.0.2
+ version: 1.0.3
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ Index: add-sidebar-panel-starter-brick-to-mod
id: >-
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
name: New Mod
version: 1.0.0
- version: 1.0.3
+ version: 1.0.4
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Index: add-trigger-starter-brick-to-mod
===================================================================
--- add-trigger-starter-brick-to-mod
+++ add-trigger-starter-brick-to-mod
@@ -91,80 +91,88 @@
@@ -91,101 +91,109 @@
- '@pixiebrix/document-context'
- element: '@pixiebrix/html/element'
reportMode: once
Expand Down Expand Up @@ -91,3 +91,25 @@ Index: add-trigger-starter-brick-to-mod
id: extensionPoint4
label: Sidebar Panel
permissions:
origins: []
permissions: []
services: {}
kind: recipe
metadata:
description: Created by playwright test for adding starter bricks to a mod
id: >-
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
name: New Mod
- version: 1.0.4
+ version: 1.0.5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Additional lines are added to the diff as context around the actual change

options:
schema:
properties: {}
type: object
uiSchema:
ui:order:
- '*'
variables:
schema:
properties: {}
type: object
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Index: brick-added
id: >-
@extension-e2e-test-unaffiliated/brick-actions-00000000-0000-0000-0000-000000000000
name: Mod Actions Test
version: 1.0.0
- version: 1.0.0
+ version: 1.0.1
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ Index: brick-copied-to-another-mod
id: >-
@extension-e2e-test-unaffiliated/simple-sidebar-panel-00000000-0000-0000-0000-000000000000
name: Simple Sidebar Panel
version: 1.0.0
- version: 1.0.0
+ version: 1.0.1
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Index: brick-copy-pasted
===================================================================
--- brick-copy-pasted
+++ brick-copy-pasted
@@ -6,80 +6,88 @@
@@ -6,82 +6,90 @@
containerSelector: span:has(> span:contains('Review in codespace'))
isAvailable:
allFrames: true
Expand Down Expand Up @@ -81,7 +81,8 @@ Index: brick-copy-pasted
id: >-
@extension-e2e-test-unaffiliated/brick-actions-00000000-0000-0000-0000-000000000000
name: Mod Actions Test
version: 1.0.0
- version: 1.0.2
+ version: 1.0.3
options:
schema:
properties: {}
Expand All @@ -91,3 +92,5 @@ Index: brick-copy-pasted
- '*'
variables:
schema:
properties: {}
type: object
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Index: brick-removed
===================================================================
--- brick-removed
+++ brick-removed
@@ -6,86 +6,80 @@
@@ -6,88 +6,82 @@
containerSelector: span:has(> span:contains('Review in codespace'))
isAvailable:
allFrames: true
Expand Down Expand Up @@ -79,7 +79,8 @@ Index: brick-removed
id: >-
@extension-e2e-test-unaffiliated/brick-actions-00000000-0000-0000-0000-000000000000
name: Mod Actions Test
version: 1.0.0
- version: 1.0.1
+ version: 1.0.2
options:
schema:
properties: {}
Expand All @@ -89,3 +90,5 @@ Index: brick-removed
- '*'
variables:
schema:
properties: {}
type: object
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ Index: bricks-moved
id: >-
@extension-e2e-test-unaffiliated/brick-actions-00000000-0000-0000-0000-000000000000
name: Mod Actions Test
version: 1.0.0
- version: 1.0.3
+ version: 1.0.4
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ Index: starter-brick-configuration-changes
id: >-
@extension-e2e-test-unaffiliated/brick-configuration-00000000-0000-0000-0000-000000000000
name: Test mod - Brick Configuration
version: 1.0.0
- version: 1.0.0
+ version: 1.0.1
options:
schema:
properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ Index: updated-inputs
===================================================================
--- updated-inputs
+++ updated-inputs
@@ -30,49 +30,60 @@
@@ -27,52 +27,63 @@
- children:
- children:
- config:
heading: h1
title: !nunjucks Simple Sidebar Panel
type: header
Expand Down Expand Up @@ -40,7 +43,8 @@ Index: updated-inputs
id: >-
@extension-e2e-test-unaffiliated/simple-sidebar-panel-00000000-0000-0000-0000-000000000000
name: Simple Sidebar Panel (Updated)
version: 1.0.2
- version: 1.0.2
+ version: 1.0.3
options:
schema:
- properties: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,14 @@ test("shows error notification when updating a public mod without incrementing t
"8203 Repro Updated",
);
await pageEditorPage.modListingPanel.activeModListItem.saveButton.click();

const saveDialog = pageEditorPage.getByRole("dialog");
await expect(saveDialog).toBeVisible();
await saveDialog.getByRole("textbox", { name: "New Version" }).fill("1.0.0");
await saveDialog
.getByRole("textbox", { name: "Message" })
.fill("Commit message");
await saveDialog.getByRole("button", { name: "Save" }).click();

await expect(pageEditorPage.getIncrementVersionErrorToast()).toBeVisible();
});
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getModComponentState,
saveModComponentState,
} from "@/store/modComponents/modComponentStorage";
import { uuidv4, normalizeSemVerString } from "@/types/helpers";
import { uuidv4 } from "@/types/helpers";
import { appApiMock } from "@/testUtils/appApiMock";
import { omit } from "lodash";
import {
Expand Down Expand Up @@ -68,6 +68,7 @@ import {
} from "@/contentScript/messenger/api";
import { adapter } from "@/pageEditor/starterBricks/adapter";
import { API_PATHS } from "@/data/service/urlPaths";
import { normalizeSemVerString } from "@/types/semVerHelpers";

TEST_setContext("background");

Expand Down
2 changes: 1 addition & 1 deletion applications/browser-extension/src/background/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import {
} from "@/utils/extensionUtils";
import { oncePerSession } from "@/mv3/SessionStorage";
import { resetFeatureFlagsCache } from "@/auth/featureFlagStorage";
import { normalizeSemVerString } from "@/types/helpers";
import { type SemVerString } from "@/types/registryTypes";
import { normalizeSemVerString } from "@/types/semVerHelpers";

/**
* The latest version of PixieBrix available in the Chrome Web Store, or null if the version hasn't been fetched.
Expand Down
23 changes: 13 additions & 10 deletions applications/browser-extension/src/data/service/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@

import { type UUID } from "@/types/stringTypes";
import { DefinitionKinds, type RegistryId } from "@/types/registryTypes";
import { createApi, type FetchBaseQueryError } from "@reduxjs/toolkit/query/react";
import {
createApi,
type FetchBaseQueryError,
} from "@reduxjs/toolkit/query/react";
import {
type ActivatedDeployment,
type Database,
type Deployment,
type DeploymentPayload,
type EditablePackageMetadata,
type Group,
type MarketplaceListing,
Expand All @@ -29,10 +34,8 @@ import {
type PackageUpsertResponse,
type PackageVersionDeprecated,
type PendingInvitation,
type RetrieveRecipeResponse,
type RemoteIntegrationConfig,
type DeploymentPayload,
type ActivatedDeployment,
type RetrieveRecipeResponse,
} from "@/types/contract";
import { type components } from "@/types/swagger";
import { dumpBrickYaml } from "@/runtime/brickYaml";
Expand All @@ -47,6 +50,7 @@ import { type Me, transformMeResponse } from "@/data/model/Me";
import { type UserMilestone } from "@/data/model/UserMilestone";
import { API_PATHS } from "@/data/service/urlPaths";
import { type Team, transformTeamResponse } from "@/data/model/Team";
import { createPrivateSharing } from "@/utils/registryUtils";
import {
type AssetPreUploadResponse,
transformAssetPreUploadResponse,
Expand Down Expand Up @@ -271,14 +275,12 @@ export const appApi = createApi({
}),
updateModDefinition: builder.mutation<
PackageUpsertResponse,
{ packageId: UUID; modDefinition: UnsavedModDefinition }
{ packageId: UUID; modDefinition: UnsavedModDefinition; message?: string }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

RTK Query change

>({
query({ packageId, modDefinition }) {
query({ packageId, modDefinition, message }) {
const config = dumpBrickYaml(modDefinition);
const sharing = (modDefinition as ModDefinition).sharing ?? {
public: false,
organizations: [],
};
const sharing =
(modDefinition as ModDefinition).sharing ?? createPrivateSharing();

return {
url: API_PATHS.BRICK(packageId),
Expand All @@ -289,6 +291,7 @@ export const appApi = createApi({
config,
kind: DefinitionKinds.MOD,
public: sharing.public,
message,
organizations: sharing.organizations,
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import buildGetModVersionStatus from "@/extensionConsole/pages/mods/utils/buildGetModVersionStatus";
import { modDefinitionFactory } from "@/testUtils/factories/modDefinitionFactories";
import { modMetadataFactory } from "@/testUtils/factories/modComponentFactories";
import { normalizeSemVerString } from "@/types/helpers";
import { mapModInstanceToUnavailableMod } from "@/utils/modUtils";
import { registryIdFactory } from "@/testUtils/factories/stringFactories";
import { modInstanceFactory } from "@/testUtils/factories/modInstanceFactories";
import { normalizeSemVerString } from "@/types/semVerHelpers";

describe("buildGetModVersionStatus", () => {
it("handles no activated mod components", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { render } from "@/extensionConsole/testHelpers";
import { type Package, type PackageVersionDeprecated } from "@/types/contract";
import { type Timestamp } from "@/types/stringTypes";
import { DefinitionKinds } from "@/types/registryTypes";
import { packageVersionDeprecatedFactory } from "@/testUtils/factories/registryFactories";
import { validateTimestamp } from "@/utils/timeUtils";

const axiosMock = new MockAdapter(axios);

Expand All @@ -46,24 +48,22 @@ describe("PackageHistory", () => {

it("renders select components for choosing versions and displays the diff", async () => {
const testVersions: PackageVersionDeprecated[] = [
{
packageVersionDeprecatedFactory({
id: testPackageId,
version: "1.0.1",
config: {},
raw_config: "some big yaml file",
created_at: "2024-01-24T20:55:41.263846Z" as Timestamp,
updated_at: "2024-01-26T23:58:12.270168Z" as Timestamp,
updated_by: {},
},
{
created_at: validateTimestamp("2024-01-24T20:55:41.263846Z"),
updated_at: validateTimestamp("2024-01-26T23:58:12.270168Z"),
}),
packageVersionDeprecatedFactory({
id: testPackageId,
version: "1.0.0",
config: {},
raw_config: "some big yaml file2",
created_at: "2024-01-20T16:55:41.263846Z" as Timestamp,
updated_at: "2024-01-22T18:58:12.270168Z" as Timestamp,
updated_by: {},
},
created_at: validateTimestamp("2024-01-20T16:55:41.263846Z"),
updated_at: validateTimestamp("2024-01-22T18:58:12.270168Z"),
}),
];

const testPackage: Package = {
Expand Down
Loading
Loading