Skip to content

Commit

Permalink
instantiate-load-settings-from-class
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafa committed Aug 27, 2024
1 parent 6e43ad6 commit 6f9e91d
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 45 deletions.
28 changes: 14 additions & 14 deletions tests/page-objects/apdex/contacts.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ const PATIENT_CONTACT = 'patientContact';

class ContactsPage extends Page {

async loadContactList(settingsProvider) {
await super.loadPage(settingsProvider, CONTACT_LIST);
async loadContactList() {
await super.loadPage(CONTACT_LIST);
}

async loadChwArea(settingsProvider) {
await super.loadPage(settingsProvider, CHW_AREA);
async loadChwArea() {
await super.loadPage(CHW_AREA);
}

async loadHousehold(settingsProvider) {
await super.loadPage(settingsProvider, HOUSEHOLD);
async loadHousehold() {
await super.loadPage(HOUSEHOLD);
}

async loadPatient(settingsProvider) {
await super.loadPage(settingsProvider, PATIENT);
async loadPatient() {
await super.loadPage(PATIENT);
}

async searchContact(settingsProvider) {
await super.searchPage(settingsProvider, CONTACT_LIST);
async searchContact() {
await super.searchPage(CONTACT_LIST);
}

async submitPatientReport(settingsProvider) {
await super.loadForm(settingsProvider, PATIENT_REPORT);
async submitPatientReport() {
await super.loadForm(PATIENT_REPORT);
}

async createPatient(settingsProvider) {
await super.loadForm(settingsProvider, PATIENT_CONTACT);
async createPatient() {
await super.loadForm(PATIENT_CONTACT);
}

}
Expand Down
4 changes: 2 additions & 2 deletions tests/page-objects/apdex/messages.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const MESSAGE_LIST = 'messageList';

class MessagesPage extends Page {

async loadMessageList(settingsProvider) {
await super.loadPage(settingsProvider, MESSAGE_LIST);
async loadMessageList() {
await super.loadPage(MESSAGE_LIST);
}

}
Expand Down
14 changes: 8 additions & 6 deletions tests/page-objects/apdex/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { browser, driver } = require('@wdio/globals');
const { execSync } = require('child_process');
const loadSettings = require('../../performance/apdex-score/settings-provider');
const APP_ID = 'org.medicmobile.webapp.mobile';
const settingsProvider = loadSettings();

module.exports = class Page {

Expand Down Expand Up @@ -118,7 +120,7 @@ module.exports = class Page {
}
}

async loadAndAssertPage(page, settingsProvider) {
async loadAndAssertPage(page) {
if (!page) {
return;
}
Expand Down Expand Up @@ -160,7 +162,7 @@ module.exports = class Page {
this.scrollToElement(formPage);
}

async fillUpForm(form, settingsProvider){
async fillUpForm(form){
if (!form) {
return;
}
Expand Down Expand Up @@ -200,7 +202,7 @@ module.exports = class Page {
await this.waitForDisplayedAndRetry(UI_ELEMENT);
}

async search (page, settingsProvider) {
async search (page) {
if (!page || !page.search) {
return;
}
Expand Down Expand Up @@ -241,17 +243,17 @@ module.exports = class Page {
.catch(error => console.error('Error: ', error));
}

async loadPage(settingsProvider, pageName) {
async loadPage(pageName) {
const page = settingsProvider.getPage(pageName);
await this.loadAndAssertPage(page, settingsProvider);
}

async loadForm(settingsProvider, formName) {
async loadForm(formName) {
const form = settingsProvider.getForm(formName);
await this.fillUpForm(form, settingsProvider);
}

async searchPage(settingsProvider, pageName) {
async searchPage(pageName) {
const page = settingsProvider.getPage(pageName);
await this.search(page, settingsProvider);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/page-objects/apdex/reports.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ const REPORT_LIST = 'reportList';

class ReportsPage extends Page {

async loadReportList(settingsProvider) {
await super.loadPage(settingsProvider, REPORT_LIST);
async loadReportList() {
await super.loadPage(REPORT_LIST);
}

async searchReport(settingsProvider) {
await super.searchPage(settingsProvider, REPORT_LIST);
async searchReport() {
await super.searchPage(REPORT_LIST);
}

}
Expand Down
4 changes: 2 additions & 2 deletions tests/page-objects/apdex/targets.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const TARGETS = 'targets';

class TargetsPage extends Page {

async loadTargets(settingsProvider) {
await super.loadPage(settingsProvider, TARGETS);
async loadTargets() {
await super.loadPage(TARGETS);
}

}
Expand Down
8 changes: 4 additions & 4 deletions tests/page-objects/apdex/tasks.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const PATIENT_TASK = 'patientTask';

class TasksPage extends Page {

async loadTaskList(settingsProvider) {
await super.loadPage(settingsProvider, TASK_LIST);
async loadTaskList() {
await super.loadPage(TASK_LIST);
}

async submitTask(settingsProvider) {
await super.loadForm(settingsProvider, PATIENT_TASK);
async submitTask() {
await super.loadForm(PATIENT_TASK);
}

}
Expand Down
26 changes: 13 additions & 13 deletions tests/performance/apdex-score/specs/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,55 +23,55 @@ describe('Apdex Performance Workflows', () => {

for (let i = 0; i < repetitions; i++) {
(skip.loadContactList ? xit : it)('should load contact list', async () => {
await contactsPage.loadContactList(settingsProvider);
await contactsPage.loadContactList();
});

(skip.loadChwArea ? xit : it)('should load CHW area', async () => {
await contactsPage.loadChwArea(settingsProvider);
await contactsPage.loadChwArea();
});

(skip.loadHousehold ? xit : it)('should load household', async () => {
await contactsPage.loadHousehold(settingsProvider);
await contactsPage.loadHousehold();
});

(skip.createPatient ? xit : it)('should create patient', async () => {
await contactsPage.createPatient(settingsProvider);
await contactsPage.createPatient();
});

(skip.loadPatient ? xit : it)('should load patient', async () => {
await contactsPage.loadPatient(settingsProvider);
await contactsPage.loadPatient();
});

(skip.submitPatientReport ? xit : it)('should submit patient report', async () => {
await contactsPage.submitPatientReport(settingsProvider);
await contactsPage.submitPatientReport();
});

(skip.searchContact ? xit : it)('should search contact', async () => {
await contactsPage.searchContact(settingsProvider);
await contactsPage.searchContact();
});

(skip.loadReportList ? xit : it)('should load report list and view a report', async () => {
await reportsPage.loadReportList(settingsProvider);
await reportsPage.loadReportList();
});

(skip.searchReport ? xit : it)('should search report', async () => {
await reportsPage.searchReport(settingsProvider);
await reportsPage.searchReport();
});

(skip.loadTaskList ? xit : it)('should load task list', async () => {
await tasksPage.loadTaskList(settingsProvider);
await tasksPage.loadTaskList();
});

(skip.submitTask ? xit : it)('should complete a task', async () => {
await tasksPage.submitTask(settingsProvider);
await tasksPage.submitTask();
});

(skip.loadTargets ? xit : it)('should load targets', async () => {
await targetsPage.loadTargets(settingsProvider);
await targetsPage.loadTargets();
});

(skip.loadMessageList ? xit : it)('should load message list and view a message', async () => {
await messagesPage.loadMessageList(settingsProvider);
await messagesPage.loadMessageList();
});

}
Expand Down

0 comments on commit 6f9e91d

Please sign in to comment.