#145 e2e refactor
This commit is contained in:
parent
70ef95fc8f
commit
62679342a7
|
@ -148,14 +148,16 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) {
|
|||
});
|
||||
|
||||
Nightmare.action('waitForTextInElement', function(selector, name, done) {
|
||||
this.wait((resultSelector, expectedText) => {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
});
|
||||
|
||||
Nightmare.action('waitForTextInInput', function(selector, name, done) {
|
||||
this.wait((resultSelector, expectedText) => {
|
||||
this.wait(selector)
|
||||
.wait((resultSelector, expectedText) => {
|
||||
return document.querySelector(resultSelector).value.toLowerCase().includes(expectedText.toLowerCase());
|
||||
}, selector, name)
|
||||
.then(done);
|
||||
|
|
|
@ -50,7 +50,6 @@ describe('Edit fiscalData path', () => {
|
|||
return nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.wait(200)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
|
@ -64,7 +63,6 @@ describe('Edit fiscalData path', () => {
|
|||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.wait(200)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
|
@ -137,7 +135,6 @@ describe('Edit fiscalData path', () => {
|
|||
return nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.wait(200)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
|
@ -151,7 +148,6 @@ describe('Edit fiscalData path', () => {
|
|||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitToClick(selectors.clientAddresses.secondEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.wait(200)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
|
|
|
@ -54,7 +54,6 @@ describe('Edit pay method path', () => {
|
|||
.waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox)
|
||||
.waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox)
|
||||
.waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox)
|
||||
.wait(200)
|
||||
.waitToClick(selectors.clientPayMethod.saveButton)
|
||||
.waitToClick(selectors.clientPayMethod.cancelNotificationButton)
|
||||
.waitForSnackbar()
|
||||
|
|
|
@ -48,6 +48,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary preview shows fields from basic data`, () => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
||||
.getInnerText(selectors.itemSummary.basicData)
|
||||
.then(result => {
|
||||
expect(result).toContain('Name: Gem of Time');
|
||||
|
@ -56,7 +57,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary preview shows fields from tags`, () => {
|
||||
return nightmare
|
||||
.wait(200)
|
||||
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
|
||||
.getInnerText(selectors.itemSummary.tags)
|
||||
.then(result => {
|
||||
expect(result).toContain('Color: Yellow');
|
||||
|
@ -65,6 +66,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary preview shows fields from niche`, () => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
|
||||
.getInnerText(selectors.itemSummary.niche)
|
||||
.then(result => {
|
||||
expect(result).toContain('Warehouse One: A1');
|
||||
|
@ -73,6 +75,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary preview shows fields from botanical`, () => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
|
||||
.getInnerText(selectors.itemSummary.botanical)
|
||||
.then(result => {
|
||||
expect(result).toContain('Botanical: Hedera helix');
|
||||
|
@ -81,6 +84,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary preview shows fields from barcode`, () => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
||||
.getInnerText(selectors.itemSummary.barcode)
|
||||
.then(result => {
|
||||
expect(result).toContain('1');
|
||||
|
@ -108,6 +112,7 @@ describe('Item summary path', () => {
|
|||
|
||||
it(`should check the item summary shows fields from all its sections`, () => {
|
||||
return nightmare
|
||||
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
||||
.getInnerText(selectors.itemSummary.basicData)
|
||||
.then(result => {
|
||||
expect(result).toContain('Name: Gem of Time');
|
||||
|
|
|
@ -69,7 +69,6 @@ describe('edit item basic data path', () => {
|
|||
.click(selectors.itemNiches.firstCodeInput)
|
||||
.wait(selectors.itemNiches.firstCodeInput)
|
||||
.waitToClick(selectors.itemBasicData.basicDataButton)
|
||||
.wait(200)
|
||||
.getInputValue(selectors.itemBasicData.nameInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Rose of Purity');
|
||||
|
|
|
@ -63,7 +63,7 @@ describe('add item tax path', () => {
|
|||
.click(selectors.itemTags.tagsButton)
|
||||
.wait(selectors.itemTags.firstTagSelect)
|
||||
.waitToClick(selectors.itemTax.taxButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'general')
|
||||
.getInputValue(selectors.itemTax.firstClassSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('General VAT');
|
||||
|
|
|
@ -71,7 +71,7 @@ describe('create item tags path', () => {
|
|||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemTags.tagsButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemTags.firstTagSelect, 'Owner')
|
||||
.getInputValue(selectors.itemTags.firstTagSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Owner');
|
||||
|
@ -80,6 +80,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the first value is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.firstValueInput, 'Thanos')
|
||||
.getInputValue(selectors.itemTags.firstValueInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Thanos');
|
||||
|
@ -88,6 +89,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the first relevancy is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.firstRelevancyInput, '1')
|
||||
.getInputValue(selectors.itemTags.firstRelevancyInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('1');
|
||||
|
@ -96,6 +98,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the second select is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.secondTagSelect, 'Color')
|
||||
.getInputValue(selectors.itemTags.secondTagSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Color');
|
||||
|
@ -104,6 +107,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the second value is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.secondValueInput, 'Dark Blue')
|
||||
.getInputValue(selectors.itemTags.secondValueInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Dark Blue');
|
||||
|
@ -112,6 +116,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the second relevancy is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.secondRelevancyInput, '2')
|
||||
.getInputValue(selectors.itemTags.secondRelevancyInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('2');
|
||||
|
@ -120,6 +125,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the third select is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.thirdTagSelect, 'Shape')
|
||||
.getInputValue(selectors.itemTags.thirdTagSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Shape');
|
||||
|
@ -128,6 +134,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the third value is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.thirdValueInput, 'round')
|
||||
.getInputValue(selectors.itemTags.thirdValueInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('round');
|
||||
|
@ -136,6 +143,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the third relevancy is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.thirdRelevancyInput, '3')
|
||||
.getInputValue(selectors.itemTags.thirdRelevancyInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('3');
|
||||
|
@ -144,6 +152,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fourth select is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fourthTagSelect, 'Power')
|
||||
.getInputValue(selectors.itemTags.fourthTagSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Power');
|
||||
|
@ -152,6 +161,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fourth value is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fourthValueInput, 'Manipulates time')
|
||||
.getInputValue(selectors.itemTags.fourthValueInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Manipulates time');
|
||||
|
@ -160,6 +170,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fourth relevancy is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fourthRelevancyInput, '4')
|
||||
.getInputValue(selectors.itemTags.fourthRelevancyInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('4');
|
||||
|
@ -168,6 +179,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fifth select is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fifthTagSelect, 'Location')
|
||||
.getInputValue(selectors.itemTags.fifthTagSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Location');
|
||||
|
@ -176,6 +188,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fifth value is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fifthValueInput, 'Gamoras hideout')
|
||||
.getInputValue(selectors.itemTags.fifthValueInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Gamoras hideout');
|
||||
|
@ -184,6 +197,7 @@ describe('create item tags path', () => {
|
|||
|
||||
it(`should confirm the fifth relevancy is the expected one`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemTags.fifthRelevancyInput, '5')
|
||||
.getInputValue(selectors.itemTags.fifthRelevancyInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('5');
|
||||
|
|
|
@ -66,7 +66,7 @@ describe('create item niche path', () => {
|
|||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemNiches.nicheButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse Two')
|
||||
.getInputValue(selectors.itemNiches.firstWarehouseSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Warehouse Two');
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('create item botanical path', () => {
|
|||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemBotanical.botanicalButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
||||
.getInputValue(selectors.itemBotanical.botanicalInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Cicuta maculata');
|
||||
|
@ -71,6 +71,7 @@ describe('create item botanical path', () => {
|
|||
|
||||
it(`should confirm the Genus for item Mjolnir was created`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
|
||||
.getInputValue(selectors.itemBotanical.genusSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Abelia');
|
||||
|
@ -105,7 +106,7 @@ describe('create item botanical path', () => {
|
|||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemBotanical.botanicalButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
||||
.getInputValue(selectors.itemBotanical.botanicalInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Herp Derp');
|
||||
|
@ -114,6 +115,7 @@ describe('create item botanical path', () => {
|
|||
|
||||
it(`should confirm the Genus for item Mjolnir was edited`, () => {
|
||||
return nightmare
|
||||
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
|
||||
.getInputValue(selectors.itemBotanical.genusSelect)
|
||||
.then(result => {
|
||||
expect(result).toEqual('Abies');
|
||||
|
|
|
@ -61,7 +61,7 @@ describe('create item barcodes path', () => {
|
|||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemBarcodes.barcodeButton)
|
||||
.wait(200)
|
||||
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
|
||||
.getInputValue(selectors.itemBarcodes.thirdCodeInput)
|
||||
.then(result => {
|
||||
expect(result).toEqual('5');
|
||||
|
|
Loading…
Reference in New Issue