Skip to content

Commit

Permalink
feat: switch to mocha in dynamic smoke tests (#71)
Browse files Browse the repository at this point in the history
* test: changes smoke tests from cucumber to mocha

* temp: remove slakc

* fix config

* config change

* fix: smoke wrapper

* fix: remove smoke wrapper and jira issues

* fix

* fix: cleanup

* fix: spaces and new lines
  • Loading branch information
vilkg authored May 27, 2021
1 parent 4f0015b commit b7fdbca
Show file tree
Hide file tree
Showing 45 changed files with 966 additions and 634 deletions.
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ pipeline {
if (fileExists('./reports/new_failures.json')) {
prefix = "NEW ERRORS FOUND! "
}
slackSend(

slackSend(
color: '#ff0000',
message: "${prefix}E2E tests initialized from branch $GIT_BRANCH for version - $VERSION failed. Please visit " + env.BUILD_URL + " for more information",
channel: '@Gintare;@Hella Dawit'
Expand Down
7 changes: 0 additions & 7 deletions features/apps/apps.feature

This file was deleted.

14 changes: 0 additions & 14 deletions features/apps/dataVisualiser.feature

This file was deleted.

9 changes: 0 additions & 9 deletions features/apps/eventVisualiser.feature

This file was deleted.

9 changes: 0 additions & 9 deletions features/apps/eventsReport.feature

This file was deleted.

9 changes: 0 additions & 9 deletions features/apps/maps.feature

This file was deleted.

9 changes: 0 additions & 9 deletions features/apps/pivotTables.feature

This file was deleted.

12 changes: 0 additions & 12 deletions features/dashboardPage.feature

This file was deleted.

27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
"version": "1.0.0",
"description": "DHIS2 E2E testing",
"dependencies": {
"@wdio/allure-reporter": "^6.8.1",
"@wdio/browserstack-service": "^6.10.4",
"@wdio/cli": "^6.10.5",
"@wdio/cucumber-framework": "^6.10.4",
"@wdio/local-runner": "^6.10.5",
"@wdio/selenium-standalone-service": "^6.10.4",
"@wdio/spec-reporter": "^6.8.1",
"@wdio/sync": "^6.10.4",
"@wdio/allure-reporter": "^7.2.1",
"@wdio/browserstack-service": "^7.2.1",
"@wdio/cli": "^7.2.1",
"@wdio/cucumber-framework": "^7.2.1",
"@wdio/local-runner": "^7.2.1",
"@wdio/selenium-standalone-service": "^7.2.1",
"@wdio/spec-reporter": "^7.2.1",
"@wdio/sync": "^7.2.1",
"chromedriver": "^86.0.0",
"deepmerge": "^4.2.2",
"moment": "^2.27.0",
"wdio-applitools-cucumber-service": "^1.0.6",
"wdio-chromedriver-service": "^6.0.4",
"webdriverio": "^6.10.5"
"webdriverio": "^7.2.1"
},
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/preset-env": "^7.7.1",
"@babel/register": "^7.7.0",
"@wdio/mocha-framework": "^7.2.1",
"chai": "^4.1.2",
"eslint-config-standard": "^13.0.1",
"eslint-plugin-import": "^2.18.2",
Expand All @@ -31,6 +32,7 @@
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-webdriverio": "^1.0.1",
"link-module-alias": "^1.2.0",
"mocha": "^8.4.0",
"request": "^2.88.0"
},
"_moduleAliases": {
Expand All @@ -42,9 +44,10 @@
"preinstall": "command -v link-module-alias && link-module-alias clean || true",
"postinstall": "link-module-alias",
"lint": "./node_modules/eslint/bin/eslint.js . --fix",
"browserstack": "./node_modules/.bin/wdio wdio.remote.conf.js",
"test": "./node_modules/.bin/wdio wdio.conf.js ",
"allure": "allure generate ./reports/allure-results/ || allure open"
"browserstack": "./node_modules/.bin/wdio ./tests/config/wdio.browserstack.cucumber.conf.js && ./node_modules/.bin/wdio ./tests/config/wdio.browserstack.mocha.conf.js",
"test": "./node_modules/.bin/wdio ./tests/config/wdio.cucumber.conf.js && ./node_modules/.bin/wdio ./tests/config/wdio.mocha.conf.js",
"smoke": "./node_modules/.bin/wdio ./tests/config/wdio.mocha.conf.js",
"allure": "allure generate --clean ./reports/allure-results/ && allure open"
},
"author": "Edoardo Sabadelli",
"maintainers": [
Expand Down
21 changes: 21 additions & 0 deletions page_objects/AppsList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Page from './Page'
import { waitForVisible } from '#support/wait';

class AppsList extends Page {
get apps() {
return browser.$$('a');
}

get table() {
return browser.$('table');
}

open () {
super.open('dhis-web-apps');

waitForVisible(this.table);
}
}

export default AppsList;
export const appsList = new AppsList();
2 changes: 1 addition & 1 deletion page_objects/Page.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
class Page {
constructor () {
this.title = 'Base page';
this.baseUrl = browser.options.baseUrl;
}

open (path) {
this.baseUrl = browser.options.baseUrl;
browser.url(path);
}
}
Expand Down
31 changes: 31 additions & 0 deletions page_objects/analytics/DataVisualiser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Page from '../Page'
import { waitForWindowToLoad, waitForVisible } from '#support/wait';

class DataVisualiser extends Page {
get visualisationList() {
browser.url('api/visualizations.json?fields=id,displayName&paging=false' );
waitForVisible(browser.$('body pre'));

return JSON.parse(browser.$('body pre').getHTML(false))['visualizations'];
}

get gettingStartedElement() {
return browser.$('[data-test="start-screen"]');
}

open() {
super.open('dhis-web-data-visualizer')
}

openFavorite(id) {
super.open('dhis-web-data-visualizer/#/' + id);
waitForWindowToLoad();
}

dataExist() {
return !browser.$('//*[contains(translate(text(), "No", "no"), "no data")]').isExisting();
}
}

export default DataVisualiser;
export const dataVisualiser = new DataVisualiser();
27 changes: 27 additions & 0 deletions page_objects/analytics/EventReports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Page from '../Page'
import { waitForWindowToLoad, waitForVisible } from '#support/wait';

class EventReports extends Page {
get visualisationList() {
browser.url('api/eventReports.json?fields=id,displayName&paging=false' );
waitForVisible(browser.$('body pre'));

return JSON.parse(browser.$('body pre').getHTML(false))['eventReports'];
}

open() {
super.open('dhis-web-event-reports')
}

openFavorite(id) {
super.open('dhis-web-event-reports/?id=' + id);
waitForWindowToLoad();
}

dataExist() {
return !browser.$('//*[contains(translate(text(), "No", "no"), "no data")]').isExisting();
}
}

export default EventReports;
export const eventReports = new EventReports();
27 changes: 27 additions & 0 deletions page_objects/analytics/EventVisualiser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Page from '../Page'
import { waitForWindowToLoad, waitForVisible } from '#support/wait';

class EventVisualiser extends Page {
get visualisationList() {
browser.url('api/eventCharts.json?fields=id,displayName&paging=false' );
waitForVisible(browser.$('body pre'));

return JSON.parse(browser.$('body pre').getHTML(false))['eventCharts'];
}

open() {
super.open('dhis-web-event-visualizer')
}

openFavorite(id) {
super.open('dhis-web-event-visualizer/?id=' + id);
waitForWindowToLoad();
}

dataExist() {
return !browser.$('//*[contains(translate(text(), "No", "no"), "no data")]').isExisting();
}
}

export default EventVisualiser;
export const eventVisualiser = new EventVisualiser();
31 changes: 31 additions & 0 deletions page_objects/analytics/Maps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Page from '../Page'
import { waitForWindowToLoad, waitForVisible } from '#support/wait';

class Maps extends Page {
get visualisationList() {
browser.url('api/maps.json?fields=id,displayName&paging=false' );
waitForVisible(browser.$('body pre'));

return JSON.parse(browser.$('body pre').getHTML(false))['maps'];
}

get mapsContainerElement() {
return browser.$('#dhis2-map-container');
}

open() {
super.open('dhis-web-maps')
}

openFavorite(id) {
super.open('dhis-web-maps/?id=' + id);
waitForWindowToLoad();
}

dataExist() {
return !browser.$('//*[contains(translate(text(), "No", "no"), "no data")]').isExisting();
}
}

export default Maps;
export const maps = new Maps();
27 changes: 27 additions & 0 deletions page_objects/analytics/PivotTables.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Page from '../Page'
import { waitForWindowToLoad, waitForVisible } from '#support/wait';

class PivotTables extends Page {
get visualisationList() {
browser.url('api/reportTables.json?fields=id,displayName&paging=false' );
waitForVisible(browser.$('body pre'));

return JSON.parse(browser.$('body pre').getHTML(false))['reportTables'];
}

open() {
super.open('dhis-web-pivot')
}

openFavorite(id) {
super.open('dhis-web-pivot/?id=' + id);
waitForWindowToLoad();
}

dataExist() {
return !browser.$('//*[contains(translate(text(), "No", "no"), "no data")]').isExisting();
}
}

export default PivotTables;
export const pivotTables = new PivotTables();
Loading

0 comments on commit b7fdbca

Please sign in to comment.