-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: "assertView", "moveCursorTo" and "currentTest" types #933
Conversation
typings/global.d.ts
Outdated
@@ -3,9 +3,48 @@ | |||
/// <reference types="mocha" /> | |||
/// <reference types="webdriverio" /> | |||
|
|||
interface Test extends Pick<Mocha.Test, "fn", "parent"> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary fast solution in order to not rewrite on TS files from src/test-reader/test-object
UPD: as a result, I rewrote the necessary files to typescript
export type AssertViewElementCommand = ( | ||
this: WebdriverIO.Element, | ||
this: WebdriverIO.Element | ChainablePromiseElement<WebdriverIO.Element>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to be able write code like - await browser.$("foo").assertView("plain")
. Without this I should write it like this - await (await browser.$("foo")).assertView("plain");
b21c517
to
62cbcf0
Compare
9671124
to
8fb2413
Compare
@@ -18,7 +18,7 @@ type GroupName = Exclude<keyof StatsResult, "total" | "perBrowser">; | |||
type StatEvent = { | |||
group: GroupName; | |||
id: string; | |||
browserId: string; | |||
browserId?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to source code browserId
can be undefined
(default value) so I fix it here.
But actually I don't remember the case where it can be undefined
, but I don't want crash something, so just add necessary types.
only: (title: string, fn: (this: Mocha.Suite) => void) => Mocha.Suite; | ||
skip: (title: string, fn: (this: Mocha.Suite) => void) => Mocha.Suite; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these types to test-reader/test-object/types
@@ -1,3 +1,7 @@ | |||
type TestDefinition = import("../src/test-reader/test-object/types").TestDefinition; | |||
type SuiteDefinition = import("../src/test-reader/test-object/types").SuiteDefinition; | |||
type TestHookDefinition = import("../src/test-reader/test-object/types").TestHookDefinition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only with the help of this syntax that it is possible to import types correctly
@@ -18,7 +18,7 @@ describe("test-reader/controllers/only-controller", () => { | |||
}; | |||
|
|||
const mkTestObject_ = ({ browserId } = {}) => { | |||
const testObject = ConfigurableTestObject.create({}); | |||
const testObject = new ConfigurableTestObject({}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove static create
method from ConfigurableTestObject
and implement it on each runnable (suite
, test
, hook
)
8fb2413
to
6b16122
Compare
No description provided.