I want to create tests in my repo (https://github.com/DWboutin/jest-spectron-ts) all seems to work, but I can't access the Application.client API in my tests.
I tried in Promises style, async/await, with Mocha and I can't make it work.
This is my only test file (very basic)
const path = require("path");
const Application = require("spectron").Application;
const electron = require("electron");
jest.setTimeout(10000); // increase to 50000 on low spec laptop
let app: any = new Application({
path: electron,
args: [path.join(__dirname, "..", ".webpack", "main", "index.js")]
});
describe("test", () => {
beforeAll(async () => {
await app.start();
});
afterAll(async () => {
if (app && app.isRunning()) {
await app.stop();
}
});
it("shows an initial window", async () => {
const windowCount = await app.client.getWindowCount();
expect(windowCount).toBe(1); // this gives 2, I don't know why
});
it("should have correct text", async () => {
const h1Text = await app.client.getText("h1"); // TypeError: app.client.getText is not a function
expect(h1Text).toEqual("Hello World!");
});
});
Can someone help me please?
from Spectron - TypeError: app.client.getText is not a function
No comments:
Post a Comment