"Fossies" - the Fresh Open Source Software Archive

Member "Rocket.Chat-4.7.2/apps/meteor/tests/e2e/07-emoji.spec.ts" (20 May 2022, 5426 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 { adminLogin } from './utils/mocks/userAndPasswordMock';
    7 
    8 test.describe('[Emoji]', function () {
    9     let loginPage: LoginPage;
   10     let mainContent: MainContent;
   11     let sideNav: SideNav;
   12 
   13     test.beforeAll(async ({ browser, baseURL }) => {
   14         const context = await browser.newContext();
   15         const page = await context.newPage();
   16         const URL = baseURL as string;
   17         loginPage = new LoginPage(page);
   18         await loginPage.goto(URL);
   19 
   20         await loginPage.login(adminLogin);
   21         sideNav = new SideNav(page);
   22         mainContent = new MainContent(page);
   23 
   24         await sideNav.openChannel('general');
   25     });
   26 
   27     test.describe('Render:', () => {
   28         test.beforeAll(async () => {
   29             await mainContent.emojiBtn().click();
   30         });
   31 
   32         test.afterAll(async () => {
   33             await mainContent.emojiSmile().first().click();
   34             await mainContent.setTextToInput('');
   35         });
   36 
   37         test('expect show the emoji picker menu', async () => {
   38             await expect(mainContent.emojiPickerMainScreen()).toBeVisible();
   39         });
   40 
   41         test('expect click the emoji picker people tab', async () => {
   42             await mainContent.emojiPickerPeopleIcon().click();
   43         });
   44 
   45         test('expect show the emoji picker people tab', async () => {
   46             await expect(mainContent.emojiPickerPeopleIcon()).toBeVisible();
   47         });
   48 
   49         test('expect show the emoji picker nature tab', async () => {
   50             await expect(mainContent.emojiPickerNatureIcon()).toBeVisible();
   51         });
   52 
   53         test('expect show the emoji picker food tab', async () => {
   54             await expect(mainContent.emojiPickerFoodIcon()).toBeVisible();
   55         });
   56 
   57         test('expect show the emoji picker activity tab', async () => {
   58             await expect(mainContent.emojiPickerActivityIcon()).toBeVisible();
   59         });
   60 
   61         test('expect show the emoji picker travel tab', async () => {
   62             await expect(mainContent.emojiPickerTravelIcon()).toBeVisible();
   63         });
   64 
   65         test('expect show the emoji picker objects tab', async () => {
   66             await expect(mainContent.emojiPickerObjectsIcon()).toBeVisible();
   67         });
   68 
   69         test('expect show the emoji picker symbols tab', async () => {
   70             await expect(mainContent.emojiPickerSymbolsIcon()).toBeVisible();
   71         });
   72 
   73         test('expect show the emoji picker flags tab', async () => {
   74             await expect(mainContent.emojiPickerFlagsIcon()).toBeVisible();
   75         });
   76 
   77         test('expect show the emoji picker custom tab', async () => {
   78             await expect(mainContent.emojiPickerCustomIcon()).toBeVisible();
   79         });
   80 
   81         test('expect show the emoji picker change tone button', async () => {
   82             await expect(mainContent.emojiPickerChangeTone()).toBeVisible();
   83         });
   84 
   85         test('expect show the emoji picker search bar', async () => {
   86             await expect(mainContent.emojiPickerFilter()).toBeVisible();
   87         });
   88     });
   89 
   90     test.describe('[Usage]', () => {
   91         test.describe('send emoji via screen:', () => {
   92             test.beforeAll(async () => {
   93                 await mainContent.emojiBtn().click();
   94                 await mainContent.emojiPickerPeopleIcon().click();
   95             });
   96 
   97             test('expect select a grinning emoji', async () => {
   98                 await mainContent.emojiGrinning().first().click();
   99             });
  100 
  101             test('expect be that the value on the message input is the same as the emoji clicked', async () => {
  102                 await expect(mainContent.messageInput()).toHaveValue(':grinning: ');
  103             });
  104 
  105             test('expect send the emoji', async () => {
  106                 await mainContent.addTextToInput(' ');
  107                 await mainContent.sendBtn().click();
  108             });
  109 
  110             test.skip('expect be that the value on the message is the same as the emoji clicked', async () => {
  111                 await expect(mainContent.lastMessage()).toContainText('😀');
  112             });
  113         });
  114 
  115         test.describe('send emoji via text:', () => {
  116             test('expect add emoji text to the message input', async () => {
  117                 await mainContent.addTextToInput(':smiley');
  118             });
  119 
  120             test('expect show the emoji popup bar', async () => {
  121                 await expect(mainContent.messagePopUp()).toBeVisible();
  122             });
  123 
  124             test('expect be that the emoji popup bar title is emoji', async () => {
  125                 await expect(mainContent.messagePopUpTitle()).toContainText('Emoji');
  126             });
  127 
  128             test('expect show the emoji popup bar items', async () => {
  129                 await expect(mainContent.messagePopUpItems()).toBeVisible();
  130             });
  131 
  132             test('expect click the first emoji on the popup list', async () => {
  133                 await mainContent.messagePopUpFirstItem().click();
  134             });
  135 
  136             test('expect be that the value on the message input is the same as the emoji clicked', async () => {
  137                 await expect(mainContent.messageInput()).toHaveValue(':smiley: ');
  138             });
  139 
  140             test('expect send the emoji', async () => {
  141                 await mainContent.sendBtn().click();
  142             });
  143 
  144             test.skip('expect be that the value on the message is the same as the emoji clicked', async () => {
  145                 await expect(mainContent.lastMessage()).toContainText('😃');
  146             });
  147         });
  148 
  149         test.describe("send texts and make sure they're not converted to emojis:", () => {
  150             // TODO: Verify why is intermitent
  151             test.skip('should render numbers', async () => {
  152                 await mainContent.sendMessage('0 1 2 3 4 5 6 7 8 9');
  153                 await mainContent.waitForLastMessageEqualsHtml('0 1 2 3 4 5 6 7 8 9');
  154             });
  155             // TODO: Verify why is intermitent
  156             test.skip('should render special characters', async () => {
  157                 await mainContent.sendMessage('# * ® © ™');
  158                 await mainContent.waitForLastMessageEqualsHtml('# * ® © ™');
  159             });
  160         });
  161     });
  162 });