summaryrefslogtreecommitdiff
path: root/cypress/support
diff options
context:
space:
mode:
authorGianni Ceccarelli <dakkar@thenautilus.net>2024-03-20 02:25:49 +0000
committerGitHub <noreply@github.com>2024-03-20 11:25:49 +0900
commitd7bb6c88d3e4878486fb1f4d1655379896a5d976 (patch)
tree452c5ea20578bc569050c54cfc1e747dc3cae100 /cypress/support
parentfix(frontend): shikiの言語・テーマの定義ファイルをCDN(esm.sh)... (diff)
downloadsharkey-d7bb6c88d3e4878486fb1f4d1655379896a5d976.tar.gz
sharkey-d7bb6c88d3e4878486fb1f4d1655379896a5d976.tar.bz2
sharkey-d7bb6c88d3e4878486fb1f4d1655379896a5d976.zip
Cypress typescript (#13591)
* convert Cypress tests to TypeScript this work was done by @lunaisnotaboy https://github.com/lunaisnotaboy for their fork https://github.com/cutiekey/cutiekey/pull/7 I just repacked their changes into a minimal set * fix call to `window` in cypress tests this error was spotted thanks to the TypeScript compiler: ``` support/commands.ts:33:12 - error TS2559: Type '(win: any) => void' has no properties in common with type 'Partial<Loggable & Timeoutable>'. 33 cy.window(win => { ~~~~~~~~ Found 1 error in support/commands.ts:33 ``` (again, @lunaisnotaboy did the actual work)
Diffstat (limited to 'cypress/support')
-rw-r--r--cypress/support/commands.ts (renamed from cypress/support/commands.js)2
-rw-r--r--cypress/support/e2e.ts (renamed from cypress/support/e2e.js)0
-rw-r--r--cypress/support/index.ts19
3 files changed, 20 insertions, 1 deletions
diff --git a/cypress/support/commands.js b/cypress/support/commands.ts
index 91a4d7abe6..c2d92e1663 100644
--- a/cypress/support/commands.js
+++ b/cypress/support/commands.ts
@@ -30,7 +30,7 @@ Cypress.Commands.add('visitHome', () => {
})
Cypress.Commands.add('resetState', () => {
- cy.window(win => {
+ cy.window().then(win => {
win.indexedDB.deleteDatabase('keyval-store');
});
cy.request('POST', '/api/reset-db', {}).as('reset');
diff --git a/cypress/support/e2e.js b/cypress/support/e2e.ts
index 827a326d18..827a326d18 100644
--- a/cypress/support/e2e.js
+++ b/cypress/support/e2e.ts
diff --git a/cypress/support/index.ts b/cypress/support/index.ts
new file mode 100644
index 0000000000..c1bed21979
--- /dev/null
+++ b/cypress/support/index.ts
@@ -0,0 +1,19 @@
+declare global {
+ namespace Cypress {
+ interface Chainable {
+ login(username: string, password: string): Chainable<void>;
+
+ registerUser(
+ username: string,
+ password: string,
+ isAdmin?: boolean
+ ): Chainable<void>;
+
+ resetState(): Chainable<void>;
+
+ visitHome(): Chainable<void>;
+ }
+ }
+}
+
+export {}