mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 12:50:39 +01:00
test: e2eテストがCIで失敗していた問題をいくつか修正 (#8642)
* test: indexeddbをテスト毎に初期化するように * fix: metaが無いときにfetch-metaを同時に呼ぶと死ぬことがある問題を修正 * test: ログイン後のクライアント側処理を待たずにリロードされてログイン出来ないことがあったのを修正
This commit is contained in:
parent
4b872856c2
commit
22bb1a1793
2 changed files with 23 additions and 6 deletions
|
@ -1,5 +1,8 @@
|
||||||
describe('Before setup instance', () => {
|
describe('Before setup instance', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
cy.window(win => {
|
||||||
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
|
});
|
||||||
cy.request('POST', '/api/reset-db').as('reset');
|
cy.request('POST', '/api/reset-db').as('reset');
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get('@reset').its('status').should('equal', 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
|
@ -32,6 +35,9 @@ describe('Before setup instance', () => {
|
||||||
|
|
||||||
describe('After setup instance', () => {
|
describe('After setup instance', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
cy.window(win => {
|
||||||
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
|
});
|
||||||
cy.request('POST', '/api/reset-db').as('reset');
|
cy.request('POST', '/api/reset-db').as('reset');
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get('@reset').its('status').should('equal', 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
|
@ -70,6 +76,9 @@ describe('After setup instance', () => {
|
||||||
|
|
||||||
describe('After user signup', () => {
|
describe('After user signup', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
cy.window(win => {
|
||||||
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
|
});
|
||||||
cy.request('POST', '/api/reset-db').as('reset');
|
cy.request('POST', '/api/reset-db').as('reset');
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get('@reset').its('status').should('equal', 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
|
@ -129,6 +138,9 @@ describe('After user signup', () => {
|
||||||
|
|
||||||
describe('After user singed in', () => {
|
describe('After user singed in', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
cy.window(win => {
|
||||||
|
win.indexedDB.deleteDatabase('keyval-store');
|
||||||
|
});
|
||||||
cy.request('POST', '/api/reset-db').as('reset');
|
cy.request('POST', '/api/reset-db').as('reset');
|
||||||
cy.get('@reset').its('status').should('equal', 204);
|
cy.get('@reset').its('status').should('equal', 204);
|
||||||
cy.reload(true);
|
cy.reload(true);
|
||||||
|
@ -163,12 +175,10 @@ describe('After user singed in', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('successfully loads', () => {
|
it('successfully loads', () => {
|
||||||
cy.visit('/');
|
cy.get('[data-cy-open-post-form]').should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('note', () => {
|
it('note', () => {
|
||||||
cy.visit('/');
|
|
||||||
|
|
||||||
cy.get('[data-cy-open-post-form]').click();
|
cy.get('[data-cy-open-post-form]').click();
|
||||||
cy.get('[data-cy-post-form-text]').type('Hello, Misskey!');
|
cy.get('[data-cy-post-form-text]').type('Hello, Misskey!');
|
||||||
cy.get('[data-cy-open-post-form-submit]').click();
|
cy.get('[data-cy-open-post-form-submit]').click();
|
||||||
|
|
|
@ -20,9 +20,16 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
|
||||||
cache = meta;
|
cache = meta;
|
||||||
return meta;
|
return meta;
|
||||||
} else {
|
} else {
|
||||||
const saved = await transactionalEntityManager.save(Meta, {
|
// metaが空のときfetchMetaが同時に呼ばれるとここが同時に呼ばれてしまうことがあるのでフェイルセーフなupsertを使う
|
||||||
id: 'x',
|
const saved = await transactionalEntityManager
|
||||||
}) as Meta;
|
.upsert(
|
||||||
|
Meta,
|
||||||
|
{
|
||||||
|
id: 'x',
|
||||||
|
},
|
||||||
|
['id'],
|
||||||
|
)
|
||||||
|
.then((x) => transactionalEntityManager.findOneByOrFail(Meta, x.identifiers[0]));
|
||||||
|
|
||||||
cache = saved;
|
cache = saved;
|
||||||
return saved;
|
return saved;
|
||||||
|
|
Loading…
Reference in a new issue