-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E2E: Improve tests, lint, and add more drivers (#855)
This PR introduces lint to cypress code, adds drivers to try and abstract the usage of cypress as much as possible. Nothing very interesting, mainly to try out the driver pattern for the e2e tests.
- Loading branch information
Showing
12 changed files
with
180 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { CypressHelper } from "@shellygo/cypress-test-utils"; | ||
|
||
export default class CypressWrapperDriver { | ||
private helper = new CypressHelper({ defaultDataAttribute: "data-wd-key" }); | ||
|
||
public given = { | ||
...this.helper.given, | ||
/** | ||
* | ||
* @param url a url to a file, this assumes the file name is the last part of the url | ||
* @param alias | ||
*/ | ||
interceptGetToFile(url: string) { | ||
let fileNameAndAlias = url.split('/').pop(); | ||
cy.intercept('GET', url, { fixture: fileNameAndAlias }).as(fileNameAndAlias!); | ||
}, | ||
|
||
interceptAndIgnore(url: string) { | ||
cy.intercept({ method: "GET", url }, []); | ||
} | ||
} | ||
|
||
public get = { | ||
...this.helper.get, | ||
elementByClassOrType(slector: string) { | ||
return cy.get(slector); | ||
} | ||
} | ||
|
||
public when = { | ||
...this.helper.when, | ||
visit(address: string) { | ||
cy.visit(address); | ||
}, | ||
confirmAlert() { | ||
cy.on("window:confirm", () => true); | ||
} | ||
} | ||
|
||
public beforeAndAfter = this.helper.beforeAndAfter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.