Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into kurt-circle-rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Irev-Dev committed Sep 20, 2024
2 parents 438928f + 3e79b90 commit ea9b36d
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 37 deletions.
2 changes: 1 addition & 1 deletion e2e/playwright/desktop-export.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test(
},
{ timeout: 15_000 }
)
.toBe(477481)
.toBe(482669)

// clean up output.gltf
await fsp.rm('output.gltf')
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ test.describe('Can export from electron app', () => {
},
{ timeout: 15_000 }
)
.toBe(477481)
.toBe(482669)

// clean up output.gltf
await fsp.rm('output.gltf')
Expand Down
40 changes: 27 additions & 13 deletions e2e/playwright/testing-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,39 @@ test.describe('Testing settings', () => {
page,
}) => {
const u = await getUtils(page)
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await page
.getByRole('button', { name: 'Start Sketch' })
.waitFor({ state: 'visible' })
await test.step(`Setup`, async () => {
await page.setViewportSize({ width: 1200, height: 500 })
await u.waitForAuthSkipAppStart()
await page
.getByRole('button', { name: 'Start Sketch' })
.waitFor({ state: 'visible' })
})

// Selectors and constants
const paneButtonLocator = page.getByTestId('debug-pane-button')
const headingLocator = page.getByRole('heading', {
name: 'Settings',
exact: true,
})
const inputLocator = page.locator('input[name="modeling-showDebugPanel"]')

// Open the settings modal with the browser keyboard shortcut
await page.keyboard.press('ControlOrMeta+Shift+,')
await test.step('Open settings dialog and set "Show debug panel" to on', async () => {
await page.keyboard.press('ControlOrMeta+Shift+,')
await expect(headingLocator).toBeVisible()

/** Test to close https://github.com/KittyCAD/modeling-app/issues/2713 */
await test.step(`Confirm that this dialog has a solid background`, async () => {
await expect
.poll(() => u.getGreatestPixDiff({ x: 600, y: 250 }, [28, 28, 28]), {
timeout: 1000,
message:
'Checking for solid background, should not see default plane colors',
})
.toBeLessThan(15)
})

await expect(headingLocator).toBeVisible()
await page.locator('#showDebugPanel').getByText('OffOn').click()
await page.locator('#showDebugPanel').getByText('OffOn').click()
})

// Close it and open again with keyboard shortcut, while KCL editor is focused
// Put the cursor in the editor
Expand Down Expand Up @@ -262,8 +277,6 @@ test.describe('Testing settings', () => {

await page.setViewportSize({ width: 1200, height: 500 })

page.on('console', console.log)

// Selectors and constants
const userThemeColor = '120'
const projectThemeColor = '50'
Expand All @@ -277,7 +290,6 @@ test.describe('Testing settings', () => {
const projectLink = page.getByText('bracket')
const logoLink = page.getByTestId('app-logo')

// Open the app and set the user theme color
await test.step('Set user theme color on home', async () => {
await expect(settingsOpenButton).toBeVisible()
await settingsOpenButton.click()
Expand All @@ -296,13 +308,15 @@ test.describe('Testing settings', () => {
await expect(projectSettingsTab).toBeChecked()
await themeColorSetting.fill(projectThemeColor)
await expect(logoLink).toHaveCSS('--primary-hue', projectThemeColor)
await settingsCloseButton.click()
})

await test.step('Refresh the application and see project setting applied', async () => {
// Make sure we're done navigating before we reload
await expect(settingsCloseButton).not.toBeVisible()
await page.reload({ waitUntil: 'domcontentloaded' })

await expect(logoLink).toHaveCSS('--primary-hue', projectThemeColor)
await settingsCloseButton.click()
})

await test.step(`Navigate back to the home view and see user setting applied`, async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/lang/abstractSyntaxTree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1766,17 +1766,17 @@ const key = 'c'`
const ast = parse(code)
if (err(ast)) throw ast
const { nonCodeMeta } = ast
expect(nonCodeMeta.nonCodeNodes[0][0]).toEqual(nonCodeMetaInstance)
expect(nonCodeMeta.nonCodeNodes[0]?.[0]).toEqual(nonCodeMetaInstance)

// extra whitespace won't change it's position (0) or value (NB the start end would have changed though)
const codeWithExtraStartWhitespace = '\n\n\n' + code
const ast2 = parse(codeWithExtraStartWhitespace)
if (err(ast2)) throw ast2
const { nonCodeMeta: nonCodeMeta2 } = ast2
expect(nonCodeMeta2.nonCodeNodes[0][0].value).toStrictEqual(
expect(nonCodeMeta2.nonCodeNodes[0]?.[0].value).toStrictEqual(
nonCodeMetaInstance.value
)
expect(nonCodeMeta2.nonCodeNodes[0][0].start).not.toBe(
expect(nonCodeMeta2.nonCodeNodes[0]?.[0].start).not.toBe(
nonCodeMetaInstance.start
)
})
Expand Down
19 changes: 10 additions & 9 deletions src/wasm-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/wasm-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rust-version = "1.73"
crate-type = ["cdylib"]

[dependencies]
bson = { version = "2.12.0", features = ["uuid-1", "chrono"] }
bson = { version = "2.13.0", features = ["uuid-1", "chrono"] }
data-encoding = "2.6.0"
gloo-utils = "0.2.0"
kcl-lib = { path = "kcl" }
Expand Down Expand Up @@ -73,7 +73,7 @@ members = [
http = "0.2.12"
kittycad = { version = "0.3.20", default-features = false, features = ["js", "requests"] }
kittycad-modeling-session = "0.1.4"
kittycad-modeling-cmds = { version = "0.2.59", features = ["websocket"] }
kittycad-modeling-cmds = { version = "0.2.61", features = ["websocket"] }

[[test]]
name = "executor"
Expand Down
6 changes: 3 additions & 3 deletions src/wasm-lib/kcl/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "kcl-lib"
description = "KittyCAD Language implementation and tools"
version = "0.2.15"
version = "0.2.16"
edition = "2021"
license = "MIT"
repository = "https://github.com/KittyCAD/modeling-app"
Expand Down Expand Up @@ -44,7 +44,7 @@ sha2 = "0.10.8"
tabled = { version = "0.15.0", optional = true }
thiserror = "1.0.63"
toml = "0.8.19"
ts-rs = { version = "9.0.1", features = ["uuid-impl", "url-impl", "chrono-impl", "no-serde-warnings", "serde-json-impl"] }
ts-rs = { version = "10.0.0", features = ["uuid-impl", "url-impl", "chrono-impl", "no-serde-warnings", "serde-json-impl"] }
url = { version = "2.5.2", features = ["serde"] }
urlencoding = "2.1.3"
uuid = { version = "1.10.0", features = ["v4", "js", "serde"] }
Expand All @@ -62,7 +62,7 @@ web-sys = { version = "0.3.69", features = ["console"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.5"
bson = { version = "2.12.0", features = ["uuid-1", "chrono"] }
bson = { version = "2.13.0", features = ["uuid-1", "chrono"] }
tokio = { version = "1.39.3", features = ["full"] }
tokio-tungstenite = { version = "0.24.0", features = ["rustls-tls-native-roots"] }
tower-lsp = { version = "0.20.0", features = ["proposed"] }
Expand Down
3 changes: 2 additions & 1 deletion src/wasm-lib/kcl/src/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub struct StdLibFnData {

/// This struct defines a single argument to a stdlib function.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)]
#[ts(export)]
// There's a bug in ts_rs where this isn't correctly imported by StdLibFnData.
#[ts(export_to = "StdLibFnData.ts")]
#[serde(rename_all = "camelCase")]
pub struct StdLibFnArg {
/// The name of the argument.
Expand Down
5 changes: 1 addition & 4 deletions src/wasm-lib/kcl/src/engine/conn_wasm.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
//! Functions for setting up our WebSocket and WebRTC connections for communications with the
//! engine.
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
use std::sync::{Arc, Mutex};

use anyhow::Result;
use indexmap::IndexMap;
Expand Down
26 changes: 26 additions & 0 deletions src/wasm-lib/kcl/src/settings/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,32 @@ impl From<UnitLength> for kittycad::types::UnitLength {
}
}

impl From<kittycad_modeling_cmds::units::UnitLength> for UnitLength {
fn from(unit: kittycad_modeling_cmds::units::UnitLength) -> Self {
match unit {
kittycad_modeling_cmds::units::UnitLength::Centimeters => UnitLength::Cm,
kittycad_modeling_cmds::units::UnitLength::Feet => UnitLength::Ft,
kittycad_modeling_cmds::units::UnitLength::Inches => UnitLength::In,
kittycad_modeling_cmds::units::UnitLength::Meters => UnitLength::M,
kittycad_modeling_cmds::units::UnitLength::Millimeters => UnitLength::Mm,
kittycad_modeling_cmds::units::UnitLength::Yards => UnitLength::Yd,
}
}
}

impl From<UnitLength> for kittycad_modeling_cmds::units::UnitLength {
fn from(unit: UnitLength) -> Self {
match unit {
UnitLength::Cm => kittycad_modeling_cmds::units::UnitLength::Centimeters,
UnitLength::Ft => kittycad_modeling_cmds::units::UnitLength::Feet,
UnitLength::In => kittycad_modeling_cmds::units::UnitLength::Inches,
UnitLength::M => kittycad_modeling_cmds::units::UnitLength::Meters,
UnitLength::Mm => kittycad_modeling_cmds::units::UnitLength::Millimeters,
UnitLength::Yd => kittycad_modeling_cmds::units::UnitLength::Yards,
}
}
}

/// The types of controls for how to navigate the 3D view.
#[derive(Debug, Default, Eq, PartialEq, Clone, Deserialize, Serialize, JsonSchema, ts_rs::TS, Display, FromStr)]
#[ts(export)]
Expand Down

0 comments on commit ea9b36d

Please sign in to comment.