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