Skip to content

Commit

Permalink
Add test for relogging in (#2932)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel authored Oct 24, 2023
1 parent 49470ed commit 5602153
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/app/worker/autoupdate/autoupdate-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class AutoupdateStream {
private _abortResolver: (val?: any) => void | undefined;
private error: any | ErrorDescription = null;
private restarting = false;
private _currentData: Object | null = null;
private _currentData: unknown | null = null;

public get active(): boolean {
return this._active;
Expand All @@ -33,7 +33,7 @@ export class AutoupdateStream {
/**
* Full data object received by autoupdate
*/
public get currentData(): Object | null {
public get currentData(): unknown | null {
return this._currentData;
}

Expand Down Expand Up @@ -68,9 +68,9 @@ export class AutoupdateStream {
if (this.abortCtrl !== undefined) {
const abortPromise = new Promise(resolver => (this._abortResolver = resolver));
setTimeout(this._abortResolver, 5000);
// @ts-ignore
this.abortCtrl.abort();
await abortPromise;
this._abortResolver = undefined;
}
}

Expand Down
21 changes: 21 additions & 0 deletions client/tests/integration/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,27 @@ test.describe(`Testing the sign in and out process`, () => {
await expect(page).toHaveURL(`/login`);
});

test(`sign in after logout`, async ({ page }) => {
const loginDelegate = async () => {
await page.goto(`/login`);
await expect(page).toHaveURL(`/login`);
await page.getByLabel(`Username *`).fill(DELEGATE_NAME);
await page.getByLabel(`Password *`).fill(DELEGATE_NAME);
await page.getByRole(`button`, { name: `Login` }).click();
};
loginDelegate();
await expect(page).not.toHaveURL(`/login`);
await expect(page).toHaveURL(`/${DEFAULT_MEETING_ID}`);

await page.locator(`os-account-button > div`).click();
await page.getByText(`Logout`).first().click();
await expect(page).toHaveURL(`/login`);

loginDelegate();
await expect(page).not.toHaveURL(`/login`);
await expect(page).toHaveURL(`/${DEFAULT_MEETING_ID}`);
});

test(`open login after logout via api`, async ({ page, context }) => {
await login(context);
await page.goto(`/`);
Expand Down

0 comments on commit 5602153

Please sign in to comment.