@tui-sandbox/library 11.3.3 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/src/client/MyNeovimConfigModification.test.js +1 -0
- package/dist/src/client/MyNeovimConfigModification.test.js.map +1 -1
- package/dist/src/client/color-utilities.test.js +1 -0
- package/dist/src/client/color-utilities.test.js.map +1 -1
- package/dist/src/client/cypress-assertions.d.ts +14 -0
- package/dist/src/client/cypress-assertions.js +32 -0
- package/dist/src/client/cypress-assertions.js.map +1 -0
- package/dist/src/client/index.d.ts +1 -0
- package/dist/src/client/index.js +1 -0
- package/dist/src/client/index.js.map +1 -1
- package/dist/src/scripts/parseArguments.test.js +1 -0
- package/dist/src/scripts/parseArguments.test.js.map +1 -1
- package/dist/src/server/applications/neovim/NeovimJavascriptApiClient.test.js +1 -0
- package/dist/src/server/applications/neovim/NeovimJavascriptApiClient.test.js.map +1 -1
- package/dist/src/server/applications/neovim/environment/createTempDir.test.js +1 -1
- package/dist/src/server/applications/neovim/environment/createTempDir.test.js.map +1 -1
- package/dist/src/server/applications/neovim/prepareNewTestDirectory.test.js +1 -0
- package/dist/src/server/applications/neovim/prepareNewTestDirectory.test.js.map +1 -1
- package/dist/src/server/applications/terminal/runBlockingShellCommand.test.js +1 -0
- package/dist/src/server/applications/terminal/runBlockingShellCommand.test.js.map +1 -1
- package/dist/src/server/blockingCommandInputSchema.test.js +1 -0
- package/dist/src/server/blockingCommandInputSchema.test.js.map +1 -1
- package/dist/src/server/cypress-support/createCypressSupportFile.test.js +1 -0
- package/dist/src/server/cypress-support/createCypressSupportFile.test.js.map +1 -1
- package/dist/src/server/updateTestdirectorySchemaFile.test.js +1 -0
- package/dist/src/server/updateTestdirectorySchemaFile.test.js.map +1 -1
- package/dist/src/server/utilities/DisposableSingleApplication.test.js +1 -0
- package/dist/src/server/utilities/DisposableSingleApplication.test.js.map +1 -1
- package/dist/src/server/utilities/generator.test.js +1 -0
- package/dist/src/server/utilities/generator.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/client/MyNeovimConfigModification.test.ts +1 -0
- package/src/client/color-utilities.test.ts +1 -0
- package/src/client/cypress-assertions.ts +37 -0
- package/src/client/index.ts +1 -0
- package/src/scripts/parseArguments.test.ts +1 -0
- package/src/server/applications/neovim/NeovimJavascriptApiClient.test.ts +1 -0
- package/src/server/applications/neovim/environment/createTempDir.test.ts +1 -1
- package/src/server/applications/neovim/prepareNewTestDirectory.test.ts +1 -0
- package/src/server/applications/terminal/runBlockingShellCommand.test.ts +1 -0
- package/src/server/blockingCommandInputSchema.test.ts +1 -0
- package/src/server/cypress-support/createCypressSupportFile.test.ts +1 -0
- package/src/server/updateTestdirectorySchemaFile.test.ts +1 -0
- package/src/server/utilities/DisposableSingleApplication.test.ts +1 -0
- package/src/server/utilities/generator.test.ts +1 -0
- package/tsconfig.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-sandbox/library",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mikavilpas/tui-sandbox"
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@xterm/addon-unicode11": "0.8.0",
|
|
19
19
|
"@xterm/xterm": "5.5.0",
|
|
20
20
|
"cors": "2.8.5",
|
|
21
|
+
"cypress": "14.5.3",
|
|
21
22
|
"dree": "5.1.5",
|
|
22
23
|
"express": "5.1.0",
|
|
23
24
|
"neovim": "5.3.0",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/** Problem: cypress provides the `contains` method, but it only checks the
|
|
4
|
+
* first match on the page.
|
|
5
|
+
*
|
|
6
|
+
* Solution: we need to check all elements on the page and filter them
|
|
7
|
+
* by the text we are looking for. Then we can check if the background
|
|
8
|
+
* color of the element is the same as the one we are looking for.
|
|
9
|
+
*
|
|
10
|
+
* Limitation: text spanning multiple lines will not be detected.
|
|
11
|
+
*/
|
|
12
|
+
export function textIsVisibleWithColor(text: string, color: string): Cypress.Chainable<JQuery> {
|
|
13
|
+
return cy.get("div.xterm-rows span").and($spans => {
|
|
14
|
+
const matching = $spans.filter((_, el) => !!el.textContent.includes(text))
|
|
15
|
+
|
|
16
|
+
const colors = matching.map((_, el) => {
|
|
17
|
+
return window.getComputedStyle(el).color
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
expect(JSON.stringify(colors.toArray())).to.contain(color)
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Like `textIsVisibleWithColor`, but checks the background color instead
|
|
25
|
+
* of the text color.
|
|
26
|
+
*/
|
|
27
|
+
export function textIsVisibleWithBackgroundColor(text: string, color: string): Cypress.Chainable<JQuery> {
|
|
28
|
+
return cy.get("div.xterm-rows span").and($spans => {
|
|
29
|
+
const matching = $spans.filter((_, el) => !!el.textContent.includes(text))
|
|
30
|
+
|
|
31
|
+
const colors = matching.map((_, el) => {
|
|
32
|
+
return window.getComputedStyle(el).backgroundColor
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
expect(JSON.stringify(colors.toArray())).to.contain(color)
|
|
36
|
+
})
|
|
37
|
+
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// This is the public client api. Semantic versioning will be applied to this.
|
|
2
2
|
|
|
3
3
|
export { rgbify } from "./color-utilities.js"
|
|
4
|
+
export { textIsVisibleWithBackgroundColor, textIsVisibleWithColor } from "./cypress-assertions.js"
|
|
4
5
|
export { NeovimTerminalClient as TerminalClient } from "./neovim-terminal-client.js"
|
|
5
6
|
export { TerminalTerminalClient } from "./terminal-terminal-client.js"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { access } from "fs/promises"
|
|
2
2
|
import { attach } from "neovim"
|
|
3
|
+
import { afterEach, beforeEach, expect, it, vi } from "vitest"
|
|
3
4
|
import type { PollingInterval } from "./NeovimJavascriptApiClient.js"
|
|
4
5
|
import { connectNeovimApi } from "./NeovimJavascriptApiClient.js"
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { rm } from "fs/promises"
|
|
2
2
|
import path from "path"
|
|
3
|
+
import { assert, describe, expect, it } from "vitest"
|
|
3
4
|
import { prepareNewTestDirectory } from "./prepareNewTestDirectory.js"
|
|
4
5
|
|
|
5
6
|
describe("prepareNewTestDirectory when the testEnvironmentPath does not exist", () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "fs"
|
|
2
2
|
import { mkdir, stat } from "fs/promises"
|
|
3
|
+
import { describe, expect, it, vi } from "vitest"
|
|
3
4
|
import { createCypressSupportFileContents } from "./contents.js"
|
|
4
5
|
import type { CreateCypressSupportFileResult } from "./createCypressSupportFile.js"
|
|
5
6
|
import { createCypressSupportFile } from "./createCypressSupportFile.js"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from "fs"
|
|
2
|
+
import { describe, expect, it, vi } from "vitest"
|
|
2
3
|
import { buildTestDirectorySchema } from "./dirtree/index.js"
|
|
3
4
|
import type { UpdateTestdirectorySchemaFileResult } from "./updateTestdirectorySchemaFile.js"
|
|
4
5
|
import { updateTestdirectorySchemaFile } from "./updateTestdirectorySchemaFile.js"
|