diff --git a/packages/yoroi-extension/features/step_definitions/common-steps.js b/packages/yoroi-extension/features/step_definitions/common-steps.js index fec90a6d7d..6b9c06965d 100644 --- a/packages/yoroi-extension/features/step_definitions/common-steps.js +++ b/packages/yoroi-extension/features/step_definitions/common-steps.js @@ -1,6 +1,6 @@ // @flow -import { Before, BeforeAll, Given, Then, After, AfterAll, setDefinitionFunctionWrapper, setDefaultTimeout, Status,setWorldConstructor} from 'cucumber'; +import { Before, BeforeAll, Given, Then, After, AfterAll, setDefinitionFunctionWrapper, setDefaultTimeout } from 'cucumber'; import * as CardanoServer from '../mock-chain/mockCardanoServer'; import * as ErgoServer from '../mock-chain/mockErgoServer'; import { By } from 'selenium-webdriver'; @@ -105,30 +105,13 @@ After({ tags: '@invalidWitnessTest' }, () => { CardanoServer.getMockServer({}); }); -const dir1 = './testScreenshots/'; - After( async function (scenario) { - - console.log("Status :"+scenario.result.status); - - const dirFailScr = './testScreenshots/'; - if(scenario.result.status == 'failed'){ - - takeScreenshot(this.driver, 'failedStep'); + if(scenario.result.status === 'failed'){ + await takeScreenshot(this.driver, 'failedStep'); } await this.driver.quit(); - }); - -async function attachScreenshot(){ - var world = this; - - driver.takeScreenshot().then(function (buffer) { - return world.attach(buffer, 'image/png'); - }); -} - const writeFile = promisify(fs.writeFile); // Steps that contain these patterns will trigger screenshots: @@ -161,25 +144,14 @@ setDefinitionFunctionWrapper((fn, _, pattern) => { async function takeScreenshot(driver, name) { // path logic - const dir = `${screenshotsDir}/${testProgress.scenarioName}`; + const dir = `${screenshotsDir}/${testProgress.scenarioName}`; if (!fs.existsSync(dir)) { fs.mkdirSync(dir); } const path = `${dir}/${testProgress.step}_${testProgress.lineNum}-${name}.png`; - const screenshot = await driver.takeScreenshot(); + const screenshot = await driver.takeScreenshot(); await writeFile(path, screenshot, 'base64'); - -} - - -async function handleAlerts(driver, decider){ - let alert = await driver.switchTo().alert(); - let alertText = await alert.getText(); - if(decider == "accept") - await alert.accept(); - else - await alert.dismiss(); } async function inputMnemonicForWallet( @@ -277,26 +249,14 @@ Given(/^I have completed the basic setup$/, async function () { // language select page await this.waitForElement('.LanguageSelectionForm_component'); await this.click('//button[text()="Continue"]', By.xpath); - // await this.click('.LanguageSelectionForm_submitButton'); - // ToS page await this.waitForElement('.TermsOfUseForm_component'); - //await sleepTh(2000); - - const TOS_class_element = await this.driver.findElement(By.css('.TermsOfUseForm_component')); - - const checkbox = await TOS_class_element.findElement(By.xpath('//input[@type="checkbox"]')); - + const tosClassElement = await this.driver.findElement(By.css('.TermsOfUseForm_component')); + const checkbox = await tosClassElement.findElement(By.xpath('//input[@type="checkbox"]')); await checkbox.click(); - - - // this.click('//input[@type="checkbox"]', By.xpath); - //await this.click('.SimpleCheckbox_check'); await this.click('//button[text()="Continue"]', By.xpath); - //await this.click('.TermsOfUseForm_submitButton'); // uri prompt page await acceptUriPrompt(this); - await this.waitForElement('.WalletAdd_component'); }); @@ -331,7 +291,6 @@ async function acceptUriPrompt(world: any) { if (world.getBrowser() !== 'firefox') { await world.waitForElement('.UriPromptForm_component'); await world.click('.allowButton'); - //await handleAlerts(world.driver,"accept"); await world.waitForElement('.UriAccept_component'); await world.click('.finishButton'); } diff --git a/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js b/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js index 64a3361d68..7a79e895a3 100644 --- a/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js +++ b/packages/yoroi-extension/features/step_definitions/wallet-creation-steps.js @@ -1,7 +1,7 @@ // @flow import { When, Then } from 'cucumber'; -import { By, WebElement } from 'selenium-webdriver'; +import { By } from 'selenium-webdriver'; import i18n from '../support/helpers/i18n-helpers'; import { expect, assert } from 'chai'; @@ -58,7 +58,6 @@ When(/^I accept the creation terms$/, async function () { const privacyDlg = await this.driver.findElement(By.xpath('//div[contains(@class,"WalletBackupPrivacyWarningDialog_component")]')) ; const privacyChkbox = privacyDlg.findElement(By.xpath('//input[@type="checkbox"]')); privacyChkbox.click(); - // await this.click('.SimpleCheckbox_check'); await this.click('//button[text()="Continue"]', By.xpath); }); @@ -78,16 +77,11 @@ When(/^I copy and enter the displayed mnemonic phrase$/, async function () { await this.click( "(//button[contains(@class,'MnemonicWord_component') " + // any word ` and (text() = '${word}')])`, By.xpath // correct word - // ` and @label = '${word}'])[1]`, By.xpath // correct word ); } - //const checkboxes = await this.driver.findElements(By.css('.SimpleCheckbox_check')); const checkboxes = await this.driver.findElements(By.xpath("//input[contains(@class,'PrivateSwitchBase-input')]")); - checkboxes.forEach((box) => box.click()); - //await this.click('.WalletRecoveryPhraseEntryDialog .primary'); await this.click('//button[text()="Confirm"]', By.xpath); - console.log("Clicked on Confirm "); }); When(/^I enter random mnemonic phrase$/, async function () { diff --git a/packages/yoroi-extension/reports/cucumberReport.html b/packages/yoroi-extension/reports/cucumberReport.html index 3963d6552b..9a8bf9ede7 100644 --- a/packages/yoroi-extension/reports/cucumberReport.html +++ b/packages/yoroi-extension/reports/cucumberReport.html @@ -279,8 +279,8 @@ Cucumberjs Report
yoroi
- Passed: 1 - Failed: 0 + Passed: 0 + Failed: 1
@@ -288,7 +288,7 @@
-
Mon Jan 17 2022 14:53:39 GMT+0530 (India Standard Time)
+
Mon Jan 17 2022 22:47:56 GMT+0530 (India Standard Time)
@@ -371,7 +371,7 @@

-
+
-
+
@@ -407,26 +407,28 @@

-
@it-5 +
@it-18
- +
- -
@@ -460,7 +462,7 @@

- 8s 809ms + 8s 629ms @@ -498,7 +500,7 @@

- 7s 453ms + 7s 539ms @@ -536,7 +538,7 @@

- 127ms + 129ms @@ -574,7 +576,7 @@

- 388ms + 397ms @@ -612,7 +614,7 @@

- 119ms + 111ms @@ -650,7 +652,7 @@

- 491ms + 474ms @@ -688,7 +690,7 @@

- 1s 60ms + 1s 99ms @@ -726,7 +728,7 @@

- 956ms + 1s 47ms @@ -800,7 +802,7 @@

- 323ms + 464ms @@ -838,7 +840,7 @@

- 152ms + 225ms @@ -866,17 +868,17 @@

- + And - I copy and enter the displayed mnemonic phrase + I enter random mnemonic phrase - 1s 973ms + 20s 18ms @@ -889,6 +891,52 @@

+ Show Error + +
+
+                                            
Error: function timed out, ensure the promise resolves within 20000 milliseconds + at Timeout._onTimeout (/Users/rahulnair/projects/yoroi-frontend/packages/yoroi-extension/node_modules/cucumber/lib/user_code_runner.js:81:20) + at listOnTimeout (internal/timers.js:554:17) + at processTimers (internal/timers.js:497:7)
+
+ + + + + @@ -904,17 +952,55 @@

- + + + + + And + I click Clear button + + + + 0s + + + + + + + + + + + + + + + + + + +
+

+ + + +

+

+ + + Then - I should see the opened wallet with name "Created Wallet" + I see All selected words are cleared - 1s 268ms + 0s @@ -976,8 +1062,8 @@

google.load("visualization", "1", {packages: ["corechart"]}); google.setOnLoadCallback(function() {drawChart({ "title" : "Features", - "failed" : 0, - "passed" : 1, + "failed" : 1, + "passed" : 0, "notdefined" : 0, "pending" : 0, "skipped" : 0, @@ -986,8 +1072,8 @@

}); google.setOnLoadCallback(function() {drawChart({ "title" : "Scenarios", - "failed" : 0, - "passed" : 1, + "failed" : 1, + "passed" : 0, "notdefined" : 0, "pending" : 0, "skipped" : 0, diff --git a/packages/yoroi-extension/reports/cucumberReport.json b/packages/yoroi-extension/reports/cucumberReport.json index eb610f8281..d1482d8b7e 100644 --- a/packages/yoroi-extension/reports/cucumberReport.json +++ b/packages/yoroi-extension/reports/cucumberReport.json @@ -8,14 +8,14 @@ "uri": "features/wallet-creation.feature", "elements": [ { - "id": "wallet-creation;wallet-creation-(it-5)", + "id": "wallet-creation;mnemonic-words-can-be-cleared-by-clicking-\"clear-button\"-on-wallet-creation-screen-(it-18)", "keyword": "Scenario", - "line": 9, - "name": "Wallet creation (IT-5)", + "line": 39, + "name": "Mnemonic words can be cleared by clicking \"Clear button\" on wallet creation screen (IT-18)", "tags": [ { - "name": "@it-5", - "line": 8 + "name": "@it-18", + "line": 38 } ], "type": "scenario", @@ -28,7 +28,7 @@ }, "result": { "status": "passed", - "duration": 3000000 + "duration": 6000000 } }, { @@ -39,7 +39,7 @@ }, "result": { "status": "passed", - "duration": 1839000000 + "duration": 1864000000 } }, { @@ -48,11 +48,11 @@ "line": 4, "name": "I have opened the extension", "match": { - "location": "features/step_definitions/common-steps.js:340" + "location": "features/step_definitions/common-steps.js:299" }, "result": { "status": "passed", - "duration": 8809000000 + "duration": 8530000000 } }, { @@ -61,11 +61,11 @@ "line": 5, "name": "I have completed the basic setup", "match": { - "location": "features/step_definitions/common-steps.js:276" + "location": "features/step_definitions/common-steps.js:248" }, "result": { "status": "passed", - "duration": 7453000000 + "duration": 12941000000 } }, { @@ -74,63 +74,63 @@ "line": 6, "name": "There is no wallet stored", "match": { - "location": "features/step_definitions/common-steps.js:359" + "location": "features/step_definitions/common-steps.js:318" }, "result": { "status": "passed", - "duration": 127000000 + "duration": 126000000 } }, { "arguments": [], "keyword": "When ", - "line": 10, + "line": 40, "name": "I click the create button", "match": { "location": "features/step_definitions/wallet-creation-steps.js:12" }, "result": { "status": "passed", - "duration": 388000000 + "duration": 434000000 } }, { "arguments": [], "keyword": "Then ", - "line": 11, + "line": 41, "name": "I select the currency cardano", "match": { "location": "features/step_definitions/wallet-creation-steps.js:16" }, "result": { "status": "passed", - "duration": 119000000 + "duration": 116000000 } }, { "arguments": [], "keyword": "Then ", - "line": 12, + "line": 42, "name": "I select Create Wallet", "match": { "location": "features/step_definitions/wallet-creation-steps.js:21" }, "result": { "status": "passed", - "duration": 491000000 + "duration": 425000000 } }, { "arguments": [], "keyword": "And ", - "line": 13, + "line": 43, "name": "I enter the name \"Created Wallet\"", "match": { "location": "features/step_definitions/wallet-steps.js:7" }, "result": { "status": "passed", - "duration": 1060000000 + "duration": 1159000000 } }, { @@ -153,77 +153,89 @@ } ], "keyword": "And ", - "line": 14, + "line": 44, "name": "I enter the created wallet password:", "match": { "location": "features/step_definitions/wallet-creation-steps.js:30" }, "result": { "status": "passed", - "duration": 956000000 + "duration": 1026000000 } }, { "arguments": [], "keyword": "And ", - "line": 17, + "line": 47, "name": "I click the \"Create personal wallet\" button", "match": { "location": "features/step_definitions/wallet-creation-steps.js:40" }, "result": { "status": "passed", - "duration": 323000000 + "duration": 459000000 } }, { "arguments": [], "keyword": "And ", - "line": 18, + "line": 48, "name": "I accept the creation terms", "match": { "location": "features/step_definitions/wallet-creation-steps.js:57" }, "result": { "status": "passed", - "duration": 152000000 + "duration": 255000000 } }, { "arguments": [], "keyword": "And ", - "line": 19, - "name": "I copy and enter the displayed mnemonic phrase", + "line": 49, + "name": "I enter random mnemonic phrase", "match": { - "location": "features/step_definitions/wallet-creation-steps.js:65" + "location": "features/step_definitions/wallet-creation-steps.js:87" }, "result": { - "status": "passed", - "duration": 1973000000 + "status": "failed", + "duration": 20012000000, + "error_message": "Error: function timed out, ensure the promise resolves within 20000 milliseconds\n at Timeout._onTimeout (/Users/rahulnair/projects/yoroi-frontend/packages/yoroi-extension/node_modules/cucumber/lib/user_code_runner.js:81:20)\n at listOnTimeout (internal/timers.js:554:17)\n at processTimers (internal/timers.js:497:7)" + } + }, + { + "arguments": [], + "keyword": "And ", + "line": 50, + "name": "I click Clear button", + "match": { + "location": "features/step_definitions/wallet-creation-steps.js:98" + }, + "result": { + "status": "skipped" } }, { "arguments": [], "keyword": "Then ", - "line": 20, - "name": "I should see the opened wallet with name \"Created Wallet\"", + "line": 51, + "name": "I see All selected words are cleared", "match": { - "location": "features/step_definitions/wallet-steps.js:20" + "location": "features/step_definitions/wallet-creation-steps.js:102" }, "result": { - "status": "passed", - "duration": 1268000000 + "status": "skipped" } }, { "keyword": "After", "hidden": true, "match": { - "location": "features/step_definitions/common-steps.js:110" + "location": "features/step_definitions/common-steps.js:108" }, "result": { "status": "passed", - "duration": 55000000 + "duration": 239000000 } } ]