Skip to content
Open
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
10 changes: 9 additions & 1 deletion apps/meteor/tests/e2e/page-objects/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export class Registration extends Main {
super(page.getByRole('main'));
}

async waitForCalloutPage(): Promise<void> {
await this.page.getByRole('status').waitFor();
}

get btnSendInstructions(): Locator {
return this.page.locator('role=button[name="Send instructions"]');
}
Expand Down Expand Up @@ -145,6 +149,10 @@ export class Registration extends Main {
}

get registrationDisabledCallout(): Locator {
return this.page.locator('role=status >> text=/New user registration is currently disabled/');
return this.page.getByRole('status').filter({ hasText: 'New user registration is currently disabled' });
}

get registrationInvalidUrlCallout(): Locator {
return this.page.getByRole('status').filter({ hasText: 'The URL provided is invalid' });
}
}
11 changes: 5 additions & 6 deletions apps/meteor/tests/e2e/register.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ test.describe.parallel('register', () => {
await page.goto('/register/invalid_secret');
});

test('should expect a invalid page informing that the secret password is invalid', async ({ page }) => {
await expect(page.locator('role=heading[level=2][name="The URL provided is invalid."]')).toBeVisible({
timeout: 10000,
});
test('should expect a invalid page informing that the secret password is invalid', async () => {
await poRegistration.waitForCalloutPage();
await expect(poRegistration.registrationInvalidUrlCallout).toBeVisible();
});
});

Expand All @@ -219,8 +218,8 @@ test.describe.parallel('register', () => {

test('should show an invalid page informing that the url is not valid', async ({ page }) => {
await page.goto('/register/secret');
await page.waitForSelector('role=heading[level=2]');
await expect(page.locator('role=heading[level=2][name="The URL provided is invalid."]')).toBeVisible();
await poRegistration.waitForCalloutPage();
await expect(poRegistration.registrationInvalidUrlCallout).toBeVisible();
});
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Callout } from '@rocket.chat/fuselage';
import type { ReactElement } from 'react';
import { useTranslation } from 'react-i18next';

Expand All @@ -8,7 +9,9 @@ const SecretRegisterInvalidForm = (): ReactElement => {

return (
<VerticalTemplate>
<h2>{t('Invalid_secret_URL_message')}</h2>
<Callout role='status' type='warning'>
{t('Invalid_secret_URL_message')}
</Callout>
</VerticalTemplate>
);
};
Expand Down
Loading