0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

test: add ui integration test for lang and dir html attributes in experience (#6581)

This commit is contained in:
Charles Zhao 2024-09-13 14:44:31 +08:00 committed by GitHub
parent cf53bb2c8c
commit 6a4726b588
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 1 deletions

View file

@ -171,3 +171,14 @@ export const setUsernamePasswordOnly = async () => {
passwordPolicy: {},
});
};
export const setLanguage = async (
language: SignInExperience['languageInfo']['fallbackLanguage'],
autoDetect = false
) =>
updateSignInExperience({
languageInfo: {
fallbackLanguage: language,
autoDetect,
},
});

View file

@ -1,5 +1,5 @@
import { demoAppUrl } from '#src/constants.js';
import { setUsernamePasswordOnly } from '#src/helpers/sign-in-experience.js';
import { setLanguage, setUsernamePasswordOnly } from '#src/helpers/sign-in-experience.js';
import ExpectExperience from '#src/ui-helpers/expect-experience.js';
const credentials = {
@ -19,6 +19,28 @@ describe('smoke testing on the demo app', () => {
await setUsernamePasswordOnly();
});
it('should have html attribute "lang=en" and "dir=ltr" by default', async () => {
const experience = new ExpectExperience(await browser.newPage());
await experience.startWith(demoAppUrl);
await experience.toMatchElement('html[lang=en][dir=ltr]');
void experience.page.close();
});
it('should have html attribute "lang=ar" and "dir=rtl" for Arabic language', async () => {
await setLanguage('ar');
const experience = new ExpectExperience(await browser.newPage());
await experience.startWith(demoAppUrl);
await experience.toMatchElement('html[lang=ar][dir=rtl]');
// Clean up
await setLanguage('en', true);
void experience.page.close();
});
it('should be able to create a new account with a credential preset', async () => {
const experience = new ExpectExperience(await browser.newPage());