From 089a0d67c85e80e553b47d476a87c5a560903541 Mon Sep 17 00:00:00 2001 From: ishowta Date: Tue, 10 May 2022 15:47:01 +0900 Subject: [PATCH 1/3] =?UTF-8?q?test:=20indexeddb=E3=82=92=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=E6=AF=8E=E3=81=AB=E5=88=9D=E6=9C=9F=E5=8C=96?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress/integration/basic.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cypress/integration/basic.js b/cypress/integration/basic.js index 7d27b649f4ce..8af64376e2fd 100644 --- a/cypress/integration/basic.js +++ b/cypress/integration/basic.js @@ -1,5 +1,8 @@ describe('Before setup instance', () => { beforeEach(() => { + cy.window(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); @@ -32,6 +35,9 @@ describe('Before setup instance', () => { describe('After setup instance', () => { beforeEach(() => { + cy.window(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); @@ -70,6 +76,9 @@ describe('After setup instance', () => { describe('After user signup', () => { beforeEach(() => { + cy.window(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); @@ -129,6 +138,9 @@ describe('After user signup', () => { describe('After user singed in', () => { beforeEach(() => { + cy.window(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); From 28269f62680dfb3505b0b59e841aac5520990744 Mon Sep 17 00:00:00 2001 From: ishowta Date: Tue, 10 May 2022 15:50:21 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20meta=E3=81=8C=E7=84=A1=E3=81=84?= =?UTF-8?q?=E3=81=A8=E3=81=8D=E3=81=ABfetch-meta=E3=82=92=E5=90=8C?= =?UTF-8?q?=E6=99=82=E3=81=AB=E5=91=BC=E3=81=B6=E3=81=A8=E6=AD=BB=E3=81=AC?= =?UTF-8?q?=E3=81=93=E3=81=A8=E3=81=8C=E3=81=82=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/misc/fetch-meta.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/misc/fetch-meta.ts b/packages/backend/src/misc/fetch-meta.ts index 5417c1096278..e855ac28eef2 100644 --- a/packages/backend/src/misc/fetch-meta.ts +++ b/packages/backend/src/misc/fetch-meta.ts @@ -20,9 +20,16 @@ export async function fetchMeta(noCache = false): Promise { cache = meta; return meta; } else { - const saved = await transactionalEntityManager.save(Meta, { - id: 'x', - }) as Meta; + // metaが空のときfetchMetaが同時に呼ばれるとここが同時に呼ばれてしまうことがあるのでフェイルセーフなupsertを使う + const saved = await transactionalEntityManager + .upsert( + Meta, + { + id: 'x', + }, + ['id'], + ) + .then((x) => transactionalEntityManager.findOneByOrFail(Meta, x.identifiers[0])); cache = saved; return saved; From 94200f7bdaa3c62f6fe7f506f72f356b272a0d0c Mon Sep 17 00:00:00 2001 From: ishowta Date: Tue, 10 May 2022 19:16:30 +0900 Subject: [PATCH 3/3] =?UTF-8?q?test:=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E5=BE=8C=E3=81=AE=E3=82=AF=E3=83=A9=E3=82=A4=E3=82=A2?= =?UTF-8?q?=E3=83=B3=E3=83=88=E5=81=B4=E5=87=A6=E7=90=86=E3=82=92=E5=BE=85?= =?UTF-8?q?=E3=81=9F=E3=81=9A=E3=81=AB=E3=83=AA=E3=83=AD=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=A6=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E3=81=AA=E3=81=84=E3=81=93=E3=81=A8=E3=81=8C?= =?UTF-8?q?=E3=81=82=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cypress/integration/basic.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cypress/integration/basic.js b/cypress/integration/basic.js index 8af64376e2fd..eb15cfe22340 100644 --- a/cypress/integration/basic.js +++ b/cypress/integration/basic.js @@ -175,12 +175,10 @@ describe('After user singed in', () => { }); it('successfully loads', () => { - cy.visit('/'); + cy.get('[data-cy-open-post-form]').should('be.visible'); }); it('note', () => { - cy.visit('/'); - cy.get('[data-cy-open-post-form]').click(); cy.get('[data-cy-post-form-text]').type('Hello, Misskey!'); cy.get('[data-cy-open-post-form-submit]').click();