Skip to content

Commit

Permalink
Update mocha, chai for testomat reporting internal (#21400)
Browse files Browse the repository at this point in the history
* [WIP] Added testomatio reporter for ui tests (#21166)

* added testomatio reporter for ui tests

* removed api key from code

---------

Co-authored-by: achakko <[email protected]>

* Added testomatio environment variable to matomo-tests.yml

* Added testomatio environment variable to matomo-tests.yml

* Added testomatio environment variable to matomo-tests.yml

* Added testomatio environment variable to matomo-tests.yml

* Added mocha-multi-reporter to package.jso to enable mocha reporting for standard spec and testomat, also added to config.

* Added mocha-multi-reporter to package.jso to enable mocha reporting for standard spec and testomat, also added to config.

* added testomatio reporter in addition regular spec

* added testomatio reporter in addition regular spec

* Updated one test to ensure it is reported into testomat correctly.

* Updated one test to ensure it is reported into testomat correctly.

* Added comments for multiple mocha reporters

* Adding nyc mocha to report test coverage

* Updated multiple mocha reporter comment and added mocha-multi-reporter dev dependency to screenshot-testing/package.json

* Added mocha-multi-reporter dev dependency to screenshot-testing/package.json

* Added mocha-multi-reporter dev dependency to screenshot-testing/package.json

* Added mocha-multi-reporter dev dependency to screenshot-testing/package.json

* Added mocha-multi-reporter dev dependency to screenshot-testing/package.json

* deleting .npmrc file

* updated lockfile

* Configured mocha-multi-reporter in config and run-tests files

* typo in reporters

* Trying to force mocha colours

* Trying to force mocha colours

* removed deprecated useColors method and kept color method

* Updated dependencies in package.json and updated condition to run spec tests locally and testomat in CI

* Update screenshot-testing lockfile

* Always export reporterOptions from UI config

* revert changes to package-lock.json

---------

Co-authored-by: Michael Bodnarchuk <[email protected]>
Co-authored-by: Marc Neudert <[email protected]>
Co-authored-by: sgiehl <[email protected]>
  • Loading branch information
4 people authored Nov 13, 2023
1 parent 780f4cd commit 6d10dce
Show file tree
Hide file tree
Showing 6 changed files with 7,673 additions and 2,024 deletions.
1 change: 1 addition & 0 deletions .github/workflows/matomo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
- name: running tests
uses: matomo-org/github-action-tests@main
with:
testomatio: ${{ secrets.TESTOMATIO }}
ui-test-options: '--num-test-groups=4 --test-group=${{ matrix.parts }}'
test-type: 'UI'
php-version: '7.2'
Expand Down
17 changes: 14 additions & 3 deletions tests/UI/config.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ exports.mocha = 'mocha-3.1.2';
exports.chai = 'chai-1.9.0';

/**
* The mocha reporter to use.
* Mocha reporters to use (can be multiple delimited by a comma).
*/
exports.reporter = "spec";
if (process.env.TESTOMATIO) {
exports.reporter = 'mocha-multi-reporters';
exports.reporterOptions = {
reporterEnabled: 'spec, @testomatio/reporter/lib/adapter/mocha.js',
testomatioReporterLibAdapterMochaJsReporterOptions: {
apiKey: process.env.TESTOMATIO
}
};
} else {
exports.reporter = 'spec';
exports.reporterOptions = {};
}

/**
* The directory that stores expected screenshots. Relative to the UI repo's root directoriy.
* The directory that stores expected screenshots. Relative to the UI repo's root directory.
*/
exports.expectedScreenshotsDir = ["./expected-screenshots", "./expected-ui-screenshots"];

Expand Down
6 changes: 3 additions & 3 deletions tests/UI/specs/ReportExporting_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("ReportExporting", function () {
visitsSummaryGetUrl = baseUrl + "&moduleToWidgetize=VisitsSummary&actionToWidgetize=get&forceView=1&viewDataTable=graphEvolution";

function normalReportTest(format) {
it("should export a normal report correctly when the " + format + " export is chosen", async function () {
it(`should export a normal report correctly when the ${format} export is chosen`, async function () {
if (await page.url() !== referrersGetWebsitesUrl) {
await page.goto(referrersGetWebsitesUrl);
await page.click('.activateExportSelection');
Expand All @@ -39,7 +39,7 @@ describe("ReportExporting", function () {
}

function evolutionReportTest(format) {
it("should export an evolution graph report correctly when the " + format + " export is chosen", async function () {
it(`should export an evolution graph report correctly when the ${format} export is chosen`, async function () {
if (await page.url() !== visitsSummaryGetUrl) {
await page.goto(visitsSummaryGetUrl);
await page.click('.activateExportSelection');
Expand All @@ -65,7 +65,7 @@ describe("ReportExporting", function () {
}

function rowEvolutionReportTest(format) {
it("should export an row evolution graph report correctly when the " + format + " export link is clicked", async function () {
it(`should export an row evolution graph report correctly when the ${format} export link is clicked`, async function () {
if (!page.url() || page.url().indexOf('popover') === -1) {
await page.goto(referrersGetWebsitesUrl);

Expand Down
Loading

0 comments on commit 6d10dce

Please sign in to comment.