-
-
Notifications
You must be signed in to change notification settings - Fork 59
Fix missing matchers #1842
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 missing matchers #1842
Changes from 2 commits
0e01da0
b002b78
2d25365
12a2035
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,75 +1,31 @@ | ||
| import * as toHaveClipboardText from './matchers/browser/toHaveClipboardText.js' | ||
| import * as toHaveTitle from './matchers/browser/toHaveTitle.js' | ||
| import * as toHaveUrl from './matchers/browser/toHaveUrl.js' | ||
| import * as toBeElementsArrayOfSize from './matchers/elements/toBeElementsArrayOfSize.js' | ||
| import * as toBeClickable from './matchers/element/toBeClickable.js' | ||
| import * as toBeDisabled from './matchers/element/toBeDisabled.js' | ||
| import * as toBeDisplayed from './matchers/element/toBeDisplayed.js' | ||
| import * as toBeDisplayedInViewport from './matchers/element/toBeDisplayedInViewport.js' | ||
| import * as toBeEnabled from './matchers/element/toBeEnabled.js' | ||
| import * as toBeExisting from './matchers/element/toBeExisting.js' | ||
| import * as toBeFocused from './matchers/element/toBeFocused.js' | ||
| import * as toBeSelected from './matchers/element/toBeSelected.js' | ||
| import * as toHaveAttribute from './matchers/element/toHaveAttribute.js' | ||
| import * as toHaveChildren from './matchers/element/toHaveChildren.js' | ||
| import * as toHaveClass from './matchers/element/toHaveClass.js' | ||
| import * as toHaveHref from './matchers/element/toHaveHref.js' | ||
| import * as toHaveHTML from './matchers/element/toHaveHTML.js' | ||
| import * as toHaveId from './matchers/element/toHaveId.js' | ||
| import * as toHaveSize from './matchers/element/toHaveSize.js' | ||
| import * as toHaveElementProperty from './matchers/element/toHaveElementProperty.js' | ||
| import * as toHaveText from './matchers/element/toHaveText.js' | ||
| import * as toHaveValue from './matchers/element/toHaveValue.js' | ||
| import * as toHaveStyle from './matchers/element/toHaveStyle.js' | ||
| import * as toBeRequested from './matchers/mock/toBeRequested.js' | ||
| import * as toBeRequestedTimes from './matchers/mock/toBeRequestedTimes.js' | ||
| import * as toBeRequestedWith from './matchers/mock/toBeRequestedWith.js' | ||
| import * as snapshotMatchers from './matchers/snapshot.js' | ||
|
|
||
| const matchers = { | ||
| // browser | ||
| ...toHaveClipboardText, | ||
| ...toHaveTitle, | ||
| ...toHaveUrl, | ||
|
|
||
| // ElementArray $$ | ||
| ...toBeElementsArrayOfSize, | ||
|
|
||
| // Element $ or ElementArray $$ | ||
| ...toBeClickable, | ||
| ...toBeDisabled, | ||
| ...toBeDisplayed, | ||
| ...toBeDisplayedInViewport, | ||
| ...toBeEnabled, | ||
| ...toBeExisting, | ||
| ...toBeFocused, | ||
| ...toBeSelected, | ||
| ...toHaveAttribute, | ||
| ...toHaveChildren, | ||
| ...toHaveClass, | ||
| ...toHaveHref, | ||
| ...toHaveHTML, | ||
| ...toHaveId, | ||
| ...toHaveSize, | ||
| ...toHaveElementProperty, | ||
| ...toHaveText, | ||
| ...toHaveValue, | ||
| ...toHaveStyle, | ||
|
|
||
| // Mock | ||
| ...toBeRequested, | ||
| ...toBeRequestedTimes, | ||
| ...toBeRequestedWith, | ||
|
|
||
| // Snapshot | ||
| ...snapshotMatchers | ||
| } | ||
|
|
||
| // avoid exporting internal functions | ||
| Object.keys(matchers).forEach((key: keyof typeof matchers) => { | ||
| if (key.endsWith('Fn')) { | ||
| delete matchers[key] | ||
| } | ||
| }) | ||
|
|
||
| export default matchers | ||
| export * from './matchers/browser/toHaveClipboardText.js' | ||
| export * from './matchers/browser/toHaveTitle.js' | ||
| export * from './matchers/browser/toHaveUrl.js' | ||
| export * from './matchers/element/toBeClickable.js' | ||
| export * from './matchers/element/toBeDisabled.js' | ||
| export * from './matchers/element/toBeDisplayed.js' | ||
| export * from './matchers/element/toBeDisplayedInViewport.js' | ||
| export * from './matchers/element/toBeEnabled.js' | ||
| export * from './matchers/element/toBeExisting.js' | ||
| export * from './matchers/element/toBeFocused.js' | ||
| export * from './matchers/element/toBeSelected.js' | ||
| export * from './matchers/element/toHaveAttribute.js' | ||
| export * from './matchers/element/toHaveChildren.js' | ||
| export * from './matchers/element/toHaveClass.js' | ||
| export * from './matchers/element/toHaveComputedLabel.js' | ||
| export * from './matchers/element/toHaveComputedRole.js' | ||
| export * from './matchers/element/toHaveElementProperty.js' | ||
| export * from './matchers/element/toHaveHeight.js' | ||
| export * from './matchers/element/toHaveHref.js' | ||
| export * from './matchers/element/toHaveHTML.js' | ||
| export * from './matchers/element/toHaveId.js' | ||
| export * from './matchers/element/toHaveSize.js' | ||
| export * from './matchers/element/toHaveStyle.js' | ||
| export * from './matchers/element/toHaveText.js' | ||
| export * from './matchers/element/toHaveValue.js' | ||
| export * from './matchers/element/toHaveWidth.js' | ||
| export * from './matchers/elements/toBeElementsArrayOfSize.js' | ||
| export * from './matchers/mock/toBeRequested.js' | ||
| export * from './matchers/mock/toBeRequestedTimes.js' | ||
| export * from './matchers/mock/toBeRequestedWith.js' | ||
| export * from './matchers/snapshot.js' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,7 @@ export class SnapshotService implements Services.ServiceInstance { | |
| async beforeTest(test: Frameworks.Test) { | ||
| this.#currentFilePath = test.file | ||
| this.#currentTestName = `${test.parent} > ${test.title}` | ||
| await this.#snapshotClient.startCurrentRun(test.file, test.fullTitle, this.#options) | ||
| await this.#snapshotClient.setup(test.file, this.#options) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the intention of this change?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The client has been updated so I got errors, to be compliant I had to change this. The reason is shared in the description of the PR where you can see the changes that ViTest made @christian-bromann
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we update the version in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It already grabs the latest version with the current package.json but I can do so yes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you! |
||
| } | ||
|
|
||
| async beforeStep(step: Frameworks.PickleStep, scenario: Frameworks.Scenario) { | ||
|
|
@@ -88,15 +88,17 @@ export class SnapshotService implements Services.ServiceInstance { | |
|
|
||
| this.#currentFilePath = file | ||
| this.#currentTestName = testName | ||
| await this.#snapshotClient.startCurrentRun(file, testName, this.#options) | ||
| await this.#snapshotClient.setup(file, this.#options) | ||
| } | ||
|
|
||
| async after() { | ||
| const result = await this.#snapshotClient.finishCurrentRun() | ||
| if (!result) { | ||
| return | ||
| if (this.#currentFilePath) { | ||
christian-bromann marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const result = await this.#snapshotClient.finish(this.#currentFilePath) | ||
| if (!result) { | ||
| return | ||
| } | ||
| this.#snapshotResults.push(result) | ||
| } | ||
| this.#snapshotResults.push(result) | ||
| } | ||
|
|
||
| #isEqual (received: unknown, expected: unknown) { | ||
|
|
||
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.
Can we add a comment here about what we are filtering for?