|
@@ -26,14 +26,6 @@ const mouse = new Pointer("mouse");
|
|
const finger1 = new Pointer("touch", 1);
|
|
const finger1 = new Pointer("touch", 1);
|
|
const finger2 = new Pointer("touch", 2);
|
|
const finger2 = new Pointer("touch", 2);
|
|
|
|
|
|
-const clickLabeledElement = (label: string) => {
|
|
|
|
- const element = document.querySelector(`[aria-label='${label}']`);
|
|
|
|
- if (!element) {
|
|
|
|
- throw new Error(`No labeled element found: ${label}`);
|
|
|
|
- }
|
|
|
|
- fireEvent.click(element);
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* This is always called at the end of your test, so usually you don't need to call it.
|
|
* This is always called at the end of your test, so usually you don't need to call it.
|
|
* However, if you have a long test, you might want to call it during the test so it's easier
|
|
* However, if you have a long test, you might want to call it during the test so it's easier
|
|
@@ -168,10 +160,10 @@ describe("regression tests", () => {
|
|
mouse.down(10, 10);
|
|
mouse.down(10, 10);
|
|
mouse.up(10, 10);
|
|
mouse.up(10, 10);
|
|
|
|
|
|
- clickLabeledElement("Background");
|
|
|
|
- clickLabeledElement(t("colors.fa5252"));
|
|
|
|
- clickLabeledElement("Stroke");
|
|
|
|
- clickLabeledElement(t("colors.5f3dc4"));
|
|
|
|
|
|
+ UI.clickLabeledElement("Background");
|
|
|
|
+ UI.clickLabeledElement(t("colors.fa5252"));
|
|
|
|
+ UI.clickLabeledElement("Stroke");
|
|
|
|
+ UI.clickLabeledElement(t("colors.5f3dc4"));
|
|
expect(API.getSelectedElement().backgroundColor).toBe("#fa5252");
|
|
expect(API.getSelectedElement().backgroundColor).toBe("#fa5252");
|
|
expect(API.getSelectedElement().strokeColor).toBe("#5f3dc4");
|
|
expect(API.getSelectedElement().strokeColor).toBe("#5f3dc4");
|
|
});
|
|
});
|
|
@@ -952,8 +944,8 @@ describe("regression tests", () => {
|
|
UI.clickTool("rectangle");
|
|
UI.clickTool("rectangle");
|
|
// change background color since default is transparent
|
|
// change background color since default is transparent
|
|
// and transparent elements can't be selected by clicking inside of them
|
|
// and transparent elements can't be selected by clicking inside of them
|
|
- clickLabeledElement("Background");
|
|
|
|
- clickLabeledElement(t("colors.fa5252"));
|
|
|
|
|
|
+ UI.clickLabeledElement("Background");
|
|
|
|
+ UI.clickLabeledElement(t("colors.fa5252"));
|
|
mouse.down();
|
|
mouse.down();
|
|
mouse.up(1000, 1000);
|
|
mouse.up(1000, 1000);
|
|
|
|
|
|
@@ -1059,8 +1051,8 @@ describe("regression tests", () => {
|
|
mouse.up(10, 10);
|
|
mouse.up(10, 10);
|
|
expect(screen.queryByText(/fill/i)).toBeNull();
|
|
expect(screen.queryByText(/fill/i)).toBeNull();
|
|
|
|
|
|
- clickLabeledElement("Background");
|
|
|
|
- clickLabeledElement(t("colors.fa5252"));
|
|
|
|
|
|
+ UI.clickLabeledElement("Background");
|
|
|
|
+ UI.clickLabeledElement(t("colors.fa5252"));
|
|
// select rectangle
|
|
// select rectangle
|
|
mouse.reset();
|
|
mouse.reset();
|
|
mouse.click();
|
|
mouse.click();
|