|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Copyright © . All rights reserved. |
| 5 | + * See LICENSE file for license details. |
| 6 | + */ |
| 7 | + |
| 8 | +declare(strict_types=1); |
| 9 | + |
| 10 | +namespace OxidEsales\ExamplesModule\Tests\Codeception\Acceptance; |
| 11 | + |
| 12 | +use OxidEsales\ExamplesModule\Tests\Codeception\Support\AcceptanceTester; |
| 13 | + |
| 14 | +/** |
| 15 | + * @group oe_examples_module |
| 16 | + * @group oe_examples_module_summernote_extension |
| 17 | + */ |
| 18 | +final class SummernoteExtensionCest |
| 19 | +{ |
| 20 | + private const string TOOLBAR = '//div[contains(@class,"note-toolbar")]'; |
| 21 | + private const string FORMATTING = self::TOOLBAR . '//div[contains(@class,"note-formatting")]'; |
| 22 | + private const string FONT = self::TOOLBAR . '//div[contains(@class,"note-font")]'; |
| 23 | + private const string MISC = self::TOOLBAR . '//div[contains(@class,"note-misc")]'; |
| 24 | + private const string DROPDOWN = self::FONT . '//div[contains(@class,"dropdown-fontname")]'; |
| 25 | + |
| 26 | + public function testModuleCanOverrideSummernoteOptions(AcceptanceTester $I): void |
| 27 | + { |
| 28 | + $I->wantToTest('Module can override Summernote toolbar and font names'); |
| 29 | + |
| 30 | + $adminPanel = $I->loginAdmin(); |
| 31 | + $adminPanel->openProducts(); |
| 32 | + $I->selectEditFrame(); |
| 33 | + |
| 34 | + $I->waitForElement('.note-editor', 15); |
| 35 | + $I->wait(3); |
| 36 | + |
| 37 | + // toolbar groups |
| 38 | + $I->seeNumberOfElements(self::TOOLBAR . '/div[contains(@class,"note-btn-group")]', 4); |
| 39 | + |
| 40 | + // formatting |
| 41 | + $I->seeElement(self::FORMATTING . '//button[contains(@class,"note-btn-bold")]'); |
| 42 | + $I->seeElement(self::FORMATTING . '//button[contains(@class,"note-btn-italic")]'); |
| 43 | + $I->seeNumberOfElements(self::FORMATTING . '//button[contains(@class,"note-btn")]', 2); |
| 44 | + |
| 45 | + // font |
| 46 | + $I->seeElement(self::FONT . '//*[@aria-label="Font Family"]'); |
| 47 | + $I->seeElement(self::FONT . '//*[@aria-label="Font Size"]'); |
| 48 | + $I->seeNumberOfElements(self::FONT . '//button[contains(@class,"note-btn")]', 2); |
| 49 | + |
| 50 | + // misc |
| 51 | + $I->seeElement(self::MISC . '//*[@aria-label="Cleaner"]'); |
| 52 | + $I->seeElement(self::MISC . '//*[@aria-label="Print"]'); |
| 53 | + $I->seeElement(self::MISC . '//button[contains(@class,"btn-codeview")]'); |
| 54 | + $I->seeNumberOfElements(self::MISC . '//button[contains(@class,"note-btn")]', 3); |
| 55 | + |
| 56 | + // font names dropdown |
| 57 | + $I->click(self::FONT . '//button[@aria-label="Font Family"]'); |
| 58 | + $I->wait(1); |
| 59 | + |
| 60 | + $I->seeNumberOfElements(self::DROPDOWN . '//a[contains(@class,"dropdown-item")]', 3); |
| 61 | + $I->see('Arial', self::DROPDOWN); |
| 62 | + $I->see('Courier New', self::DROPDOWN); |
| 63 | + $I->see('Custom Font', self::DROPDOWN); |
| 64 | + } |
| 65 | +} |
0 commit comments