Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,22 @@ commands:
if sudo docker compose run --rm web bash -lc '\
gem install bundler && \
bundle install && \
bun install && \
bun install \
'; then
echo "export SETUP_OK=true" >> "$BASH_ENV"
else
echo "export SETUP_OK=false" >> "$BASH_ENV"
exit 1
fi
- run:
name: Run setup tasks
command: |
if [ "$SETUP_OK" != "true" ]; then
echo "export SETUP_OK=false" >> "$BASH_ENV"
exit 1
fi

if sudo docker compose run --rm web bash -lc '\
bundle exec rails db:create && \
bundle exec rails db:migrate && \
bundle exec rake keys:generate \
Expand Down
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ GEM
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.18.1)
json (2.19.1)
jsonapi-renderer (0.2.2)
jwt (3.1.2)
base64
Expand Down Expand Up @@ -352,7 +352,7 @@ GEM
responders (3.2.0)
actionpack (>= 7.0)
railties (>= 7.0)
retriable (3.2.1)
retriable (3.4.1)
rexml (3.4.4)
rollbar (3.7.0)
rspec (3.13.2)
Expand Down Expand Up @@ -415,7 +415,7 @@ GEM
thor (1.5.0)
thwait (0.2.0)
e2mmap
timeout (0.6.0)
timeout (0.6.1)
trailblazer-option (0.1.2)
tsort (0.2.0)
tzinfo (2.0.6)
Expand Down
296 changes: 185 additions & 111 deletions bun.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/__test_support__/bun_test_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ const resetThreeFiberHookMocks = () => {
beforeEach(() => {
bunJest.clearAllMocks();
resetThreeFiberHookMocks();
location.search = "";
resetMutableFixture(auth, authBaseline);
resetMutableFixture(bot, botBaseline);
resetMutableFixture(config, configBaseline);
Expand Down
1 change: 0 additions & 1 deletion frontend/farm_designer/__tests__/index_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ describe("<FarmDesigner />", () => {

beforeEach(() => {
setWindowWidth(1000);
location.search = "";
lastLegendProps = undefined;
lastGardenMapProps = undefined;
editSpy = jest.spyOn(crud, "edit").mockImplementation(jest.fn());
Expand Down
7 changes: 0 additions & 7 deletions frontend/farm_designer/map/__tests__/util_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ afterEach(() => {
});

describe("round()", () => {
beforeEach(() => {
jest.clearAllMocks();
mockIsMobile = false;
mockState = fakeState();
location.search = "";
});

it("rounds a number", () => {
expect(round(44)).toEqual(40);
expect(round(98)).toEqual(100);
Expand Down
5 changes: 1 addition & 4 deletions frontend/help/documentation/__tests__/software_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import { SoftwareDocsPanel } from "../software";
import { ExternalUrl } from "../../../external_urls";

describe("<SoftwareDocsPanel />", () => {
beforeEach(() => {
location.search = "";
});

it("renders software docs", () => {
location.search = "";
const { container } = render(<SoftwareDocsPanel />);
expect(container.querySelector("iframe")?.getAttribute("src"))
.toEqual(ExternalUrl.softwareDocs);
Expand Down
4 changes: 2 additions & 2 deletions frontend/photos/camera_calibration/__tests__/index_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe("<CameraCalibration/>", () => {
const p = fakeProps();
p.wDEnv = { CAMERA_CALIBRATION_easy_calibration: SPECIAL_VALUES.FALSE };
render(<CameraCalibration {...p} />);
fireEvent.click(screen.getByRole("checkbox", { hidden: true }));
fireEvent.click(screen.getByRole("checkbox"));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
"CAMERA_CALIBRATION_easy_calibration", "\"TRUE\"",
);
Expand All @@ -165,7 +165,7 @@ describe("<CameraCalibration/>", () => {
const p = fakeProps();
p.wDEnv = { CAMERA_CALIBRATION_easy_calibration: SPECIAL_VALUES.TRUE };
render(<CameraCalibration {...p} />);
fireEvent.click(screen.getByRole("checkbox", { hidden: true }));
fireEvent.click(screen.getByRole("checkbox"));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
"CAMERA_CALIBRATION_easy_calibration", "\"FALSE\"",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ describe("<CameraSelection />", () => {
it("stores config in API", () => {
const p = fakeProps();
render(<CameraSelection {...p} />);
fireEvent.click(screen.getByRole("button", {
name: /change camera/i,
hidden: true,
}));
fireEvent.click(screen.getByRole("button", { name: /change camera/i }));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith("camera", "\"mycamera\"");
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,12 @@ describe("<CaptureSizeSelection />", () => {
p.env = { take_photo_width: "200", take_photo_height: "100" };
render(<CaptureSizeSelection {...p} />);
expect(screen.getByTestId("selected-size")).toHaveTextContent("custom");
fireEvent.click(screen.getByRole("button", {
name: /select custom/i,
hidden: true,
}));
fireEvent.click(screen.getByRole("button", { name: /select custom/i }));
expect(p.saveFarmwareEnv).not.toHaveBeenCalled();
const sizeInputs = screen.queryAllByRole("spinbutton", {
hidden: true,
});
const sizeInputs = screen.queryAllByRole("spinbutton");
const [widthInput, heightInput] = sizeInputs.length >= 2
? sizeInputs
: screen.getAllByRole("textbox", { hidden: true });
: screen.getAllByRole("textbox");
fireEvent.focus(widthInput);
fireEvent.change(widthInput, {
target: { value: "400" },
Expand Down Expand Up @@ -150,10 +145,7 @@ describe("<CaptureSizeSelection />", () => {
p.env = {};
render(<CaptureSizeSelection {...p} />);
expect(screen.getByTestId("selected-size")).toHaveTextContent("640x480");
fireEvent.click(screen.getByRole("button", {
name: /select 320x240/i,
hidden: true,
}));
fireEvent.click(screen.getByRole("button", { name: /select 320x240/i }));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith("take_photo_width", "320");
expect(p.saveFarmwareEnv).toHaveBeenCalledWith("take_photo_height", "240");
});
Expand All @@ -169,7 +161,6 @@ describe("<CaptureSizeSelection />", () => {
expect(screen.getByTestId("selected-size")).toHaveTextContent(selection);
fireEvent.click(screen.getByRole("button", {
name: new RegExp(`select ${selection}`),
hidden: true,
}));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
"take_photo_width", "" + expectedWidth);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("<RotationSetting />", () => {
it("toggles setting on", () => {
const p = fakeProps();
render(<RotationSetting {...p} />);
fireEvent.click(screen.getByRole("button", { hidden: true }));
fireEvent.click(screen.getByRole("button"));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
DISABLE_ROTATE_AT_CAPTURE_KEY, "1");
});
Expand All @@ -25,7 +25,7 @@ describe("<RotationSetting />", () => {
const p = fakeProps();
p.env = { [DISABLE_ROTATE_AT_CAPTURE_KEY]: "1" };
render(<RotationSetting {...p} />);
fireEvent.click(screen.getByRole("button", { hidden: true }));
fireEvent.click(screen.getByRole("button"));
expect(p.saveFarmwareEnv).toHaveBeenCalledWith(
DISABLE_ROTATE_AT_CAPTURE_KEY, "0");
});
Expand All @@ -49,7 +49,7 @@ describe("<RotationSetting />", () => {
expect(container.querySelector(".capture-rotate-setting")).toBeNull();
return;
}
const text = (screen.getByRole("button", { hidden: true }).textContent || "").toLowerCase();
const text = (screen.getByRole("button").textContent || "").toLowerCase();
const expected = label.toLowerCase();
const equivalent = expected === "yes" ? "true" : "false";
expect([expected, equivalent]).toContain(text);
Expand Down
4 changes: 2 additions & 2 deletions frontend/settings/__tests__/three_d_settings_test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("<ThreeDSettings />", () => {

it("toggles setting on", () => {
const { container } = render(<ThreeDSettings {...fakeProps()} />);
const toggle = within(container).getByRole("button", { name: "no", hidden: true });
const toggle = within(container).getByRole("button", { name: "no" });
fireEvent.click(toggle);
expect(crud.initSave).toHaveBeenCalledWith("FarmwareEnv", {
key: namespace3D("bounds"),
Expand All @@ -87,7 +87,7 @@ describe("<ThreeDSettings />", () => {
fakeEnv.body.value = "1";
p.farmwareEnvs = [fakeEnv];
const { container } = render(<ThreeDSettings {...p} />);
const toggle = within(container).getByRole("button", { name: "yes", hidden: true });
const toggle = within(container).getByRole("button", { name: "yes" });
fireEvent.click(toggle);
expect(crud.initSave).not.toHaveBeenCalled();
expect(crud.edit).toHaveBeenCalledWith(fakeEnv, { value: "0" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("<OrderNumberRow />", () => {
const newOrderNumber = "FB1234";
render(<OrderNumberRow {...p} />);
changeBlurableInputRTL(
screen.getByRole("textbox", { hidden: true }),
screen.getByRole("textbox"),
newOrderNumber,
);
expect(crud.edit).toHaveBeenCalledWith(p.device, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("<CalibrationRow />", () => {
p.mcuParams.encoder_enabled_z = 0;
render(<CalibrationRow {...p} />);
const enabledAxes: string[] = [];
screen.getAllByRole("button", { hidden: true }).map(button => {
screen.getAllByRole("button").map(button => {
if (!(button as HTMLButtonElement).disabled) {
enabledAxes.push((button.textContent || "").split(" ").pop() as string);
fireEvent.click(button);
Expand All @@ -42,7 +42,7 @@ describe("<CalibrationRow />", () => {
p.mcuParams.encoder_enabled_y = 1;
p.mcuParams.encoder_enabled_z = 0;
render(<CalibrationRow {...p} />);
screen.getAllByRole("button", { hidden: true }).map(button => fireEvent.click(button));
screen.getAllByRole("button").map(button => fireEvent.click(button));
expect(p.action).toHaveBeenCalledTimes(3);
["x", "y", "z"].map(x => expect(p.action).toHaveBeenCalledWith(x));
});
Expand All @@ -58,7 +58,7 @@ describe("<CalibrationRow />", () => {
p.mcuParams.movement_enable_endpoints_z = 0;
p.stallUseDisabled = true;
render(<CalibrationRow {...p} />);
const buttons = screen.getAllByRole("button", { hidden: true });
const buttons = screen.getAllByRole("button");
[0, 1].map(i =>
expect((buttons[i] as HTMLButtonElement).disabled).toEqual(false));
expect((buttons[2] as HTMLButtonElement).disabled).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("<ParameterManagement />", () => {
const p = fakeProps();
p.settingsPanelState.parameter_management = true;
render(<ParameterManagement {...p} />);
fireEvent.change(screen.getByRole("textbox", { hidden: true }), { target: { value: "" } });
fireEvent.change(screen.getByRole("textbox"), { target: { value: "" } });
fireEvent.click(screen.getByTitle("IMPORT"));
expect(confirm).toHaveBeenCalledWith(Content.PARAMETER_IMPORT_CONFIRM);
expect(exportMenu.importParameters).toHaveBeenCalledWith("");
Expand All @@ -108,7 +108,7 @@ describe("<ParameterImport />", () => {

it("updates", () => {
render(<ParameterImport {...fakeProps()} />);
const input = screen.getByRole("textbox", { hidden: true });
const input = screen.getByRole("textbox");
expect(input.value).toEqual("");
fireEvent.change(input, { target: { value: "{}" } });
expect(input.value).toEqual("{}");
Expand Down
8 changes: 4 additions & 4 deletions frontend/settings/maybe_highlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,16 @@ export const Highlight = (props: HighlightProps) => {
}));
};

const searchMatch = () => {
return searchTerm &&
const searchMatch = (): boolean => {
return !!searchTerm &&
// if searching, look for setting name match
(some(ALTERNATE_NAMES[settingName].map(s => s.toLowerCase()
.includes(searchTerm.toLowerCase())))
// if match not found, look for section content match
|| (isSectionHeader && inContent(searchTerm)));
|| (!!isSectionHeader && inContent(searchTerm)));
};

const hidden = () => {
const hidden = (): boolean => {
const isolateName = getUrlQuery("only");
if (isolateName) {
const inSection = isSectionHeader && inContent(isolateName, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("<ChangeOwnershipForm />", () => {

it("renders", () => {
const { getByRole, container } = render(<ChangeOwnershipForm />);
const header = getByRole("button", { name: /Change Ownership/, hidden: true });
const header = getByRole("button", { name: /Change Ownership/ });
fireEvent.click(header);
expect(container.textContent).toContain("Email");
expect(container.textContent).toContain("Password");
Expand All @@ -36,7 +36,7 @@ describe("<ChangeOwnershipForm />", () => {

it("submits", () => {
const { getByRole, getByText, container } = render(<ChangeOwnershipForm />);
const header = getByRole("button", { name: /Change Ownership/, hidden: true });
const header = getByRole("button", { name: /Change Ownership/ });
fireEvent.click(header);
const email = container.querySelectorAll("input")[0];
expect(email).toBeTruthy();
Expand All @@ -60,7 +60,7 @@ describe("<ChangeOwnershipForm />", () => {
const useRefSpy = jest.spyOn(React, "useRef").mockReturnValue({ current: undefined });
try {
const { getByRole, getByText, container } = render(<ChangeOwnershipForm />);
const header = getByRole("button", { name: /Change Ownership/, hidden: true });
const header = getByRole("button", { name: /Change Ownership/ });
fireEvent.click(header);
const email = container.querySelectorAll("input")[0];
expect(email).toBeTruthy();
Expand Down
24 changes: 18 additions & 6 deletions lib/tasks/news_user_report.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
require_relative "../../app/lib/key_gen"

class NewUserReportMailer < ActionMailer::Base
SUBJECT = "Daily Report: New FarmBot Setups"
HOST = ENV.fetch("API_HOST")

default from: "farmbot-mailer@#{HOST}"
layout "mailer"

def daily_report(message, emails)
mail(
from: "do-not-reply@#{HOST}",
to: emails,
subject: SUBJECT,
body: message,
)
end
end

class NewUserReport
EMAILS = (ENV["CUSTOMER_SUPPORT_SUBSCRIBERS"] || "").split(",").map(&:strip)
TPL = <<~HEREDOC
Expand Down Expand Up @@ -55,12 +72,7 @@ class NewUserReport

def deliver
puts message
ActionMailer::Base.mail(
from: "do-not-reply@#{ENV["API_HOST"]}",
to: EMAILS,
subject: "Daily Report: New FarmBot Setups",
body: message,
).deliver
NewUserReportMailer.daily_report(message, EMAILS).deliver_now
end
end

Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"farmbot": "15.9.3",
"fengari": "0.1.5",
"fengari-web": "0.1.4",
"i18next": "25.8.14",
"i18next": "25.8.17",
"lodash": "4.17.23",
"markdown-it": "14.1.1",
"markdown-it-emoji": "3.0.0",
Expand Down Expand Up @@ -99,21 +99,21 @@
"@types/jest": "30.0.0",
"@types/readable-stream": "4.0.23",
"@types/suncalc": "1.9.2",
"@typescript-eslint/eslint-plugin": "8.56.1",
"@typescript-eslint/parser": "8.56.1",
"@typescript-eslint/eslint-plugin": "8.57.0",
"@typescript-eslint/parser": "8.57.0",
"happy-dom": "20.8.3",
"eslint": "10.0.2",
"eslint": "10.0.3",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jest": "29.15.0",
"eslint-plugin-no-null": "1.0.2",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-react": "7.37.5",
"eslint-plugin-react-hooks": "7.0.1",
"jest": "30.2.0",
"jest": "30.3.0",
"jest-canvas-mock": "2.5.2",
"jest-cli": "30.2.0",
"jest-environment-jsdom": "30.2.0",
"jest-cli": "30.3.0",
"jest-environment-jsdom": "30.3.0",
"jest-junit": "16.0.0",
"jest-skipped-reporter": "0.0.5",
"jshint": "2.13.6",
Expand All @@ -122,7 +122,7 @@
"playwright": "1.58.2",
"raf": "3.4.1",
"react-test-renderer": "19.2.4",
"sass": "1.97.3",
"sass": "1.98.0",
"sass-lint": "1.13.1",
"ts-jest": "29.4.6",
"tslint": "5.20.1"
Expand Down
Loading
Loading