Skip to content

Commit

Permalink
Cleaning up the code, skip invalid barcode scenario for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria Lorena Rodriguez Viruel authored and Maria Lorena Rodriguez Viruel committed Feb 7, 2024
1 parent b2c57b1 commit f8d8e3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const person = personFactory.build({
const barcodeImagePath = path.join(__dirname, '/images/valid-barcode.jpg');
const invalidBarcodeImagePath = path.join(__dirname, '/images/invalid-barcode.jpg');

describe('Test Contact Search with Barcode Scanner', async () => {
describe('Test Contact Search with Barcode Scanner', () => {
before(async () => {
await utils.saveDocs([...places.values(), person]);
await utils.createUsers([offlineUser]);
Expand All @@ -28,12 +28,15 @@ describe('Test Contact Search with Barcode Scanner', async () => {
await commonPage.waitForPageLoaded();
});

it('Barcode search icon should show on mobile view', async () => {
await commonPage.goToPeople();
await (await searchPage.barcodeSearchInput()).waitForExist();
});

it('Search should display correct results, clear search should display all contacts', async () => {
await commonPage.sync(true);
await browser.refresh();
await commonPage.goToPeople();
await searchPage.performBarcodeSearch(barcodeImagePath);
await commonPage.waitForLoaders();
await browser.pause(2000);
expect(await contactPage.getAllLHSContactsNames()).to.have.members([
person.name
]);
Expand All @@ -45,10 +48,9 @@ describe('Test Contact Search with Barcode Scanner', async () => {
]);
});

it('With an invalid barcode image - Search should display snackbar with error message', async () => {
it.skip('With an invalid barcode image - Search should display snackbar with error message', async () => {
await commonPage.goToPeople();
await searchPage.performBarcodeSearch(invalidBarcodeImagePath);
await commonPage.waitForLoaders();
expect(await commonPage.snackbarMessage()).to.equal('Failed to read the barcode. Retry.');
});

Expand Down
5 changes: 2 additions & 3 deletions tests/page-objects/default-mobile/search/search.wdio.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ const performSearch = async (term) => {
};

const performBarcodeSearch = async (barcodeImagePath) => {
await $('.barcode-scanner-input').waitForExist();
//await $('.mm-search-bar-container .fa.fa-qrcode').waitForDisplayed();
await (await barcodeSearchInput()).waitForExist();
// In this case the upload file button is hidden,
// then we need to manipulate the DOM of the respective element to make it interactable.
await browser.execute(function () {
document.getElementsByClassName('barcode-scanner-input')[0].style.display = 'block';
});
await (await barcodeSearchInput()).setValue(barcodeImagePath);
await browser.pause(2000);
await commonPage.waitForLoaders();
};

module.exports = {
searchPageDefault,
performSearch,
performBarcodeSearch,
barcodeSearchInput,
};

0 comments on commit f8d8e3c

Please sign in to comment.