-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* brick action panel * adds more page editor poms * fix type import
- Loading branch information
1 parent
7f0595e
commit 3ab86b4
Showing
9 changed files
with
207 additions
and
59 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
end-to-end-tests/pageObjects/pageEditor/brickActionsPanel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { BasePageObject } from "../basePageObject"; | ||
import { ModifiesModState } from "./utils"; | ||
|
||
export class BrickActionsPanel extends BasePageObject { | ||
getAddBrickButton(n: number) { | ||
return this.getByTestId(/icon-button-.*-add-brick/).nth(n); | ||
} | ||
|
||
@ModifiesModState | ||
async addBrick(brickName: string, { index = 0 }: { index?: number } = {}) { | ||
await this.getAddBrickButton(index).click(); | ||
|
||
// Add brick modal | ||
await this.page.getByTestId("tag-search-input").fill(brickName); | ||
await this.page.getByRole("button", { name: brickName }).first().click(); | ||
|
||
await this.page.getByRole("button", { name: "Add brick" }).click(); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
end-to-end-tests/pageObjects/pageEditor/brickConfigurationPanel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { BasePageObject } from "../basePageObject"; | ||
import { ModifiesModState } from "./utils"; | ||
|
||
export class BrickConfigurationPanel extends BasePageObject { | ||
@ModifiesModState | ||
async fillField(fieldLabel: string, value: string) { | ||
await this.getByLabel(fieldLabel).fill(value); | ||
} | ||
|
||
@ModifiesModState | ||
async fillFieldByPlaceholder(fieldPlaceholder: string, value: string) { | ||
await this.getByPlaceholder(fieldPlaceholder).fill(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { BasePageObject } from "../basePageObject"; | ||
|
||
export class DataPanel extends BasePageObject {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { BasePageObject } from "../basePageObject"; | ||
|
||
export class ModEditorPane extends BasePageObject { | ||
modId = this.getByLabel("Mod ID"); | ||
name = this.getByLabel("Name"); | ||
version = this.getByLabel("Version"); | ||
description = this.getByLabel("Description"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { type BasePageObject } from "../basePageObject"; | ||
|
||
type AsyncFunction<T> = (...args: any[]) => Promise<T>; | ||
|
||
// Decorator used for functions that modify the state of the mod. | ||
// This is used to wait for Redux to update before continuing. | ||
export function ModifiesModState<T>( | ||
value: AsyncFunction<T>, | ||
context: ClassMethodDecoratorContext<BasePageObject, AsyncFunction<T>>, | ||
) { | ||
return async function (this: BasePageObject, ...args: any[]): Promise<T> { | ||
const result = await value.apply(this, args); | ||
// See EditorPane.tsx:REDUX_SYNC_WAIT_MILLIS | ||
// eslint-disable-next-line playwright/no-wait-for-timeout -- Wait for Redux to update | ||
await this.page.waitForTimeout(500); | ||
return result; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters