web: fix tests failing on macos

This commit is contained in:
Abdullah Atta
2025-01-20 11:28:22 +05:00
parent c680121eb0
commit 522ea1520d
22 changed files with 248 additions and 19 deletions

View File

@@ -0,0 +1,4 @@
Subtotal: ₹300
Sales tax: ₹200
Discount: -₹300
Total: ₹300

View File

@@ -0,0 +1,4 @@
Subtotal: ₹300
Sales tax: ₹200
Discount: ₹0
Total: ₹300/mo

View File

@@ -0,0 +1,4 @@
Subtotal: $100
Sales tax: $0
Discount: -$100
Total: $100

View File

@@ -0,0 +1,4 @@
Subtotal: $100
Sales tax: $0
Discount: $0
Total: $100/mo

View File

@@ -0,0 +1,4 @@
Subtotal: ₹400
Sales tax: ₹300
Discount: -₹400
Total: ₹400

View File

@@ -0,0 +1,4 @@
Subtotal: ₹400
Sales tax: ₹300
Discount: ₹0
Total: ₹400/yr

View File

@@ -0,0 +1,4 @@
Subtotal: $200
Sales tax: $0
Discount: -$200
Total: $200

View File

@@ -0,0 +1,4 @@
Subtotal: $200
Sales tax: $0
Discount: $0
Total: $200/yr

View File

@@ -0,0 +1 @@
53ad8e4e40ebebd0f400498dTest note 1 (0) Test note 1 (1) Test note 1 (2) Test note 1 (3) Test note 1 (4) Test note 1 (5) Test note 1 (6) Test note 1 (7) Test note 1 (8) Test note 1 (9)

View File

@@ -0,0 +1 @@
f054d19e9a2f46eff7b9bb25Test note 2 (0)Test note 2 (1)Test note 2 (2)Test note 2 (3)Test note 2 (4)Test note 2 (5)Test note 2 (6)Test note 2 (7)Test note 2 (8)Test note 2 (9)

View File

@@ -0,0 +1 @@
Test note 1Test note 1 (0) Test note 1 (1) Test note 1 (2) Test note 1 (3) Test note 1 (4) Test note 1 (5) Test note 1 (6) Test note 1 (7) Test note 1 (8) Test note 1 (9)

View File

@@ -0,0 +1 @@
Test note 2Test note 2 (0)Test note 2 (1)Test note 2 (2)Test note 2 (3)Test note 2 (4)Test note 2 (5)Test note 2 (6)Test note 2 (7)Test note 2 (8)Test note 2 (9)

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -0,0 +1 @@
This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1An edit I made

View File

@@ -43,7 +43,7 @@ test("ctrl+a should select all notes", async ({ page }) => {
const { notesList, notes } = await populateList(page); const { notesList, notes } = await populateList(page);
await notes.focus(); await notes.focus();
await notes.press("Control+a"); await notes.press("ControlOrMeta+a");
for (const note of notesList) { for (const note of notesList) {
expect(await note.isSelected()).toBeTruthy(); expect(await note.isSelected()).toBeTruthy();
@@ -55,7 +55,7 @@ test("right clicking on selected notes should open multi-selection menu", async
}) => { }) => {
const { notesList, notes } = await populateList(page); const { notesList, notes } = await populateList(page);
await notes.focus(); await notes.focus();
await notes.press("Control+a"); await notes.press("ControlOrMeta+a");
await notesList[1].contextMenu.open(); await notesList[1].contextMenu.open();
@@ -67,7 +67,7 @@ test("right clicking on selected notes should open multi-selection menu", async
test("pressing Escape should deselect all items", async ({ page }) => { test("pressing Escape should deselect all items", async ({ page }) => {
const { notesList, notes } = await populateList(page); const { notesList, notes } = await populateList(page);
await notes.focus(); await notes.focus();
await notes.press("Control+a"); await notes.press("ControlOrMeta+a");
await notes.press("Escape"); await notes.press("Escape");
@@ -209,11 +209,11 @@ test("select notes using Control+Click", async ({ page }, info) => {
const { notesList, notes } = await populateList(page, 10); const { notesList, notes } = await populateList(page, 10);
await notes.focus(); await notes.focus();
await page.keyboard.down("Control"); await page.keyboard.down("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
await notesList[i].click(); await notesList[i].click();
} }
await page.keyboard.up("Control"); await page.keyboard.up("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
expect(await notesList[i].isSelected()).toBeTruthy(); expect(await notesList[i].isSelected()).toBeTruthy();
@@ -278,11 +278,11 @@ test("Ctrl+Click to select/unselect notes", async ({ page }, info) => {
const { notesList, notes } = await populateList(page, 10); const { notesList, notes } = await populateList(page, 10);
await notes.focus(); await notes.focus();
await page.keyboard.down("Control"); await page.keyboard.down("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
await notesList[i].click(); await notesList[i].click();
} }
await page.keyboard.up("Control"); await page.keyboard.up("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
expect(await notesList[i].isSelected()).toBeTruthy(); expect(await notesList[i].isSelected()).toBeTruthy();
@@ -295,11 +295,11 @@ test("Ctrl+Click to select/unselect notes", async ({ page }, info) => {
).toBeTruthy(); ).toBeTruthy();
await selectedNote.contextMenu.close(); await selectedNote.contextMenu.close();
await page.keyboard.down("Control"); await page.keyboard.down("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
await notesList[i].click(); await notesList[i].click();
} }
await page.keyboard.up("Control"); await page.keyboard.up("ControlOrMeta");
for (let i = 2; i < 10; i += 2) { for (let i = 2; i < 10; i += 2) {
expect(await notesList[i].isSelected()).toBeFalsy(); expect(await notesList[i].isSelected()).toBeFalsy();

View File

@@ -164,7 +164,7 @@ export class EditorModel {
async selectAll() { async selectAll() {
await this.content.focus(); await this.content.focus();
await this.page.keyboard.press("Control+a"); await this.page.keyboard.press("ControlOrMeta+a");
await this.page.waitForTimeout(500); await this.page.waitForTimeout(500);
} }
@@ -257,8 +257,8 @@ export class EditorModel {
]); ]);
}); });
await this.page.keyboard.down("Control"); await this.page.keyboard.down("ControlOrMeta");
await this.page.keyboard.press("KeyV"); await this.page.keyboard.press("KeyV");
await this.page.keyboard.up("Control"); await this.page.keyboard.up("ControlOrMeta");
} }
} }

View File

@@ -291,9 +291,9 @@ export class NoteContextMenuModel extends BaseProperties {
}); });
await subNotebookItem.waitFor(); await subNotebookItem.waitFor();
await page.keyboard.down("Control"); await page.keyboard.down("ControlOrMeta");
await subNotebookItem.click(); await subNotebookItem.click();
await page.keyboard.up("Control"); await page.keyboard.up("ControlOrMeta");
await addSubNotebooks(page, dialog, subNotebookItem, subNotebook); await addSubNotebooks(page, dialog, subNotebookItem, subNotebook);
} }
@@ -317,9 +317,9 @@ export class NoteContextMenuModel extends BaseProperties {
await notebookItem.waitFor({ state: "visible" }); await notebookItem.waitFor({ state: "visible" });
await this.page.keyboard.down("Control"); await this.page.keyboard.down("ControlOrMeta");
await notebookItem.click(); await notebookItem.click();
await this.page.keyboard.up("Control"); await this.page.keyboard.up("ControlOrMeta");
await addSubNotebooks(this.page, dialog, notebookItem, notebook); await addSubNotebooks(this.page, dialog, notebookItem, notebook);

View File

@@ -0,0 +1,184 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta
name="description"
content="This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1"
/>
<title>Test 1</title>
<meta name="created-at" content="xxx" />
<meta name="updated-at" content="xxx" />
<link rel="stylesheet" href="https://app.notesnook.com/assets/editor-styles.css?d=1690887574068">
<style>
.image-container {
display: block;
}
.image-container.align-right {
display: flex;
justify-content: end;
}
.image-container.align-center {
display: flex;
justify-content: center;
}
.image-container.float {
float: left;
}
.image-container.float.align-right {
float: right;
}
body {
background-color: transparent !important;
color: #202124;
font-family: "Open Sans", "Noto Sans", Frutiger, Calibri, Myriad, Arial, Ubuntu, Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
}
.math-block {
padding-top: 20px;
padding-bottom: 20px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #212121;
}
p {
margin-bottom: 0px;
}
p[data-spacing="double"] {
margin-top: 1em;
}
p[data-spacing="single"] {
margin-top: 0px;
}
p[data-spacing="single"]:empty {
margin-top: 1em;
}
pre.codeblock {
overflow-x: auto;
}
iframe {
max-width: 100% !important;
background-color: transparent !important;
}
li > p {
margin-top: 0px;
margin-bottom: 10px;
}
.checklist > li {
list-style: none;
margin: 0.25em 0;
}
.checklist > li::before {
content: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20id%3D%22checklist-unchecked%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Crect%20id%3D%22Rectangle%22%20width%3D%2215%22%20height%3D%2215%22%20x%3D%22.5%22%20y%3D%22.5%22%20fill-rule%3D%22nonzero%22%20stroke%3D%22%234C4C4C%22%20rx%3D%222%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A");
cursor: pointer;
height: 1.1em;
margin-left: -2.5em;
margin-top: 0em;
position: absolute;
width: 1.5em;
padding-left: 1em;
}
.checklist li.checked::before {
content: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%3E%3Cg%20id%3D%22checklist-checked%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%3Crect%20id%3D%22Rectangle%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22%23008837%22%20fill-rule%3D%22nonzero%22%20rx%3D%222%22%2F%3E%3Cpath%20id%3D%22Path%22%20fill%3D%22%23FFF%22%20fill-rule%3D%22nonzero%22%20d%3D%22M11.5703186%2C3.14417309%20C11.8516238%2C2.73724603%2012.4164781%2C2.62829933%2012.83558%2C2.89774797%20C13.260121%2C3.17069355%2013.3759736%2C3.72932262%2013.0909105%2C4.14168582%20L7.7580587%2C11.8560195%20C7.43776896%2C12.3193404%206.76483983%2C12.3852142%206.35607322%2C11.9948725%20L3.02491697%2C8.8138662%20C2.66090143%2C8.46625845%202.65798871%2C7.89594698%203.01850234%2C7.54483354%20C3.373942%2C7.19866177%203.94940006%2C7.19592841%204.30829608%2C7.5386474%20L6.85276923%2C9.9684299%20L11.5703186%2C3.14417309%20Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E%0A");
}
.checklist li.checked {
color: #505050;
}
[dir="rtl"] .checklist > li::before {
margin-left: 0;
margin-right: -1.5em;
}
blockquote {
border-left: 5px solid #e5e5e5;
padding-left: 10px;
margin-top: 0px;
}
code:not(pre code) {
background-color: #f7f7f7;
border: 1px solid #e5e5e5;
border-radius: 5px;
padding: 3px 5px 0px 5px;
font-family: Hack, Consolas, "Andale Mono", "Lucida Console", "Liberation Mono", "Courier New", Courier, monospace !important;
font-size: 10pt !important;
}
.ProseMirror code > span {
font-family: Hack, Consolas, "Andale Mono", "Lucida Console", "Liberation Mono", "Courier New", Courier, monospace !important;
}
pre {
padding: 10px;
background-color: #e5e5e5;
border-radius: 5px;
font-family: Hack, Consolas, "Andale Mono", "Lucida Console", "Liberation Mono", "Courier New", Courier, monospace !important;
margin-bottom: 16px !important;
}
table {
border-collapse: collapse;
margin: 0;
overflow: hidden;
table-layout: fixed;
}
table td,
table th {
border: 1px solid #e5e5e5;
box-sizing: border-box;
min-width: 1em;
padding: 3px 5px;
position: relative;
vertical-align: top;
}
table td > *,
table th > * {
margin-bottom: 0;
}
table th {
background-color: #f7f7f7;
font-weight: bold;
text-align: left;
}
table p {
margin: 0;
}
</style>
<style>
code[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#6272a4}.token.punctuation{color:#f8f8f2}.namespace{opacity:.7}.token.constant,.token.deleted,.token.property,.token.symbol,.token.tag{color:#ff79c6}.token.boolean,.token.number{color:#bd93f9}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#50fa7b}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f8f8f2}.token.atrule,.token.attr-value,.token.class-name,.token.function{color:#f1fa8c}.token.keyword{color:#8be9fd}.token.important,.token.regex{color:#ffb86c}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}
</style>
</head>
<body>
<h1>Test 1</h1>
<p data-block-id="xxx" data-spacing="double">This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1</p>
</body>
</html>

View File

@@ -0,0 +1,4 @@
# Test 1
This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1

View File

@@ -0,0 +1,3 @@
Test 1
This is Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1Test 1

View File

@@ -230,12 +230,13 @@ export class WaSqliteWorkerMultipleTabDriver implements Driver {
export class WaSqliteWorkerSingleTabDriver implements Driver { export class WaSqliteWorkerSingleTabDriver implements Driver {
private connection?: DatabaseConnection; private connection?: DatabaseConnection;
private connectionMutex = new Mutex(); private connectionMutex = new Mutex();
private readonly worker = wrap<SQLiteWorker>( private readonly worker;
new Worker({ name: this.config.dbName })
);
constructor(private readonly config: Config) { constructor(private readonly config: Config) {
console.log("single tab driver", config.dbName); console.log("single tab driver", config.dbName);
this.worker = wrap<SQLiteWorker>(
new Worker({ name: config.dbName })
)
} }
async init(): Promise<void> { async init(): Promise<void> {