From 6f9752d1bee265cb7db902f01e51688d35d0bbe4 Mon Sep 17 00:00:00 2001 From: RahatHameed Date: Mon, 6 Nov 2023 12:08:19 +0100 Subject: [PATCH 1/4] OXDEV-7520 Remove left over code --- tests/Codeception/Page/Widget/BaseWidget.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/Codeception/Page/Widget/BaseWidget.php b/tests/Codeception/Page/Widget/BaseWidget.php index a4ae0d2..10d82a0 100644 --- a/tests/Codeception/Page/Widget/BaseWidget.php +++ b/tests/Codeception/Page/Widget/BaseWidget.php @@ -45,16 +45,4 @@ public function addContent(string $element, string $content): self return $this; } - /** - * @param string|array $selector - */ - protected function getSelectorByTheme($selector): string - { - return is_array($selector) ? $selector[$this->getTheme()] : $selector; - } - - protected function getTheme(): string - { - return getenv('THEME_ID') ?: 'apex'; - } } From 04da923a50fd0a698836b554f9384b721df1c101 Mon Sep 17 00:00:00 2001 From: RahatHameed Date: Thu, 2 Nov 2023 12:31:49 +0100 Subject: [PATCH 2/4] OXDEV-7520 Add test for column widget --- .../Acceptance/ColumnWidgetCest.php | 39 +++++++++++++++++++ tests/Codeception/Page/VisualCmsPanel.php | 16 +++++++- .../Codeception/Page/Widget/ColumnWidget.php | 36 +++++++++++++++++ 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 tests/Codeception/Acceptance/ColumnWidgetCest.php create mode 100644 tests/Codeception/Page/Widget/ColumnWidget.php diff --git a/tests/Codeception/Acceptance/ColumnWidgetCest.php b/tests/Codeception/Acceptance/ColumnWidgetCest.php new file mode 100644 index 0000000..c81b51e --- /dev/null +++ b/tests/Codeception/Acceptance/ColumnWidgetCest.php @@ -0,0 +1,39 @@ +wantToTest('adding of column widget'); + + $cmsTitle = 'Column widget'; + $visualCmsPanel = $I->createCMSPage($cmsTitle); + + $visualCmsPanel->addColumn(); + $visualCmsPanel->saveCmsContent(); + + //Open page in frontend + $I->amOnPage('/column-widget'); + $I->dontSeeElement($visualCmsPanel->previewHolder); + $I->see($cmsTitle); + + $textWidget = new ColumnWidget($I); + $textWidget->seeColumnWidgetElement(); + } +} diff --git a/tests/Codeception/Page/VisualCmsPanel.php b/tests/Codeception/Page/VisualCmsPanel.php index dfb6a47..2e79f12 100644 --- a/tests/Codeception/Page/VisualCmsPanel.php +++ b/tests/Codeception/Page/VisualCmsPanel.php @@ -9,12 +9,11 @@ namespace OxidEsales\VcmsExamples\Tests\Codeception\Page; -use Facebook\WebDriver\WebDriverKeys; -use OxidEsales\Codeception\Admin\Component\AdminMenu; use OxidEsales\Codeception\Module\Translation\Translator; use OxidEsales\Codeception\Page\Page; use OxidEsales\VcmsExamples\Tests\Codeception\Page\Widget\BaseWidget; use OxidEsales\VcmsExamples\Tests\Codeception\Step\AdminAcceptanceTester; +use OxidEsales\VcmsExamples\Tests\Codeception\Page\Widget\ColumnWidget; class VisualCmsPanel extends Page { @@ -36,6 +35,9 @@ class VisualCmsPanel extends Page private $addWidgetButton = "//a[@class='dd-veditor-widget-action']"; public $previewHolder = "//body[contains(@class, 'cl-ddoevisualcmspreview')]"; + + public $addColumn = ".dd-veditor-column-action"; + public function openVisualCms(): self { /** @var AdminAcceptanceTester $I */ @@ -157,4 +159,14 @@ public function addWidget(string $widgetClass): BaseWidget return $widget; } + + public function addColumn() + { + /** @var AdminAcceptanceTester $I */ + $I = $this->user; + + $I->click($this->addColumn); + + return new ColumnWidget($I); + } } diff --git a/tests/Codeception/Page/Widget/ColumnWidget.php b/tests/Codeception/Page/Widget/ColumnWidget.php new file mode 100644 index 0000000..2c65b41 --- /dev/null +++ b/tests/Codeception/Page/Widget/ColumnWidget.php @@ -0,0 +1,36 @@ +user = $I; + } + + public function seeColumnWidgetElement(): self + { + /** @var AdminAcceptanceTester $I */ + $I = $this->user; + + $I->seeElement($this->widgetShortCodeClass); + $I->seeElement($this->widgetAdditionalClass); + + return $this; + } +} From 891a97843468c8445d8314419762771c5ad005cc Mon Sep 17 00:00:00 2001 From: RahatHameed Date: Fri, 3 Nov 2023 16:47:07 +0100 Subject: [PATCH 3/4] OXDEV-7538 Add GitHub actions --- .github/testplans/oe_vcmsexamples.yml | 69 +++++++++++++++++++++++ .github/workflows/dispatch_dev_module.yml | 32 +++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .github/testplans/oe_vcmsexamples.yml create mode 100644 .github/workflows/dispatch_dev_module.yml diff --git a/.github/testplans/oe_vcmsexamples.yml b/.github/testplans/oe_vcmsexamples.yml new file mode 100644 index 0000000..f786ed1 --- /dev/null +++ b/.github/testplans/oe_vcmsexamples.yml @@ -0,0 +1,69 @@ +workflow: + matrix: &matrix + # We only test the latest recommended versions here but both template engines + php: &matrix_php '["8.1"]' + mysql: &matrix_mysql '["5.7"]' + # currently, only twig works for oe_vcmsexamples template_engine: &template_engine '["smarty","twig"]' + +global: + git: &git + shop_ref: &git_shop_ref b-7.0.x + enterprise_ref: &git_enterprise_ref 'b-7.0.x' + + composer: &composer + configure: + ref: &dev_ref dev-b-7.1.x + require: + ref: *dev_ref + +prepare_shop: + matrix: *matrix + git: *git + composer: *composer + +install_shop: + matrix: *matrix + git: *git + +install_module: + matrix: *matrix + cache: + prefix: 'moduleInstallation-ce-{{ .Github.SHA }}-{{ .Github.RunNumber }}-{{ .Github.RunAttempt }}' + ids: 'oe_vcmsexamples' + git: + module: + url: &git_module_url '{{ .Github.Repository }}' + ref: '{{ .Github.Ref }}' + package_name: &package_name 'oxid-esales/vcms-examples' + +codeception_tests: + matrix: *matrix + container: + options: '-e THEME_ID=apex' + composer: *composer + configuration: '/var/www/vendor/oxid-esales/vcms-examples/tests/codeception.yml' + suite: 'acceptance' + additional_options: '-g oe_vcmsexamples' + coverage: + path: '' + +shop_setup_tests: + skip: true + +deprecated_tests: + skip: true + +sonarcloud: + skip: true + +phpcs_tests: + skip: true + matrix: *matrix + +styles: + skip: false + matrix: *matrix + +finish: + matrix: *matrix + slack_title: 'Module oe_vcmsexamples CE on {{ .Github.Repository }} by {{ .Github.Actor }}' diff --git a/.github/workflows/dispatch_dev_module.yml b/.github/workflows/dispatch_dev_module.yml new file mode 100644 index 0000000..b446627 --- /dev/null +++ b/.github/workflows/dispatch_dev_module.yml @@ -0,0 +1,32 @@ +name: dispatch_dev_module +# Matrix workflow using re-usable github actions + +on: + workflow_dispatch: + inputs: + testplan: + type: string + required: true + description: 'URL/PATH of the testplan to run' + default: 'https://raw.githubusercontent.com/OXID-eSales/vcms-examples/.github/testplans/oe_vcmsexamples.yml' + runs_on: + type: string + description: 'JSON string/array describing the runner' + required: true + default: '"ubuntu-latest"' + +jobs: + call_matrix: + uses: oxid-eSales/github-actions/.github/workflows/call-test_matrix.yml@v0 + with: + testplan: ${{ inputs.testplan }} + runs_on: ${{ inputs.runs_on }} + secrets: + DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }} + DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} + CACHE_ENDPOINT: ${{ secrets.CACHE_ENDPOINT }} + CACHE_ACCESS_KEY: ${{ secrets.CACHE_ACCESS_KEY }} + CACHE_SECRET_KEY: ${{ secrets.CACHE_SECRET_KEY }} + enterprise_github_token: ${{ secrets.enterprise_github_token }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file From 2580e4e4befa5beb55f06dba9481e74d9b8365fe Mon Sep 17 00:00:00 2001 From: Nikola Ivanovski Date: Mon, 6 Nov 2023 13:43:11 +0200 Subject: [PATCH 4/4] OXDEV-7520 Fix code style and test group --- tests/Codeception/Acceptance/GoogleMapWidgetCest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Codeception/Acceptance/GoogleMapWidgetCest.php b/tests/Codeception/Acceptance/GoogleMapWidgetCest.php index 0a8082d..8318313 100644 --- a/tests/Codeception/Acceptance/GoogleMapWidgetCest.php +++ b/tests/Codeception/Acceptance/GoogleMapWidgetCest.php @@ -14,7 +14,7 @@ /** * @group oe_vcmsexamples - * @group oe_vcmsexamples_widget_text + * @group oe_vcmsexamples_widget_googlemaps */ final class GoogleMapWidgetCest { @@ -30,9 +30,9 @@ public function testGoogleMapWidgetAdd(AdminAcceptanceTester $I): void $cmsTitle = 'Google Map Widget'; - // @codingStandardsIgnoreStart - $link = 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d341751.4640925346!2d7.2344488890625!3d47.995675900000016!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47911b61e3aab3d3%3A0x2739f5134e70bd9e!2sOXID%20eSales%20AG!5e0!3m2!1sen!2sde!4v1697029847015!5m2!1sen!2sde'; - // @codingStandardsIgnoreEnd + // @codingStandardsIgnoreStart + $link = 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d341751.4640925346!2d7.2344488890625!3d47.995675900000016!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47911b61e3aab3d3%3A0x2739f5134e70bd9e!2sOXID%20eSales%20AG!5e0!3m2!1sen!2sde!4v1697029847015!5m2!1sen!2sde'; + // @codingStandardsIgnoreEnd $widgetData = [ 'height' => 400, 'width' => 500,