misskey/cypress/e2e/router.cy.ts
Gianni Ceccarelli d7bb6c88d3
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)
2024-03-20 11:25:49 +09:00

36 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
describe('Router transition', () => {
describe('Redirect', () => {
// サーバの初期化。ルートのテストに関しては各describeごとに1度だけ実行で十分だと思う使いまわした方が早い
before(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser('admin', 'pass', true);
// ユーザー作成
cy.registerUser('alice', 'alice1234');
cy.login('alice', 'alice1234');
// アカウント初期設定ウィザード
// 表示に時間がかかるのでデフォルト秒数だとタイムアウトする
cy.get('[data-cy-user-setup] [data-cy-modal-window-close]', { timeout: 30000 }).click();
cy.wait(500);
cy.get('[data-cy-modal-dialog-ok]').click();
});
it('redirect to user profile', () => {
// テストのためだけに用意されたリダイレクト用ルートに飛ぶ
cy.visit('/redirect-test');
// プロフィールページのURLであることを確認する
cy.url().should('include', '/@alice')
});
});
});