Skip to content

Commit

Permalink
Merge branch 'stable' into feat/BlockName
Browse files Browse the repository at this point in the history
  • Loading branch information
elsoazemelet committed Aug 5, 2024
2 parents 995f9e4 + 27686c7 commit 529ec00
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"vitest": "^1.6.0"
},
"dependencies": {
"@intechstudio/grid-protocol": "^1.20240719.951",
"@intechstudio/grid-protocol": "1.20240719.951",
"@intechstudio/grid-uikit": "^1.20240722.817",
"adm-zip": "^0.5.10",
"chokidar": "^3.5.3",
Expand Down
42 changes: 41 additions & 1 deletion playwright-tests/data/actionBlock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
export const blocks = (page) => ({
Function: {
Function: {
block: page.locator('#action-menu div').filter({ hasText: 'Function' }).nth(3),
elements: {
Function: page.locator('#cfg-0'),
input: page.locator('.view-line'),
End: page.locator('#cfg-1'),
},
}
},

variables: {
Lookup: {
block: page
Expand Down Expand Up @@ -198,6 +209,8 @@ export const blocks = (page) => ({
.nth(2),
elements: {
Mode: page.getByRole("textbox").first(),
Min: page.getByRole("textbox").nth(1),
Max: page.getByRole("textbox").nth(2),
},
},
"Encoder Mode": {
Expand All @@ -208,6 +221,9 @@ export const blocks = (page) => ({
elements: {
Mode: page.getByRole("textbox").first(),
Velocity: page.getByRole("textbox").nth(1),
Min: page.getByRole("textbox").nth(2),
Max: page.getByRole("textbox").nth(3),
Sensitivity: page.getByRole("textbox").nth(4),
},
},
"Potmeter Mode": {
Expand All @@ -217,7 +233,21 @@ export const blocks = (page) => ({
.nth(2),
elements: {
Bit: page.getByRole("textbox").first(),
Max: page.getByRole("textbox").nth(1),
Min: page.getByRole("textbox" ).nth(1),
Max: page.getByRole("textbox").nth(2),
},
},
"Endless Mode": {
block: page
.locator("#action-menu div")
.filter({ hasText: "Endless Mode" })
.nth(2),
elements: {
Mode: page.getByRole("textbox").first(),
Velocity: page.getByRole("textbox" ).nth(1),
Min: page.getByRole("textbox").nth(2),
Max: page.getByRole("textbox").nth(3),
Sensitivity: page.getByRole("textbox").nth(4),
},
},
},
Expand Down Expand Up @@ -274,6 +304,16 @@ export const blocks = (page) => ({
end: page.locator("#cfg-2"),
},
},
"Button Step": {
block: page
.locator("#action-menu div")
.filter({ hasText: "Button Step" })
.nth(2),
elements: {
"Button Off": page.locator("#cfg-0"),
"Step One": page.locator("#cfg-1"),
},
},
},
specialEncoder: {
"Left/Right Rotate": {
Expand Down
18 changes: 18 additions & 0 deletions playwright-tests/pages/configPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export class ConfigPage {
this.blocks = blocks(page);
this.loopTimesSwtich =
this.blocks["loop"]["Repeater Loop"]["elements"]["times"];
this.elementMinMaxButton = page.getByLabel('Enable Min');
this.elementSensitivity = page.getByLabel('Enable Sensitivity');

this.addBlocktoLastSandwitchButton = page
.locator("anim-block")
.filter({ hasText: "End" })
Expand Down Expand Up @@ -111,6 +114,21 @@ export class ConfigPage {
.click();
}

async clickCategoryCheckboxFileds(blockName) {
await this.clickCategoryMinMax();
if (blockName == "Encoder Mode" || blockName == "Endless Mode") {
await this.clickCategorySensitivity();
}
}

async clickCategoryMinMax() {
await this.elementMinMaxButton.click()
}

async clickCategorySensitivity() {
await this.elementSensitivity.click()
}

// Element and Action Operations

async selectAllActions() {
Expand Down
36 changes: 23 additions & 13 deletions playwright-tests/tests/actionBlockExistence.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function setupModule(moduleName) {
}

const blocks = {
Function: ["Function"],
variables: ["Lookup", "Global", "Locals", "Self"],
led: ["Start Animation", "Stop Animation", "Color", "Intensity"],
midi: ["MIDI", "MIDI 14", "MIDI SysEX"],
Expand All @@ -27,15 +28,18 @@ const blocks = {
"Mouse Button",
"Mouse Move",
],
element: ["Button Mode", "Encoder Mode", "Potmeter Mode"],
condition: ["If"], // Add "If Else" and "Else"
element: ["Button Mode", "Encoder Mode", "Potmeter Mode", "Endless Mode"],
condition: ["If"],
loop: ["Repeater Loop"],
specialEncoder: ["Left/Right Rotate", "Push & Rotate L R", "Push & Rotate"],
code: ["Code Block", "Comment Block", "Element Name"],
timer: ["Clock Source", "Start", "Stop"],
specialButton: ["Press/Release"],
specialButton: ["Press/Release", "Button Step"],
};
const blockElements = {
Function: {
Function: ["Function", "input", "End"]
},
variables: {
Lookup: ["source", "input", "output", "destination", "addNewPair"],
Global: ["Commit", "var", "i", "addNewPair"],
Expand Down Expand Up @@ -77,9 +81,10 @@ const blockElements = {
"Mouse Move": ["Axis", "Position"],
},
element: {
"Button Mode": ["Mode"],
"Encoder Mode": ["Mode", "Velocity"],
"Potmeter Mode": ["Bit"],
"Button Mode": ["Mode", "Min", "Max"],
"Encoder Mode": ["Mode", "Velocity", "Min", "Max", "Sensitivity"],
"Potmeter Mode": ["Bit", "Min", "Max"],
"Endless Mode": ["Mode", "Velocity", "Min", "Max", "Sensitivity"],
},
condition: {
If: ["input", "end"],
Expand Down Expand Up @@ -120,6 +125,7 @@ const blockElements = {
},
specialButton: {
"Press/Release": ["press", "release", "end"],
"Button Step": ["Button Off", "Step One"],
},
};

Expand All @@ -144,12 +150,12 @@ test.beforeAll(async () => {
});

test.afterAll(async () => {
if (context) {
await context.close();
}
if (browser) {
await browser.close();
}
// if (context) {
// await context.close();
// }
// if (browser) {
// await browser.close();
// }
});

test.describe("Block Existence", () => {
Expand All @@ -169,10 +175,11 @@ test.describe("Block Existence", () => {
});
}
});

let blockCategory = "";
test.describe("Elements Existence", () => {
for (const [category, blockData] of Object.entries(blockElements)) {
test.describe(`${category} category`, () => {
blockCategory = category;
for (const [blockName, elementList] of Object.entries(blockData)) {
test.describe(`${blockName} block`, () => {
test.beforeAll(async () => {
Expand All @@ -186,6 +193,9 @@ test.describe("Elements Existence", () => {
if (blockName == "Repeater Loop") {
configPage.openLoopTimes();
}
if (category == "element") {
await configPage.clickCategoryCheckboxFileds(blockName)
}
});

// Test
Expand Down

0 comments on commit 529ec00

Please sign in to comment.