"Fossies" - the Fresh Open Source Software Archive

Member "Rocket.Chat-4.7.2/apps/meteor/tests/e2e/04-main-elements-render.spec.ts" (20 May 2022, 8593 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 FlexTab from './utils/pageobjects/FlexTab';
    6 import LoginPage from './utils/pageobjects/LoginPage';
    7 import { adminLogin } from './utils/mocks/userAndPasswordMock';
    8 
    9 test.describe('[Main Elements Render]', function () {
   10     let loginPage: LoginPage;
   11     let mainContent: MainContent;
   12     let sideNav: SideNav;
   13     let flexTab: FlexTab;
   14 
   15     test.beforeAll(async ({ browser, baseURL }) => {
   16         const context = await browser.newContext();
   17         const page = await context.newPage();
   18         const URL = baseURL;
   19         loginPage = new LoginPage(page);
   20         await loginPage.goto(URL as string);
   21 
   22         await loginPage.login(adminLogin);
   23         sideNav = new SideNav(page);
   24         mainContent = new MainContent(page);
   25         flexTab = new FlexTab(page);
   26     });
   27 
   28     test.describe('[Side Nav Bar]', () => {
   29         test.describe('[Render]', () => {
   30             test('expect show the new channel button', async () => {
   31                 await expect(sideNav.newChannelBtnToolbar()).toBeVisible();
   32             });
   33 
   34             test('expect show "general" channel', async () => {
   35                 await expect(sideNav.general()).toBeVisible();
   36             });
   37         });
   38 
   39         test.describe('[Spotlight search bar]', () => {
   40             test('expect show spotlight search bar', async () => {
   41                 await sideNav.spotlightSearchIcon().click();
   42                 await expect(sideNav.spotlightSearch()).toBeVisible();
   43             });
   44 
   45             test('expect click the spotlight and show the channel list', async () => {
   46                 await sideNav.spotlightSearch().click();
   47                 await expect(sideNav.spotlightSearchPopUp()).toBeVisible();
   48             });
   49 
   50             test('expect add text to the spotlight and show the channel list', async () => {
   51                 await sideNav.spotlightSearch().type('rocket.cat');
   52                 await expect(sideNav.spotlightSearchPopUp()).toBeVisible();
   53                 await sideNav.getPage().locator('//*[@data-qa="sidebar-search-result"]//*[@data-index="0"]').click();
   54             });
   55         });
   56     });
   57     test.describe('[User Options]', () => {
   58         test.describe('[Render]', () => {
   59             test.beforeEach(async () => {
   60                 await sideNav.sidebarUserMenu().click();
   61             });
   62 
   63             test.afterEach(async () => {
   64                 await sideNav.sidebarUserMenu().click();
   65             });
   66 
   67             test('expect show online button', async () => {
   68                 await expect(sideNav.statusOnline()).toBeVisible();
   69             });
   70 
   71             test('expect show away button', async () => {
   72                 await expect(sideNav.statusAway()).toBeVisible();
   73             });
   74 
   75             test('expect show busy button', async () => {
   76                 await expect(sideNav.statusBusy()).toBeVisible();
   77             });
   78 
   79             test('expect show offline button', async () => {
   80                 await expect(sideNav.statusOffline()).toBeVisible();
   81             });
   82 
   83             test('expect show my account button', async () => {
   84                 await expect(sideNav.account()).toBeVisible();
   85             });
   86 
   87             test('expect show logout button', async () => {
   88                 await expect(sideNav.logout()).toBeVisible();
   89             });
   90         });
   91     });
   92 
   93     test.describe('[Main Content]', () => {
   94         test.describe('[Render]', () => {
   95             test.beforeAll(async () => {
   96                 await sideNav.openChannel('general');
   97             });
   98 
   99             test('expect show the title of the channel', async () => {
  100                 await expect(mainContent.channelTitle('general')).toBeVisible();
  101             });
  102 
  103             test('expect show the empty favorite star (before)', async () => {
  104                 await expect(mainContent.emptyFavoriteStar()).toBeVisible();
  105             });
  106 
  107             test('expect click the empty star', async () => {
  108                 await mainContent.emptyFavoriteStar().click();
  109             });
  110 
  111             test('expect show the filled favorite star', async () => {
  112                 await expect(mainContent.favoriteStar()).toBeVisible();
  113             });
  114 
  115             test('expect click the star', async () => {
  116                 await mainContent.favoriteStar().click();
  117             });
  118 
  119             test('expect show the empty favorite star (after)', async () => {
  120                 await expect(mainContent.emptyFavoriteStar()).toBeVisible();
  121             });
  122 
  123             test('expect show the message input bar', async () => {
  124                 await expect(mainContent.messageInput()).toBeVisible();
  125             });
  126 
  127             test('expect show the message box actions button', async () => {
  128                 await expect(mainContent.messageBoxActions()).toBeVisible();
  129             });
  130 
  131             // issues with the new message box action button and the no animations on tests
  132 
  133             test('expect show the audio recording button', async () => {
  134                 await expect(mainContent.recordBtn()).toBeVisible();
  135             });
  136 
  137             test('expect show the emoji button', async () => {
  138                 await expect(mainContent.emojiBtn()).toBeVisible();
  139             });
  140             // TODO: Verify why is intermitent
  141             test.skip('expect show the last message', async () => {
  142                 await expect(mainContent.lastMessage()).toBeVisible();
  143             });
  144             // TODO: Verify why is intermitent
  145             test.skip('expect be that the last message is from the logged user', async () => {
  146                 await expect(mainContent.lastMessageUser()).toBeVisible();
  147             });
  148 
  149             test('expect not show the Admin tag', async () => {
  150                 await expect(mainContent.lastMessageUserTag()).not.toBeVisible();
  151             });
  152         });
  153     });
  154 
  155     test.describe('[FlexTab]', () => {
  156         test.describe('[Render]', () => {
  157             test.beforeAll(async () => {
  158                 await sideNav.openChannel('general');
  159             });
  160 
  161             test.describe('[Room tab info]', () => {
  162                 test.beforeAll(async () => {
  163                     await flexTab.operateFlexTab('info', true);
  164                 });
  165 
  166                 test.afterAll(async () => {
  167                     await flexTab.operateFlexTab('info', false);
  168                 });
  169 
  170                 test('expect show the room info button', async () => {
  171                     await expect(flexTab.channelTab()).toBeVisible();
  172                 });
  173 
  174                 test('expect show the room info tab content', async () => {
  175                     await expect(flexTab.channelSettings()).toBeVisible();
  176                 });
  177             });
  178 
  179             test.describe('[Search Tab]', () => {
  180                 test.beforeAll(async () => {
  181                     await flexTab.operateFlexTab('search', true);
  182                 });
  183 
  184                 test.afterAll(async () => {
  185                     await flexTab.operateFlexTab('search', false);
  186                 });
  187 
  188                 test('expect show the message search  button', async () => {
  189                     await expect(flexTab.searchTab()).toBeVisible();
  190                 });
  191 
  192                 test('expect show the message tab content', async () => {
  193                     await expect(flexTab.searchTabContent()).toBeVisible();
  194                 });
  195             });
  196 
  197             test.describe('[Members Tab]', () => {
  198                 test.beforeAll(async () => {
  199                     await flexTab.operateFlexTab('members', true);
  200                 });
  201 
  202                 test.afterAll(async () => {
  203                     await flexTab.operateFlexTab('members', false);
  204                 });
  205 
  206                 test('expect show the members tab button', async () => {
  207                     await expect(flexTab.membersTab()).toBeVisible();
  208                 });
  209 
  210                 test('expect show the members content', async () => {
  211                     await expect(flexTab.membersTabContent()).toBeVisible();
  212                 });
  213             });
  214 
  215             test.describe('[Notifications Tab]', () => {
  216                 test.beforeAll(async () => {
  217                     await flexTab.operateFlexTab('notifications', true);
  218                 });
  219 
  220                 test.afterAll(async () => {
  221                     await flexTab.operateFlexTab('notifications', false);
  222                 });
  223 
  224                 test('expect not show the notifications button', async () => {
  225                     await expect(flexTab.notificationsTab()).not.toBeVisible();
  226                 });
  227 
  228                 test('expect show the notifications Tab content', async () => {
  229                     await expect(flexTab.notificationsSettings()).toBeVisible();
  230                 });
  231             });
  232 
  233             test.describe('[Files Tab]', () => {
  234                 test.beforeAll(async () => {
  235                     await flexTab.operateFlexTab('files', true);
  236                 });
  237 
  238                 test.afterAll(async () => {
  239                     await flexTab.operateFlexTab('files', false);
  240                 });
  241 
  242                 test('expect show the files Tab content', async () => {
  243                     await expect(flexTab.filesTabContent()).toBeVisible();
  244                 });
  245             });
  246 
  247             test.describe('[Mentions Tab]', () => {
  248                 test.beforeAll(async () => {
  249                     await flexTab.operateFlexTab('mentions', true);
  250                 });
  251 
  252                 test.afterAll(async () => {
  253                     await flexTab.operateFlexTab('mentions', false);
  254                 });
  255 
  256                 test('expect show the mentions Tab content', async () => {
  257                     await expect(flexTab.mentionsTabContent()).toBeVisible();
  258                 });
  259             });
  260 
  261             test.describe('[Starred Messages Tab]', () => {
  262                 test.beforeAll(async () => {
  263                     await flexTab.operateFlexTab('starred', true);
  264                 });
  265 
  266                 test.afterAll(async () => {
  267                     await flexTab.operateFlexTab('starred', false);
  268                 });
  269 
  270                 test('expect show the starred messages Tab content', async () => {
  271                     await expect(flexTab.starredTabContent()).toBeVisible();
  272                 });
  273             });
  274 
  275             test.describe('[Pinned Messages Tab]', () => {
  276                 test.beforeAll(async () => {
  277                     await flexTab.operateFlexTab('pinned', true);
  278                 });
  279 
  280                 test.afterAll(async () => {
  281                     await flexTab.operateFlexTab('pinned', false);
  282                 });
  283 
  284                 test('expect show the pinned messages Tab content', async () => {
  285                     await expect(flexTab.pinnedTabContent()).toBeVisible();
  286                 });
  287             });
  288         });
  289     });
  290 });