mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-29 14:48:51 +01:00
e2e: refactoring and making it work.
This commit is contained in:
parent
2a506df443
commit
88c32b9ec6
8 changed files with 446 additions and 400 deletions
18
e2e/utils/acceptTermsIfPresent.ts
Normal file
18
e2e/utils/acceptTermsIfPresent.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
export async function acceptTermsIfPresent(page) {
|
||||
// Clear the flag so that the modal is forced to appear on every request.
|
||||
await page.evaluate(() => localStorage.removeItem('termsAccepted'));
|
||||
|
||||
try {
|
||||
// Get the "i accept" button using an accessible role and regex.
|
||||
const acceptButton = page.getByRole('button', { name: /i accept/i });
|
||||
// Wait for the button to become visible.
|
||||
await acceptButton.waitFor({ state: 'visible', timeout: 10000 });
|
||||
// Click the button.
|
||||
await acceptButton.click();
|
||||
// Wait for the button to be hidden (indicating the modal closed).
|
||||
await acceptButton.waitFor({ state: 'hidden', timeout: 10000 });
|
||||
} catch (error) {
|
||||
console.log('Terms & Conditions modal did not appear: ', error);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue