Skip to content

Commit

Permalink
Migrate concatenate strings (medic#7333)
Browse files Browse the repository at this point in the history
* migrate concatenate xpath strings

* rename files
  • Loading branch information
ngaruko authored Nov 23, 2021
1 parent 95fdaba commit fd05c85
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 51 deletions.
42 changes: 0 additions & 42 deletions tests/e2e/concatenate-xpath-strings.spec.js

This file was deleted.

44 changes: 44 additions & 0 deletions tests/e2e/concatenate-xpath-strings.wdio-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const concatenateStrings = require('../page-objects/forms/concatenate-strings.wdio.page');
const common = require('../page-objects/common/common.wdio.page');
const constants = require('../constants');
const loginPage = require('../page-objects/login/login.wdio.page');
const reportsPage = require('../page-objects/reports/reports.wdio.page');
const { expect } = require('chai');


const userContactDoc = {
_id: constants.USER_CONTACT_ID,
name: 'Jack',
date_of_birth: '',
phone: '+64274444444',
alternate_phone: '',
notes: '',
type: 'person',
reported_date: 1478469976421,
parent: {
_id: 'some_parent',
},
};

// If this test starts failing then we need to document in the release notes that we've removed the deprecated
// feature allowing for concatenation of strings
describe('Concatenate xpath strings', () => {
before(async () => {
await loginPage.cookieLogin();
await concatenateStrings.configureForm(userContactDoc);
});

it('concatenates strings', async () => {
await common.goToReports();
await reportsPage.openForm('Concatenate Strings');
const concatElement = await $('#concat');
await concatElement.waitForDisplayed();
const fullNameInput = await $('[name="/concatenate-strings/inputs/full_name"]');
const firstNameInput = await $('[name="/concatenate-strings/inputs/first_name"]');
expect(await fullNameInput.getValue()).to.equal('John Doe');

await firstNameInput.setValue('Bruce');
await fullNameInput.click();
expect(await fullNameInput.getValue()).to.equal('Bruce Wayne');
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const utils = require('../../utils');
const helper = require('../../helper');

const xml = `<?xml version="1.0"?>
<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa">
<h:head>
Expand Down Expand Up @@ -50,20 +48,22 @@ const docs = [
}
}
}];
const submitButton = () => $('[ng-click="onSubmit()"]');
const reportContent = () => $('div#reports-content');
const refreshIcon = () => $('.icon.icon-refresh');

module.exports = {
configureForm: (userContactDoc) => {
return utils.seedTestData(userContactDoc, docs);
configureForm: async (userContactDoc) => {
return await utils.seedTestData(userContactDoc, docs);
},

submit: async () => {
const submitButton = element(by.css('[ng-click="onSubmit()"]'));
await helper.clickElementNative(submitButton);
await helper.waitElementToBeVisibleNative(element(by.css('div#reports-content')));
await (await submitButton()).click();
await (await reportContent()).waitForDisplayed();
},

reset: () => {
return element(by.css('.icon.icon-refresh')).click();
reset: async () => {
return await(await refreshIcon()).click();
},

formInternalId: formInternalId,
Expand Down

0 comments on commit fd05c85

Please sign in to comment.