Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for relogging in #2932

Merged
merged 7 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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