"Fossies" - the Fresh Open Source Software Archive

Member "Rocket.Chat-4.7.2/apps/meteor/tests/e2e/10-user-preferences.spec.ts" (20 May 2022, 4125 Bytes) of package /linux/www/Rocket.Chat-4.7.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { test, expect } from '@playwright/test';
    2 
    3 import MainContent from './utils/pageobjects/MainContent';
    4 import SideNav from './utils/pageobjects/SideNav';
    5 import LoginPage from './utils/pageobjects/LoginPage';
    6 import FlexTab from './utils/pageobjects/FlexTab';
    7 import PreferencesMainContent from './utils/pageobjects/PreferencesMainContent';
    8 import { adminLogin, adminRegister } from './utils/mocks/userAndPasswordMock';
    9 
   10 test.describe('[User Preferences]', function () {
   11     test.describe('default', () => {
   12         let flexTab: FlexTab;
   13         let loginPage: LoginPage;
   14         let mainContent: MainContent;
   15         let sideNav: SideNav;
   16         let preferencesMainContent: PreferencesMainContent;
   17 
   18         test.beforeAll(async ({ browser, baseURL }) => {
   19             const context = await browser.newContext();
   20             const page = await context.newPage();
   21             const URL = baseURL as string;
   22             loginPage = new LoginPage(page);
   23             await loginPage.goto(URL);
   24 
   25             await loginPage.login(adminLogin);
   26             sideNav = new SideNav(page);
   27             mainContent = new MainContent(page);
   28             preferencesMainContent = new PreferencesMainContent(page);
   29 
   30             await sideNav.sidebarUserMenu().click();
   31             await sideNav.account().click();
   32         });
   33 
   34         test.describe('render:', () => {
   35             test('expect show the preferences link', async () => {
   36                 await expect(sideNav.preferences()).toBeVisible();
   37             });
   38 
   39             test('expect show the profile link', async () => {
   40                 await expect(sideNav.profile()).toBeVisible();
   41             });
   42 
   43             test('expect click on the profile link', async () => {
   44                 await sideNav.profile().click();
   45             });
   46 
   47             test('expect show the username input', async () => {
   48                 await expect(preferencesMainContent.userNameTextInput()).toBeVisible();
   49             });
   50 
   51             test('expect show the real name input', async () => {
   52                 await expect(preferencesMainContent.realNameTextInput()).toBeVisible();
   53             });
   54 
   55             test('expect show the email input', async () => {
   56                 await expect(preferencesMainContent.emailTextInput()).toBeVisible(); // .scrollIntoView()
   57             });
   58 
   59             test('expect show the password input', async () => {
   60                 await expect(preferencesMainContent.passwordTextInput()).toBeVisible(); // .scrollIntoView()
   61             });
   62 
   63             test('expect show the submit button', async () => {
   64                 await expect(preferencesMainContent.submitBtn()).toBeVisible();
   65                 await expect(preferencesMainContent.submitBtn()).toBeDisabled();
   66             });
   67         });
   68 
   69         test.describe('user info change:', () => {
   70             test('expect click on the profile link', async () => {
   71                 await sideNav.profile().click();
   72             });
   73 
   74             test('expect change the name field', async () => {
   75                 await preferencesMainContent.changeRealName(`Edited${adminRegister.name}${Date.now()}`);
   76             });
   77 
   78             test('expect change the Username field', async () => {
   79                 await preferencesMainContent.changeUsername(`Edited${adminRegister.name}${Date.now()}`);
   80             });
   81 
   82             test('expect save the settings', async () => {
   83                 await preferencesMainContent.saveChanges();
   84             });
   85 
   86             test('expect close the preferences menu', async () => {
   87                 await sideNav.preferencesClose().click();
   88                 await sideNav.getChannelFromList('general').scrollIntoViewIfNeeded();
   89                 await sideNav.getChannelFromList('general').click();
   90             });
   91             // TODO: Verify why is intermitent
   92             test.skip('expect send a message to be tested', async () => {
   93                 await mainContent.sendMessage('HI');
   94                 await mainContent.waitForLastMessageEqualsText('HI');
   95             });
   96             // TODO: Verify why is intermitent
   97             test.skip('expect be that the name on the last message is the edited one', async () => {
   98                 await expect(mainContent.lastMessageUser()).toContainText(`Edited${adminRegister.name}`);
   99             });
  100             // TODO: Verify why is intermitent
  101             test.skip('expect be that the user name on the members flex tab is the edited one', async () => {
  102                 mainContent.lastMessageUser().click();
  103                 await expect(flexTab.memberUserName()).toContainText(`Edited${adminRegister.name}`);
  104             });
  105             // TODO: Verify why is intermitent
  106             test.skip('expect that the real name on the members flex tab is the edited one', async () => {
  107                 await expect(flexTab.memberRealName()).toContainText(`Edited${adminRegister.name}`);
  108             });
  109         });
  110     });
  111 });