summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranatawa12 <anatawa12@icloud.com>2024-04-14 08:08:26 +0900
committerGitHub <noreply@github.com>2024-04-14 08:08:26 +0900
commit48a7679b8a8b3df80d7f90ac6f4a852f47a8df22 (patch)
treec475dec858e1a9e9bc63052cb6cc783701ee1af5
parentfix(backend): 登録にメール認証が必須になっている場合、登... (diff)
downloadsharkey-48a7679b8a8b3df80d7f90ac6f4a852f47a8df22.tar.gz
sharkey-48a7679b8a8b3df80d7f90ac6f4a852f47a8df22.tar.bz2
sharkey-48a7679b8a8b3df80d7f90ac6f4a852f47a8df22.zip
test: do not use indexedDB in cypress environment due to chrome bug (#13709)
-rw-r--r--cypress/support/commands.ts4
-rw-r--r--packages/frontend/src/scripts/idb-proxy.ts10
2 files changed, 14 insertions, 0 deletions
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index c2d92e1663..281f2e6ccd 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -30,9 +30,13 @@ Cypress.Commands.add('visitHome', () => {
})
Cypress.Commands.add('resetState', () => {
+ // iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
+ // see https://github.com/misskey-dev/misskey/issues/13605#issuecomment-2053652123
+ /*
cy.window().then(win => {
win.indexedDB.deleteDatabase('keyval-store');
});
+ */
cy.request('POST', '/api/reset-db', {}).as('reset');
cy.get('@reset').its('status').should('equal', 204);
cy.reload(true);
diff --git a/packages/frontend/src/scripts/idb-proxy.ts b/packages/frontend/src/scripts/idb-proxy.ts
index 1ca0990ba9..6b511f2a5f 100644
--- a/packages/frontend/src/scripts/idb-proxy.ts
+++ b/packages/frontend/src/scripts/idb-proxy.ts
@@ -15,6 +15,16 @@ const fallbackName = (key: string) => `idbfallback::${key}`;
let idbAvailable = typeof window !== 'undefined' ? !!(window.indexedDB && window.indexedDB.open) : true;
+// iframe.contentWindow.indexedDB.deleteDatabase() がchromeのバグで使用できないため、indexedDBを無効化している。
+// バグが治って再度有効化するのであれば、cypressのコマンド内のコメントアウトを外すこと
+// see https://github.com/misskey-dev/misskey/issues/13605#issuecomment-2053652123
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-expect-error
+if (window.Cypress) {
+ idbAvailable = false;
+ console.log('Cypress detected. It will use localStorage.');
+}
+
if (idbAvailable) {
await iset('idb-test', 'test')
.catch(err => {