From 9f396aec8ddb6c08066600fcdf4695e6f93fe65a Mon Sep 17 00:00:00 2001 From: Yordan Iliev Date: Mon, 24 Jun 2024 15:49:11 +0300 Subject: [PATCH 1/4] Add allure reporting to login and registration tests Signed-off-by: Yordan Iliev --- .gitignore | 2 + automation/package.json | 8 +- automation/playwright.config.js | 4 +- automation/tests/loginTests.test.js | 85 ++- automation/tests/registrationTests.test.js | 753 ++++++++++++--------- 5 files changed, 526 insertions(+), 326 deletions(-) diff --git a/.gitignore b/.gitignore index ea618b743..bbfa9a2fd 100644 --- a/.gitignore +++ b/.gitignore @@ -151,3 +151,5 @@ automation/playwright-report/ automation/blob-report/ automation/playwright/.cache/ automation/.env +automation/allure-results +automation/allure-report diff --git a/automation/package.json b/automation/package.json index f1f42c54e..338fbbfc4 100644 --- a/automation/package.json +++ b/automation/package.json @@ -2,11 +2,15 @@ "name": "hedera-transaction-tool-tests", "version": "1.0.0", "scripts": { - "test": "playwright test" + "test": "playwright test", + "allure:generate": "allure generate allure-results --clean --single-file -o allure-report", + "allure:open": "allure open allure-report" }, "devDependencies": { "playwright": "^1.41.2", - "prettier": "^3.2.5" + "prettier": "^3.2.5", + "allure-playwright": "^2.0.0", + "allure-commandline": "^2.29.0" }, "main": "playwright.config.js", "directories": { diff --git a/automation/playwright.config.js b/automation/playwright.config.js index 612ead0a5..8707fd9a8 100644 --- a/automation/playwright.config.js +++ b/automation/playwright.config.js @@ -1,7 +1,9 @@ import { defineConfig } from '@playwright/test'; export default defineConfig({ - reporter: process.env.CI ? 'github' : 'list', + reporter: process.env.CI + ? ['github', ['list'], ['allure-playwright']] + : [['list'], ['allure-playwright']], retries: 3, workers: 1, diff --git a/automation/tests/loginTests.test.js b/automation/tests/loginTests.test.js index 4f3f62fbc..503f868fd 100644 --- a/automation/tests/loginTests.test.js +++ b/automation/tests/loginTests.test.js @@ -9,6 +9,7 @@ const { const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); const LoginPage = require('../pages/LoginPage'); +import { allure } from 'allure-playwright'; let app, window; let globalCredentials = { email: '', password: '' }; @@ -46,42 +47,84 @@ test.describe('Login tests', () => { }); test('Verify that login with incorrect password shows an error message', async () => { + await allure.label('feature', 'Login'); + await allure.label('severity', 'normal'); + let passwordErrorMessage; const incorrectPassword = globalCredentials.password + '123'; - await loginPage.waitForToastToDisappear(); - await loginPage.login(globalCredentials.email, incorrectPassword); - const passwordErrorMessage = (await loginPage.getLoginPasswordErrorMessage()).trim(); - - expect(passwordErrorMessage).toBe('Invalid password.'); + await allure.step('Wait for any previous toasts to disappear', async () => { + await loginPage.waitForToastToDisappear(); + }); + await allure.step('Attempt to login with incorrect password', async () => { + await loginPage.login(globalCredentials.email, incorrectPassword); + }); + await allure.step('Get the password error message', async () => { + passwordErrorMessage = (await loginPage.getLoginPasswordErrorMessage()).trim(); + }); + await allure.step('Verify the error message', async () => { + expect(passwordErrorMessage).toBe('Invalid password.'); + }); }); test('Verify that login with incorrect email shows an error message', async () => { - const incorrectEmail = globalCredentials.email + '123'; - await loginPage.waitForToastToDisappear(); - await loginPage.login(incorrectEmail, globalCredentials.password); - const passwordErrorMessage = (await loginPage.getLoginEmailErrorMessage()).trim(); + await allure.label('feature', 'Login'); + await allure.label('severity', 'normal'); - expect(passwordErrorMessage).toBe('Invalid e-mail.'); + let emailErrorMessage; + const incorrectEmail = globalCredentials.email + '123'; + await allure.step('Wait for any previous toasts to disappear', async () => { + await loginPage.waitForToastToDisappear(); + }); + await allure.step('Attempt to login with incorrect email', async () => { + await loginPage.login(incorrectEmail, globalCredentials.password); + }); + await allure.step('Get the password error message', async () => { + emailErrorMessage = (await loginPage.getLoginEmailErrorMessage()).trim(); + }); + + await allure.step('Verify the error message', async () => { + expect(emailErrorMessage).toBe('Invalid e-mail.'); + }); }); test('Verify all essential elements are present on the login page', async () => { - const allElementsAreCorrect = await loginPage.verifyLoginElements(); + await allure.label('feature', 'Login'); + await allure.label('severity', 'normal'); - expect(allElementsAreCorrect).toBe(true); + const allElementsAreCorrect = await loginPage.verifyLoginElements(); + await allure.step('Verify login elements', async () => { + expect(allElementsAreCorrect).toBe(true); + }); }); test('Verify successful login', async () => { - await loginPage.login(globalCredentials.email, globalCredentials.password); - // Assuming we have logged in, user should see the settings button - const isButtonVisible = await loginPage.isSettingsButtonVisible(); - - expect(isButtonVisible).toBe(true); + await allure.label('feature', 'Login'); + await allure.label('severity', 'critical'); + + await allure.step('Attempt to login with correct credentials', async () => { + await loginPage.login(globalCredentials.email, globalCredentials.password); + }); + await allure.step('Verify settings button visibility', async () => { + // Assuming we have logged in, user should see the settings button + const isButtonVisible = await loginPage.isSettingsButtonVisible(); + + expect(isButtonVisible).toBe(true); + }); }); test('Verify resetting account', async () => { - await loginPage.logout(); - await resetAppState(window); + await allure.label('feature', 'Account Reset'); + await allure.label('severity', 'critical'); + + await allure.step('Attempt logout', async () => { + await loginPage.logout(); + }); + await allure.step('Reset app state', async () => { + await resetAppState(window); + }); // Assuming we have reset the account, and we land on the registration page, we confirm that we see password field. - const isConfirmPasswordVisible = await registrationPage.isConfirmPasswordFieldVisible(); - expect(isConfirmPasswordVisible).toBe(true); + await allure.step('Verify account is reset', async () => { + const isConfirmPasswordVisible = await registrationPage.isConfirmPasswordFieldVisible(); + expect(isConfirmPasswordVisible).toBe(true); + }); }); }); diff --git a/automation/tests/registrationTests.test.js b/automation/tests/registrationTests.test.js index 076d1cc1d..c776883ec 100644 --- a/automation/tests/registrationTests.test.js +++ b/automation/tests/registrationTests.test.js @@ -8,6 +8,7 @@ const { } = require('../utils/util'); const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); +import { allure } from 'allure-playwright'; let app, window; let globalCredentials = { email: '', password: '' }; @@ -34,361 +35,509 @@ test.describe('Registration tests', () => { }); test('Verify all elements are present on the registration page', async () => { - const allElementsAreCorrect = await registrationPage.verifyRegistrationElements(); - expect(allElementsAreCorrect).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Verify all registration page elements are present', async () => { + const allElementsAreCorrect = await registrationPage.verifyRegistrationElements(); + expect(allElementsAreCorrect).toBe(true); + }); }); test('Verify rejection of invalid email format in the registration form', async () => { - await registrationPage.typeEmail('wrong.gmail'); - await registrationPage.typePassword('test'); - await registrationPage.submitRegistration(); - - const errorMessage = (await registrationPage.getEmailErrorMessage()).trim(); - - expect(errorMessage).toBe('Invalid e-mail.'); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'minor'); + + await allure.step('Type invalid email', async () => { + await registrationPage.typeEmail('wrong.gmail'); + }); + await allure.step('Type password', async () => { + await registrationPage.typePassword('test'); + }); + await allure.step('Submit registration form', async () => { + await registrationPage.submitRegistration(); + }); + await allure.step('Verify the email error message', async () => { + const errorMessage = (await registrationPage.getEmailErrorMessage()).trim(); + expect(errorMessage).toBe('Invalid e-mail.'); + }); }); test('Verify e-mail field accepts valid format', async () => { - await registrationPage.typeEmail('test23@test.com'); - await registrationPage.typePassword('test'); - await registrationPage.submitRegistration(); - - const isErrorMessageVisible = await registrationPage.isEmailErrorMessageVisible(); - - expect(isErrorMessageVisible).toBe(false); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Type valid email', async () => { + await registrationPage.typeEmail('test23@test.com'); + }); + await allure.step('Type password', async () => { + await registrationPage.typePassword('test'); + }); + await allure.step('Submit registration form', async () => { + await registrationPage.submitRegistration(); + }); + await allure.step('Verify no error message for email', async () => { + const isErrorMessageVisible = await registrationPage.isEmailErrorMessageVisible(); + expect(isErrorMessageVisible).toBe(false); + }); }); test('Verify password field rejects empty password', async () => { - await registrationPage.typeEmail('test@test.com'); - await registrationPage.typePassword('test'); - await registrationPage.submitRegistration(); - - const errorMessage = (await registrationPage.getPasswordErrorMessage()).trim(); - - expect(errorMessage).toBe('Invalid password.'); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'minor'); + + await allure.step('Type valid email', async () => { + await registrationPage.typeEmail('test@test.com'); + }); + await allure.step('Type password and leave confirm password empty', async () => { + await registrationPage.typePassword('test'); + }); + await allure.step('Submit registration form', async () => { + await registrationPage.submitRegistration(); + }); + await allure.step('Verify the password error message', async () => { + const errorMessage = (await registrationPage.getPasswordErrorMessage()).trim(); + expect(errorMessage).toBe('Invalid password.'); + }); }); test('Verify confirm password field rejects mismatching passwords', async () => { - await registrationPage.typeEmail('test@test.com'); - await registrationPage.typePassword('test'); - await registrationPage.typeConfirmPassword('notTest'); - - await registrationPage.submitRegistration(); - - const errorMessage = (await registrationPage.getConfirmPasswordErrorMessage()).trim(); - - expect(errorMessage).toBe('Password do not match.'); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Type valid email', async () => { + await registrationPage.typeEmail('test@test.com'); + }); + await allure.step('Type password', async () => { + await registrationPage.typePassword('test'); + }); + await allure.step('Type mismatching confirm password', async () => { + await registrationPage.typeConfirmPassword('notTest'); + }); + await allure.step('Submit registration form', async () => { + await registrationPage.submitRegistration(); + }); + await allure.step('Verify the confirm password error message', async () => { + const errorMessage = (await registrationPage.getConfirmPasswordErrorMessage()).trim(); + expect(errorMessage).toBe('Password do not match.'); + }); }); test('Verify elements on account setup page are correct', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const allElementsAreCorrect = await registrationPage.verifyAccountSetupElements(); - expect(allElementsAreCorrect).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Verify account setup elements', async () => { + const allElementsAreCorrect = await registrationPage.verifyAccountSetupElements(); + expect(allElementsAreCorrect).toBe(true); + }); }); test('Verify "Create New" tab elements in account setup are correct', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - await registrationPage.clickOnCreateNewTab(); - - const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); - expect(allTilesArePresent).toBe(true); - - const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); - expect(isCheckBoxVisible).toBe(true); - - const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); - expect(isGenerateButtonVisible).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Verify mnemonic tiles are present', async () => { + const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); + expect(allTilesArePresent).toBe(true); + }); + await allure.step('Verify "I Understand" checkbox is visible', async () => { + const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); + expect(isCheckBoxVisible).toBe(true); + }); + await allure.step('Verify generate button is visible', async () => { + const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); + expect(isGenerateButtonVisible).toBe(true); + }); }); test('Verify "Import Existing" tab elements in account setup are correct', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); - expect(allTilesArePresent).toBe(true); - - const isClearButtonVisible = await registrationPage.isClearButtonVisible(); - expect(isClearButtonVisible).toBe(true); - - const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); - expect(isCheckBoxVisible).toBe(false); - - const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); - expect(isGenerateButtonVisible).toBe(false); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Import Existing" tab', async () => { + await registrationPage.clickOnImportTab(); + }); + await allure.step('Verify mnemonic tiles are present', async () => { + const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); + expect(allTilesArePresent).toBe(true); + }); + await allure.step('Verify clear button is visible', async () => { + const isClearButtonVisible = await registrationPage.isClearButtonVisible(); + expect(isClearButtonVisible).toBe(true); + }); + await allure.step('Verify "I Understand" checkbox is not visible', async () => { + const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); + expect(isCheckBoxVisible).toBe(false); + }); + await allure.step('Verify generate button is not visible', async () => { + const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); + expect(isGenerateButtonVisible).toBe(false); + }); }); test('Verify re-generate of recovery phrase changes words', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + let firstSetOfWords, secondSetOfWords; + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Click on "I Understand" checkbox and generate button', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + }); + await allure.step('Capture first set of recovery phrase words', async () => { + await registrationPage.captureRecoveryPhraseWords(); + firstSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); + }); + await allure.step( + 'Click on generate again button and capture second set of words', + async () => { + await registrationPage.clickOnGenerateAgainButton(); + await registrationPage.captureRecoveryPhraseWords(); + secondSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); + }, ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - - await registrationPage.captureRecoveryPhraseWords(); - const firstSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); - - await registrationPage.clickOnGenerateAgainButton(); - await registrationPage.captureRecoveryPhraseWords(); - const secondSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); - - // Verify that the second set of words is different from the first set - const wordsAreChanged = registrationPage.compareWordSets( - Object.values(firstSetOfWords), - Object.values(secondSetOfWords), + await allure.step( + 'Verify that the second set of words is different from the first set', + async () => { + const wordsAreChanged = registrationPage.compareWordSets( + Object.values(firstSetOfWords), + Object.values(secondSetOfWords), + ); + expect(wordsAreChanged).toBe(true); + }, ); - expect(wordsAreChanged).toBe(true); }); test('Verify generate button is disabled until "I Understand" checkbox is selected', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - await registrationPage.clickOnCreateNewTab(); - - const isGenerateButtonClickable = await registrationPage.isGenerateButtonDisabled(); - expect(isGenerateButtonClickable).toBe(true); - - await registrationPage.clickOnUnderstandCheckbox(); - - const isGenerateButtonVisibleAfterSelectingCheckbox = - await registrationPage.isGenerateButtonDisabled(); - expect(isGenerateButtonVisibleAfterSelectingCheckbox).toBe(false); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Verify generate button is disabled', async () => { + const isGenerateButtonClickable = await registrationPage.isGenerateButtonDisabled(); + expect(isGenerateButtonClickable).toBe(true); + }); + await allure.step('Click on "I Understand" checkbox', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + }); + await allure.step('Verify generate button is enabled', async () => { + const isGenerateButtonVisibleAfterSelectingCheckbox = + await registrationPage.isGenerateButtonDisabled(); + expect(isGenerateButtonVisibleAfterSelectingCheckbox).toBe(false); + }); }); test('Verify clear button clears the existing mnemonic phrase', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - - await registrationPage.clickOnImportTab(); - - await registrationPage.fillAllMissingRecoveryPhraseWords(); - - await registrationPage.clickOnClearButton(); - - const isMnemonicCleared = await registrationPage.verifyAllMnemonicFieldsCleared(); - - expect(isMnemonicCleared).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Click on "I Understand" checkbox and generate button', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + }); + await allure.step('Click on "Import" tab and fill recovery phrase words', async () => { + await registrationPage.clickOnImportTab(); + await registrationPage.fillAllMissingRecoveryPhraseWords(); + }); + await allure.step('Click on clear button and verify mnemonic fields are cleared', async () => { + await registrationPage.clickOnClearButton(); + const isMnemonicCleared = await registrationPage.verifyAllMnemonicFieldsCleared(); + expect(isMnemonicCleared).toBe(true); + }); }); test('Verify final step of account setup has all correct elements', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - - const isAllElementsPresent = await registrationPage.verifyFinalStepAccountSetupElements(); - expect(isAllElementsPresent).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'normal'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Click on "I Understand" checkbox and generate button', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + }); + await allure.step('Verify final step elements', async () => { + const isAllElementsPresent = await registrationPage.verifyFinalStepAccountSetupElements(); + expect(isAllElementsPresent).toBe(true); + }); }); - test('Verify successful registration through "Create New" flow', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - - await registrationPage.clickOnFinalNextButtonWithRetry(); - - const toastMessage = await registrationPage.getToastMessage(); - expect(toastMessage).toBe('Key Pair saved successfully'); + test('Verify successful registration through "Create New" fminor', async () => { + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Click on "I Understand" checkbox and generate button', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + await registrationPage.clickOnFinalNextButtonWithRetry(); + }); + await allure.step('Verify toast message', async () => { + const toastMessage = await registrationPage.getToastMessage(); + expect(toastMessage).toBe('Key Pair saved successfully'); + }); }); - test('Verify successful registration through "Import Existing" flow', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - - await registrationPage.clickOnImportTab(); - - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.scrollToNextImportButton(); - await registrationPage.clickOnNextImportButton(); - - await registrationPage.clickOnFinalNextButtonWithRetry(); - - const toastMessage = await registrationPage.getToastMessage(); - expect(toastMessage).toBe('Key Pair saved successfully'); + test('Verify successful registration through "Import Existing" fminor', async () => { + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register with generated credentials', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + }); + await allure.step('Click on "Create New" tab', async () => { + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + }); + await allure.step('Click on "I Understand" checkbox and generate button', async () => { + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnImportTab(); + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.scrollToNextImportButton(); + await registrationPage.clickOnNextImportButton(); + await registrationPage.clickOnFinalNextButtonWithRetry(); + }); + await allure.step('Verify toast message', async () => { + const toastMessage = await registrationPage.getToastMessage(); + expect(toastMessage).toBe('Key Pair saved successfully'); + }); }); test('Verify user is stored in the database after registration', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.completeRegistration( - globalCredentials.email, - globalCredentials.password, - ); - - const userExists = await registrationPage.verifyUserExists(globalCredentials.email); - expect(userExists).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Complete registration', async () => { + await registrationPage.completeRegistration( + globalCredentials.email, + globalCredentials.password, + ); + }); + await allure.step('Verify user exists in the database', async () => { + const userExists = await registrationPage.verifyUserExists(globalCredentials.email); + expect(userExists).toBe(true); + }); }); test('Verify user public key is stored in the database after registration', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await registrationPage.clickOnCreateNewTab(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - - const publicKeyFromApp = await registrationPage.getPublicKey(); - - await registrationPage.clickOnFinalNextButtonWithRetry(); - - const publicKeyFromDb = await registrationPage.getPublicKeyByEmail(globalCredentials.email); - - expect(publicKeyFromApp).toBe(publicKeyFromDb); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + let publicKeyFromApp; + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Register and capture public key', async () => { + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await registrationPage.clickOnCreateNewTab(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + publicKeyFromApp = await registrationPage.getPublicKey(); + await registrationPage.clickOnFinalNextButtonWithRetry(); + }); + await allure.step('Verify public key in database', async () => { + const publicKeyFromDb = await registrationPage.getPublicKeyByEmail(globalCredentials.email); + expect(publicKeyFromApp).toBe(publicKeyFromDb); + }); }); test('Verify user private key is stored in the database after registration', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - - await registrationPage.completeRegistration( - globalCredentials.email, - globalCredentials.password, - ); - - const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( - globalCredentials.email, - ); - - expect(privateKeyExists).toBe(true); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Generate random email and password', async () => { + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + }); + await allure.step('Complete registration', async () => { + await registrationPage.completeRegistration( + globalCredentials.email, + globalCredentials.password, + ); + }); + await allure.step('Verify private key exists in database', async () => { + const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( + globalCredentials.email, + ); + expect(privateKeyExists).toBe(true); + }); }); test('Verify user is deleted from the database after resetting account', async () => { - // BeforeEach executes logout and reset account state, so we just verify it's no longer existing - const userExists = await registrationPage.verifyUserExists(globalCredentials.email); - expect(userExists).toBe(false); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Verify user no longer exists after reset', async () => { + // BeforeEach executes logout and reset account state, so we just verify it's no longer existing + const userExists = await registrationPage.verifyUserExists(globalCredentials.email); + expect(userExists).toBe(false); + }); }); test('Verify user key pair is deleted from the database after resetting account', async () => { - // BeforeEach executes logout and reset account state, so we just verify it's no longer existing - const publicKeyExists = await registrationPage.verifyPublicKeyExistsByEmail( - globalCredentials.email, - ); - expect(publicKeyExists).toBe(false); - - const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( - globalCredentials.email, - ); - expect(privateKeyExists).toBe(false); + await allure.label('feature', 'Registration'); + await allure.label('severity', 'critical'); + + await allure.step('Verify public key no longer exists after reset', async () => { + // BeforeEach executes logout and reset account state, so we just verify it's no longer existing + const publicKeyExists = await registrationPage.verifyPublicKeyExistsByEmail( + globalCredentials.email, + ); + expect(publicKeyExists).toBe(false); + }); + await allure.step('Verify private key no longer exists after reset', async () => { + const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( + globalCredentials.email, + ); + expect(privateKeyExists).toBe(false); + }); }); }); From 9f75cc72b4dc6062a3e9cdac7ab7ac721a765bd6 Mon Sep 17 00:00:00 2001 From: Yordan Iliev Date: Tue, 25 Jun 2024 16:08:23 +0300 Subject: [PATCH 2/4] Add allure reporting to all tests and severity levels Signed-off-by: Yordan Iliev --- automation/package-lock.json | 108 +- automation/package.json | 3 +- automation/pages/AccountPage.js | 155 +- automation/pages/DetailsPage.js | 190 ++- automation/pages/FilePage.js | 183 ++- automation/pages/LoginPage.js | 147 +- automation/pages/RegistrationPage.js | 486 +++--- automation/pages/SettingsPage.js | 272 ++-- automation/pages/TransactionPage.js | 1649 ++++++++++++-------- automation/playwright.config.js | 40 +- automation/tests/loginTests.test.js | 92 +- automation/tests/registrationTests.test.js | 774 ++++----- automation/tests/settingsTests.test.js | 16 +- automation/tests/transactionTests.test.js | 39 +- automation/tests/workflowTests.test.js | 36 +- 15 files changed, 2473 insertions(+), 1717 deletions(-) diff --git a/automation/package-lock.json b/automation/package-lock.json index 5ac22a8ed..a9b6640c7 100644 --- a/automation/package-lock.json +++ b/automation/package-lock.json @@ -7,7 +7,6 @@ "": { "name": "hedera-transaction-tool-tests", "version": "1.0.0", - "license": "ISC", "dependencies": { "@hashgraph/proto": "^2.13.0", "@hashgraph/sdk": "^2.44.0", @@ -19,6 +18,9 @@ "sqlite3": "5.1.7" }, "devDependencies": { + "allure-commandline": "^2.29.0", + "allure-js-commons": "3.0.0-beta.3", + "allure-playwright": "^2.0.0", "playwright": "^1.41.2", "prettier": "^3.2.5" }, @@ -723,6 +725,66 @@ "node": ">=8" } }, + "node_modules/allure-commandline": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/allure-commandline/-/allure-commandline-2.29.0.tgz", + "integrity": "sha512-he/oWJflViIdEmuQ4er5k+xRd//PaVVElHHTx01h6W71KM9qKiLeF5MloV93UBYoJRzjD9fgbZedSMKemCEGkQ==", + "dev": true, + "bin": { + "allure": "bin/allure" + } + }, + "node_modules/allure-js-commons": { + "version": "3.0.0-beta.3", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-3.0.0-beta.3.tgz", + "integrity": "sha512-akVMlszV8yw7WciiizHjiW646mRAbz5ClI9Dqa6l3pzAL46IH09/XN5QCQf19csVUZWA7T7sffRiQVc+9tIfRg==", + "dev": true, + "dependencies": { + "md5": "^2.3.0", + "properties": "^1.2.1" + } + }, + "node_modules/allure-playwright": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/allure-playwright/-/allure-playwright-2.15.1.tgz", + "integrity": "sha512-P1Uu1j/ptDHdYp3V5ZAeBZyt33+L+OQu0otUIEl/zkOcv0KRycHqlHwC0GEJmpgnLKvVP7s+K37LcLoSUUj3Cg==", + "dev": true, + "dependencies": { + "allure-js-commons": "2.15.1" + } + }, + "node_modules/allure-playwright/node_modules/allure-js-commons": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.15.1.tgz", + "integrity": "sha512-5V/VINplbu0APnfSZOkYpKOzucO36Q2EtTD1kqjWjl7n6tj7Hh+IHCZsH3Vpk/LXRDfj9RuXugBBvwYKV5YMJw==", + "dev": true, + "dependencies": { + "md5": "^2.3.0", + "properties": "^1.2.1", + "strip-ansi": "^5.2.0" + } + }, + "node_modules/allure-playwright/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/allure-playwright/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -939,6 +1001,15 @@ "node": ">= 10" } }, + "node_modules/charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -1022,6 +1093,15 @@ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "optional": true }, + "node_modules/crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/crypto-js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", @@ -1503,6 +1583,12 @@ "node": ">= 12" } }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1595,6 +1681,17 @@ "node": ">= 10" } }, + "node_modules/md5": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "dev": true, + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -2159,6 +2256,15 @@ "node": ">=10" } }, + "node_modules/properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz", + "integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, "node_modules/protobufjs": { "version": "7.2.6", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", diff --git a/automation/package.json b/automation/package.json index 338fbbfc4..8c369a195 100644 --- a/automation/package.json +++ b/automation/package.json @@ -10,7 +10,8 @@ "playwright": "^1.41.2", "prettier": "^3.2.5", "allure-playwright": "^2.0.0", - "allure-commandline": "^2.29.0" + "allure-commandline": "^2.29.0", + "allure-js-commons": "3.0.0-beta.3" }, "main": "playwright.config.js", "directories": { diff --git a/automation/pages/AccountPage.js b/automation/pages/AccountPage.js index bffa0c8d4..14e4645ef 100644 --- a/automation/pages/AccountPage.js +++ b/automation/pages/AccountPage.js @@ -1,5 +1,6 @@ const BasePage = require('./BasePage'); const TransactionPage = require('./TransactionPage'); +import { allure } from 'allure-playwright'; class AccountPage extends BasePage { constructor(window) { @@ -10,8 +11,6 @@ class AccountPage extends BasePage { } /* Selectors */ - - // Buttons editButtonSelector = 'button-edit-account'; removeButtonSelector = 'button-remove-account-card'; addNewButtonSelector = 'button-add-new-account'; @@ -24,7 +23,6 @@ class AccountPage extends BasePage { linkAccountButtonSelector = 'button-link-account-id'; selectManyAccountsButtonSelector = 'button-select-many-accounts'; - // Texts accountIdTextSelector = 'p-account-data-account-id'; evmAddressTextSelector = 'p-account-data-evm-address'; balanceTextSelector = 'p-account-data-balance'; @@ -41,147 +39,210 @@ class AccountPage extends BasePage { pendingRewardTextSelector = 'p-account-data-pending-reward'; rewardsTextSelector = 'p-account-data-rewards'; - // Inputs existingAccountIdInputSelector = 'input-existing-account-id'; multiSelectCheckboxSelector = 'checkbox-multiple-account-id-'; async clickOnEditButton() { - await this.clickByTestId(this.editButtonSelector); + return allure.step('Click on Edit Button', async () => { + await this.clickByTestId(this.editButtonSelector); + }); } async clickOnRemoveButton() { - await this.clickByTestId(this.removeButtonSelector); + return allure.step('Click on Remove Button', async () => { + await this.clickByTestId(this.removeButtonSelector); + }); } async clickOnAddNewButton() { - await this.clickByTestId(this.addNewButtonSelector); + return allure.step('Click on Add New Button', async () => { + await this.clickByTestId(this.addNewButtonSelector); + }); } async clickOnCreateNewLink() { - await this.clickByTestId(this.createNewLinkSelector); + return allure.step('Click on Create New Link', async () => { + await this.clickByTestId(this.createNewLinkSelector); + }); } async clickOnAddExistingLink() { - await this.clickByTestId(this.addExistingLinkSelector); + return allure.step('Click on Add Existing Link', async () => { + await this.clickByTestId(this.addExistingLinkSelector); + }); } async clickOnAccountsLink() { - await this.clickByTestId(this.accountsLinkSelector); + return allure.step('Click on Accounts Link', async () => { + await this.clickByTestId(this.accountsLinkSelector); + }); } async getAccountIdText() { - return await this.getTextByTestId(this.accountIdTextSelector); + return allure.step('Get Account ID Text', async () => { + return await this.getTextByTestId(this.accountIdTextSelector); + }); } async getEvmAddressText() { - return await this.getTextByTestId(this.evmAddressTextSelector); + return allure.step('Get EVM Address Text', async () => { + return await this.getTextByTestId(this.evmAddressTextSelector); + }); } async getBalanceText() { - return await this.getTextByTestId(this.balanceTextSelector); + return allure.step('Get Balance Text', async () => { + return await this.getTextByTestId(this.balanceTextSelector); + }); } async getKeyText() { - return await this.getTextByTestId(this.keyTextSelector); + return allure.step('Get Key Text', async () => { + return await this.getTextByTestId(this.keyTextSelector); + }); } async getKeyTypeText() { - return await this.getTextByTestId(this.keyTypeTextSelector); + return allure.step('Get Key Type Text', async () => { + return await this.getTextByTestId(this.keyTypeTextSelector); + }); } async getReceiverSigRequiredText() { - return await this.getTextByTestId(this.receiverSigRequiredTextSelector); + return allure.step('Get Receiver Sig Required Text', async () => { + return await this.getTextByTestId(this.receiverSigRequiredTextSelector); + }); } async getMemoText() { - return await this.getTextByTestId(this.memoTextSelector); + return allure.step('Get Memo Text', async () => { + return await this.getTextByTestId(this.memoTextSelector); + }); } async getMaxAutoAssocText() { - return await this.getTextByTestId(this.maxAutoAssocTextSelector); + return allure.step('Get Max Auto Association Text', async () => { + return await this.getTextByTestId(this.maxAutoAssocTextSelector); + }); } async getEthereumNonceText() { - return await this.getTextByTestId(this.ethereumNonceTextSelector); + return allure.step('Get Ethereum Nonce Text', async () => { + return await this.getTextByTestId(this.ethereumNonceTextSelector); + }); } async getCreatedAtText() { - return await this.getTextByTestId(this.createdAtTextSelector); + return allure.step('Get Created At Text', async () => { + return await this.getTextByTestId(this.createdAtTextSelector); + }); } async getExpiresAtText() { - return await this.getTextByTestId(this.expiresAtTextSelector); + return allure.step('Get Expires At Text', async () => { + return await this.getTextByTestId(this.expiresAtTextSelector); + }); } async getAutoRenewPeriodText() { - return await this.getTextByTestId(this.autoRenewPeriodTextSelector); + return allure.step('Get Auto Renew Period Text', async () => { + return await this.getTextByTestId(this.autoRenewPeriodTextSelector); + }); } async getStakedToText() { - return await this.getTextByTestId(this.stakedToTextSelector); + return allure.step('Get Staked To Text', async () => { + return await this.getTextByTestId(this.stakedToTextSelector); + }); } async getPendingRewardText() { - return await this.getTextByTestId(this.pendingRewardTextSelector); + return allure.step('Get Pending Reward Text', async () => { + return await this.getTextByTestId(this.pendingRewardTextSelector); + }); } async getRewardsText() { - return await this.getTextByTestId(this.rewardsTextSelector); + return allure.step('Get Rewards Text', async () => { + return await this.getTextByTestId(this.rewardsTextSelector); + }); } async clickOnDeleteFromNetworkLink() { - await this.clickByTestId(this.deleteFromNetworkLinkSelector); + return allure.step('Click on Delete From Network Link', async () => { + await this.clickByTestId(this.deleteFromNetworkLinkSelector); + }); } async clickOnUpdateInNetworkLink() { - await this.clickByTestId(this.updateInNetworkLinkSelector); + return allure.step('Click on Update In Network Link', async () => { + await this.clickByTestId(this.updateInNetworkLinkSelector); + }); } async addAccountToUnliked(accountId) { - this.unlikedAccounts.push(accountId); + return allure.step('Add Account To Unliked', async () => { + this.unlikedAccounts.push(accountId); + }); } async unlinkAccounts() { - await this.waitForElementToBeVisible(this.confirmUnlinkButtonSelector); - await this.clickByTestId(this.confirmUnlinkButtonSelector); + return allure.step('Unlink Accounts', async () => { + await this.waitForElementToBeVisible(this.confirmUnlinkButtonSelector); + await this.clickByTestId(this.confirmUnlinkButtonSelector); + }); } async fillInExistingAccountId(accountId) { - await this.fillByTestId(this.existingAccountIdInputSelector, accountId); + return allure.step('Fill In Existing Account ID', async () => { + await this.fillByTestId(this.existingAccountIdInputSelector, accountId); + }); } async clickOnLinkAccountButton() { - await this.clickByTestId(this.linkAccountButtonSelector); + return allure.step('Click on Link Account Button', async () => { + await this.clickByTestId(this.linkAccountButtonSelector); + }); } async isUnlinkedAccountsListEmpty() { - return this.unlikedAccounts.length === 0; + return allure.step('Check if Unlinked Accounts List is Empty', async () => { + return this.unlikedAccounts.length === 0; + }); } async getFirstAccountFromUnlinkedList() { - return this.unlikedAccounts[0]; + return allure.step('Get First Account From Unlinked List', async () => { + return this.unlikedAccounts[0]; + }); } async ensureAccountExistsAndUnlinked(password) { - if (await this.isUnlinkedAccountsListEmpty()) { - const { newAccountId } = await this.transactionPage.createNewAccount(password); - await this.transactionPage.mirrorGetAccountResponse(newAccountId); - await this.transactionPage.clickOnTransactionsMenuButton(); - await this.clickOnAccountsLink(); - await this.clickOnRemoveButton(); - await this.unlinkAccounts(newAccountId); - } + return allure.step('Ensure Account Exists and Unlinked', async () => { + if (await this.isUnlinkedAccountsListEmpty()) { + const { newAccountId } = await this.transactionPage.createNewAccount(password); + await this.transactionPage.mirrorGetAccountResponse(newAccountId); + await this.transactionPage.clickOnTransactionsMenuButton(); + await this.clickOnAccountsLink(); + await this.clickOnRemoveButton(); + await this.unlinkAccounts(newAccountId); + } + }); } async clickOnAccountCheckbox(accountId) { - const { delay } = await import('../utils/util.js'); - await delay(1000); - const index = await this.transactionPage.findAccountIndexById(accountId); - await this.clickByTestId(this.multiSelectCheckboxSelector + index); + return allure.step('Click on Account Checkbox', async () => { + const { delay } = await import('../utils/util.js'); + await delay(1000); + const index = await this.transactionPage.findAccountIndexById(accountId); + await this.clickByTestId(this.multiSelectCheckboxSelector + index); + }); } async clickOnSelectManyAccountsButton() { - await this.clickByTestId(this.selectManyAccountsButtonSelector); + return allure.step('Click on Select Many Accounts Button', async () => { + await this.clickByTestId(this.selectManyAccountsButtonSelector); + }); } } diff --git a/automation/pages/DetailsPage.js b/automation/pages/DetailsPage.js index 1ab48f936..b5ea307e1 100644 --- a/automation/pages/DetailsPage.js +++ b/automation/pages/DetailsPage.js @@ -1,6 +1,7 @@ const BasePage = require('./BasePage'); const TransactionPage = require('./TransactionPage'); const { expect } = require('playwright/test'); +import { allure } from 'allure-playwright'; class DetailsPage extends BasePage { constructor(window) { @@ -10,13 +11,10 @@ class DetailsPage extends BasePage { } /* Selectors */ - - // Buttons transactionDetailsButtonIndexSelector = 'button-transaction-details-'; viewContentsButtonSelector = 'button-view-file-contents'; seeKeyDetailsButtonSelector = 'button-file-details-key'; - //Text transactionCreatedAtIndexSelector = 'td-transaction-createdAt-'; transactionStatusIndexSelector = 'td-transaction-status-'; transactionTypeIndexSelector = 'td-transaction-type-'; @@ -49,178 +47,250 @@ class DetailsPage extends BasePage { fileDetailsKeyTextSelector = 'p-file-details-key-text'; async clickOnFirstTransactionDetailsButton() { - await this.clickByTestId(this.transactionDetailsButtonIndexSelector + '0'); + return allure.step('Click on First Transaction Details Button', async () => { + await this.clickByTestId(this.transactionDetailsButtonIndexSelector + '0'); + }); } async getFirstTransactionCreated() { - return await this.getTextByTestId(this.transactionCreatedAtIndexSelector + '0'); + return allure.step('Get First Transaction Created', async () => { + return await this.getTextByTestId(this.transactionCreatedAtIndexSelector + '0'); + }); } async getFirstTransactionStatus() { - return await this.getTextByTestId(this.transactionStatusIndexSelector + '0'); + return allure.step('Get First Transaction Status', async () => { + return await this.getTextByTestId(this.transactionStatusIndexSelector + '0'); + }); } async getFirstTransactionType() { - return await this.getTextByTestId(this.transactionTypeIndexSelector + '0'); + return allure.step('Get First Transaction Type', async () => { + return await this.getTextByTestId(this.transactionTypeIndexSelector + '0'); + }); } async getFirstTransactionId() { - return await this.getTextByTestId(this.transactionIdIndexSelector + '0'); + return allure.step('Get First Transaction ID', async () => { + return await this.getTextByTestId(this.transactionIdIndexSelector + '0'); + }); } async isTransactionDetailsButtonVisible() { - return this.isElementVisible(this.transactionDetailsButtonIndexSelector + '0'); + return allure.step('Check if Transaction Details Button is Visible', async () => { + return this.isElementVisible(this.transactionDetailsButtonIndexSelector + '0'); + }); } async getTransactionDetailsType() { - return await this.getTextByTestId(this.transactionDetailsTypeSelector); + return allure.step('Get Transaction Details Type', async () => { + return await this.getTextByTestId(this.transactionDetailsTypeSelector); + }); } async getTransactionDetailsId() { - return await this.getTextByTestId(this.transactionDetailsIdSelector); + return allure.step('Get Transaction Details ID', async () => { + return await this.getTextByTestId(this.transactionDetailsIdSelector); + }); } async getTransactionDetailsCreatedAt() { - return await this.getTextByTestId(this.transactionDetailsCreatedAtSelector); + return allure.step('Get Transaction Details Created At', async () => { + return await this.getTextByTestId(this.transactionDetailsCreatedAtSelector); + }); } async getTransactionDetailsExecutedAt() { - return await this.getTextByTestId(this.transactionDetailsExecutedAtSelector); + return allure.step('Get Transaction Details Executed At', async () => { + return await this.getTextByTestId(this.transactionDetailsExecutedAtSelector); + }); } async getValidStart() { - return await this.getTextByTestId(this.transactionDetailsValidStartSelector); + return allure.step('Get Valid Start', async () => { + return await this.getTextByTestId(this.transactionDetailsValidStartSelector); + }); } async getTransactionDetailsFeePayer() { - return await this.getTextByTestId(this.transactionDetailsFeePayerSelector); + return allure.step('Get Transaction Details Fee Payer', async () => { + return await this.getTextByTestId(this.transactionDetailsFeePayerSelector); + }); } async getTransactionDetailsMemo() { - return await this.getTextByTestId(this.transactionDetailsMemoSelector); + return allure.step('Get Transaction Details Memo', async () => { + return await this.getTextByTestId(this.transactionDetailsMemoSelector); + }); } async getAccountUpdateDetailsId() { - return await this.getTextByTestId(this.accountUpdateDetailsIdSelector); + return allure.step('Get Account Update Details ID', async () => { + return await this.getTextByTestId(this.accountUpdateDetailsIdSelector); + }); } async getAccountDetailsKey() { - return await this.getTextByTestId(this.accountDetailsKeySelector); + return allure.step('Get Account Details Key', async () => { + return await this.getTextByTestId(this.accountDetailsKeySelector); + }); } async getAccountDetailsMemo() { - return await this.getTextByTestId(this.accountDetailsMemoSelector); + return allure.step('Get Account Details Memo', async () => { + return await this.getTextByTestId(this.accountDetailsMemoSelector); + }); } async getAccountDetailsStaking() { - return await this.getTextByTestId(this.accountDetailsStakingSelector); + return allure.step('Get Account Details Staking', async () => { + return await this.getTextByTestId(this.accountDetailsStakingSelector); + }); } async getAccountDetailsDeclineRewards() { - return await this.getTextByTestId(this.accountDetailsDeclineRewardsSelector); + return allure.step('Get Account Details Decline Rewards', async () => { + return await this.getTextByTestId(this.accountDetailsDeclineRewardsSelector); + }); } async getAccountDetailsReceiverSigRequired() { - return await this.getTextByTestId(this.accountDetailsReceiverSigRequiredSelector); + return allure.step('Get Account Details Receiver Sig Required', async () => { + return await this.getTextByTestId(this.accountDetailsReceiverSigRequiredSelector); + }); } async getAccountDetailsInitBalance() { - return await this.getTextByTestId(this.accountDetailsInitBalanceSelector); + return allure.step('Get Account Details Init Balance', async () => { + return await this.getTextByTestId(this.accountDetailsInitBalanceSelector); + }); } async getDeletedAccountId() { - return await this.getTextByTestId(this.accountDeleteDetailsDeletedAccountIdSelector); + return allure.step('Get Deleted Account ID', async () => { + return await this.getTextByTestId(this.accountDeleteDetailsDeletedAccountIdSelector); + }); } async getAccountDeleteDetailsTransferId() { - return await this.getTextByTestId(this.accountDeleteDetailsTransferIdSelector); + return allure.step('Get Account Delete Details Transfer ID', async () => { + return await this.getTextByTestId(this.accountDeleteDetailsTransferIdSelector); + }); } async getTransferDetailsFromAccount() { - return await this.getTextByTestId(this.transferDetailsFromAccountSelector); + return allure.step('Get Transfer Details From Account', async () => { + return await this.getTextByTestId(this.transferDetailsFromAccountSelector); + }); } async getTransferDetailsFromAmount() { - return await this.getTextByTestId(this.transferDetailsFromAmountSelector); + return allure.step('Get Transfer Details From Amount', async () => { + return await this.getTextByTestId(this.transferDetailsFromAmountSelector); + }); } async getTransferDetailsToAccount() { - return await this.getTextByTestId(this.transferDetailsToAccountSelector); + return allure.step('Get Transfer Details To Account', async () => { + return await this.getTextByTestId(this.transferDetailsToAccountSelector); + }); } async getTransferDetailsToAmount() { - return await this.getTextByTestId(this.transferDetailsToAmountSelector); + return allure.step('Get Transfer Details To Amount', async () => { + return await this.getTextByTestId(this.transferDetailsToAmountSelector); + }); } async getAllowanceDetailsOwnerAccount() { - return await this.getTextByTestId(this.allowanceDetailsOwnerAccountSelector); + return allure.step('Get Allowance Details Owner Account', async () => { + return await this.getTextByTestId(this.allowanceDetailsOwnerAccountSelector); + }); } async getAllowanceDetailsSpenderAccount() { - return await this.getTextByTestId(this.allowanceDetailsSpenderAccountSelector); + return allure.step('Get Allowance Details Spender Account', async () => { + return await this.getTextByTestId(this.allowanceDetailsSpenderAccountSelector); + }); } async getAllowanceDetailsAmount() { - return await this.getTextByTestId(this.allowanceDetailsAmountSelector); + return allure.step('Get Allowance Details Amount', async () => { + return await this.getTextByTestId(this.allowanceDetailsAmountSelector); + }); } async isViewContentsButtonVisible() { - return await this.isElementVisible(this.viewContentsButtonSelector); + return allure.step('Check if View Contents Button is Visible', async () => { + return await this.isElementVisible(this.viewContentsButtonSelector); + }); } async isSeeKeyDetailsButtonVisible() { - return await this.isElementVisible(this.seeKeyDetailsButtonSelector); + return allure.step('Check if See Key Details Button is Visible', async () => { + return await this.isElementVisible(this.seeKeyDetailsButtonSelector); + }); } async getFileDetailsExpirationTime() { - return await this.getTextByTestId(this.fileDetailsExpirationTimeSelector); + return allure.step('Get File Details Expiration Time', async () => { + return await this.getTextByTestId(this.fileDetailsExpirationTimeSelector); + }); } async getFileDetailsFileId() { - return await this.getTextByTestId(this.fileDetailsFileIdSelector); + return allure.step('Get File Details File ID', async () => { + return await this.getTextByTestId(this.fileDetailsFileIdSelector); + }); } async getFileDetailsKeyText() { - return await this.getTextByTestId(this.fileDetailsKeyTextSelector); + return allure.step('Get File Details Key Text', async () => { + return await this.getTextByTestId(this.fileDetailsKeyTextSelector); + }); } async assertTransactionDisplayed(expectedId, expectedType) { - const transactionId = await this.getFirstTransactionId(); - expect(expectedId.toString()).toContain(transactionId); + return allure.step('Assert Transaction Displayed', async () => { + const transactionId = await this.getFirstTransactionId(); + expect(expectedId.toString()).toContain(transactionId); - const transactionType = await this.getFirstTransactionType(); - expect(transactionType).toBe(expectedType); + const transactionType = await this.getFirstTransactionType(); + expect(transactionType).toBe(expectedType); - const transactionStatus = await this.getFirstTransactionStatus(); - expect(transactionStatus).toBe('SUCCESS'); + const transactionStatus = await this.getFirstTransactionStatus(); + expect(transactionStatus).toBe('SUCCESS'); - const transactionCreatedAt = await this.getFirstTransactionCreated(); - expect(transactionCreatedAt).toBeTruthy(); + const transactionCreatedAt = await this.getFirstTransactionCreated(); + expect(transactionCreatedAt).toBeTruthy(); - const isTransactionDetailsButtonVisible = await this.isTransactionDetailsButtonVisible(); - expect(isTransactionDetailsButtonVisible).toBe(true); + const isTransactionDetailsButtonVisible = await this.isTransactionDetailsButtonVisible(); + expect(isTransactionDetailsButtonVisible).toBe(true); + }); } async assertTransactionDetails(expectedId, expectedType, extraAssertions = () => {}) { - const transactionId = await this.getTransactionDetailsId(); - expect(expectedId.toString()).toContain(transactionId); + return allure.step('Assert Transaction Details', async () => { + const transactionId = await this.getTransactionDetailsId(); + expect(expectedId.toString()).toContain(transactionId); - const transactionType = await this.getTransactionDetailsType(); - expect(transactionType).toBe(expectedType); + const transactionType = await this.getTransactionDetailsType(); + expect(transactionType).toBe(expectedType); - const transactionCreatedAt = await this.getTransactionDetailsCreatedAt(); - expect(transactionCreatedAt).toBeTruthy(); + const transactionCreatedAt = await this.getTransactionDetailsCreatedAt(); + expect(transactionCreatedAt).toBeTruthy(); - const transactionExecutedAt = await this.getTransactionDetailsExecutedAt(); - expect(transactionExecutedAt).toBeTruthy(); + const transactionExecutedAt = await this.getTransactionDetailsExecutedAt(); + expect(transactionExecutedAt).toBeTruthy(); - const validStart = await this.getValidStart(); - expect(validStart).toBeTruthy(); + const validStart = await this.getValidStart(); + expect(validStart).toBeTruthy(); - const transactionFeePayer = await this.getTransactionDetailsFeePayer(); - expect(transactionFeePayer).toBeTruthy(); + const transactionFeePayer = await this.getTransactionDetailsFeePayer(); + expect(transactionFeePayer).toBeTruthy(); - await extraAssertions(); + await extraAssertions(); + }); } } diff --git a/automation/pages/FilePage.js b/automation/pages/FilePage.js index 88e9e8155..09d1fbf7c 100644 --- a/automation/pages/FilePage.js +++ b/automation/pages/FilePage.js @@ -1,5 +1,6 @@ const BasePage = require('./BasePage'); const TransactionPage = require('./TransactionPage'); +import { allure } from 'allure-playwright'; class FilePage extends BasePage { constructor(window) { @@ -10,8 +11,6 @@ class FilePage extends BasePage { } /* Selectors */ - - // Buttons removeFileCardButtonSelector = 'button-remove-file-card'; updateFileButtonSelector = 'button-update-file'; appendFileButtonSelector = 'button-append-file'; @@ -27,11 +26,9 @@ class FilePage extends BasePage { filesMenuButtonSelector = 'button-menu-files'; selectManyFilesButtonSelector = 'button-select-many-files'; - // Inputs existingFileIdInputSelector = 'input-existing-file-id'; multiSelectFileCheckboxSelector = 'checkbox-multiple-file-id-'; - // Texts fileIdTextSelector = 'p-file-id-info'; fileSizeTextSelector = 'p-file-size'; fileKeyTextSelector = 'p-file-key'; @@ -44,158 +41,222 @@ class FilePage extends BasePage { toastMessageSelector = '.v-toast__text'; async clickOnRemoveFileCardButton() { - await this.clickByTestId(this.removeFileCardButtonSelector); + return allure.step('Click on Remove File Card Button', async () => { + await this.clickByTestId(this.removeFileCardButtonSelector); + }); } async clickOnUpdateFileButton() { - await this.clickByTestId(this.updateFileButtonSelector); + return allure.step('Click on Update File Button', async () => { + await this.clickByTestId(this.updateFileButtonSelector); + }); } async clickOnAppendFileButton() { - await this.clickByTestId(this.appendFileButtonSelector); + return allure.step('Click on Append File Button', async () => { + await this.clickByTestId(this.appendFileButtonSelector); + }); } async clickOnReadFileButton() { - await this.clickByTestId(this.readFileButtonSelector); + return allure.step('Click on Read File Button', async () => { + await this.clickByTestId(this.readFileButtonSelector); + }); } async clickOnAddNewFileButton() { - await this.clickByTestId(this.addNewButtonSelector); + return allure.step('Click on Add New File Button', async () => { + await this.clickByTestId(this.addNewButtonSelector); + }); } async clickOnCreateNewFileLink() { - await this.clickByTestId(this.createNewLinkSelector); + return allure.step('Click on Create New File Link', async () => { + await this.clickByTestId(this.createNewLinkSelector); + }); } async clickOnUpdateFileLink() { - await this.clickByTestId(this.updateLinkSelector); + return allure.step('Click on Update File Link', async () => { + await this.clickByTestId(this.updateLinkSelector); + }); } async clickOnAppendFileLink() { - await this.clickByTestId(this.appendLinkSelector); + return allure.step('Click on Append File Link', async () => { + await this.clickByTestId(this.appendLinkSelector); + }); } async clickOnReadFileLink() { - await this.clickByTestId(this.readLinkSelector); + return allure.step('Click on Read File Link', async () => { + await this.clickByTestId(this.readLinkSelector); + }); } async clickOnAddExistingFileLink() { - await this.clickByTestId(this.addExistingLinkSelector); + return allure.step('Click on Add Existing File Link', async () => { + await this.clickByTestId(this.addExistingLinkSelector); + }); } async clickOnLinkFileButton() { - await this.clickByTestId(this.linkFileButtonSelector); + return allure.step('Click on Link File Button', async () => { + await this.clickByTestId(this.linkFileButtonSelector); + }); } async fillInExistingFileId(fileId) { - await this.fillByTestId(this.existingFileIdInputSelector, fileId); + return allure.step('Fill in Existing File ID', async () => { + await this.fillByTestId(this.existingFileIdInputSelector, fileId); + }); } async getFileIdText() { - return await this.getTextByTestId(this.fileIdTextSelector); + return allure.step('Get File ID Text', async () => { + return await this.getTextByTestId(this.fileIdTextSelector); + }); } async getFileSizeText() { - return await this.getTextByTestId(this.fileSizeTextSelector); + return allure.step('Get File Size Text', async () => { + return await this.getTextByTestId(this.fileSizeTextSelector); + }); } async getFileKeyText() { - return await this.getTextByTestId(this.fileKeyTextSelector); + return allure.step('Get File Key Text', async () => { + return await this.getTextByTestId(this.fileKeyTextSelector); + }); } async getFileKeyTypeText() { - return await this.getTextByTestId(this.fileKeyTypeTextSelector); + return allure.step('Get File Key Type Text', async () => { + return await this.getTextByTestId(this.fileKeyTypeTextSelector); + }); } async getFileMemoText() { - return await this.getTextByTestId(this.fileMemoTextSelector); + return allure.step('Get File Memo Text', async () => { + return await this.getTextByTestId(this.fileMemoTextSelector); + }); } async getFileLedgerText() { - return await this.getTextByTestId(this.fileLedgerTextSelector); + return allure.step('Get File Ledger Text', async () => { + return await this.getTextByTestId(this.fileLedgerTextSelector); + }); } async getFileExpirationText() { - return await this.getTextByTestId(this.fileExpirationTextSelector); + return allure.step('Get File Expiration Text', async () => { + return await this.getTextByTestId(this.fileExpirationTextSelector); + }); } async getFileDescriptionText() { - return await this.getTextByTestId(this.fileDescriptionTextSelector); + return allure.step('Get File Description Text', async () => { + return await this.getTextByTestId(this.fileDescriptionTextSelector); + }); } async getFirstFileFromList() { - return await this.unlikedFiles[0]; + return allure.step('Get First File from List', async () => { + return await this.unlikedFiles[0]; + }); } async isUnlinkedFilesEmpty() { - return this.unlikedFiles.length === 0; + return allure.step('Check if Unlinked Files is Empty', async () => { + return this.unlikedFiles.length === 0; + }); } async addFileToUnliked(fileId) { - this.unlikedFiles.push(fileId); + return allure.step('Add File to Unliked', async () => { + this.unlikedFiles.push(fileId); + }); } async clickOnFilesMenuButton() { - await this.clickByTestId(this.filesMenuButtonSelector); + return allure.step('Click on Files Menu Button', async () => { + await this.clickByTestId(this.filesMenuButtonSelector); + }); } async clickOnConfirmUnlinkFileButton() { - await this.clickByTestId(this.confirmUnlinkFileButtonSelector); + return allure.step('Click on Confirm Unlink File Button', async () => { + await this.clickByTestId(this.confirmUnlinkFileButtonSelector); + }); } async getFirstFileIdFromPage() { - return await this.getTextByTestId(this.fileIdListPrefixSelector + '0'); + return allure.step('Get First File ID from Page', async () => { + return await this.getTextByTestId(this.fileIdListPrefixSelector + '0'); + }); } async clickOnAddNewButtonForFile() { - await this.clickByTestId(this.addNewButtonSelector); + return allure.step('Click on Add New Button for File', async () => { + await this.clickByTestId(this.addNewButtonSelector); + }); } async clickOnFileCheckbox(fileId) { - const { delay } = await import('../utils/util.js'); - await delay(1000); - const index = await this.findFileByIndex(fileId); - await this.clickByTestId(this.multiSelectFileCheckboxSelector + index); + return allure.step('Click on File Checkbox', async () => { + const { delay } = await import('../utils/util.js'); + await delay(1000); + const index = await this.findFileByIndex(fileId); + await this.clickByTestId(this.multiSelectFileCheckboxSelector + index); + }); } async findFileByIndex(fileId) { - const count = await this.countElementsByTestId(this.fileIdListPrefixSelector); - if (count === 0) { - return 0; - } else { - for (let i = 0; i < count; i++) { - const idText = await this.getTextByTestId(this.fileIdListPrefixSelector + i); - if (idText === fileId) { - return i; + return allure.step('Find File by Index', async () => { + const count = await this.countElementsByTestId(this.fileIdListPrefixSelector); + if (count === 0) { + return 0; + } else { + for (let i = 0; i < count; i++) { + const idText = await this.getTextByTestId(this.fileIdListPrefixSelector + i); + if (idText === fileId) { + return i; + } } + return -1; // Return -1 if the account ID is not found } - return -1; // Return -1 if the account ID is not found - } + }); } async isFileCardVisible(fileId) { - await this.waitForElementToBeVisible(this.addNewButtonSelector); - const index = await this.findFileByIndex(fileId); - if (index === -1) { - return false; // file not found - } else { - return await this.isElementVisible(this.fileIdListPrefixSelector + index); - } + return allure.step('Check if File Card is Visible', async () => { + await this.waitForElementToBeVisible(this.addNewButtonSelector); + const index = await this.findFileByIndex(fileId); + if (index === -1) { + return false; // file not found + } else { + return await this.isElementVisible(this.fileIdListPrefixSelector + index); + } + }); } async ensureFileExistsAndUnlinked(password) { - if (await this.isUnlinkedFilesEmpty()) { - const { fileId } = await this.transactionPage.createFile('test', password); - await this.clickOnFilesMenuButton(); - await this.clickOnRemoveFileCardButton(); - await this.clickOnConfirmUnlinkFileButton(); - await this.addFileToUnliked(fileId); - await this.waitForElementToDisappear(this.toastMessageSelector); - } + return allure.step('Ensure File Exists and Unlinked', async () => { + if (await this.isUnlinkedFilesEmpty()) { + const { fileId } = await this.transactionPage.createFile('test', password); + await this.clickOnFilesMenuButton(); + await this.clickOnRemoveFileCardButton(); + await this.clickOnConfirmUnlinkFileButton(); + await this.addFileToUnliked(fileId); + await this.waitForElementToDisappear(this.toastMessageSelector); + } + }); } async clickOnSelectManyFilesButton() { - await this.clickByTestId(this.selectManyFilesButtonSelector); + return allure.step('Click on Select Many Files Button', async () => { + await this.clickByTestId(this.selectManyFilesButtonSelector); + }); } } diff --git a/automation/pages/LoginPage.js b/automation/pages/LoginPage.js index 49f3f02e4..6e5d77b24 100644 --- a/automation/pages/LoginPage.js +++ b/automation/pages/LoginPage.js @@ -1,4 +1,5 @@ const BasePage = require('./BasePage'); +import { allure } from 'allure-playwright'; class LoginPage extends BasePage { constructor(window) { @@ -7,12 +8,9 @@ class LoginPage extends BasePage { } /* Selectors */ - - // Inputs emailInputSelector = 'input-email'; passwordInputSelector = 'input-password'; - // Buttons signInButtonSelector = 'button-login'; importantNoteModalButtonSelector = 'button-understand-agree'; resetStateButtonSelector = 'link-reset'; @@ -21,116 +19,129 @@ class LoginPage extends BasePage { logoutButtonSelector = 'button-logout'; settingsButtonSelector = 'button-menu-settings'; - // Labels emailLabelSelector = 'label-email'; passwordLabelSelector = 'label-password'; - // Messages toastMessageSelector = '.v-toast__text'; invalidPasswordMessageSelector = 'invalid-text-password'; invalidEmailMessageSelector = 'invalid-text-email'; - // Method to close the 'Important note' modal if it appears async closeImportantNoteModal() { - // Wait for the button to be visible with a timeout - const modalButton = this.window.getByTestId(this.importantNoteModalButtonSelector); - await modalButton.waitFor({ state: 'visible', timeout: 500 }).catch(e => {}); - - // If the modal is visible, then click the button to close the modal - if (await modalButton.isVisible()) { - await modalButton.click(); - } + await allure.step('Close Important Note Modal', async () => { + const modalButton = this.window.getByTestId(this.importantNoteModalButtonSelector); + await modalButton.waitFor({ state: 'visible', timeout: 500 }).catch(e => {}); + if (await modalButton.isVisible()) { + await modalButton.click(); + } + }); } async resetForm() { - await this.fillByTestId(this.emailInputSelector, ''); - await this.fillByTestId(this.passwordInputSelector, ''); + await allure.step('Reset Form', async () => { + await this.fillByTestId(this.emailInputSelector, ''); + await this.fillByTestId(this.passwordInputSelector, ''); + }); } - // specific logout method for the login tests async logout() { - const isLogoutButtonVisible = await this.isElementVisible(this.logoutButtonSelector); - if (isLogoutButtonVisible) { - console.log('Logout button is visible, clicking to logout'); - await this.clickByTestId(this.logoutButtonSelector); - const element = this.window.getByTestId(this.emailInputSelector); - await element.waitFor({ state: 'visible', timeout: 1000 }); - } else { - console.log('Logout button is not visible, resetting the form'); - await this.resetForm(); - } + await allure.step('Logout', async () => { + const isLogoutButtonVisible = await this.isElementVisible(this.logoutButtonSelector); + if (isLogoutButtonVisible) { + console.log('Logout button is visible, clicking to logout'); + await this.clickByTestId(this.logoutButtonSelector); + const element = this.window.getByTestId(this.emailInputSelector); + await element.waitFor({ state: 'visible', timeout: 1000 }); + } else { + console.log('Logout button is not visible, resetting the form'); + await this.resetForm(); + } + }); } async verifyLoginElements() { - const checks = await Promise.all([ - this.isElementVisible(this.emailLabelSelector), - this.isElementVisible(this.emailInputSelector), - this.isElementVisible(this.passwordLabelSelector), - this.isElementVisible(this.passwordInputSelector), - this.isElementVisible(this.signInButtonSelector), - this.isElementVisible(this.resetStateButtonSelector), - this.isElementVisible(this.keepLoggedInCheckboxSelector), - ]); - return checks.every(isTrue => isTrue); + return await allure.step('Verify Login Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.emailLabelSelector), + this.isElementVisible(this.emailInputSelector), + this.isElementVisible(this.passwordLabelSelector), + this.isElementVisible(this.passwordInputSelector), + this.isElementVisible(this.signInButtonSelector), + this.isElementVisible(this.resetStateButtonSelector), + this.isElementVisible(this.keepLoggedInCheckboxSelector), + ]); + return checks.every(isTrue => isTrue); + }); } async login(email, password) { - await this.typeEmail(email); - await this.typePassword(password); - await this.clickSignIn(); + await allure.step('Login', async () => { + await this.typeEmail(email); + await this.typePassword(password); + await this.clickSignIn(); + }); } - // Method to reset the application state async resetState() { - // Check if the initial reset button exists and is visible - const initialResetButtonExists = await this.isElementVisible(this.resetStateButtonSelector); - - // Proceed only if the initial reset button is visible - if (initialResetButtonExists) { - try { - await this.clickByTestId(this.resetStateButtonSelector); - } catch (e) { - console.log('Failed to click on the reset link'); - } - // Now wait for the confirmation reset button to become visible - try { - const resetButton = this.window.getByTestId(this.confirmResetStateButtonSelector); - await resetButton.waitFor({ state: 'visible', timeout: 1000 }); - // If the waitFor resolves successfully, click the reset button - await resetButton.click(); - await this.waitForToastToDisappear(); - } catch (e) { - console.log("The 'Reset' modal did not appear within the timeout."); + await allure.step('Reset State', async () => { + const initialResetButtonExists = await this.isElementVisible(this.resetStateButtonSelector); + if (initialResetButtonExists) { + try { + await this.clickByTestId(this.resetStateButtonSelector); + } catch (e) { + console.log('Failed to click on the reset link'); + } + try { + const resetButton = this.window.getByTestId(this.confirmResetStateButtonSelector); + await resetButton.waitFor({ state: 'visible', timeout: 1000 }); + await resetButton.click(); + await this.waitForToastToDisappear(); + } catch (e) { + console.log("The 'Reset' modal did not appear within the timeout."); + } } - } + }); } async typeEmail(email) { - await this.window.getByTestId(this.emailInputSelector).fill(email); + await allure.step('Type Email', async () => { + await this.window.getByTestId(this.emailInputSelector).fill(email); + }); } async typePassword(password) { - await this.window.getByTestId(this.passwordInputSelector).fill(password); + await allure.step('Type Password', async () => { + await this.window.getByTestId(this.passwordInputSelector).fill(password); + }); } async clickSignIn() { - await this.window.getByTestId(this.signInButtonSelector).click(); + await allure.step('Click Sign In', async () => { + await this.window.getByTestId(this.signInButtonSelector).click(); + }); } async waitForToastToDisappear() { - await this.waitForElementToDisappear(this.toastMessageSelector); + await allure.step('Wait For Toast To Disappear', async () => { + await this.waitForElementToDisappear(this.toastMessageSelector); + }); } async isSettingsButtonVisible() { - return await this.isElementVisible(this.settingsButtonSelector); + return await allure.step('Is Settings Button Visible', async () => { + return await this.isElementVisible(this.settingsButtonSelector); + }); } async getLoginPasswordErrorMessage() { - return await this.getTextByTestId(this.invalidPasswordMessageSelector); + return await allure.step('Get Login Password Error Message', async () => { + return await this.getTextByTestId(this.invalidPasswordMessageSelector); + }); } async getLoginEmailErrorMessage() { - return await this.getTextByTestId(this.invalidEmailMessageSelector); + return await allure.step('Get Login Email Error Message', async () => { + return await this.getTextByTestId(this.invalidEmailMessageSelector); + }); } } diff --git a/automation/pages/RegistrationPage.js b/automation/pages/RegistrationPage.js index 78f9c6462..a03f8e839 100644 --- a/automation/pages/RegistrationPage.js +++ b/automation/pages/RegistrationPage.js @@ -1,6 +1,7 @@ const BasePage = require('./BasePage'); const { expect } = require('playwright/test'); const { queryDatabase } = require('../utils/databaseUtil'); +import { allure } from 'allure-playwright'; class RegistrationPage extends BasePage { constructor(window) { @@ -10,8 +11,6 @@ class RegistrationPage extends BasePage { } /* Selectors */ - - // Inputs emailInputSelector = 'input-email'; passwordInputSelector = 'input-password'; confirmPasswordInputSelector = 'input-password-confirm'; @@ -20,7 +19,6 @@ class RegistrationPage extends BasePage { keyTypeInputSelector = 'input-key-type'; understandBackedUpCheckboxSelector = 'checkbox-understand-backed-up'; - // Buttons registerButtonSelector = 'button-login'; createNewTabSelector = 'tab-0'; importExistingTabSelector = 'tab-1'; @@ -35,7 +33,6 @@ class RegistrationPage extends BasePage { showPrivateKeyButtonSelector = 'button-show-private-key'; logoutButtonSelector = 'button-logout'; - // Labels emailLabelSelector = 'label-email'; passwordLabelSelector = 'label-password'; confirmPasswordLabelSelector = 'label-password-confirm'; @@ -44,7 +41,6 @@ class RegistrationPage extends BasePage { keyTypeLabelSelector = 'label-key-type'; privateKeyLabelSelector = 'label-private-key'; - // Messages toastMessageSelector = '.v-toast__text'; emailErrorMessageSelector = 'invalid-text-email'; passwordErrorMessageSelector = 'invalid-text-password'; @@ -59,62 +55,64 @@ class RegistrationPage extends BasePage { return this.inputRecoveryWordBase + index; } - // Method to capture all the recovery phrase words and their indexes async captureRecoveryPhraseWords() { - this.recoveryPhraseWords = {}; // Reset the recoveryPhraseWords object - for (let i = 1; i <= 24; i++) { - const selector = this.getRecoveryWordSelector(i); - const wordElement = await this.window.getByTestId(selector); - this.recoveryPhraseWords[i] = await wordElement.inputValue(); - } + await allure.step('Capture Recovery Phrase Words', async () => { + this.recoveryPhraseWords = {}; + for (let i = 1; i <= 24; i++) { + const selector = this.getRecoveryWordSelector(i); + const wordElement = await this.window.getByTestId(selector); + this.recoveryPhraseWords[i] = await wordElement.inputValue(); + } + }); } - // Method to fill a missing recovery phrase word by index async fillRecoveryPhraseWord(index, word) { - const selector = this.getRecoveryWordSelector(index); - await this.fillByTestId(selector, word); + await allure.step(`Fill Recovery Phrase Word at Index ${index}`, async () => { + const selector = this.getRecoveryWordSelector(index); + await this.fillByTestId(selector, word); + }); } - // Method to fill in all missing recovery phrase words based on the saved recoveryPhraseWords async fillAllMissingRecoveryPhraseWords() { - for (let i = 1; i <= 24; i++) { - const selector = this.getRecoveryWordSelector(i); - const wordElement = await this.window.getByTestId(selector); - const value = await wordElement.inputValue(); - if (!value) { - const word = this.recoveryPhraseWords[i]; - if (word) { - await this.fillRecoveryPhraseWord(i, word); + await allure.step('Fill All Missing Recovery Phrase Words', async () => { + for (let i = 1; i <= 24; i++) { + const selector = this.getRecoveryWordSelector(i); + const wordElement = await this.window.getByTestId(selector); + const value = await wordElement.inputValue(); + if (!value) { + const word = this.recoveryPhraseWords[i]; + if (word) { + await this.fillRecoveryPhraseWord(i, word); + } } } - } + }); } async clickOnFinalNextButtonWithRetry(retryCount = 5) { - let attempts = 0; - let isSuccessful = false; - - while (attempts < retryCount && !isSuccessful) { - try { - // Attempt to click the final next button - await this.clickByTestId(this.finalNextButtonSelector); - await this.window.waitForSelector(this.settingsButtonSelector, { - state: 'visible', - timeout: 1000, - }); - isSuccessful = true; // If the above waitForSelector doesn't throw, we assume success - } catch (error) { - console.log( - `Attempt ${attempts + 1} to click ${this.finalNextButtonSelector} failed, retrying...`, - ); - await this.window.waitForTimeout(1000); // Wait for 1 second before retrying - attempts++; + await allure.step('Click on Final Next Button With Retry', async () => { + let attempts = 0; + let isSuccessful = false; + while (attempts < retryCount && !isSuccessful) { + try { + await this.clickByTestId(this.finalNextButtonSelector); + await this.window.waitForSelector(this.settingsButtonSelector, { + state: 'visible', + timeout: 1000, + }); + isSuccessful = true; + } catch (error) { + console.log( + `Attempt ${attempts + 1} to click ${this.finalNextButtonSelector} failed, retrying...`, + ); + await this.window.waitForTimeout(1000); + attempts++; + } } - } - - if (!isSuccessful) { - throw new Error('Failed to navigate to the next page after maximum attempts'); - } + if (!isSuccessful) { + throw new Error('Failed to navigate to the next page after maximum attempts'); + } + }); } compareWordSets(firstSet, secondSet) { @@ -128,310 +126,372 @@ class RegistrationPage extends BasePage { } async verifyAllMnemonicTilesArePresent() { - let allTilesArePresent = true; - for (let i = 1; i <= 24; i++) { - const tileSelector = this.getRecoveryWordSelector(i); - try { - const isVisible = await this.isElementVisible(tileSelector); - const isEditable = await this.isElementEditable(tileSelector); - // Check if the tile is visible and it's not editable - if (!isVisible && isEditable) { + return await allure.step('Verify All Mnemonic Tiles Are Present', async () => { + let allTilesArePresent = true; + for (let i = 1; i <= 24; i++) { + const tileSelector = this.getRecoveryWordSelector(i); + try { + const isVisible = await this.isElementVisible(tileSelector); + const isEditable = await this.isElementEditable(tileSelector); + if (!isVisible && isEditable) { + allTilesArePresent = false; + break; + } + } catch (error) { + console.error(`Error verifying tile ${i}:`, error); allTilesArePresent = false; break; } - } catch (error) { - console.error(`Error verifying tile ${i}:`, error); - allTilesArePresent = false; - break; } - } - return allTilesArePresent; + return allTilesArePresent; + }); } async verifyAllMnemonicFieldsCleared() { - let allFieldsCleared = true; - for (let i = 1; i <= 24; i++) { - const wordFieldSelector = this.getRecoveryWordSelector(i); - const fieldValue = await this.window.getByTestId(wordFieldSelector).inputValue(); - if (fieldValue !== '') { - allFieldsCleared = false; - console.log(`Field ${i} was not cleared.`); - break; + return await allure.step('Verify All Mnemonic Fields Cleared', async () => { + let allFieldsCleared = true; + for (let i = 1; i <= 24; i++) { + const wordFieldSelector = this.getRecoveryWordSelector(i); + const fieldValue = await this.window.getByTestId(wordFieldSelector).inputValue(); + if (fieldValue !== '') { + allFieldsCleared = false; + console.log(`Field ${i} was not cleared.`); + break; + } } - } - return allFieldsCleared; + return allFieldsCleared; + }); } async resetForm() { - await this.fillByTestId(this.emailInputSelector, ''); - await this.fillByTestId(this.passwordInputSelector, ''); + await allure.step('Reset Form', async () => { + await this.fillByTestId(this.emailInputSelector, ''); + await this.fillByTestId(this.passwordInputSelector, ''); + }); } async logoutForReset() { - const isLogoutButtonVisible = await this.isElementVisible(this.logoutButtonSelector); - if (isLogoutButtonVisible) { - console.log('Logout button is visible, clicking to logout'); - await this.clickByTestId(this.logoutButtonSelector); - const element = this.window.getByTestId(this.emailInputSelector); - await element.waitFor({ state: 'visible', timeout: 1000 }); - } else { - console.log('Logout button not visible, resetting the form'); - const isSecondPasswordVisible = await this.isElementVisible( - this.confirmPasswordInputSelector, - ); - if (isSecondPasswordVisible) { - await this.resetForm(); - await this.fillByTestId(this.confirmPasswordInputSelector, ''); + await allure.step('Logout For Reset', async () => { + const isLogoutButtonVisible = await this.isElementVisible(this.logoutButtonSelector); + if (isLogoutButtonVisible) { + console.log('Logout button is visible, clicking to logout'); + await this.clickByTestId(this.logoutButtonSelector); + const element = this.window.getByTestId(this.emailInputSelector); + await element.waitFor({ state: 'visible', timeout: 1000 }); } else { - await this.resetForm(); + console.log('Logout button not visible, resetting the form'); + const isSecondPasswordVisible = await this.isElementVisible( + this.confirmPasswordInputSelector, + ); + if (isSecondPasswordVisible) { + await this.resetForm(); + await this.fillByTestId(this.confirmPasswordInputSelector, ''); + } else { + await this.resetForm(); + } } - } + }); } - // Combined method to verify all elements on Registration page async verifyRegistrationElements() { - const checks = await Promise.all([ - this.isElementVisibleAndEditable(this.emailLabelSelector), - this.isElementVisibleAndEditable(this.emailInputSelector), - this.isElementVisibleAndEditable(this.passwordLabelSelector), - this.isElementVisibleAndEditable(this.passwordInputSelector), - this.isElementVisibleAndEditable(this.confirmPasswordLabelSelector), - this.isElementVisibleAndEditable(this.confirmPasswordInputSelector), - this.isElementVisibleAndEditable(this.registerButtonSelector), - ]); - - // Return true if all checks pass - return checks.every(isTrue => isTrue); + return await allure.step('Verify Registration Elements', async () => { + const checks = await Promise.all([ + this.isElementVisibleAndEditable(this.emailLabelSelector), + this.isElementVisibleAndEditable(this.emailInputSelector), + this.isElementVisibleAndEditable(this.passwordLabelSelector), + this.isElementVisibleAndEditable(this.passwordInputSelector), + this.isElementVisibleAndEditable(this.confirmPasswordLabelSelector), + this.isElementVisibleAndEditable(this.confirmPasswordInputSelector), + this.isElementVisibleAndEditable(this.registerButtonSelector), + ]); + return checks.every(isTrue => isTrue); + }); } async verifyAccountSetupElements() { - const checks = await Promise.all([ - this.isElementVisible(this.createNewTabSelector), - this.isElementVisible(this.importExistingTabSelector), - this.isElementVisible(this.accountSetupHeaderSelector), - this.isElementVisible(this.setRecoveryPhraseMessageSelector), - this.isElementVisible(this.recoveryPhraseMessageSelector), - this.isElementVisible(this.keyPairsMessageSelector), - this.isElementVisible(this.clearButtonSelector), - ]); - - // Return true if all checks pass - return checks.every(isTrue => isTrue); + return await allure.step('Verify Account Setup Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.createNewTabSelector), + this.isElementVisible(this.importExistingTabSelector), + this.isElementVisible(this.accountSetupHeaderSelector), + this.isElementVisible(this.setRecoveryPhraseMessageSelector), + this.isElementVisible(this.recoveryPhraseMessageSelector), + this.isElementVisible(this.keyPairsMessageSelector), + this.isElementVisible(this.clearButtonSelector), + ]); + return checks.every(isTrue => isTrue); + }); } async verifyFinalStepAccountSetupElements() { - const checks = await Promise.all([ - this.isElementVisible(this.nicknameInputSelector), - this.isElementVisible(this.keyTypeLabelSelector), - this.isElementVisible(this.keyTypeInputSelector), - this.isElementVisible(this.privateKeyLabelSelector), - this.isElementVisible(this.privateKeySpanSelector), - this.isElementVisible(this.showPrivateKeyButtonSelector), - this.isElementVisible(this.publicKeyLabelSelector), - this.isElementVisible(this.publicKeySpanSelector), - ]); - - // Return true if all checks pass - return checks.every(isTrue => isTrue); - } - - // Combined method to register + return await allure.step('Verify Final Step Account Setup Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.nicknameInputSelector), + this.isElementVisible(this.keyTypeLabelSelector), + this.isElementVisible(this.keyTypeInputSelector), + this.isElementVisible(this.privateKeyLabelSelector), + this.isElementVisible(this.privateKeySpanSelector), + this.isElementVisible(this.showPrivateKeyButtonSelector), + this.isElementVisible(this.publicKeyLabelSelector), + this.isElementVisible(this.publicKeySpanSelector), + ]); + return checks.every(isTrue => isTrue); + }); + } + async register(email, password, confirmPassword) { - await this.typeEmail(email); - await this.typePassword(password); - await this.typeConfirmPassword(confirmPassword); - await this.submitRegistration(); + await allure.step('Register', async () => { + await this.typeEmail(email); + await this.typePassword(password); + await this.typeConfirmPassword(confirmPassword); + await this.submitRegistration(); + }); } async completeRegistration(email, password) { - await this.register(email, password, password); - - const isTabVisible = await this.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - - await this.clickOnCreateNewTab(); - await this.clickOnUnderstandCheckbox(); - await this.clickOnGenerateButton(); - - await this.captureRecoveryPhraseWords(); - await this.clickOnUnderstandCheckbox(); - await this.clickOnVerifyButton(); - - await this.fillAllMissingRecoveryPhraseWords(); - await this.clickOnNextButton(); - - await this.waitForElementToDisappear(this.toastMessageSelector); - await this.clickOnFinalNextButtonWithRetry(); - - const toastMessage = await this.getToastMessage(); - expect(toastMessage).toBe('Key Pair saved successfully'); + await allure.step('Complete Registration', async () => { + await this.register(email, password, password); + const isTabVisible = await this.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + await this.clickOnCreateNewTab(); + await this.clickOnUnderstandCheckbox(); + await this.clickOnGenerateButton(); + await this.captureRecoveryPhraseWords(); + await this.clickOnUnderstandCheckbox(); + await this.clickOnVerifyButton(); + await this.fillAllMissingRecoveryPhraseWords(); + await this.clickOnNextButton(); + await this.waitForElementToDisappear(this.toastMessageSelector); + await this.clickOnFinalNextButtonWithRetry(); + const toastMessage = await this.getToastMessage(); + expect(toastMessage).toBe('Key Pair saved successfully'); + }); } async verifyUserExists(email) { - const query = ` + return await allure.step('Verify User Exists', async () => { + const query = ` SELECT * FROM User WHERE email = ?`; - const user = await queryDatabase(query, [email]); - return user !== undefined; + const user = await queryDatabase(query, [email]); + return user !== undefined; + }); } async getPublicKeyByEmail(email) { - const query = ` + return await allure.step('Get Public Key By Email', async () => { + const query = ` SELECT kp.public_key FROM KeyPair kp JOIN User u ON u.id = kp.user_id WHERE u.email = ?`; - - try { - const row = await queryDatabase(query, [email]); - return row ? row.public_key : null; - } catch (error) { - console.error('Error fetching public key:', error); - return null; - } + try { + const row = await queryDatabase(query, [email]); + return row ? row.public_key : null; + } catch (error) { + console.error('Error fetching public key:', error); + return null; + } + }); } async verifyPrivateKeyExistsByEmail(email) { - const query = ` + return await allure.step('Verify Private Key Exists By Email', async () => { + const query = ` SELECT kp.private_key FROM KeyPair kp JOIN User u ON u.id = kp.user_id WHERE u.email = ? AND kp.private_key IS NOT NULL`; - - try { - const row = await queryDatabase(query, [email]); - return row !== undefined; - } catch (error) { - console.error('Error checking for private key:', error); - return false; - } + try { + const row = await queryDatabase(query, [email]); + return row !== undefined; + } catch (error) { + console.error('Error checking for private key:', error); + return false; + } + }); } async verifyPublicKeyExistsByEmail(email) { - const query = ` + return await allure.step('Verify Public Key Exists By Email', async () => { + const query = ` SELECT kp.public_key FROM KeyPair kp JOIN User u ON u.id = kp.user_id WHERE u.email = ? AND kp.private_key IS NOT NULL`; - - try { - const row = await queryDatabase(query, [email]); - return row !== undefined; - } catch (error) { - console.error('Error checking for private key:', error); - return false; - } + try { + const row = await queryDatabase(query, [email]); + return row !== undefined; + } catch (error) { + console.error('Error checking for private key:', error); + return false; + } + }); } async typeEmail(email) { - await this.fillByTestId(this.emailInputSelector, email); + await allure.step('Type Email', async () => { + await this.fillByTestId(this.emailInputSelector, email); + }); } async typePassword(password) { - await this.fillByTestId(this.passwordInputSelector, password); + await allure.step('Type Password', async () => { + await this.fillByTestId(this.passwordInputSelector, password); + }); } async typeConfirmPassword(confirmPassword) { - await this.fillByTestId(this.confirmPasswordInputSelector, confirmPassword); + await allure.step('Type Confirm Password', async () => { + await this.fillByTestId(this.confirmPasswordInputSelector, confirmPassword); + }); } async submitRegistration() { - await this.clickByTestId(this.registerButtonSelector); + await allure.step('Submit Registration', async () => { + await this.clickByTestId(this.registerButtonSelector); + }); } async clickOnCreateNewTab() { - await this.clickByTestId(this.createNewTabSelector); + await allure.step('Click on Create New Tab', async () => { + await this.clickByTestId(this.createNewTabSelector); + }); } async clickOnImportTab() { - await this.clickByTestId(this.importExistingTabSelector); + await allure.step('Click on Import Tab', async () => { + await this.clickByTestId(this.importExistingTabSelector); + }); } async clickOnUnderstandCheckbox() { - await this.clickByTestId(this.understandBackedUpCheckboxSelector); + await allure.step('Click on Understand Checkbox', async () => { + await this.clickByTestId(this.understandBackedUpCheckboxSelector); + }); } async clickOnGenerateButton() { - await this.clickByTestId(this.generateButtonSelector); + await allure.step('Click on Generate Button', async () => { + await this.clickByTestId(this.generateButtonSelector); + }); } async clickOnVerifyButton() { - await this.clickByTestId(this.verifyButtonSelector); + await allure.step('Click on Verify Button', async () => { + await this.clickByTestId(this.verifyButtonSelector); + }); } async clickOnClearButton() { - await this.clickByTestId(this.clearButtonSelector); + await allure.step('Click on Clear Button', async () => { + await this.clickByTestId(this.clearButtonSelector); + }); } async clickOnNextButton() { - await this.clickByTestId(this.nextButtonSelector); + await allure.step('Click on Next Button', async () => { + await this.clickByTestId(this.nextButtonSelector); + }); } async clickOnNextImportButton() { - await this.clickByTestId(this.nextButtonImportSelector); + await allure.step('Click on Next Import Button', async () => { + await this.clickByTestId(this.nextButtonImportSelector); + }); } async scrollToNextImportButton() { - await this.scrollIntoViewByTestId(this.nextButtonImportSelector); + await allure.step('Scroll to Next Import Button', async () => { + await this.scrollIntoViewByTestId(this.nextButtonImportSelector); + }); } async getEmailErrorMessage() { - return await this.getTextByTestId(this.emailErrorMessageSelector); + return await allure.step('Get Email Error Message', async () => { + return await this.getTextByTestId(this.emailErrorMessageSelector); + }); } async isEmailErrorMessageVisible() { - return await this.isElementVisible(this.emailErrorMessageSelector); + return await allure.step('Is Email Error Message Visible', async () => { + return await this.isElementVisible(this.emailErrorMessageSelector); + }); } async getPasswordErrorMessage() { - return await this.getTextByTestId(this.passwordErrorMessageSelector); + return await allure.step('Get Password Error Message', async () => { + return await this.getTextByTestId(this.passwordErrorMessageSelector); + }); } async getConfirmPasswordErrorMessage() { - return await this.getTextByTestId(this.confirmPasswordErrorMessageSelector); + return await allure.step('Get Confirm Password Error Message', async () => { + return await this.getTextByTestId(this.confirmPasswordErrorMessageSelector); + }); } async isCreateNewTabVisible() { - return await this.isElementVisibleAndEditable(this.createNewTabSelector); + return await allure.step('Is Create New Tab Visible', async () => { + return await this.isElementVisibleAndEditable(this.createNewTabSelector); + }); } async isUnderstandCheckboxVisible() { - return await this.isElementVisible(this.understandBackedUpCheckboxSelector); + return await allure.step('Is Understand Checkbox Visible', async () => { + return await this.isElementVisible(this.understandBackedUpCheckboxSelector); + }); } async isGenerateButtonVisible() { - return await this.isElementVisible(this.generateButtonSelector); + return await allure.step('Is Generate Button Visible', async () => { + return await this.isElementVisible(this.generateButtonSelector); + }); } async isGenerateButtonDisabled() { - return await this.isDisabled(this.generateButtonSelector); + return await allure.step('Is Generate Button Disabled', async () => { + return await this.isDisabled(this.generateButtonSelector); + }); } async isClearButtonVisible() { - return await this.isElementVisible(this.clearButtonSelector); + return await allure.step('Is Clear Button Visible', async () => { + return await this.isElementVisible(this.clearButtonSelector); + }); } async getToastMessage() { - return await this.getTextByCssSelector(this.toastMessageSelector, 25000); + return await allure.step('Get Toast Message', async () => { + return await this.getTextByCssSelector(this.toastMessageSelector, 25000); + }); } async clickOnGenerateAgainButton() { - await this.clickByTestId(this.generateAgainButtonSelector); + await allure.step('Click on Generate Again Button', async () => { + await this.clickByTestId(this.generateAgainButtonSelector); + }); } async isConfirmPasswordFieldVisible() { - return await this.isElementVisible(this.confirmPasswordInputSelector, 5000); + return await allure.step('Is Confirm Password Field Visible', async () => { + return await this.isElementVisible(this.confirmPasswordInputSelector, 5000); + }); } async getPublicKey() { - return await this.getTextByTestId(this.publicKeySpanSelector); + return await allure.step('Get Public Key', async () => { + return await this.getTextByTestId(this.publicKeySpanSelector); + }); } async getPrivateKey() { - return await this.getTextByTestId(this.privateKeySpanSelector); + return await allure.step('Get Private Key', async () => { + return await this.getTextByTestId(this.privateKeySpanSelector); + }); } } diff --git a/automation/pages/SettingsPage.js b/automation/pages/SettingsPage.js index cb40e5a89..c2496003b 100644 --- a/automation/pages/SettingsPage.js +++ b/automation/pages/SettingsPage.js @@ -1,5 +1,6 @@ const BasePage = require('./BasePage'); const { queryDatabase } = require('../utils/databaseUtil'); +import { allure } from 'allure-playwright'; class SettingsPage extends BasePage { constructor(window) { @@ -9,8 +10,6 @@ class SettingsPage extends BasePage { } /* Selectors */ - - // Inputs nodeAccountidInputSelector = 'input-node-accountid'; passwordInputSelector = 'input-password'; indexInputSelector = 'input-index'; @@ -25,7 +24,6 @@ class SettingsPage extends BasePage { currentPasswordInputSelector = 'input-current-password'; newPasswordInputSelector = 'input-new-password'; - // Buttons settingsButtonSelector = 'button-menu-settings'; generalTabButtonSelector = 'tab-0'; organisationsTabButtonSelector = 'tab-1'; @@ -57,10 +55,8 @@ class SettingsPage extends BasePage { confirmChangePasswordButtonSelector = 'button-confirm-change-password'; closeButtonSelector = 'button-close'; - // Text decryptedPrivateKeySelector = 'span-private-key-0'; - // Prefixes indexCellSelectorPrefix = 'cell-index-'; nicknameCellSelectorPrefix = 'cell-nickname-'; accountIdCellSelectorPrefix = 'cell-account-'; @@ -68,220 +64,302 @@ class SettingsPage extends BasePage { publicKeyCellSelectorPrefix = 'span-public-key-'; async verifySettingsElements() { - const checks = await Promise.all([ - this.isElementVisible(this.generalTabButtonSelector), - this.isElementVisible(this.organisationsTabButtonSelector), - this.isElementVisible(this.keysTabButtonSelector), - this.isElementVisible(this.profileTabButtonSelector), - this.isElementVisible(this.mainnetTabButtonSelector), - this.isElementVisible(this.testnetTabButtonSelector), - this.isElementVisible(this.previewnetTabButtonSelector), - this.isElementVisible(this.customTabButtonSelector), - this.isElementVisible(this.darkTabButtonSelector), - this.isElementVisible(this.lightTabButtonSelector), - this.isElementVisible(this.systemTabButtonSelector), - ]); - - return checks.every(isTrue => isTrue); + return allure.step('Verify Settings Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.generalTabButtonSelector), + this.isElementVisible(this.organisationsTabButtonSelector), + this.isElementVisible(this.keysTabButtonSelector), + this.isElementVisible(this.profileTabButtonSelector), + this.isElementVisible(this.mainnetTabButtonSelector), + this.isElementVisible(this.testnetTabButtonSelector), + this.isElementVisible(this.previewnetTabButtonSelector), + this.isElementVisible(this.customTabButtonSelector), + this.isElementVisible(this.darkTabButtonSelector), + this.isElementVisible(this.lightTabButtonSelector), + this.isElementVisible(this.systemTabButtonSelector), + ]); + + return checks.every(isTrue => isTrue); + }); } async incrementIndex() { - let numericValue = parseInt(this.currentIndex); - numericValue++; - this.currentIndex = numericValue.toString(); + return allure.step('Increment Index', async () => { + let numericValue = parseInt(this.currentIndex); + numericValue++; + this.currentIndex = numericValue.toString(); + }); } async decrementIndex() { - let numericValue = parseInt(this.currentIndex); - numericValue--; - this.currentIndex = numericValue.toString(); + return allure.step('Decrement Index', async () => { + let numericValue = parseInt(this.currentIndex); + numericValue--; + this.currentIndex = numericValue.toString(); + }); } - // Function to verify keys exist for a given index and user's email async verifyKeysExistByIndexAndEmail(email, index) { - const query = ` - SELECT public_key, private_key - FROM KeyPair kp - JOIN User u ON u.id = kp.user_id - WHERE u.email = ? AND kp."index" = ?`; - - try { - const row = await queryDatabase(query, [email, index]); - return row !== undefined && row.public_key !== undefined && row.private_key !== undefined; - } catch (error) { - console.error('Error verifying keys for index:', error); - return false; - } + return allure.step('Verify Keys Exist by Index and Email', async () => { + const query = ` + SELECT public_key, private_key + FROM KeyPair kp + JOIN User u ON u.id = kp.user_id + WHERE u.email = ? AND kp."index" = ?`; + + try { + const row = await queryDatabase(query, [email, index]); + return row !== undefined && row.public_key !== undefined && row.private_key !== undefined; + } catch (error) { + console.error('Error verifying keys for index:', error); + return false; + } + }); } async getKeyRowCount() { - return await this.countElementsByTestId(this.indexCellSelectorPrefix); + return allure.step('Get Key Row Count', async () => { + return await this.countElementsByTestId(this.indexCellSelectorPrefix); + }); } async getRowDataByIndex(index) { - return { - index: await this.getTextByTestId(this.indexCellSelectorPrefix + index), - nickname: await this.getTextByTestId(this.nicknameCellSelectorPrefix + index), - accountID: await this.getTextByTestId(this.accountIdCellSelectorPrefix + index), - keyType: await this.getTextByTestId(this.keyTypeCellSelectorPrefix + index), - publicKey: await this.getTextByTestId(this.publicKeyCellSelectorPrefix + index), - }; + return allure.step('Get Row Data by Index', async () => { + return { + index: await this.getTextByTestId(this.indexCellSelectorPrefix + index), + nickname: await this.getTextByTestId(this.nicknameCellSelectorPrefix + index), + accountID: await this.getTextByTestId(this.accountIdCellSelectorPrefix + index), + keyType: await this.getTextByTestId(this.keyTypeCellSelectorPrefix + index), + publicKey: await this.getTextByTestId(this.publicKeyCellSelectorPrefix + index), + }; + }); } async clickOnSettingsButton() { - await this.clickByTestId(this.settingsButtonSelector); + return allure.step('Click on Settings Button', async () => { + await this.clickByTestId(this.settingsButtonSelector); + }); } async clickOnKeysTab() { - await this.clickByTestId(this.keysTabButtonSelector); + return allure.step('Click on Keys Tab', async () => { + await this.clickByTestId(this.keysTabButtonSelector); + }); } async clickOnProfileTab() { - await this.clickByTestId(this.profileTabButtonSelector); + return allure.step('Click on Profile Tab', async () => { + await this.clickByTestId(this.profileTabButtonSelector); + }); } async clickOnRestoreButton() { - const { delay } = require('../utils/util.js'); - const maxRetries = 10; - let attempt = 0; - - while (attempt < maxRetries) { - await this.clickByTestId(this.restoreButtonSelector); - if (await this.isElementVisible(this.continueButtonSelector, 3000)) { - return; + return allure.step('Click on Restore Button', async () => { + const { delay } = require('../utils/util.js'); + const maxRetries = 10; + let attempt = 0; + + while (attempt < maxRetries) { + await this.clickByTestId(this.restoreButtonSelector); + if (await this.isElementVisible(this.continueButtonSelector, 3000)) { + return; + } + await delay(2000); + attempt++; } - await delay(2000); - attempt++; - } - throw new Error( - `Failed to click on restore button and see continue button after ${maxRetries} attempts`, - ); + throw new Error( + `Failed to click on restore button and see continue button after ${maxRetries} attempts`, + ); + }); } async clickOnContinueButton() { - await this.clickByTestId(this.continueButtonSelector, 25000); + return allure.step('Click on Continue Button', async () => { + await this.clickByTestId(this.continueButtonSelector, 25000); + }); } async fillInPassword(password) { - await this.fillByTestId(this.passwordInputSelector, password); + return allure.step('Fill in Password', async () => { + await this.fillByTestId(this.passwordInputSelector, password); + }); } async clickOnPasswordContinueButton() { - await this.clickByTestId(this.continuePasswordButtonSelector); + return allure.step('Click on Password Continue Button', async () => { + await this.clickByTestId(this.continuePasswordButtonSelector); + }); } async fillInIndex(index = 1) { - await this.fillByTestId(this.indexInputSelector, index); + return allure.step('Fill in Index', async () => { + await this.fillByTestId(this.indexInputSelector, index); + }); } async clickOnIndexContinueButton() { - await this.clickByTestId(this.continueIndexButtonSelector); + return allure.step('Click on Index Continue Button', async () => { + await this.clickByTestId(this.continueIndexButtonSelector); + }); } async fillInNickname(nickname) { - await this.fillByTestId(this.nicknameInputSelector, nickname); + return allure.step('Fill in Nickname', async () => { + await this.fillByTestId(this.nicknameInputSelector, nickname); + }); } async clickOnNicknameContinueButton() { - await this.clickByTestId(this.continueNicknameButtonSelector, 12000); + return allure.step('Click on Nickname Continue Button', async () => { + await this.clickByTestId(this.continueNicknameButtonSelector, 12000); + }); } async clickOnContinuePhraseButton() { - await this.clickByTestId(this.continuePhraseButtonSelector); + return allure.step('Click on Continue Phrase Button', async () => { + await this.clickByTestId(this.continuePhraseButtonSelector); + }); } async clickOnCustomTab() { - await this.clickByTestId(this.customTabButtonSelector); + return allure.step('Click on Custom Tab', async () => { + await this.clickByTestId(this.customTabButtonSelector); + }); } async clickOnImportButton() { - await this.clickByTestId(this.importButtonSelector); + return allure.step('Click on Import Button', async () => { + await this.clickByTestId(this.importButtonSelector); + }); } async clickOnECDSADropDown() { - await this.clickByTestId(this.ecdsaImportLinkSelector); + return allure.step('Click on ECDSA Drop Down', async () => { + await this.clickByTestId(this.ecdsaImportLinkSelector); + }); } async clickOnED25519DropDown() { - await this.clickByTestId(this.ed25519ImportLinkSelector); + return allure.step('Click on ED25519 Drop Down', async () => { + await this.clickByTestId(this.ed25519ImportLinkSelector); + }); } async fillInECDSAPrivateKey(ecdsaPrivateKey) { - await this.fillByTestId(this.ecdsaPrivateKeyInputSelector, ecdsaPrivateKey); + return allure.step('Fill in ECDSA Private Key', async () => { + await this.fillByTestId(this.ecdsaPrivateKeyInputSelector, ecdsaPrivateKey); + }); } async fillInED25519PrivateKey(ecdsaPrivateKey) { - await this.fillByTestId(this.ed25519PrivateKeyInputSelector, ecdsaPrivateKey); + return allure.step('Fill in ED25519 Private Key', async () => { + await this.fillByTestId(this.ed25519PrivateKeyInputSelector, ecdsaPrivateKey); + }); } async fillInECDSANickname(ecdsaNickname) { - await this.fillByTestId(this.ecdsaNicknameInputSelector, ecdsaNickname); + return allure.step('Fill in ECDSA Nickname', async () => { + await this.fillByTestId(this.ecdsaNicknameInputSelector, ecdsaNickname); + }); } async fillInED25519Nickname(ecdsaNickname) { - await this.fillByTestId(this.ed25519PNicknameInputSelector, ecdsaNickname); + return allure.step('Fill in ED25519 Nickname', async () => { + await this.fillByTestId(this.ed25519PNicknameInputSelector, ecdsaNickname); + }); } async fillInECDSAPassword(password) { - await this.fillByTestId(this.ecdsaPasswordInputSelector, password); + return allure.step('Fill in ECDSA Password', async () => { + await this.fillByTestId(this.ecdsaPasswordInputSelector, password); + }); } async fillInED25519Password(password) { - await this.fillByTestId(this.ed25519PasswordInputSelector, password); + return allure.step('Fill in ED25519 Password', async () => { + await this.fillByTestId(this.ed25519PasswordInputSelector, password); + }); } async clickOnECDSAImportButton() { - await this.clickByTestId(this.ecdsaImportButtonSelector); + return allure.step('Click on ECDSA Import Button', async () => { + await this.clickByTestId(this.ecdsaImportButtonSelector); + }); } async clickOnED25519ImportButton() { - await this.clickByTestId(this.ed25519ImportButtonSelector); + return allure.step('Click on ED25519 Import Button', async () => { + await this.clickByTestId(this.ed25519ImportButtonSelector); + }); } async clickOnEyeDecryptIcon() { - await this.clickByTestId(this.decryptMainPrivateKeyButtonSelector); + return allure.step('Click on Eye Decrypt Icon', async () => { + await this.clickByTestId(this.decryptMainPrivateKeyButtonSelector); + }); } async fillInDecryptPassword(password) { - await this.fillByTestId(this.decryptPasswordInputSelector, password); + return allure.step('Fill in Decrypt Password', async () => { + await this.fillByTestId(this.decryptPasswordInputSelector, password); + }); } async clickOnDecryptButton() { - await this.clickByTestId(this.decryptPasswordButtonSelector); + return allure.step('Click on Decrypt Button', async () => { + await this.clickByTestId(this.decryptPasswordButtonSelector); + }); } async getPrivateKeyText() { - return await this.getTextByTestId(this.decryptedPrivateKeySelector); + return allure.step('Get Private Key Text', async () => { + return await this.getTextByTestId(this.decryptedPrivateKeySelector); + }); } async clickOnDeleteButtonAtIndex(index) { - await this.clickByTestId(this.deleteKeyButtonPrefix + index); + return allure.step('Click on Delete Button at Index', async () => { + await this.clickByTestId(this.deleteKeyButtonPrefix + index); + }); } async clickOnDeleteKeyPairButton() { - await this.clickByTestId(this.deleteKeyPairButton); + return allure.step('Click on Delete Key Pair Button', async () => { + await this.clickByTestId(this.deleteKeyPairButton); + }); } async fillInCurrentPassword(password) { - await this.fillByTestId(this.currentPasswordInputSelector, password); + return allure.step('Fill in Current Password', async () => { + await this.fillByTestId(this.currentPasswordInputSelector, password); + }); } async fillInNewPassword(password) { - await this.fillByTestId(this.newPasswordInputSelector, password); + return allure.step('Fill in New Password', async () => { + await this.fillByTestId(this.newPasswordInputSelector, password); + }); } async clickOnChangePasswordButton() { - await this.clickByTestId(this.changePasswordButtonSelector); + return allure.step('Click on Change Password Button', async () => { + await this.clickByTestId(this.changePasswordButtonSelector); + }); } async clickOnConfirmChangePassword() { - await this.clickByTestId(this.confirmChangePasswordButtonSelector); + return allure.step('Click on Confirm Change Password', async () => { + await this.clickByTestId(this.confirmChangePasswordButtonSelector); + }); } async clickOnCloseButton() { - await this.waitForElementToBeVisible(this.closeButtonSelector, 15000); - await this.clickByTestId(this.closeButtonSelector); + return allure.step('Click on Close Button', async () => { + await this.waitForElementToBeVisible(this.closeButtonSelector, 15000); + await this.clickByTestId(this.closeButtonSelector); + }); } } + module.exports = SettingsPage; diff --git a/automation/pages/TransactionPage.js b/automation/pages/TransactionPage.js index 7ba8b92e4..9ddb2ad2e 100644 --- a/automation/pages/TransactionPage.js +++ b/automation/pages/TransactionPage.js @@ -2,6 +2,7 @@ const BasePage = require('./BasePage'); const { getAccountDetails, getTransactionDetails } = require('../utils/mirrorNodeAPI'); const { queryDatabase } = require('../utils/databaseUtil'); const { decodeAndFlattenKeys } = require('../utils/keyUtil'); +import { allure } from 'allure-playwright'; class TransactionPage extends BasePage { constructor(window) { @@ -130,304 +131,351 @@ class TransactionPage extends BasePage { // Method to close the 'Save Draft' modal if it appears async closeDraftModal() { - // Wait for the button to be visible with a timeout - const modalButton = this.window.getByTestId(this.discardModalDraftButtonSelector); - await modalButton.waitFor({ state: 'visible', timeout: 500 }).catch(e => {}); + return await allure.step('Close Draft Modal', async () => { + const modalButton = this.window.getByTestId(this.discardModalDraftButtonSelector); + await modalButton.waitFor({ state: 'visible', timeout: 500 }).catch(e => {}); - // If the modal is visible, then click the button to close the modal - if (await modalButton.isVisible()) { - await modalButton.click(); - } + if (await modalButton.isVisible()) { + await modalButton.click(); + } + }); } // Combined method to verify all elements on Create transaction page async verifyAccountCreateTransactionElements() { - const checks = await Promise.all([ - this.isElementVisible(this.saveDraftButtonSelector), - this.isElementVisible(this.singleTabSelector), - this.isElementVisible(this.complexTabSelector), - this.isElementVisible(this.signAndSubmitButtonSelector), - this.isElementVisible(this.payerDropdownSelector), - this.isElementVisible(this.initialBalanceInputSelector), - this.isElementVisible(this.maxAutoAssociationsInputSelector), - this.isElementVisible(this.accountMemoInputSelector), - this.isElementVisible(this.nicknameInputSelector), - ]); - - // Return true if all checks pass - return checks.every(isTrue => isTrue); + return await allure.step('Verify Account Create Transaction Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.saveDraftButtonSelector), + this.isElementVisible(this.singleTabSelector), + this.isElementVisible(this.complexTabSelector), + this.isElementVisible(this.signAndSubmitButtonSelector), + this.isElementVisible(this.payerDropdownSelector), + this.isElementVisible(this.initialBalanceInputSelector), + this.isElementVisible(this.maxAutoAssociationsInputSelector), + this.isElementVisible(this.accountMemoInputSelector), + this.isElementVisible(this.nicknameInputSelector), + ]); + + return checks.every(isTrue => isTrue); + }); } async verifyFileCreateTransactionElements() { - const checks = await Promise.all([ - this.isElementVisible(this.signAndSubmitFileCreateSelector), - this.isElementVisible(this.fileContentTextFieldSelector), - this.isElementVisible(this.fileCreateTransactionMemoInputSelector), - this.isElementVisible(this.fileCreateMemoInputSelector), - this.isElementVisible(this.fileCreateExpirationDateInputSelector), - this.isElementVisible(this.fileCreateNameInputSelector), - this.isElementVisible(this.fileCreateDescriptionInputSelector), - this.isElementVisible(this.fileContentTextFieldSelector), - this.isElementVisible(this.signAndSubmitFileCreateSelector), - ]); - return checks.every(isTrue => isTrue); + return await allure.step('Verify File Create Transaction Elements', async () => { + const checks = await Promise.all([ + this.isElementVisible(this.signAndSubmitFileCreateSelector), + this.isElementVisible(this.fileContentTextFieldSelector), + this.isElementVisible(this.fileCreateTransactionMemoInputSelector), + this.isElementVisible(this.fileCreateMemoInputSelector), + this.isElementVisible(this.fileCreateExpirationDateInputSelector), + this.isElementVisible(this.fileCreateNameInputSelector), + this.isElementVisible(this.fileCreateDescriptionInputSelector), + this.isElementVisible(this.fileContentTextFieldSelector), + this.isElementVisible(this.signAndSubmitFileCreateSelector), + ]); + return checks.every(isTrue => isTrue); + }); } async verifyConfirmTransactionInformation(typeTransaction) { - await this.window.waitForSelector( - '[data-testid="modal-confirm-transaction"][style*="display: block"]', - { state: 'visible', timeout: 10000 }, - ); - const regex = /^\d+\.\d+\.\d+@\d+\.\d+$/; - const transactionId = await this.getTextByTestId(this.textTransactionIdSelector); - const txType = await this.getTextByTestId(this.textTypeTransactionSelector); - const maxTxFee = await this.getTextByTestId(this.textMaxTxFeeSelector); - const isSignButtonVisible = await this.isElementVisible(this.buttonSignTransactionSelector); - - const checks = [ - regex.test(transactionId), - txType === typeTransaction, - maxTxFee.length > 0, - isSignButtonVisible, - ]; - - return checks.every(isTrue => isTrue); + return await allure.step('Verify Confirm Transaction Information', async () => { + await this.window.waitForSelector( + '[data-testid="modal-confirm-transaction"][style*="display: block"]', + { state: 'visible', timeout: 10000 }, + ); + const regex = /^\d+\.\d+\.\d+@\d+\.\d+$/; + const transactionId = await this.getTextByTestId(this.textTransactionIdSelector); + const txType = await this.getTextByTestId(this.textTypeTransactionSelector); + const maxTxFee = await this.getTextByTestId(this.textMaxTxFeeSelector); + const isSignButtonVisible = await this.isElementVisible(this.buttonSignTransactionSelector); + + const checks = [ + regex.test(transactionId), + txType === typeTransaction, + maxTxFee.length > 0, + isSignButtonVisible, + ]; + + return checks.every(isTrue => isTrue); + }); } async mirrorGetAccountResponse(accountId) { - const accountDetails = await getAccountDetails(accountId); - console.log('Account Details:', accountDetails); + let accountDetails; + await allure.step('Execute Mirror node Accounts API call', async () => { + accountDetails = await getAccountDetails(accountId); + console.log('Account Details:', accountDetails); + }); return accountDetails; } async mirrorGetTransactionResponse(transactionId) { - const transactionDetails = await getTransactionDetails(transactionId); - if (transactionDetails.transactions.length > 0) { - console.log('Transaction Details:', transactionDetails.transactions[0]); - } else { - console.log('Transaction not found in mirror node'); - } + let transactionDetails; + await allure.step('Execute Mirror node Transactions API call', async () => { + transactionDetails = await getTransactionDetails(transactionId); + if (transactionDetails.transactions.length > 0) { + console.log('Transaction Details:', transactionDetails.transactions[0]); + } else { + console.log('Transaction not found in mirror node'); + } + }); return transactionDetails; } async closeCompletedTransaction() { - const isCompletedTxModalVisible = await this.isElementVisible( - this.modalTransactionSuccessSelector, - ); - if (isCompletedTxModalVisible) { - await this.clickOnCloseButtonForCompletedTransaction(); - } + return await allure.step('Close Completed Transaction', async () => { + const isCompletedTxModalVisible = await this.isElementVisible( + this.modalTransactionSuccessSelector, + ); + if (isCompletedTxModalVisible) { + await this.clickOnCloseButtonForCompletedTransaction(); + } + }); } async clickOnTransactionsMenuButton() { - await this.clickByTestId(this.transactionsMenuButtonSelector); + return await allure.step('Click On Transactions Menu Button', async () => { + await this.clickByTestId(this.transactionsMenuButtonSelector); + }); } async clickOnAccountsMenuButton() { - await this.clickByTestId(this.accountsMenuButtonSelector); + return await allure.step('Click On Accounts Menu Button', async () => { + await this.clickByTestId(this.accountsMenuButtonSelector); + }); } async clickOnCreateNewTransactionButton() { - await this.clickByTestId(this.createNewTransactionButtonSelector); + return await allure.step('Click On Create New Transaction Button', async () => { + await this.clickByTestId(this.createNewTransactionButtonSelector); + }); } - /** - * Generalized function to attempt clicking on a transaction link and check for the visibility of a target element. - * @param {string} linkSelector - The test ID selector for the transaction link. - * @param {string} targetSelector - The test ID selector for the target element to verify page transition. - * @param {string} transactionType - A string representing the type of transaction for logging purposes. - * @throws {Error} Throws an error if unable to navigate to the transaction page after multiple attempts. - */ async clickOnTransactionLink(linkSelector, targetSelector, transactionType) { - console.log(`Attempting to click on ${transactionType} Transaction link`); - const maxAttempts = 10; // Maximum number of attempts to find the correct element - for (let index = 0; index < maxAttempts; index++) { - try { - await this.clickByTestIdWithIndex(linkSelector, index); - // Check if the next page element that should appear is visible - if (await this.isElementVisible(targetSelector)) { - console.log(`Successfully navigated to the ${transactionType} Transaction page.`); - return; + await allure.step(`Click On ${transactionType} Transaction Link`, async () => { + const maxAttempts = 10; + for (let index = 0; index < maxAttempts; index++) { + try { + await this.clickByTestIdWithIndex(linkSelector, index); + if (await this.isElementVisible(targetSelector)) { + console.log(`Successfully navigated to the ${transactionType} Transaction page.`); + return; + } + } catch (error) { + console.log( + `Attempt ${index + 1}: Failed to find or click on the correct element, retrying...`, + ); } - } catch (error) { - console.log( - `Attempt ${index + 1}: Failed to find or click on the correct element, retrying...`, - ); } - } - throw new Error( - `Failed to navigate to the ${transactionType} Transaction page after multiple attempts`, - ); + throw new Error( + `Failed to navigate to the ${transactionType} Transaction page after multiple attempts`, + ); + }); } async clickOnMenuLink(linkSelector, activeClass, transactionType) { - console.log(`Attempting to click on ${transactionType} menu link`); - const maxAttempts = 10; // Maximum number of attempts to find the correct element - for (let index = 0; index < maxAttempts; index++) { - try { - await this.clickByTestIdWithIndex(linkSelector, index); - return; - } catch (error) { - console.log( - `Attempt ${index + 1}: Failed to find or click on the correct element, retrying...`, - ); + await allure.step(`Click On ${transactionType} Menu Link`, async () => { + const maxAttempts = 10; + for (let index = 0; index < maxAttempts; index++) { + try { + await this.clickByTestIdWithIndex(linkSelector, index); + return; + } catch (error) { + console.log( + `Attempt ${index + 1}: Failed to find or click on the correct element, retrying...`, + ); + } } - } - throw new Error(`Failed to activate the ${transactionType} menu link after multiple attempts`); + throw new Error( + `Failed to activate the ${transactionType} menu link after multiple attempts`, + ); + }); } async clickOnCreateAccountTransaction() { - await this.clickOnTransactionLink( - this.createAccountSublinkSelector, - this.signAndSubmitButtonSelector, - 'Create Account', - ); + return await allure.step('Click On Create Account Transaction', async () => { + await this.clickOnTransactionLink( + this.createAccountSublinkSelector, + this.signAndSubmitButtonSelector, + 'Create Account', + ); + }); } async clickOnDeleteAccountTransaction() { - await this.clickOnTransactionLink( - this.deleteAccountSublinkSelector, - this.transferAccountInputSelector, - 'Delete Account', - ); + return await allure.step('Click On Delete Account Transaction', async () => { + await this.clickOnTransactionLink( + this.deleteAccountSublinkSelector, + this.transferAccountInputSelector, + 'Delete Account', + ); + }); } async clickOnUpdateAccountTransaction() { - await this.clickOnTransactionLink( - this.updateAccountSublinkSelector, - this.updateAccountInputSelector, - 'Update Account', - ); + return await allure.step('Click On Update Account Transaction', async () => { + await this.clickOnTransactionLink( + this.updateAccountSublinkSelector, + this.updateAccountInputSelector, + 'Update Account', + ); + }); } async clickOnApproveAllowanceTransaction() { - await this.clickOnTransactionLink( - this.allowanceSublinkSelector, - this.signAndSubmitAllowanceSelector, - 'Approve Allowance', - ); + return await allure.step('Click On Approve Allowance Transaction', async () => { + await this.clickOnTransactionLink( + this.allowanceSublinkSelector, + this.signAndSubmitAllowanceSelector, + 'Approve Allowance', + ); + }); } async clickOnTransferTokensTransaction() { - await this.clickOnTransactionLink( - this.transferTokensSublinkSelector, - this.signAndSubmitTransferSelector, - 'Transfer Tokens', - ); + return await allure.step('Click On Transfer Tokens Transaction', async () => { + await this.clickOnTransactionLink( + this.transferTokensSublinkSelector, + this.signAndSubmitTransferSelector, + 'Transfer Tokens', + ); + }); } async clickOnFileCreateTransaction() { - await this.clickOnTransactionLink( - this.createFileSublinkSelector, - this.signAndSubmitFileCreateSelector, - 'Create File', - ); + return await allure.step('Click On File Create Transaction', async () => { + await this.clickOnTransactionLink( + this.createFileSublinkSelector, + this.signAndSubmitFileCreateSelector, + 'Create File', + ); + }); } async clickOnReadCreateTransaction() { - await this.clickOnTransactionLink( - this.readFileSublinkSelector, - this.signAndReadFileButtonSelector, - 'Read File', - ); + return await allure.step('Click On Read Create Transaction', async () => { + await this.clickOnTransactionLink( + this.readFileSublinkSelector, + this.signAndReadFileButtonSelector, + 'Read File', + ); + }); } async clickOnUpdateFileSublink() { - await this.clickOnTransactionLink( - this.updateFileSublinkSelector, - this.signAndSubmitUpdateFileSelector, - 'Update File', - ); + return await allure.step('Click On Update File Sublink', async () => { + await this.clickOnTransactionLink( + this.updateFileSublinkSelector, + this.signAndSubmitUpdateFileSelector, + 'Update File', + ); + }); } async clickOnAppendFileSublink() { - await this.clickOnTransactionLink( - this.appendFileSublinkSelector, - this.signAndSubmitFileAppendButtonSelector, - 'Append File', - ); + return await allure.step('Click On Append File Sublink', async () => { + await this.clickOnTransactionLink( + this.appendFileSublinkSelector, + this.signAndSubmitFileAppendButtonSelector, + 'Append File', + ); + }); } async verifyTransactionExists(transactionId, transactionType) { - const query = ` + return await allure.step('Verify Transaction Exists', async () => { + const query = ` SELECT COUNT(*) AS count FROM "Transaction" WHERE transaction_id = ? AND type = ?`; - try { - const row = await queryDatabase(query, [transactionId, transactionType]); - return row ? row.count > 0 : false; - } catch (error) { - console.error('Error verifying transaction:', error); - return false; - } + try { + const row = await queryDatabase(query, [transactionId, transactionType]); + return row ? row.count > 0 : false; + } catch (error) { + console.error('Error verifying transaction:', error); + return false; + } + }); } async verifyAccountExists(accountId) { - const query = ` + return await allure.step('Verify Account Exists', async () => { + const query = ` SELECT COUNT(*) AS count FROM HederaAccount WHERE account_id = ?`; - try { - const row = await queryDatabase(query, [accountId]); - return row ? row.count > 0 : false; - } catch (error) { - console.error('Error verifying account:', error); - return false; - } + try { + const row = await queryDatabase(query, [accountId]); + return row ? row.count > 0 : false; + } catch (error) { + console.error('Error verifying account:', error); + return false; + } + }); } async verifyFileExists(fileId) { - const query = ` + return await allure.step('Verify File Exists', async () => { + const query = ` SELECT COUNT(*) AS count FROM HederaFile WHERE file_id = ?`; - try { - const row = await queryDatabase(query, [fileId]); - return row ? row.count > 0 : false; - } catch (error) { - console.error('Error verifying file:', error); - return false; - } + try { + const row = await queryDatabase(query, [fileId]); + return row ? row.count > 0 : false; + } catch (error) { + console.error('Error verifying file:', error); + return false; + } + }); } async addPublicKeyAtDepth(depth) { - await this.clickAddButton(depth); - await this.selectPublicKeyOption(depth); - const publicKey = await this.generateRandomPublicKey(); - await this.fillInPublicKeyField(publicKey); - await this.clickInsertPublicKey(); + return await allure.step(`Add Public Key At Depth ${depth}`, async () => { + await this.clickAddButton(depth); + await this.selectPublicKeyOption(depth); + const publicKey = await this.generateRandomPublicKey(); + await this.fillInPublicKeyField(publicKey); + await this.clickInsertPublicKey(); + }); } async addThresholdKeyAtDepth(depth) { - await this.clickAddButton(depth); - await this.selectThreshold(depth); + return await allure.step(`Add Threshold Key At Depth ${depth}`, async () => { + await this.clickAddButton(depth); + await this.selectThreshold(depth); + }); } async createComplexKeyStructure() { - let currentDepth = '0'; + return await allure.step('Create Complex Key Structure', async () => { + let currentDepth = '0'; - await this.addThresholdKeyAtDepth(currentDepth, '0'); + await this.addThresholdKeyAtDepth(currentDepth, '0'); - await this.addPublicKeyAtDepth(`${currentDepth}-0`); - await this.addPublicKeyAtDepth(`${currentDepth}-0`); + await this.addPublicKeyAtDepth(`${currentDepth}-0`); + await this.addPublicKeyAtDepth(`${currentDepth}-0`); - await this.addThresholdKeyAtDepth(currentDepth, '0'); + await this.addThresholdKeyAtDepth(currentDepth, '0'); - await this.addPublicKeyAtDepth(`${currentDepth}-1`); - await this.addPublicKeyAtDepth(`${currentDepth}-1`); + await this.addPublicKeyAtDepth(`${currentDepth}-1`); + await this.addPublicKeyAtDepth(`${currentDepth}-1`); - currentDepth = `${currentDepth}-0`; - await this.addThresholdKeyAtDepth(currentDepth); + currentDepth = `${currentDepth}-0`; + await this.addThresholdKeyAtDepth(currentDepth); - await this.addPublicKeyAtDepth(`0-0-2`); - await this.addPublicKeyAtDepth(`0-0-2`); + await this.addPublicKeyAtDepth(`0-0-2`); + await this.addPublicKeyAtDepth(`0-0-2`); + }); } async decodeByteCode(bytecode) { - return decodeAndFlattenKeys(bytecode); + return await allure.step('Decode Byte Code', async () => { + return decodeAndFlattenKeys(bytecode); + }); } getAllGeneratedPublicKeys() { @@ -435,951 +483,1254 @@ class TransactionPage extends BasePage { } async keysMatch(decodedKeys, generatedKeys) { - const sortedDecodedKeys = decodedKeys.map(key => key.toLowerCase()).sort(); - const sortedGeneratedKeys = generatedKeys.map(key => key.toLowerCase()).sort(); + return await allure.step('Match Keys', async () => { + const sortedDecodedKeys = decodedKeys.map(key => key.toLowerCase()).sort(); + const sortedGeneratedKeys = generatedKeys.map(key => key.toLowerCase()).sort(); - if (sortedDecodedKeys.length !== sortedGeneratedKeys.length) { - return false; - } + if (sortedDecodedKeys.length !== sortedGeneratedKeys.length) { + return false; + } - return sortedDecodedKeys.every((value, index) => value === sortedGeneratedKeys[index]); + return sortedDecodedKeys.every((value, index) => value === sortedGeneratedKeys[index]); + }); } async generateRandomPublicKey() { - const header = '302a300506032b6570032100'; - const hexChars = '0123456789ABCDEF'; - let publicKey = ''; - for (let i = 0; i < 64; i++) { - publicKey += hexChars.charAt(Math.floor(Math.random() * hexChars.length)); - } - const publicKeyWithPrefix = header + publicKey; - this.generatedPublicKeys.push(publicKeyWithPrefix); // Store the generated public key - return publicKey; - } - - /** - * Finds the index of the element containing the specified account ID. - * @param {string} accountId - The account ID to search for. - * @returns {number} The index of the element with the specified account ID, or -1 if not found. - */ + return await allure.step('Generate Random Public Key', async () => { + const header = '302a300506032b6570032100'; + const hexChars = '0123456789ABCDEF'; + let publicKey = ''; + for (let i = 0; i < 64; i++) { + publicKey += hexChars.charAt(Math.floor(Math.random() * hexChars.length)); + } + const publicKeyWithPrefix = header + publicKey; + this.generatedPublicKeys.push(publicKeyWithPrefix); // Store the generated public key + return publicKey; + }); + } + async findAccountIndexById(accountId) { - const count = await this.countElementsByTestId(this.accountIdPrefixSelector); - if (count === 0) { - return 0; - } else { - for (let i = 0; i < count; i++) { - const idText = await this.getTextByTestId(this.accountIdPrefixSelector + i); - if (idText === accountId) { - return i; + return await allure.step('Find Account Index By ID', async () => { + const count = await this.countElementsByTestId(this.accountIdPrefixSelector); + if (count === 0) { + return 0; + } else { + for (let i = 0; i < count; i++) { + const idText = await this.getTextByTestId(this.accountIdPrefixSelector + i); + if (idText === accountId) { + return i; + } } + return -1; // Return -1 if the account ID is not found } - return -1; // Return -1 if the account ID is not found - } + }); } async isAccountCardVisible(accountId) { - await this.waitForElementToBeVisible(this.addNewAccountButtonSelector); - const index = await this.findAccountIndexById(accountId); - if (index === -1) { - return false; // account not found - } else { - return await this.isElementVisible(this.accountIdPrefixSelector + index); - } + return await allure.step('Check If Account Card Is Visible', async () => { + await this.waitForElementToBeVisible(this.addNewAccountButtonSelector); + const index = await this.findAccountIndexById(accountId); + if (index === -1) { + return false; // account not found + } else { + return await this.isElementVisible(this.accountIdPrefixSelector + index); + } + }); } async ensureAccountExists(password) { - if (await this.isAccountsListEmpty()) { - await this.createNewAccount(password); - } + return await allure.step('Ensure Account Exists', async () => { + if (await this.isAccountsListEmpty()) { + await this.createNewAccount(password); + } + }); } async ensureFileExists(text, password) { - if (await this.isGeneratedFilesEmpty()) { - await this.createFile(text, password); - } + return await allure.step('Ensure File Exists', async () => { + if (await this.isGeneratedFilesEmpty()) { + await this.createFile(text, password); + } + }); } async createNewAccount(password, options = {}, isComingFromDraft = false) { - const { - isComplex = false, - maxAutoAssociations = null, - initialFunds = null, - isReceiverSigRequired = false, - memo = null, - } = options; - if (!isComingFromDraft) { - await this.clickOnCreateNewTransactionButton(); - await this.clickOnCreateAccountTransaction(); - } - // Handle complex key creation - if (isComplex) { - await this.handleComplexKeyCreation(); - } - - // Handle optional settings - const optionHandlers = [ - { - condition: maxAutoAssociations !== null, - handler: () => this.fillInMaxAccountAssociations(maxAutoAssociations.toString()), - }, - { condition: initialFunds !== null, handler: () => this.fillInInitialFunds(initialFunds) }, - { condition: isReceiverSigRequired, handler: () => this.clickOnReceiverSigRequiredSwitch() }, - { condition: memo !== null, handler: () => this.fillInMemo(memo) }, - ]; - - for (const { condition, handler } of optionHandlers) { - if (condition) await handler(); - } + let newAccountId, newTransactionId; + await allure.step('Execute account create tx', async () => { + const { + isComplex = false, + maxAutoAssociations = null, + initialFunds = null, + isReceiverSigRequired = false, + memo = null, + } = options; + if (!isComingFromDraft) { + await this.clickOnCreateNewTransactionButton(); + await this.clickOnCreateAccountTransaction(); + } + // Handle complex key creation + if (isComplex) { + await this.handleComplexKeyCreation(); + } - await this.clickOnSignAndSubmitButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - await this.waitForCreatedAtToBeVisible(); + // Handle optional settings + const optionHandlers = [ + { + condition: maxAutoAssociations !== null, + handler: () => this.fillInMaxAccountAssociations(maxAutoAssociations.toString()), + }, + { condition: initialFunds !== null, handler: () => this.fillInInitialFunds(initialFunds) }, + { + condition: isReceiverSigRequired, + handler: () => this.clickOnReceiverSigRequiredSwitch(), + }, + { condition: memo !== null, handler: () => this.fillInMemo(memo) }, + ]; + + for (const { condition, handler } of optionHandlers) { + if (condition) await handler(); + } - const newTransactionId = await this.getTransactionDetailsId(); - const transactionDetails = await this.mirrorGetTransactionResponse(newTransactionId); - const newAccountId = transactionDetails.transactions[0].entity_id; + await this.clickOnSignAndSubmitButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + await this.waitForCreatedAtToBeVisible(); - await this.clickOnTransactionsMenuButton(); - await this.addAccountsToList(newAccountId); + newTransactionId = await this.getTransactionDetailsId(); + const transactionDetails = await this.mirrorGetTransactionResponse(newTransactionId); + newAccountId = transactionDetails.transactions[0].entity_id; + await this.clickOnTransactionsMenuButton(); + await this.addAccountsToList(newAccountId); + }); return { newAccountId, newTransactionId }; } // Helper method for complex key creation async handleComplexKeyCreation() { - await this.clickOnComplexTab(); - await this.clickOnCreateNewComplexKeyButton(); - await this.createComplexKeyStructure(); - await this.clickOnDoneButton(); + return await allure.step('Handle Complex Key Creation', async () => { + await this.clickOnComplexTab(); + await this.clickOnCreateNewComplexKeyButton(); + await this.createComplexKeyStructure(); + await this.clickOnDoneButton(); + }); } async deleteAccount(accountId, password) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnDeleteAccountTransaction(); - await this.fillInTransferAccountId(); - await this.fillInDeletedAccountId(accountId); - await this.clickOnSignAndSubmitDeleteButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); - await this.removeAccountFromList(accountId); + let transactionId; + await allure.step('Delete Account', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnDeleteAccountTransaction(); + await this.fillInTransferAccountId(); + await this.fillInDeletedAccountId(accountId); + await this.clickOnSignAndSubmitDeleteButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + await this.removeAccountFromList(accountId); + }); return transactionId; } async updateAccount(accountId, password, maxAutoAssociations, memo) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnUpdateAccountTransaction(); - await this.fillInUpdatedAccountId(accountId); - await this.fillInMaxAutoAssociations(maxAutoAssociations); - await this.fillInMemoUpdate(memo); - await this.fillInTransactionMemoUpdate('Transaction memo update'); - if (await this.isSwitchToggledOn(this.acceptStakingRewardsSwitchSelector)) { - await this.clickOnAcceptStakingRewardsSwitch(); //disabling staking rewards - } - await this.waitForElementPresentInDOM(this.updateAccountIdFetchedDivSelector, 30000); - await this.clickOnSignAndSubmitUpdateButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); + let transactionId; + await allure.step('Update Account', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnUpdateAccountTransaction(); + await this.fillInUpdatedAccountId(accountId); + await this.fillInMaxAutoAssociations(maxAutoAssociations); + await this.fillInMemoUpdate(memo); + await this.fillInTransactionMemoUpdate('Transaction memo update'); + if (await this.isSwitchToggledOn(this.acceptStakingRewardsSwitchSelector)) { + await this.clickOnAcceptStakingRewardsSwitch(); //disabling staking rewards + } + await this.waitForElementPresentInDOM(this.updateAccountIdFetchedDivSelector, 30000); + await this.clickOnSignAndSubmitUpdateButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + }); return transactionId; } async waitForCreatedAtToBeVisible() { - await this.waitForElementToBeVisible(this.transactionDetailsCreatedAtSelector, 25000); + return await allure.step('Wait For Created At To Be Visible', async () => { + await this.waitForElementToBeVisible(this.transactionDetailsCreatedAtSelector, 25000); + }); } async getTransactionDetailsId() { - return await this.getTextByTestId(this.transactionDetailsIdSelector); + return await allure.step('Get Transaction Details ID', async () => { + return await this.getTextByTestId(this.transactionDetailsIdSelector); + }); } async createFile(fileContent, password) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnFileServiceLink(); - await this.clickOnFileCreateTransaction(); - const publicKey = await this.getPublicKeyText(); - await this.fillInFileContent(fileContent); - await this.clickOnSignAndSubmitFileCreateButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); - const transactionDetails = await this.mirrorGetTransactionResponse(transactionId); - const fileId = transactionDetails.transactions[0].entity_id; - await this.addGeneratedFile(fileId, fileContent, publicKey); + let transactionId, fileId; + await allure.step('Create File', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnFileServiceLink(); + await this.clickOnFileCreateTransaction(); + const publicKey = await this.getPublicKeyText(); + await this.fillInFileContent(fileContent); + await this.clickOnSignAndSubmitFileCreateButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + const transactionDetails = await this.mirrorGetTransactionResponse(transactionId); + fileId = transactionDetails.transactions[0].entity_id; + await this.addGeneratedFile(fileId, fileContent, publicKey); + }); return { transactionId, fileId }; } async readFile(fileId, password) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnFileServiceLink(); - await this.clickOnReadCreateTransaction(); - await this.fillInFileIdForRead(fileId); - await this.clickOnSignAndReadFileButton(); - await this.fillInPasswordForRead(password); - await this.clickOnSignReadQueryButton(); - await this.waitForElementToDisappear(this.toastMessageSelector); - return await this.readFileContentFromTextArea(); + let fileContent; + await allure.step('Read File', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnFileServiceLink(); + await this.clickOnReadCreateTransaction(); + await this.fillInFileIdForRead(fileId); + await this.clickOnSignAndReadFileButton(); + await this.fillInPasswordForRead(password); + await this.clickOnSignReadQueryButton(); + await this.waitForElementToDisappear(this.toastMessageSelector); + fileContent = await this.readFileContentFromTextArea(); + }); + return fileContent; } async updateFile(fileId, fileContent, password) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnFileServiceLink(); - await this.clickOnUpdateFileSublink(); - await this.fillInFileIdForUpdate(fileId); - const publicKey = await this.getPublicKeyFromFile(fileId); - await this.fillInPublicKeyForFile(publicKey); - await this.fillInFileContentForUpdate(fileContent); - await this.clickOnSignAndSubmitUpdateFileButton(); - await this.clickOnSignFileButton(); - await this.fillInPasswordForFile(password); - await this.clickOnContinueSignFileButton(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); - await this.updateFileText(fileId, fileContent); + let transactionId; + await allure.step('Update File', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnFileServiceLink(); + await this.clickOnUpdateFileSublink(); + await this.fillInFileIdForUpdate(fileId); + const publicKey = await this.getPublicKeyFromFile(fileId); + await this.fillInPublicKeyForFile(publicKey); + await this.fillInFileContentForUpdate(fileContent); + await this.clickOnSignAndSubmitUpdateFileButton(); + await this.clickOnSignFileButton(); + await this.fillInPasswordForFile(password); + await this.clickOnContinueSignFileButton(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + await this.updateFileText(fileId, fileContent); + }); return transactionId; } async appendFile(fileId, fileContent, password) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnFileServiceLink(); - await this.clickOnAppendFileSublink(); - await this.fillInFileIdForAppend(fileId); - const publicKey = await this.getPublicKeyFromFile(fileId); - await this.fillInPublicKeyForFile(publicKey); - await this.fillInFileContentForAppend(fileContent); - await this.clickOnSignAndSubmitFileAppendButton(); - await this.clickOnSignFileButton(); - await this.fillInPasswordForFile(password); - await this.clickOnContinueSignFileButton(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); - await this.appendToFileText(fileId, fileContent); + let transactionId; + await allure.step('Append File', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnFileServiceLink(); + await this.clickOnAppendFileSublink(); + await this.fillInFileIdForAppend(fileId); + const publicKey = await this.getPublicKeyFromFile(fileId); + await this.fillInPublicKeyForFile(publicKey); + await this.fillInFileContentForAppend(fileContent); + await this.clickOnSignAndSubmitFileAppendButton(); + await this.clickOnSignFileButton(); + await this.fillInPasswordForFile(password); + await this.clickOnContinueSignFileButton(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + await this.appendToFileText(fileId, fileContent); + }); return transactionId; } async approveAllowance(spenderAccountId, amount, password, isTestNegative = false) { - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnApproveAllowanceTransaction(); - if (isTestNegative) { - await this.fillByTestId(this.allowanceOwnerAccountSelector, '0.0.999'); - } else { - await this.fillInAllowanceOwnerAccount(); - } - await this.fillInAllowanceAmount(amount); - await this.fillInSpenderAccountId(spenderAccountId); - await this.clickOnSignAndSubmitAllowanceButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); - await this.clickOnTransactionsMenuButton(); + let transactionId; + await allure.step('Approve Allowance', async () => { + await this.clickOnTransactionsMenuButton(); + await this.clickOnCreateNewTransactionButton(); + await this.clickOnApproveAllowanceTransaction(); + if (isTestNegative) { + await this.fillByTestId(this.allowanceOwnerAccountSelector, '0.0.999'); + } else { + await this.fillInAllowanceOwnerAccount(); + } + await this.fillInAllowanceAmount(amount); + await this.fillInSpenderAccountId(spenderAccountId); + await this.clickOnSignAndSubmitAllowanceButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + }); return transactionId; } async transferAmountBetweenAccounts(toAccountId, amount, password, options = {}) { const { isSupposedToFail = false } = options; + let transactionId = null; - await this.clickOnTransactionsMenuButton(); - await this.clickOnCreateNewTransactionButton(); - await this.clickOnTransferTokensTransaction(); - await this.fillInTransferFromAccountId(); - await this.fillInTransferAmountFromAccount(amount); - await this.fillInTransferToAccountId(toAccountId); - await this.clickOnAddTransferFromButton(); - await this.fillInTransferAmountToAccount(amount); - await this.clickOnAddTransferToButton(); - - await this.clickOnSignAndSubmitTransferButton(); - await this.clickSignTransactionButton(); - await this.fillInPassword(password); - await this.clickOnPasswordContinue(); - - if (isSupposedToFail) { - return null; - } else { - await this.waitForCreatedAtToBeVisible(); - const transactionId = await this.getTransactionDetailsId(); + await allure.step('Transfer Amount Between Accounts', async () => { await this.clickOnTransactionsMenuButton(); - return transactionId; - } + await this.clickOnCreateNewTransactionButton(); + await this.clickOnTransferTokensTransaction(); + await this.fillInTransferFromAccountId(); + await this.fillInTransferAmountFromAccount(amount); + await this.fillInTransferToAccountId(toAccountId); + await this.clickOnAddTransferFromButton(); + await this.fillInTransferAmountToAccount(amount); + await this.clickOnAddTransferToButton(); + + await this.clickOnSignAndSubmitTransferButton(); + await this.clickSignTransactionButton(); + await this.fillInPassword(password); + await this.clickOnPasswordContinue(); + + if (!isSupposedToFail) { + await this.waitForCreatedAtToBeVisible(); + transactionId = await this.getTransactionDetailsId(); + await this.clickOnTransactionsMenuButton(); + } + }); + + return transactionId; } async clickOnReceiverSigRequiredSwitch() { - await this.toggleSwitchByTestId(this.receiverSigRequiredSwitchSelector); + return await allure.step('Click On Receiver Signature Required Switch', async () => { + await this.toggleSwitchByTestId(this.receiverSigRequiredSwitchSelector); + }); } async clickONReceiverSigRequiredSwitchForUpdate() { - await this.toggleSwitchByTestId(this.receiverSigRequiredSwitchForUpdateSelector); + return await allure.step('Click On Receiver Signature Required Switch For Update', async () => { + await this.toggleSwitchByTestId(this.receiverSigRequiredSwitchForUpdateSelector); + }); } async isReceiverSigRequiredSwitchToggledOn() { - return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchSelector); + return await allure.step('Is Receiver Signature Required Switch Toggled On', async () => { + return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchSelector); + }); } async isReceiverSigRequiredSwitchToggledOnUpdatePage() { - return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchForUpdateSelector); + return await allure.step( + 'Is Receiver Signature Required Switch Toggled On Update Page', + async () => { + return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchForUpdateSelector); + }, + ); } async isReceiverSigRequiredSwitchToggledOnForUpdatePage() { - return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchForUpdateSelector); + return await allure.step( + 'Is Receiver Signature Required Switch Toggled On For Update Page', + async () => { + return await this.isSwitchToggledOn(this.receiverSigRequiredSwitchForUpdateSelector); + }, + ); } async clickOnAcceptStakingRewardsSwitch() { - await this.toggleSwitchByTestId(this.acceptStakingRewardsSwitchSelector); + return await allure.step('Click On Accept Staking Rewards Switch', async () => { + await this.toggleSwitchByTestId(this.acceptStakingRewardsSwitchSelector); + }); } async isAcceptStakingRewardsSwitchToggledOn() { - return await this.isSwitchToggledOn(this.acceptStakingRewardsSwitchSelector); + return await allure.step('Is Accept Staking Rewards Switch Toggled On', async () => { + return await this.isSwitchToggledOn(this.acceptStakingRewardsSwitchSelector); + }); } async fillInMemo(memo) { - await this.fillByTestId(this.accountMemoInputSelector, memo); + return await allure.step('Fill In Memo', async () => { + await this.fillByTestId(this.accountMemoInputSelector, memo); + }); } async getMemoText() { - return this.getTextFromInputFieldByTestId(this.accountMemoInputSelector); + return await allure.step('Get Memo Text', async () => { + return this.getTextFromInputFieldByTestId(this.accountMemoInputSelector); + }); } async fillInInitialFunds(amount) { - const { delay } = await import('../utils/util.js'); - const getFilledBalance = async () => - this.getTextFromInputFieldByTestId(this.initialBalanceInputSelector); + return await allure.step('Fill In Initial Funds', async () => { + const { delay } = await import('../utils/util.js'); + const getFilledBalance = async () => + this.getTextFromInputFieldByTestId(this.initialBalanceInputSelector); - let filledBalance = await getFilledBalance(); + let filledBalance = await getFilledBalance(); - while (filledBalance !== amount) { - await this.fillByTestId(this.initialBalanceInputSelector, amount); - await delay(1000); - filledBalance = await getFilledBalance(); - } + while (filledBalance !== amount) { + await this.fillByTestId(this.initialBalanceInputSelector, amount); + await delay(1000); + filledBalance = await getFilledBalance(); + } + }); } async getInitialFundsValue() { - return this.getTextFromInputFieldByTestId(this.initialBalanceInputSelector); + return await allure.step('Get Initial Funds Value', async () => { + return this.getTextFromInputFieldByTestId(this.initialBalanceInputSelector); + }); } async fillInMaxAccountAssociations(amount) { - await this.fillByTestId(this.maxAutoAssociationsInputSelector, amount); + return await allure.step('Fill In Max Account Associations', async () => { + await this.fillByTestId(this.maxAutoAssociationsInputSelector, amount); + }); } async getFilledMaxAccountAssociations() { - return this.getTextFromInputFieldByTestId(this.maxAutoAssociationsInputSelector); + return await allure.step('Get Filled Max Account Associations', async () => { + return this.getTextFromInputFieldByTestId(this.maxAutoAssociationsInputSelector); + }); } async clickOnSignAndSubmitButton() { - await this.clickByTestId(this.signAndSubmitButtonSelector, 10000); + return await allure.step('Click On Sign And Submit Button', async () => { + await this.clickByTestId(this.signAndSubmitButtonSelector, 10000); + }); } async clickOnSignAndSubmitDeleteButton() { - await this.clickByTestId(this.signAndSubmitDeleteButtonSelector); + return await allure.step('Click On Sign And Submit Delete Button', async () => { + await this.clickByTestId(this.signAndSubmitDeleteButtonSelector); + }); } async clickOnSignAndSubmitUpdateButton() { - await this.clickByTestId(this.signAndSubmitUpdateButtonSelector); + return await allure.step('Click On Sign And Submit Update Button', async () => { + await this.clickByTestId(this.signAndSubmitUpdateButtonSelector); + }); } async clickSignTransactionButton() { - // Construct the selector for the confirmation transaction modal that is visible and in a displayed state - const modalSelector = `[data-testid="${this.confirmTransactionModalSelector}"][style*="display: block"]`; - await this.window.waitForSelector(modalSelector, { state: 'visible', timeout: 15000 }); + return await allure.step('Click Sign Transaction Button', async () => { + const modalSelector = `[data-testid="${this.confirmTransactionModalSelector}"][style*="display: block"]`; + await this.window.waitForSelector(modalSelector, { state: 'visible', timeout: 15000 }); - // Construct the selector for the enabled sign button within the visible modal - const signButtonSelector = `${modalSelector} [data-testid="${this.buttonSignTransactionSelector}"]:enabled`; + const signButtonSelector = `${modalSelector} [data-testid="${this.buttonSignTransactionSelector}"]:enabled`; - // Wait for the sign button to be visible and enabled, then attempt to click it - await this.window.waitForSelector(signButtonSelector, { state: 'visible', timeout: 15000 }); - await this.window.click(signButtonSelector); + await this.window.waitForSelector(signButtonSelector, { state: 'visible', timeout: 15000 }); + await this.window.click(signButtonSelector); - // After clicking the sign button, wait for the password input to become visible - await this.waitForElementToBeVisible(this.passwordSignTransactionInputSelector); + await this.waitForElementToBeVisible(this.passwordSignTransactionInputSelector); + }); } async clickOnPasswordContinue() { - await this.clickByTestId(this.passwordContinueButtonSelector); + return await allure.step('Click On Password Continue', async () => { + await this.clickByTestId(this.passwordContinueButtonSelector); + }); } async clickOnCloseButtonForCompletedTransaction() { - await this.clickByTestId(this.closeCompletedTxButtonSelector); + return await allure.step('Click On Close Button For Completed Transaction', async () => { + await this.clickByTestId(this.closeCompletedTxButtonSelector); + }); } async fillInPassword(password) { - await this.fillByTestId(this.passwordSignTransactionInputSelector, password); + return await allure.step('Fill In Password', async () => { + await this.fillByTestId(this.passwordSignTransactionInputSelector, password); + }); } async clickOnCancelTransaction() { - await this.clickByTestId(this.buttonCancelTransactionSelector); + return await allure.step('Click On Cancel Transaction', async () => { + await this.clickByTestId(this.buttonCancelTransactionSelector); + }); } async clickAddButton(depth) { - await this.clickByTestId(this.addComplexButtonIndex + depth); + return await allure.step('Click Add Button', async () => { + await this.clickByTestId(this.addComplexButtonIndex + depth); + }); } async selectPublicKeyOption(depth) { - await this.clickByTestId(this.addPublicKeyButtonIndex + depth); + return await allure.step('Select Public Key Option', async () => { + await this.clickByTestId(this.addPublicKeyButtonIndex + depth); + }); } async selectThreshold(depth) { - await this.clickByTestId(this.selectThresholdNumberIndex + depth); + return await allure.step('Select Threshold', async () => { + await this.clickByTestId(this.selectThresholdNumberIndex + depth); + }); } async fillInPublicKeyField(publicKey) { - await this.fillByTestId(this.publicKeyComplexInputSelector, publicKey); + return await allure.step('Fill In Public Key Field', async () => { + await this.fillByTestId(this.publicKeyComplexInputSelector, publicKey); + }); } async clickInsertPublicKey() { - await this.clickByTestId(this.insertPublicKeyButtonSelector); + return await allure.step('Click Insert Public Key', async () => { + await this.clickByTestId(this.insertPublicKeyButtonSelector); + }); } async clickOnCreateNewComplexKeyButton() { - await this.clickByTestId(this.spanCreateNewComplexKeyButtonSelector); + return await allure.step('Click On Create New Complex Key Button', async () => { + await this.clickByTestId(this.spanCreateNewComplexKeyButtonSelector); + }); } async clickOnComplexTab() { - await this.clickByTestId(this.complexTabSelector); + return await allure.step('Click On Complex Tab', async () => { + await this.clickByTestId(this.complexTabSelector); + }); } async clickOnDoneButton() { - await this.clickByTestId(this.doneComplexKeyButtonSelector); + return await allure.step('Click On Done Button', async () => { + await this.clickByTestId(this.doneComplexKeyButtonSelector); + }); } - /** - * Generalized function to fill in the account ID input field, remove the last character, - * type it again to trigger UI updates, and retry until the target button is enabled. - * @param {string} accountId - The account ID to be filled in. - * @param {string} inputSelector - The test ID selector for the input field. - * @param {string} buttonSelector - The test ID selector for the button to check. - */ async fillInAccountId(accountId, inputSelector, buttonSelector) { - const maxRetries = 100; // Maximum number of retries before giving up - let attempt = 0; + return await allure.step('Fill In Account ID', async () => { + const maxRetries = 100; + let attempt = 0; - while (attempt < maxRetries) { - const { delay } = await import('../utils/util.js'); - // Fill the input normally - const element = this.window.getByTestId(inputSelector); - await element.fill(accountId); + while (attempt < maxRetries) { + const { delay } = await import('../utils/util.js'); + const element = this.window.getByTestId(inputSelector); + await element.fill(accountId); - // Grab the last character of accountId and prepare the version without the last char - const lastChar = accountId.slice(-1); - const withoutLastChar = accountId.slice(0, -1); + const lastChar = accountId.slice(-1); + const withoutLastChar = accountId.slice(0, -1); - // Clear the input and retype it without the last character - await element.fill(withoutLastChar); + await element.fill(withoutLastChar); - // Type the last character - await this.window.keyboard.type(lastChar); + await this.window.keyboard.type(lastChar); - // Check if the target button is enabled - if (await this.isButtonEnabled(buttonSelector)) { - return; // Exit the function if the button is enabled - } + if (await this.isButtonEnabled(buttonSelector)) { + return; + } - // Wait a short period before retrying to allow for UI updates - await delay(100); // Wait for 100 milliseconds + await delay(100); - attempt++; // Increment the attempt counter - } + attempt++; + } - throw new Error( - `Failed to enable the button after multiple attempts. Selector: ${buttonSelector}`, - ); + throw new Error( + `Failed to enable the button after multiple attempts. Selector: ${buttonSelector}`, + ); + }); } async fillInDeletedAccountId(accountId) { - await this.fillInAccountId( - accountId, - this.deletedAccountInputSelector, - this.signAndSubmitDeleteButtonSelector, - ); + return await allure.step('Fill In Deleted Account ID', async () => { + await this.fillInAccountId( + accountId, + this.deletedAccountInputSelector, + this.signAndSubmitDeleteButtonSelector, + ); + }); } async fillInUpdatedAccountId(accountId) { - await this.fillInAccountId( - accountId, - this.updateAccountInputSelector, - this.signAndSubmitUpdateButtonSelector, - ); + return await allure.step('Fill In Updated Account ID', async () => { + await this.fillInAccountId( + accountId, + this.updateAccountInputSelector, + this.signAndSubmitUpdateButtonSelector, + ); + }); } async fillInSpenderAccountId(accountId) { - await this.fillInAccountId( - accountId, - this.allowanceSpenderAccountSelector, - this.signAndSubmitAllowanceSelector, - ); + return await allure.step('Fill In Spender Account ID', async () => { + await this.fillInAccountId( + accountId, + this.allowanceSpenderAccountSelector, + this.signAndSubmitAllowanceSelector, + ); + }); } async fillInSpenderAccountIdNormally(accountId) { - await this.fillByTestId(this.allowanceSpenderAccountSelector, accountId); + return await allure.step('Fill In Spender Account ID Normally', async () => { + await this.fillByTestId(this.allowanceSpenderAccountSelector, accountId); + }); } async getSpenderAccountId() { - return await this.getTextFromInputFieldByTestId(this.allowanceSpenderAccountSelector); + return await allure.step('Get Spender Account ID', async () => { + return await this.getTextFromInputFieldByTestId(this.allowanceSpenderAccountSelector); + }); } async fillInTransferAccountId() { - const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); - const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); - await this.fillByTestId(this.transferAccountInputSelector, firstAccountId); - return firstAccountId; + return await allure.step('Fill In Transfer Account ID', async () => { + const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); + const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); + await this.fillByTestId(this.transferAccountInputSelector, firstAccountId); + return firstAccountId; + }); } async getFirstAccountIdFromText(allAccountIds) { - const accountIdsArray = allAccountIds.split(' '); - return accountIdsArray[0]; + return await allure.step('Get First Account ID From Text', async () => { + const accountIdsArray = allAccountIds.split(' '); + return accountIdsArray[0]; + }); } async getPayerAccountId() { - const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); - return await this.getFirstAccountIdFromText(allAccountIdsText); + return await allure.step('Get Payer Account ID', async () => { + const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); + return await this.getFirstAccountIdFromText(allAccountIdsText); + }); } async addAccountsToList(accountId) { - this.generatedAccounts.push(accountId); + return await allure.step('Add Accounts To List', async () => { + this.generatedAccounts.push(accountId); + }); } async removeAccountFromList(accountId) { - this.generatedAccounts = this.generatedAccounts.filter(id => id !== accountId); + return await allure.step('Remove Account From List', async () => { + this.generatedAccounts = this.generatedAccounts.filter(id => id !== accountId); + }); } async addGeneratedFile(fileId, text, publicKey) { - this.generatedFiles[fileId] = { text, publicKey }; + return await allure.step('Add Generated File', async () => { + this.generatedFiles[fileId] = { text, publicKey }; + }); } async getTextFromCache(fileId) { - const file = this.generatedFiles[fileId]; - return file ? file.text : null; + return await allure.step('Get Text From Cache', async () => { + const file = this.generatedFiles[fileId]; + return file ? file.text : null; + }); } async getPublicKeyFromFile(fileId) { - const file = this.generatedFiles[fileId]; - return file ? file.publicKey : null; + return await allure.step('Get Public Key From File', async () => { + const file = this.generatedFiles[fileId]; + return file ? file.publicKey : null; + }); } async listGeneratedFileKeys() { - return Object.keys(this.generatedFiles); + return await allure.step('List Generated File Keys', async () => { + return Object.keys(this.generatedFiles); + }); } async getFirsFileIdFromCache() { - const keys = await this.listGeneratedFileKeys(); - return keys.length > 0 ? keys[0] : null; + return await allure.step('Get First File ID From Cache', async () => { + const keys = await this.listGeneratedFileKeys(); + return keys.length > 0 ? keys[0] : null; + }); } async isGeneratedFilesEmpty() { - return Object.keys(this.generatedFiles).length === 0; + return await allure.step('Is Generated Files Empty', async () => { + return Object.keys(this.generatedFiles).length === 0; + }); } async updateFileText(fileId, newText) { - if (this.generatedFiles[fileId]) { - this.generatedFiles[fileId].text = newText; - } else { - throw new Error(`File with ID ${fileId} does not exist.`); - } + return await allure.step('Update File Text', async () => { + if (this.generatedFiles[fileId]) { + this.generatedFiles[fileId].text = newText; + } else { + throw new Error(`File with ID ${fileId} does not exist.`); + } + }); } async appendToFileText(fileId, textToAppend) { - if (this.generatedFiles[fileId]) { - this.generatedFiles[fileId].text += textToAppend; - } else { - throw new Error(`File with ID ${fileId} does not exist.`); - } + return await allure.step('Append To File Text', async () => { + if (this.generatedFiles[fileId]) { + this.generatedFiles[fileId].text += textToAppend; + } else { + throw new Error(`File with ID ${fileId} does not exist.`); + } + }); } async isAccountsListEmpty() { - return this.generatedAccounts.length === 0; + return await allure.step('Is Accounts List Empty', async () => { + return this.generatedAccounts.length === 0; + }); } async getFirstAccountFromList() { - return this.generatedAccounts[0]; + return await allure.step('Get First Account From List', async () => { + return this.generatedAccounts[0]; + }); } async fillInMaxAutoAssociations(amount) { - await this.fillByTestId(this.maxAutoAssociationsUpdateInputSelector, amount); + return await allure.step('Fill In Max Auto Associations', async () => { + await this.fillByTestId(this.maxAutoAssociationsUpdateInputSelector, amount); + }); } async getFilledMaxAutoAssociationsOnUpdatePage() { - return await this.getTextFromInputFieldByTestId(this.maxAutoAssociationsUpdateInputSelector); + return await allure.step('Get Filled Max Auto Associations On Update Page', async () => { + return await this.getTextFromInputFieldByTestId(this.maxAutoAssociationsUpdateInputSelector); + }); } async fillInMemoUpdate(memo) { - await this.fillByTestId(this.memoUpdateInputSelector, memo); + return await allure.step('Fill In Memo Update', async () => { + await this.fillByTestId(this.memoUpdateInputSelector, memo); + }); } async fillInUpdateAccountIdNormally(accountId) { - await this.fillByTestId(this.updateAccountInputSelector, accountId); + return await allure.step('Fill In Update Account ID Normally', async () => { + await this.fillByTestId(this.updateAccountInputSelector, accountId); + }); } async fillInDeleteAccountIdNormally(accountId) { - await this.fillByTestId(this.deletedAccountInputSelector, accountId); + return await allure.step('Fill In Delete Account ID Normally', async () => { + await this.fillByTestId(this.deletedAccountInputSelector, accountId); + }); } async getMemoTextOnUpdatePage() { - return await this.getTextFromInputFieldByTestId(this.memoUpdateInputSelector); + return await allure.step('Get Memo Text On Update Page', async () => { + return await this.getTextFromInputFieldByTestId(this.memoUpdateInputSelector); + }); } async fillInTransactionMemoUpdate(memo) { - await this.fillByTestId(this.transactionMemoUpdateInputSelector, memo); + return await allure.step('Fill In Transaction Memo Update', async () => { + await this.fillByTestId(this.transactionMemoUpdateInputSelector, memo); + }); } async getTransactionMemoText() { - return await this.getTextFromInputFieldByTestId(this.transactionMemoUpdateInputSelector); + return await allure.step('Get Transaction Memo Text', async () => { + return await this.getTextFromInputFieldByTestId(this.transactionMemoUpdateInputSelector); + }); } async getTransactionMemoTextForDeletePage() { - return await this.getTextFromInputFieldByTestId(this.deleteAccountMemoInputSelector); + return await allure.step('Get Transaction Memo Text For Delete Page', async () => { + return await this.getTextFromInputFieldByTestId(this.deleteAccountMemoInputSelector); + }); } async fillInNickname(nickname) { - await this.fillByTestId(this.nicknameInputSelector, nickname); + return await allure.step('Fill In Nickname', async () => { + await this.fillByTestId(this.nicknameInputSelector, nickname); + }); } async fillInTransferFromAccountId() { - const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); - const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); - await this.fillByTestId(this.transferFromAccountIdInputSelector, firstAccountId); - return firstAccountId; + return await allure.step('Fill In Transfer From Account ID', async () => { + const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); + const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); + await this.fillByTestId(this.transferFromAccountIdInputSelector, firstAccountId); + return firstAccountId; + }); } async fillInTransferAmountFromAccount(amount) { - await this.fillByTestId(this.transferAmountFromAccountInputSelector, amount); + return await allure.step('Fill In Transfer Amount From Account', async () => { + await this.fillByTestId(this.transferAmountFromAccountInputSelector, amount); + }); } async fillInTransferToAccountId(accountId) { - await this.fillByTestId(this.transferToAccountIdInputSelector, accountId); + return await allure.step('Fill In Transfer To Account ID', async () => { + await this.fillByTestId(this.transferToAccountIdInputSelector, accountId); + }); } async fillInTransferAmountToAccount(amount) { - await this.fillByTestId(this.transferAmountToAccountInputSelector, amount); + return await allure.step('Fill In Transfer Amount To Account', async () => { + await this.fillByTestId(this.transferAmountToAccountInputSelector, amount); + }); } async clickOnAddTransferFromButton() { - await this.clickByTestId(this.addTransferFromButtonSelector); + return await allure.step('Click On Add Transfer From Button', async () => { + await this.clickByTestId(this.addTransferFromButtonSelector); + }); } async clickOnAddTransferToButton() { - await this.clickByTestId(this.addTransferToButtonSelector); + return await allure.step('Click On Add Transfer To Button', async () => { + await this.clickByTestId(this.addTransferToButtonSelector); + }); } async clickOnAddRestButton() { - await this.clickByTestId(this.addRestButtonSelector); + return await allure.step('Click On Add Rest Button', async () => { + await this.clickByTestId(this.addRestButtonSelector); + }); } async clickOnSignAndSubmitTransferButton() { - await this.clickByTestId(this.signAndSubmitTransferSelector); + return await allure.step('Click On Sign And Submit Transfer Button', async () => { + await this.clickByTestId(this.signAndSubmitTransferSelector); + }); } async getHbarAmountValueForTwoAccounts() { - return await this.getAllTextByTestId(this.hbarAmountValueSelector); + return await allure.step('Get HBAR Amount Value For Two Accounts', async () => { + return await this.getAllTextByTestId(this.hbarAmountValueSelector); + }); } async isSignAndSubmitButtonEnabled() { - return await this.isButtonEnabled(this.signAndSubmitTransferSelector); + return await allure.step('Is Sign And Submit Button Enabled', async () => { + return await this.isButtonEnabled(this.signAndSubmitTransferSelector); + }); } async fillInAllowanceOwnerAccount() { - const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); - const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); - await this.fillByTestId(this.allowanceOwnerAccountSelector, firstAccountId); - return firstAccountId; + return await allure.step('Fill In Allowance Owner Account', async () => { + const allAccountIdsText = await this.getTextByTestId(this.payerDropdownSelector); + const firstAccountId = await this.getFirstAccountIdFromText(allAccountIdsText); + await this.fillByTestId(this.allowanceOwnerAccountSelector, firstAccountId); + return firstAccountId; + }); } async getAllowanceOwnerAccountId() { - return await this.getTextFromInputFieldByTestId(this.allowanceOwnerAccountSelector); + return await allure.step('Get Allowance Owner Account ID', async () => { + return await this.getTextFromInputFieldByTestId(this.allowanceOwnerAccountSelector); + }); } async fillInAllowanceAmount(amount) { - await this.fillByTestId(this.allowanceAmountSelector, amount); + return await allure.step('Fill In Allowance Amount', async () => { + await this.fillByTestId(this.allowanceAmountSelector, amount); + }); } async getAllowanceAmount() { - return await this.getTextFromInputFieldByTestId(this.allowanceAmountSelector); + return await allure.step('Get Allowance Amount', async () => { + return await this.getTextFromInputFieldByTestId(this.allowanceAmountSelector); + }); } async clickOnSignAndSubmitAllowanceButton() { - await this.clickByTestId(this.signAndSubmitAllowanceSelector); + return await allure.step('Click On Sign And Submit Allowance Button', async () => { + await this.clickByTestId(this.signAndSubmitAllowanceSelector); + }); } async isSignAndSubmitCreateAccountButtonVisible() { - return await this.isElementVisible(this.signAndSubmitButtonSelector); + return await allure.step('Is Sign And Submit Create Account Button Visible', async () => { + return await this.isElementVisible(this.signAndSubmitButtonSelector); + }); } async isSignAndSubmitUpdateAccountButtonVisible() { - return await this.isElementVisible(this.signAndSubmitUpdateButtonSelector); + return await allure.step('Is Sign And Submit Update Account Button Visible', async () => { + return await this.isElementVisible(this.signAndSubmitUpdateButtonSelector); + }); } async isTransferAccountIdVisible() { - return await this.isElementVisible(this.transferAccountInputSelector); + return await allure.step('Is Transfer Account ID Visible', async () => { + return await this.isElementVisible(this.transferAccountInputSelector); + }); } async getPrefilledAccountIdInUpdatePage() { - return await this.getTextFromInputFieldByTestId(this.updateAccountInputSelector); + return await allure.step('Get Prefilled Account ID In Update Page', async () => { + return await this.getTextFromInputFieldByTestId(this.updateAccountInputSelector); + }); } async getPrefilledAccountIdInDeletePage() { - return await this.getTextFromInputFieldByTestId(this.deletedAccountInputSelector); + return await allure.step('Get Prefilled Account ID In Delete Page', async () => { + return await this.getTextFromInputFieldByTestId(this.deletedAccountInputSelector); + }); } async getPrefilledTransferIdAccountInDeletePage() { - return await this.getTextFromInputFieldByTestId(this.transferAccountInputSelector); + return await allure.step('Get Prefilled Transfer ID Account In Delete Page', async () => { + return await this.getTextFromInputFieldByTestId(this.transferAccountInputSelector); + }); } async fillInFileContent(fileContent) { - await this.fillByTestId(this.fileContentTextFieldSelector, fileContent); + return await allure.step('Fill In File Content', async () => { + await this.fillByTestId(this.fileContentTextFieldSelector, fileContent); + }); } async getFileContentText() { - return await this.getTextFromInputFieldByTestId(this.fileContentTextFieldSelector); + return await allure.step('Get File Content Text', async () => { + return await this.getTextFromInputFieldByTestId(this.fileContentTextFieldSelector); + }); } async clickOnSignAndSubmitFileCreateButton() { - await this.clickByTestId(this.signAndSubmitFileCreateSelector, 10000); + return await allure.step('Click On Sign And Submit File Create Button', async () => { + await this.clickByTestId(this.signAndSubmitFileCreateSelector, 10000); + }); } async clickOnFileServiceLink() { - await this.clickOnMenuLink(this.fileServiceLinkSelector, 'active', 'File Service'); + return await allure.step('Click On File Service Link', async () => { + await this.clickOnMenuLink(this.fileServiceLinkSelector, 'active', 'File Service'); + }); } async fillInFileIdForRead(fileId) { - await this.fillByTestId(this.fileIdInputForReadSelector, fileId); + return await allure.step('Fill In File ID For Read', async () => { + await this.fillByTestId(this.fileIdInputForReadSelector, fileId); + }); } async getFileIdFromReadPage() { - return await this.getTextFromInputFieldByTestId(this.fileIdInputForReadSelector); + return await allure.step('Get File ID From Read Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileIdInputForReadSelector); + }); } async readFileContentFromTextArea() { - return await this.getTextFromInputFieldByTestId(this.fileContentReadTextFieldSelector); + return await allure.step('Read File Content From Text Area', async () => { + return await this.getTextFromInputFieldByTestId(this.fileContentReadTextFieldSelector); + }); } async clickOnSignAndReadFileButton() { - await this.clickByTestId(this.signAndReadFileButtonSelector); + return await allure.step('Click On Sign And Read File Button', async () => { + await this.clickByTestId(this.signAndReadFileButtonSelector); + }); } async fillInPasswordForRead(password) { - await this.fillByTestId(this.signPasswordForReadInputFieldSelector, password); + return await allure.step('Fill In Password For Read', async () => { + await this.fillByTestId(this.signPasswordForReadInputFieldSelector, password); + }); } async clickOnSignReadQueryButton() { - await this.clickByTestId(this.signReadQueryButtonSelector); + return await allure.step('Click On Sign Read Query Button', async () => { + await this.clickByTestId(this.signReadQueryButtonSelector); + }); } async getPublicKeyText() { - return await this.getTextFromInputFieldByTestIdWithIndex(this.publicKeyInputSelector); + return await allure.step('Get Public Key Text', async () => { + return await this.getTextFromInputFieldByTestIdWithIndex(this.publicKeyInputSelector); + }); } async fillInFileIdForUpdate(fileId) { - await this.fillByTestId(this.fileIdUpdateInputSelector, fileId); + return await allure.step('Fill In File ID For Update', async () => { + await this.fillByTestId(this.fileIdUpdateInputSelector, fileId); + }); } async getFileIdFromUpdatePage() { - return await this.getTextFromInputFieldByTestId(this.fileIdUpdateInputSelector); + return await allure.step('Get File ID From Update Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileIdUpdateInputSelector); + }); } async fillInPublicKeyForFile(publicKey) { - await this.fillByTestIdWithIndex(this.publicKeyInputSelector, publicKey); + return await allure.step('Fill In Public Key For File', async () => { + await this.fillByTestIdWithIndex(this.publicKeyInputSelector, publicKey); + }); } async fillInFileContentForUpdate(fileContent) { - await this.fillByTestId(this.fileContentUpdateTextFieldSelector, fileContent); + return await allure.step('Fill In File Content For Update', async () => { + await this.fillByTestId(this.fileContentUpdateTextFieldSelector, fileContent); + }); } async clickOnSignAndSubmitUpdateFileButton() { - await this.clickByTestId(this.signAndSubmitUpdateFileSelector); + return await allure.step('Click On Sign And Submit Update File Button', async () => { + await this.clickByTestId(this.signAndSubmitUpdateFileSelector); + }); } async clickOnSignFileButton() { - await this.clickByTestId(this.signFileUpdateButtonSelector); + return await allure.step('Click On Sign File Button', async () => { + await this.clickByTestId(this.signFileUpdateButtonSelector); + }); } async fillInPasswordForFile(password) { - await this.fillByTestId(this.signPasswordForFileUpdateInputSelector, password); + return await allure.step('Fill In Password For File', async () => { + await this.fillByTestId(this.signPasswordForFileUpdateInputSelector, password); + }); } async clickOnContinueSignFileButton() { - await this.clickByTestId(this.continueSignFileUpdateButtonSelector); + return await allure.step('Click On Continue Sign File Button', async () => { + await this.clickByTestId(this.continueSignFileUpdateButtonSelector); + }); } async clickOnSignAndSubmitFileAppendButton() { - await this.clickByTestId(this.signAndSubmitFileAppendButtonSelector); + return await allure.step('Click On Sign And Submit File Append Button', async () => { + await this.clickByTestId(this.signAndSubmitFileAppendButtonSelector); + }); } async fillInFileIdForAppend(fileId) { - await this.fillByTestId(this.fileIdInputForAppendSelector, fileId); + return await allure.step('Fill In File ID For Append', async () => { + await this.fillByTestId(this.fileIdInputForAppendSelector, fileId); + }); } async getFileIdFromAppendPage() { - return await this.getTextFromInputFieldByTestId(this.fileIdInputForAppendSelector); + return await allure.step('Get File ID From Append Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileIdInputForAppendSelector); + }); } async fillInFileContentForAppend(fileContent) { - await this.fillByTestId(this.fileContentAppendTextFieldSelector, fileContent); + return await allure.step('Fill In File Content For Append', async () => { + await this.fillByTestId(this.fileContentAppendTextFieldSelector, fileContent); + }); } async getTransactionTypeHeaderText() { - return await this.getTextByTestId(this.transactionTypeHeaderSelector); + return await allure.step('Get Transaction Type Header Text', async () => { + return await this.getTextByTestId(this.transactionTypeHeaderSelector); + }); } async clickOnSaveDraftButton() { - await this.clickByTestId(this.saveDraftButtonSelector); + return await allure.step('Click On Save Draft Button', async () => { + await this.clickByTestId(this.saveDraftButtonSelector); + }); } async clickOnDraftsMenuButton() { - await this.clickByTestId(this.draftsTabSelector); + return await allure.step('Click On Drafts Menu Button', async () => { + await this.clickByTestId(this.draftsTabSelector); + }); } async fillInDeleteAccountTransactionMemo(memo) { - await this.fillByTestId(this.deleteAccountMemoInputSelector, memo); + return await allure.step('Fill In Delete Account Transaction Memo', async () => { + await this.fillByTestId(this.deleteAccountMemoInputSelector, memo); + }); } async fillInTransactionMemoForApprovePage(memo) { - await this.fillByTestId(this.approveAllowanceTransactionMemoSelector, memo); + return await allure.step('Fill In Transaction Memo For Approve Page', async () => { + await this.fillByTestId(this.approveAllowanceTransactionMemoSelector, memo); + }); } async getTransactionMemoFromApprovePage() { - return await this.getTextFromInputFieldByTestId(this.approveAllowanceTransactionMemoSelector); + return await allure.step('Get Transaction Memo From Approve Page', async () => { + return await this.getTextFromInputFieldByTestId(this.approveAllowanceTransactionMemoSelector); + }); } async fillInTransactionMemoForCreateFilePage(memo) { - await this.fillByTestId(this.fileCreateTransactionMemoInputSelector, memo); + return await allure.step('Fill In Transaction Memo For Create File Page', async () => { + await this.fillByTestId(this.fileCreateTransactionMemoInputSelector, memo); + }); } async getTransactionMemoFromFilePage() { - return await this.getTextFromInputFieldByTestId(this.fileCreateTransactionMemoInputSelector); + return await allure.step('Get Transaction Memo From File Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileCreateTransactionMemoInputSelector); + }); } async fillInFileMemoForCreatePage(memo) { - await this.fillByTestId(this.fileCreateMemoInputSelector, memo); + return await allure.step('Fill In File Memo For Create Page', async () => { + await this.fillByTestId(this.fileCreateMemoInputSelector, memo); + }); } async getFileMemoFromCreatePage() { - return await this.getTextFromInputFieldByTestId(this.fileCreateMemoInputSelector); + return await allure.step('Get File Memo From Create Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileCreateMemoInputSelector); + }); } async fillInTransactionMemoForFileUpdatePage(memo) { - await this.fillByTestId(this.fileUpdateTransactionMemoInputSelector, memo); + return await allure.step('Fill In Transaction Memo For File Update Page', async () => { + await this.fillByTestId(this.fileUpdateTransactionMemoInputSelector, memo); + }); } async getTransactionMemoFromFileUpdatePage() { - return await this.getTextFromInputFieldByTestId(this.fileUpdateTransactionMemoInputSelector); + return await allure.step('Get Transaction Memo From File Update Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileUpdateTransactionMemoInputSelector); + }); } async fillInTransactionMemoForFileAppendPage(memo) { - await this.fillByTestId(this.fileAppendTransactionMemoInputSelector, memo); + return await allure.step('Fill In Transaction Memo For File Append Page', async () => { + await this.fillByTestId(this.fileAppendTransactionMemoInputSelector, memo); + }); } async getTransactionMemoFromFileAppendPage() { - return await this.getTextFromInputFieldByTestId(this.fileAppendTransactionMemoInputSelector); + return await allure.step('Get Transaction Memo From File Append Page', async () => { + return await this.getTextFromInputFieldByTestId(this.fileAppendTransactionMemoInputSelector); + }); } async fillInFileUpdateMemo(memo) { - await this.fillByTestId(this.fileUpdateMemoInputSelector, memo); + return await allure.step('Fill In File Update Memo', async () => { + await this.fillByTestId(this.fileUpdateMemoInputSelector, memo); + }); } async getFileUpdateMemo() { - return await this.getTextFromInputFieldByTestId(this.fileUpdateMemoInputSelector); + return await allure.step('Get File Update Memo', async () => { + return await this.getTextFromInputFieldByTestId(this.fileUpdateMemoInputSelector); + }); } async getNewAccountIdDetailsText() { - return await this.getTextByTestId(this.newAccountIdDetailsSelector, 15000); + return await allure.step('Get New Account ID Details Text', async () => { + return await this.getTextByTestId(this.newAccountIdDetailsSelector, 15000); + }); } async getFirstTransactionStatus() { - return await this.getTextByTestId(this.transactionStatusIndexSelector + '0'); + return await allure.step('Get First Transaction Status', async () => { + return await this.getTextByTestId(this.transactionStatusIndexSelector + '0'); + }); } async getFirstDraftDate() { - return await this.getTextByTestId(this.draftDetailsDateIndexSelector + '0'); + return await allure.step('Get First Draft Date', async () => { + return await this.getTextByTestId(this.draftDetailsDateIndexSelector + '0'); + }); } async getFirstDraftType() { - return await this.getTextByTestId(this.draftDetailsTypeIndexSelector + '0'); + return await allure.step('Get First Draft Type', async () => { + return await this.getTextByTestId(this.draftDetailsTypeIndexSelector + '0'); + }); } async getFirstDraftIsTemplateCheckboxVisible() { - return await this.isElementVisible(this.draftDetailsIsTemplateCheckboxSelector + '0'); + return await allure.step('Get First Draft Is Template Checkbox Visible', async () => { + return await this.isElementVisible(this.draftDetailsIsTemplateCheckboxSelector + '0'); + }); } async clickOnFirstDraftIsTemplateCheckbox() { - await this.clickByTestId(this.draftDetailsIsTemplateCheckboxSelector + '0'); + return await allure.step('Click On First Draft Is Template Checkbox', async () => { + await this.clickByTestId(this.draftDetailsIsTemplateCheckboxSelector + '0'); + }); } async clickOnFirstDraftDeleteButton() { - await this.clickByTestId(this.draftDeleteButtonIndexSelector + '0'); + return await allure.step('Click On First Draft Delete Button', async () => { + await this.clickByTestId(this.draftDeleteButtonIndexSelector + '0'); + }); } async isFirstDraftDeleteButtonVisible() { - return await this.isElementVisible(this.draftDeleteButtonIndexSelector + '0'); + return await allure.step('Is First Draft Delete Button Visible', async () => { + return await this.isElementVisible(this.draftDeleteButtonIndexSelector + '0'); + }); } async clickOnFirstDraftContinueButton() { - await this.clickByTestId(this.draftContinueButtonIndexSelector + '0'); + return await allure.step('Click On First Draft Continue Button', async () => { + await this.clickByTestId(this.draftContinueButtonIndexSelector + '0'); + }); } async isFirstDraftContinueButtonVisible() { - return await this.isElementVisible(this.draftContinueButtonIndexSelector + '0'); + return await allure.step('Is First Draft Continue Button Visible', async () => { + return await this.isElementVisible(this.draftContinueButtonIndexSelector + '0'); + }); } async saveDraft() { - await this.clickOnSaveDraftButton(); - await this.clickOnTransactionsMenuButton(); - await this.closeDraftModal(); - await this.clickOnDraftsMenuButton(); + return await allure.step('Save Draft', async () => { + await this.clickOnSaveDraftButton(); + await this.clickOnTransactionsMenuButton(); + await this.closeDraftModal(); + await this.clickOnDraftsMenuButton(); + }); } async deleteFirstDraft() { - await this.clickOnFirstDraftDeleteButton(); - await this.waitForElementToDisappear(this.toastMessageSelector); + return await allure.step('Delete First Draft', async () => { + await this.clickOnFirstDraftDeleteButton(); + await this.waitForElementToDisappear(this.toastMessageSelector); + }); } async navigateToDrafts() { - await this.clickOnTransactionsMenuButton(); - await this.closeDraftModal(); - await this.clickOnDraftsMenuButton(); + return await allure.step('Navigate To Drafts', async () => { + await this.clickOnTransactionsMenuButton(); + await this.closeDraftModal(); + await this.clickOnDraftsMenuButton(); + }); } async waitForPublicKeyToBeFilled() { - await this.waitForInputFieldToBeFilled(this.publicKeyInputSelector, 1); + return await allure.step('Wait For Public Key To Be Filled', async () => { + await this.waitForInputFieldToBeFilled(this.publicKeyInputSelector, 1); + }); } async turnReceiverSigSwitchOn() { - const maxAttempts = 10; - const interval = 500; - let attempts = 0; - - while (attempts < maxAttempts) { - const isToggledOn = await this.isReceiverSigRequiredSwitchToggledOnForUpdatePage(); - if (isToggledOn) { - console.log(`Receiver signature switch is turned on.`); - return; // Exit the function if the switch is toggled on - } else { - console.log(`Attempt ${attempts + 1}: Receiver signature switch is off, toggling it on...`); - await this.clickONReceiverSigRequiredSwitchForUpdate(); - attempts++; - await new Promise(resolve => setTimeout(resolve, interval)); + return await allure.step('Turn Receiver Signature Switch On', async () => { + const maxAttempts = 10; + const interval = 500; + let attempts = 0; + + while (attempts < maxAttempts) { + const isToggledOn = await this.isReceiverSigRequiredSwitchToggledOnForUpdatePage(); + if (isToggledOn) { + console.log(`Receiver signature switch is turned on.`); + return; + } else { + console.log( + `Attempt ${attempts + 1}: Receiver signature switch is off, toggling it on...`, + ); + await this.clickONReceiverSigRequiredSwitchForUpdate(); + attempts++; + await new Promise(resolve => setTimeout(resolve, interval)); + } } - } - throw new Error('Failed to turn the receiver signature switch on after multiple attempts'); + throw new Error('Failed to turn the receiver signature switch on after multiple attempts'); + }); } } module.exports = TransactionPage; diff --git a/automation/playwright.config.js b/automation/playwright.config.js index 8707fd9a8..109177430 100644 --- a/automation/playwright.config.js +++ b/automation/playwright.config.js @@ -1,9 +1,45 @@ import { defineConfig } from '@playwright/test'; +import * as os from 'os'; +import dotenv from 'dotenv'; + +// Load environment variables from .env file +dotenv.config(); export default defineConfig({ reporter: process.env.CI - ? ['github', ['list'], ['allure-playwright']] - : [['list'], ['allure-playwright']], + ? [ + 'github', + ['list'], + [ + 'allure-playwright', + { + detail: true, + suiteTitle: false, + environmentInfo: { + os_platform: os.platform(), + os_version: os.version(), + node_version: process.version, + ENVIRONMENT: process.env.ENVIRONMENT, + }, + }, + ], + ] + : [ + ['list'], + [ + 'allure-playwright', + { + detail: true, + suiteTitle: false, + environmentInfo: { + os_platform: os.platform(), + os_version: os.version(), + node_version: process.version, + ENVIRONMENT: process.env.ENVIRONMENT, + }, + }, + ], + ], retries: 3, workers: 1, diff --git a/automation/tests/loginTests.test.js b/automation/tests/loginTests.test.js index 503f868fd..e006134cc 100644 --- a/automation/tests/loginTests.test.js +++ b/automation/tests/loginTests.test.js @@ -9,7 +9,8 @@ const { const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); const LoginPage = require('../pages/LoginPage'); -import { allure } from 'allure-playwright'; +const { allure } = require('allure-playwright'); +const { Severity } = require('allure-js-commons'); let app, window; let globalCredentials = { email: '', password: '' }; @@ -47,84 +48,51 @@ test.describe('Login tests', () => { }); test('Verify that login with incorrect password shows an error message', async () => { - await allure.label('feature', 'Login'); - await allure.label('severity', 'normal'); - let passwordErrorMessage; + await allure.severity(Severity.TRIVIAL); + const incorrectPassword = globalCredentials.password + '123'; - await allure.step('Wait for any previous toasts to disappear', async () => { - await loginPage.waitForToastToDisappear(); - }); - await allure.step('Attempt to login with incorrect password', async () => { - await loginPage.login(globalCredentials.email, incorrectPassword); - }); - await allure.step('Get the password error message', async () => { - passwordErrorMessage = (await loginPage.getLoginPasswordErrorMessage()).trim(); - }); - await allure.step('Verify the error message', async () => { - expect(passwordErrorMessage).toBe('Invalid password.'); - }); + await loginPage.waitForToastToDisappear(); + await loginPage.login(globalCredentials.email, incorrectPassword); + const passwordErrorMessage = (await loginPage.getLoginPasswordErrorMessage()).trim(); + + expect(passwordErrorMessage).toBe('Invalid password.'); }); test('Verify that login with incorrect email shows an error message', async () => { - await allure.label('feature', 'Login'); - await allure.label('severity', 'normal'); + await allure.severity(Severity.TRIVIAL); - let emailErrorMessage; const incorrectEmail = globalCredentials.email + '123'; - await allure.step('Wait for any previous toasts to disappear', async () => { - await loginPage.waitForToastToDisappear(); - }); - await allure.step('Attempt to login with incorrect email', async () => { - await loginPage.login(incorrectEmail, globalCredentials.password); - }); - await allure.step('Get the password error message', async () => { - emailErrorMessage = (await loginPage.getLoginEmailErrorMessage()).trim(); - }); - - await allure.step('Verify the error message', async () => { - expect(emailErrorMessage).toBe('Invalid e-mail.'); - }); + await loginPage.waitForToastToDisappear(); + await loginPage.login(incorrectEmail, globalCredentials.password); + const passwordErrorMessage = (await loginPage.getLoginEmailErrorMessage()).trim(); + + expect(passwordErrorMessage).toBe('Invalid e-mail.'); }); test('Verify all essential elements are present on the login page', async () => { - await allure.label('feature', 'Login'); - await allure.label('severity', 'normal'); + await allure.severity(Severity.NORMAL); const allElementsAreCorrect = await loginPage.verifyLoginElements(); - await allure.step('Verify login elements', async () => { - expect(allElementsAreCorrect).toBe(true); - }); + expect(allElementsAreCorrect).toBe(true); }); test('Verify successful login', async () => { - await allure.label('feature', 'Login'); - await allure.label('severity', 'critical'); - - await allure.step('Attempt to login with correct credentials', async () => { - await loginPage.login(globalCredentials.email, globalCredentials.password); - }); - await allure.step('Verify settings button visibility', async () => { - // Assuming we have logged in, user should see the settings button - const isButtonVisible = await loginPage.isSettingsButtonVisible(); - - expect(isButtonVisible).toBe(true); - }); + await allure.severity(Severity.BLOCKER); + + await loginPage.login(globalCredentials.email, globalCredentials.password); + // Assuming we have logged in, user should see the settings button + const isButtonVisible = await loginPage.isSettingsButtonVisible(); + + expect(isButtonVisible).toBe(true); }); test('Verify resetting account', async () => { - await allure.label('feature', 'Account Reset'); - await allure.label('severity', 'critical'); - - await allure.step('Attempt logout', async () => { - await loginPage.logout(); - }); - await allure.step('Reset app state', async () => { - await resetAppState(window); - }); + await allure.severity(Severity.NORMAL); + + await loginPage.logout(); + await resetAppState(window); // Assuming we have reset the account, and we land on the registration page, we confirm that we see password field. - await allure.step('Verify account is reset', async () => { - const isConfirmPasswordVisible = await registrationPage.isConfirmPasswordFieldVisible(); - expect(isConfirmPasswordVisible).toBe(true); - }); + const isConfirmPasswordVisible = await registrationPage.isConfirmPasswordFieldVisible(); + expect(isConfirmPasswordVisible).toBe(true); }); }); diff --git a/automation/tests/registrationTests.test.js b/automation/tests/registrationTests.test.js index c776883ec..6d26d453a 100644 --- a/automation/tests/registrationTests.test.js +++ b/automation/tests/registrationTests.test.js @@ -8,7 +8,8 @@ const { } = require('../utils/util'); const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); -import { allure } from 'allure-playwright'; +const { allure } = require('allure-playwright'); +const { Severity } = require('allure-js-commons'); let app, window; let globalCredentials = { email: '', password: '' }; @@ -35,509 +36,380 @@ test.describe('Registration tests', () => { }); test('Verify all elements are present on the registration page', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Verify all registration page elements are present', async () => { - const allElementsAreCorrect = await registrationPage.verifyRegistrationElements(); - expect(allElementsAreCorrect).toBe(true); - }); + await allure.severity(Severity.NORMAL); + const allElementsAreCorrect = await registrationPage.verifyRegistrationElements(); + expect(allElementsAreCorrect).toBe(true); }); test('Verify rejection of invalid email format in the registration form', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'minor'); - - await allure.step('Type invalid email', async () => { - await registrationPage.typeEmail('wrong.gmail'); - }); - await allure.step('Type password', async () => { - await registrationPage.typePassword('test'); - }); - await allure.step('Submit registration form', async () => { - await registrationPage.submitRegistration(); - }); - await allure.step('Verify the email error message', async () => { - const errorMessage = (await registrationPage.getEmailErrorMessage()).trim(); - expect(errorMessage).toBe('Invalid e-mail.'); - }); + await allure.severity(Severity.TRIVIAL); + await registrationPage.typeEmail('wrong.gmail'); + await registrationPage.typePassword('test'); + await registrationPage.submitRegistration(); + + const errorMessage = (await registrationPage.getEmailErrorMessage()).trim(); + + expect(errorMessage).toBe('Invalid e-mail.'); }); test('Verify e-mail field accepts valid format', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Type valid email', async () => { - await registrationPage.typeEmail('test23@test.com'); - }); - await allure.step('Type password', async () => { - await registrationPage.typePassword('test'); - }); - await allure.step('Submit registration form', async () => { - await registrationPage.submitRegistration(); - }); - await allure.step('Verify no error message for email', async () => { - const isErrorMessageVisible = await registrationPage.isEmailErrorMessageVisible(); - expect(isErrorMessageVisible).toBe(false); - }); + await allure.severity(Severity.TRIVIAL); + await registrationPage.typeEmail('test23@test.com'); + await registrationPage.typePassword('test'); + await registrationPage.submitRegistration(); + + const isErrorMessageVisible = await registrationPage.isEmailErrorMessageVisible(); + + expect(isErrorMessageVisible).toBe(false); }); test('Verify password field rejects empty password', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'minor'); - - await allure.step('Type valid email', async () => { - await registrationPage.typeEmail('test@test.com'); - }); - await allure.step('Type password and leave confirm password empty', async () => { - await registrationPage.typePassword('test'); - }); - await allure.step('Submit registration form', async () => { - await registrationPage.submitRegistration(); - }); - await allure.step('Verify the password error message', async () => { - const errorMessage = (await registrationPage.getPasswordErrorMessage()).trim(); - expect(errorMessage).toBe('Invalid password.'); - }); + await allure.severity(Severity.NORMAL); + await registrationPage.typeEmail('test@test.com'); + await registrationPage.typePassword('test'); + await registrationPage.submitRegistration(); + + const errorMessage = (await registrationPage.getPasswordErrorMessage()).trim(); + + expect(errorMessage).toBe('Invalid password.'); }); test('Verify confirm password field rejects mismatching passwords', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Type valid email', async () => { - await registrationPage.typeEmail('test@test.com'); - }); - await allure.step('Type password', async () => { - await registrationPage.typePassword('test'); - }); - await allure.step('Type mismatching confirm password', async () => { - await registrationPage.typeConfirmPassword('notTest'); - }); - await allure.step('Submit registration form', async () => { - await registrationPage.submitRegistration(); - }); - await allure.step('Verify the confirm password error message', async () => { - const errorMessage = (await registrationPage.getConfirmPasswordErrorMessage()).trim(); - expect(errorMessage).toBe('Password do not match.'); - }); + await allure.severity(Severity.NORMAL); + await registrationPage.typeEmail('test@test.com'); + await registrationPage.typePassword('test'); + await registrationPage.typeConfirmPassword('notTest'); + + await registrationPage.submitRegistration(); + + const errorMessage = (await registrationPage.getConfirmPasswordErrorMessage()).trim(); + + expect(errorMessage).toBe('Password do not match.'); }); test('Verify elements on account setup page are correct', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Verify account setup elements', async () => { - const allElementsAreCorrect = await registrationPage.verifyAccountSetupElements(); - expect(allElementsAreCorrect).toBe(true); - }); + await allure.severity(Severity.NORMAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const allElementsAreCorrect = await registrationPage.verifyAccountSetupElements(); + expect(allElementsAreCorrect).toBe(true); }); test('Verify "Create New" tab elements in account setup are correct', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Verify mnemonic tiles are present', async () => { - const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); - expect(allTilesArePresent).toBe(true); - }); - await allure.step('Verify "I Understand" checkbox is visible', async () => { - const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); - expect(isCheckBoxVisible).toBe(true); - }); - await allure.step('Verify generate button is visible', async () => { - const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); - expect(isGenerateButtonVisible).toBe(true); - }); + await allure.severity(Severity.NORMAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + await registrationPage.clickOnCreateNewTab(); + + const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); + expect(allTilesArePresent).toBe(true); + + const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); + expect(isCheckBoxVisible).toBe(true); + + const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); + expect(isGenerateButtonVisible).toBe(true); }); test('Verify "Import Existing" tab elements in account setup are correct', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Import Existing" tab', async () => { - await registrationPage.clickOnImportTab(); - }); - await allure.step('Verify mnemonic tiles are present', async () => { - const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); - expect(allTilesArePresent).toBe(true); - }); - await allure.step('Verify clear button is visible', async () => { - const isClearButtonVisible = await registrationPage.isClearButtonVisible(); - expect(isClearButtonVisible).toBe(true); - }); - await allure.step('Verify "I Understand" checkbox is not visible', async () => { - const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); - expect(isCheckBoxVisible).toBe(false); - }); - await allure.step('Verify generate button is not visible', async () => { - const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); - expect(isGenerateButtonVisible).toBe(false); - }); + await allure.severity(Severity.NORMAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const allTilesArePresent = await registrationPage.verifyAllMnemonicTilesArePresent(); + expect(allTilesArePresent).toBe(true); + + const isClearButtonVisible = await registrationPage.isClearButtonVisible(); + expect(isClearButtonVisible).toBe(true); + + const isCheckBoxVisible = await registrationPage.isUnderstandCheckboxVisible(); + expect(isCheckBoxVisible).toBe(false); + + const isGenerateButtonVisible = await registrationPage.isGenerateButtonVisible(); + expect(isGenerateButtonVisible).toBe(false); }); test('Verify re-generate of recovery phrase changes words', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - let firstSetOfWords, secondSetOfWords; - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Click on "I Understand" checkbox and generate button', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - }); - await allure.step('Capture first set of recovery phrase words', async () => { - await registrationPage.captureRecoveryPhraseWords(); - firstSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); - }); - await allure.step( - 'Click on generate again button and capture second set of words', - async () => { - await registrationPage.clickOnGenerateAgainButton(); - await registrationPage.captureRecoveryPhraseWords(); - secondSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); - }, + await allure.severity(Severity.NORMAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, ); - await allure.step( - 'Verify that the second set of words is different from the first set', - async () => { - const wordsAreChanged = registrationPage.compareWordSets( - Object.values(firstSetOfWords), - Object.values(secondSetOfWords), - ); - expect(wordsAreChanged).toBe(true); - }, + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + + await registrationPage.captureRecoveryPhraseWords(); + const firstSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); + + await registrationPage.clickOnGenerateAgainButton(); + await registrationPage.captureRecoveryPhraseWords(); + const secondSetOfWords = registrationPage.getCopyOfRecoveryPhraseWords(); + + // Verify that the second set of words is different from the first set + const wordsAreChanged = registrationPage.compareWordSets( + Object.values(firstSetOfWords), + Object.values(secondSetOfWords), ); + expect(wordsAreChanged).toBe(true); }); test('Verify generate button is disabled until "I Understand" checkbox is selected', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Verify generate button is disabled', async () => { - const isGenerateButtonClickable = await registrationPage.isGenerateButtonDisabled(); - expect(isGenerateButtonClickable).toBe(true); - }); - await allure.step('Click on "I Understand" checkbox', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - }); - await allure.step('Verify generate button is enabled', async () => { - const isGenerateButtonVisibleAfterSelectingCheckbox = - await registrationPage.isGenerateButtonDisabled(); - expect(isGenerateButtonVisibleAfterSelectingCheckbox).toBe(false); - }); + await allure.severity(Severity.TRIVIAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + await registrationPage.clickOnCreateNewTab(); + + const isGenerateButtonClickable = await registrationPage.isGenerateButtonDisabled(); + expect(isGenerateButtonClickable).toBe(true); + + await registrationPage.clickOnUnderstandCheckbox(); + + const isGenerateButtonVisibleAfterSelectingCheckbox = + await registrationPage.isGenerateButtonDisabled(); + expect(isGenerateButtonVisibleAfterSelectingCheckbox).toBe(false); }); test('Verify clear button clears the existing mnemonic phrase', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Click on "I Understand" checkbox and generate button', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - }); - await allure.step('Click on "Import" tab and fill recovery phrase words', async () => { - await registrationPage.clickOnImportTab(); - await registrationPage.fillAllMissingRecoveryPhraseWords(); - }); - await allure.step('Click on clear button and verify mnemonic fields are cleared', async () => { - await registrationPage.clickOnClearButton(); - const isMnemonicCleared = await registrationPage.verifyAllMnemonicFieldsCleared(); - expect(isMnemonicCleared).toBe(true); - }); + await allure.severity(Severity.TRIVIAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + + await registrationPage.clickOnImportTab(); + + await registrationPage.fillAllMissingRecoveryPhraseWords(); + + await registrationPage.clickOnClearButton(); + + const isMnemonicCleared = await registrationPage.verifyAllMnemonicFieldsCleared(); + + expect(isMnemonicCleared).toBe(true); }); test('Verify final step of account setup has all correct elements', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'normal'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Click on "I Understand" checkbox and generate button', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - }); - await allure.step('Verify final step elements', async () => { - const isAllElementsPresent = await registrationPage.verifyFinalStepAccountSetupElements(); - expect(isAllElementsPresent).toBe(true); - }); + await allure.severity(Severity.NORMAL); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + + const isAllElementsPresent = await registrationPage.verifyFinalStepAccountSetupElements(); + expect(isAllElementsPresent).toBe(true); }); - test('Verify successful registration through "Create New" fminor', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Click on "I Understand" checkbox and generate button', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - await registrationPage.clickOnFinalNextButtonWithRetry(); - }); - await allure.step('Verify toast message', async () => { - const toastMessage = await registrationPage.getToastMessage(); - expect(toastMessage).toBe('Key Pair saved successfully'); - }); + test('Verify successful registration through "Create New" flow', async () => { + await allure.severity(Severity.BLOCKER); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + + await registrationPage.clickOnFinalNextButtonWithRetry(); + + const toastMessage = await registrationPage.getToastMessage(); + expect(toastMessage).toBe('Key Pair saved successfully'); }); - test('Verify successful registration through "Import Existing" fminor', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register with generated credentials', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - }); - await allure.step('Click on "Create New" tab', async () => { - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - }); - await allure.step('Click on "I Understand" checkbox and generate button', async () => { - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnImportTab(); - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.scrollToNextImportButton(); - await registrationPage.clickOnNextImportButton(); - await registrationPage.clickOnFinalNextButtonWithRetry(); - }); - await allure.step('Verify toast message', async () => { - const toastMessage = await registrationPage.getToastMessage(); - expect(toastMessage).toBe('Key Pair saved successfully'); - }); + test('Verify successful registration through "Import Existing" flow', async () => { + await allure.severity(Severity.BLOCKER); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + await registrationPage.captureRecoveryPhraseWords(); + + await registrationPage.clickOnImportTab(); + + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.scrollToNextImportButton(); + await registrationPage.clickOnNextImportButton(); + + await registrationPage.clickOnFinalNextButtonWithRetry(); + + const toastMessage = await registrationPage.getToastMessage(); + expect(toastMessage).toBe('Key Pair saved successfully'); }); test('Verify user is stored in the database after registration', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Complete registration', async () => { - await registrationPage.completeRegistration( - globalCredentials.email, - globalCredentials.password, - ); - }); - await allure.step('Verify user exists in the database', async () => { - const userExists = await registrationPage.verifyUserExists(globalCredentials.email); - expect(userExists).toBe(true); - }); + await allure.severity(Severity.BLOCKER); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.completeRegistration( + globalCredentials.email, + globalCredentials.password, + ); + + const userExists = await registrationPage.verifyUserExists(globalCredentials.email); + expect(userExists).toBe(true); }); test('Verify user public key is stored in the database after registration', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - let publicKeyFromApp; - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Register and capture public key', async () => { - await registrationPage.register( - globalCredentials.email, - globalCredentials.password, - globalCredentials.password, - ); - const isTabVisible = await registrationPage.isCreateNewTabVisible(); - expect(isTabVisible).toBe(true); - await registrationPage.clickOnCreateNewTab(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnGenerateButton(); - await registrationPage.captureRecoveryPhraseWords(); - await registrationPage.clickOnUnderstandCheckbox(); - await registrationPage.clickOnVerifyButton(); - await registrationPage.fillAllMissingRecoveryPhraseWords(); - await registrationPage.clickOnNextButton(); - publicKeyFromApp = await registrationPage.getPublicKey(); - await registrationPage.clickOnFinalNextButtonWithRetry(); - }); - await allure.step('Verify public key in database', async () => { - const publicKeyFromDb = await registrationPage.getPublicKeyByEmail(globalCredentials.email); - expect(publicKeyFromApp).toBe(publicKeyFromDb); - }); + await allure.severity(Severity.BLOCKER); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.register( + globalCredentials.email, + globalCredentials.password, + globalCredentials.password, + ); + + const isTabVisible = await registrationPage.isCreateNewTabVisible(); + expect(isTabVisible).toBe(true); + + await registrationPage.clickOnCreateNewTab(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnGenerateButton(); + + await registrationPage.captureRecoveryPhraseWords(); + await registrationPage.clickOnUnderstandCheckbox(); + await registrationPage.clickOnVerifyButton(); + + await registrationPage.fillAllMissingRecoveryPhraseWords(); + await registrationPage.clickOnNextButton(); + + const publicKeyFromApp = await registrationPage.getPublicKey(); + + await registrationPage.clickOnFinalNextButtonWithRetry(); + + const publicKeyFromDb = await registrationPage.getPublicKeyByEmail(globalCredentials.email); + + expect(publicKeyFromApp).toBe(publicKeyFromDb); }); test('Verify user private key is stored in the database after registration', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Generate random email and password', async () => { - globalCredentials.email = generateRandomEmail(); - globalCredentials.password = generateRandomPassword(); - }); - await allure.step('Complete registration', async () => { - await registrationPage.completeRegistration( - globalCredentials.email, - globalCredentials.password, - ); - }); - await allure.step('Verify private key exists in database', async () => { - const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( - globalCredentials.email, - ); - expect(privateKeyExists).toBe(true); - }); + await allure.severity(Severity.BLOCKER); + globalCredentials.email = generateRandomEmail(); + globalCredentials.password = generateRandomPassword(); + + await registrationPage.completeRegistration( + globalCredentials.email, + globalCredentials.password, + ); + + const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( + globalCredentials.email, + ); + + expect(privateKeyExists).toBe(true); }); test('Verify user is deleted from the database after resetting account', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Verify user no longer exists after reset', async () => { - // BeforeEach executes logout and reset account state, so we just verify it's no longer existing - const userExists = await registrationPage.verifyUserExists(globalCredentials.email); - expect(userExists).toBe(false); - }); + await allure.severity(Severity.NORMAL); + // BeforeEach executes logout and reset account state, so we just verify it's no longer existing + const userExists = await registrationPage.verifyUserExists(globalCredentials.email); + expect(userExists).toBe(false); }); test('Verify user key pair is deleted from the database after resetting account', async () => { - await allure.label('feature', 'Registration'); - await allure.label('severity', 'critical'); - - await allure.step('Verify public key no longer exists after reset', async () => { - // BeforeEach executes logout and reset account state, so we just verify it's no longer existing - const publicKeyExists = await registrationPage.verifyPublicKeyExistsByEmail( - globalCredentials.email, - ); - expect(publicKeyExists).toBe(false); - }); - await allure.step('Verify private key no longer exists after reset', async () => { - const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( - globalCredentials.email, - ); - expect(privateKeyExists).toBe(false); - }); + await allure.severity(Severity.NORMAL); + // BeforeEach executes logout and reset account state, so we just verify it's no longer existing + const publicKeyExists = await registrationPage.verifyPublicKeyExistsByEmail( + globalCredentials.email, + ); + expect(publicKeyExists).toBe(false); + + const privateKeyExists = await registrationPage.verifyPrivateKeyExistsByEmail( + globalCredentials.email, + ); + expect(privateKeyExists).toBe(false); }); }); diff --git a/automation/tests/settingsTests.test.js b/automation/tests/settingsTests.test.js index 68c28268c..59e43a328 100644 --- a/automation/tests/settingsTests.test.js +++ b/automation/tests/settingsTests.test.js @@ -11,6 +11,8 @@ const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); const LoginPage = require('../pages/LoginPage'); const SettingsPage = require('../pages/SettingsPage'); +const { allure } = require('allure-playwright'); +const { Severity } = require('allure-js-commons'); let app, window; let globalCredentials = { email: '', password: '' }; @@ -49,12 +51,14 @@ test.describe('Settings tests', () => { }); test('Verify that all elements in settings page are present', async () => { + await allure.severity(Severity.NORMAL); await settingsPage.clickOnSettingsButton(); const allElementsVisible = await settingsPage.verifySettingsElements(); expect(allElementsVisible).toBe(true); }); test('Verify user can decrypt private key', async () => { + await allure.severity(Severity.BLOCKER); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -67,6 +71,7 @@ test.describe('Settings tests', () => { }); test('Verify user can restore key', async () => { + await allure.severity(Severity.BLOCKER); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -76,7 +81,7 @@ test.describe('Settings tests', () => { await settingsPage.fillInPassword(globalCredentials.password); await settingsPage.clickOnPasswordContinueButton(); - const isMnemonicRequired = settingsPage.isElementVisible( + const isMnemonicRequired = await settingsPage.isElementVisible( registrationPage.getRecoveryWordSelector(1), ); if (isMnemonicRequired) { @@ -99,6 +104,7 @@ test.describe('Settings tests', () => { }); test('Verify user restored key pair is saved in the local database', async () => { + await allure.severity(Severity.BLOCKER); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -108,7 +114,7 @@ test.describe('Settings tests', () => { await settingsPage.fillInPassword(globalCredentials.password); await settingsPage.clickOnPasswordContinueButton(); - const isMnemonicRequired = settingsPage.isElementVisible( + const isMnemonicRequired = await settingsPage.isElementVisible( registrationPage.getRecoveryWordSelector(1), ); if (isMnemonicRequired) { @@ -133,6 +139,7 @@ test.describe('Settings tests', () => { }); test('Verify user can delete key', async () => { + await allure.severity(Severity.NORMAL); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -144,7 +151,7 @@ test.describe('Settings tests', () => { await settingsPage.fillInPassword(globalCredentials.password); await settingsPage.clickOnPasswordContinueButton(); - const isMnemonicRequired = settingsPage.isElementVisible( + const isMnemonicRequired = await settingsPage.isElementVisible( registrationPage.getRecoveryWordSelector(1), ); if (isMnemonicRequired) { @@ -183,6 +190,7 @@ test.describe('Settings tests', () => { }); test('Verify user can import ECDSA key', async () => { + await allure.severity(Severity.NORMAL); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -213,6 +221,7 @@ test.describe('Settings tests', () => { }); test('Verify user can import ED25519 keys', async () => { + await allure.severity(Severity.NORMAL); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnKeysTab(); @@ -243,6 +252,7 @@ test.describe('Settings tests', () => { }); test('Verify user can change password', async () => { + await allure.severity(Severity.BLOCKER); await settingsPage.clickOnSettingsButton(); await settingsPage.clickOnProfileTab(); diff --git a/automation/tests/transactionTests.test.js b/automation/tests/transactionTests.test.js index 28925931d..e59c1cf92 100644 --- a/automation/tests/transactionTests.test.js +++ b/automation/tests/transactionTests.test.js @@ -11,6 +11,8 @@ const RegistrationPage = require('../pages/RegistrationPage.js'); const { expect } = require('playwright/test'); const LoginPage = require('../pages/LoginPage'); const TransactionPage = require('../pages/TransactionPage'); +const { allure } = require('allure-playwright'); +const { Severity } = require('allure-js-commons'); let app, window; let globalCredentials = { email: '', password: '' }; @@ -54,12 +56,13 @@ test.describe('Transaction tests', () => { }); test.beforeEach(async () => { - await transactionPage.closeCompletedTransaction(); + //await transactionPage.closeCompletedTransaction(); await transactionPage.clickOnTransactionsMenuButton(); await transactionPage.closeDraftModal(); }); test('Verify that all elements on account create page are correct', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); @@ -69,6 +72,7 @@ test.describe('Transaction tests', () => { }); test('Verify confirm transaction modal is displayed with valid information for Account Create tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); @@ -81,6 +85,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute create account transaction with single key', async () => { + await allure.severity(Severity.BLOCKER); const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password); const accountDetails = await transactionPage.mirrorGetAccountResponse(newAccountId); @@ -101,6 +106,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can create account with receiver sig required', async () => { + await allure.severity(Severity.NORMAL); const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password, { isReceiverSigRequired: true, }); @@ -111,6 +117,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can create account with initial funds', async () => { + await allure.severity(Severity.NORMAL); const initialHbarFunds = '1'; const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password, { @@ -123,6 +130,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can create account with max account associations', async () => { + await allure.severity(Severity.NORMAL); const maxAutoAssociations = 10; const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password, { @@ -135,6 +143,7 @@ test.describe('Transaction tests', () => { }); test('Verify transaction is stored in the local database for account create tx', async () => { + await allure.severity(Severity.NORMAL); const { newTransactionId } = await transactionPage.createNewAccount(globalCredentials.password); const isTxExistingInDb = await transactionPage.verifyTransactionExists( @@ -146,6 +155,7 @@ test.describe('Transaction tests', () => { }); test('Verify account is stored in the local database for account create tx', async () => { + await allure.severity(Severity.NORMAL); const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password); await transactionPage.clickOnAccountsMenuButton(); @@ -155,6 +165,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute Account Create tx with complex key', async () => { + await allure.severity(Severity.BLOCKER); const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password, { isComplex: true, }); @@ -168,6 +179,7 @@ test.describe('Transaction tests', () => { }); test('Verify account is displayed in the account card section', async () => { + await allure.severity(Severity.NORMAL); const { newAccountId } = await transactionPage.createNewAccount(globalCredentials.password); await transactionPage.clickOnAccountsMenuButton(); @@ -177,6 +189,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute account delete tx', async () => { + await allure.severity(Severity.BLOCKER); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const transactionId = await transactionPage.deleteAccount( @@ -195,6 +208,7 @@ test.describe('Transaction tests', () => { }); test('Verify account is deleted from the db after account delete tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.deleteAccount(accountFromList, globalCredentials.password); @@ -204,6 +218,7 @@ test.describe('Transaction tests', () => { }); test('Verify account id is removed from the account cards after account delete tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.deleteAccount(accountFromList, globalCredentials.password); @@ -214,6 +229,7 @@ test.describe('Transaction tests', () => { }); test('Verify that account is updated after we execute an account update tx', async () => { + await allure.severity(Severity.BLOCKER); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const updatedMemoText = 'Updated memo'; @@ -247,6 +263,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute transfer tokens tx', async () => { + await allure.severity(Severity.BLOCKER); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeTransferred = '1'; @@ -268,6 +285,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can add the rest of remaining hbars to receiver accounts', async () => { + await allure.severity(Severity.TRIVIAL); const amountToBeTransferred = 10; const amountLeftForRestAccounts = 9; await transactionPage.ensureAccountExists(globalCredentials.password); @@ -299,6 +317,7 @@ test.describe('Transaction tests', () => { }); test('Verify sign button is disabled when receiver amount is higher than payer amount when doing transfer tx', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.ensureAccountExists(globalCredentials.password); const receiverAccount = await transactionPage.getFirstAccountFromList(); await loginPage.waitForToastToDisappear(); @@ -318,6 +337,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute approve allowance tx', async () => { + await allure.severity(Severity.BLOCKER); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeApproved = '10'; @@ -342,6 +362,7 @@ test.describe('Transaction tests', () => { }); test('Verify all elements are present on file create tx page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnTransactionsMenuButton(); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnFileServiceLink(); @@ -352,6 +373,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute file create tx', async () => { + await allure.severity(Severity.BLOCKER); const { transactionId } = await transactionPage.createFile('test', globalCredentials.password); const transactionDetails = await transactionPage.mirrorGetTransactionResponse(transactionId); @@ -362,6 +384,7 @@ test.describe('Transaction tests', () => { }); test('Verify file is stored in the db after file create tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -371,6 +394,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute file read tx', async () => { + await allure.severity(Severity.BLOCKER); await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); const textFromCache = await transactionPage.getTextFromCache(fileId); @@ -381,6 +405,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute file update tx', async () => { + await allure.severity(Severity.BLOCKER); const newText = 'Lorem Ipsum'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -403,6 +428,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can execute file append tx', async () => { + await allure.severity(Severity.BLOCKER); const newText = ' extra text to append'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -425,6 +451,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can save draft and is visible in the draft page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); await transactionPage.saveDraft(); @@ -449,6 +476,7 @@ test.describe('Transaction tests', () => { }); test('Verify user can delete a draft transaction', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); await transactionPage.saveDraft(); @@ -460,6 +488,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction is no longer visible after we execute the tx', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); await transactionPage.waitForPublicKeyToBeFilled(); @@ -474,6 +503,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction is visible after we execute the tx and we have template checkbox selected', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); await transactionPage.waitForPublicKeyToBeFilled(); @@ -492,6 +522,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for account create tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnCreateAccountTransaction(); @@ -536,6 +567,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for account update tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnUpdateAccountTransaction(); @@ -577,6 +609,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for account delete tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnDeleteAccountTransaction(); @@ -603,6 +636,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for approve allowance tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnApproveAllowanceTransaction(); @@ -634,6 +668,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for create file tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.clickOnCreateNewTransactionButton(); await transactionPage.clickOnFileServiceLink(); await transactionPage.clickOnFileCreateTransaction(); @@ -663,6 +698,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for update file tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); await transactionPage.clickOnCreateNewTransactionButton(); @@ -693,6 +729,7 @@ test.describe('Transaction tests', () => { }); test('Verify draft transaction contains the saved info for append file tx', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); await transactionPage.clickOnCreateNewTransactionButton(); diff --git a/automation/tests/workflowTests.test.js b/automation/tests/workflowTests.test.js index dd075b807..cf2e03bc8 100644 --- a/automation/tests/workflowTests.test.js +++ b/automation/tests/workflowTests.test.js @@ -14,6 +14,8 @@ const TransactionPage = require('../pages/TransactionPage'); const AccountPage = require('../pages/AccountPage'); const FilePage = require('../pages/FilePage'); const DetailsPage = require('../pages/DetailsPage'); +const { allure } = require('allure-playwright'); +const { Severity } = require('allure-js-commons'); let app, window; let globalCredentials = { email: '', password: '' }; @@ -60,12 +62,13 @@ test.describe('Workflow tests', () => { }); test.beforeEach(async () => { - await transactionPage.closeCompletedTransaction(); + //await transactionPage.closeCompletedTransaction(); await transactionPage.clickOnTransactionsMenuButton(); await transactionPage.closeDraftModal(); }); test('Verify account card is visible with valid information', async () => { + await allure.severity(Severity.NORMAL); const initialHbarFunds = '1'; const memoText = 'test memo'; const maxAutoAssociations = '23'; @@ -137,6 +140,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Create New" button navigates the user on create account tx page', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.mirrorGetAccountResponse(accountFromList); @@ -151,6 +155,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Edit" and "Update" navigates the user on update account tx page with prefilled account', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.mirrorGetAccountResponse(accountFromList); @@ -168,6 +173,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Edit" and "Delete" navigates the user on update account tx page with prefilled account', async () => { + await allure.severity(Severity.TRIVIAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.mirrorGetAccountResponse(accountFromList); @@ -184,6 +190,7 @@ test.describe('Workflow tests', () => { }); test('Verify user can unlink accounts', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); await transactionPage.clickOnTransactionsMenuButton(); @@ -208,6 +215,7 @@ test.describe('Workflow tests', () => { }); test('Verify user can add an existing account', async () => { + await allure.severity(Severity.NORMAL); await accountPage.ensureAccountExistsAndUnlinked(globalCredentials.password); const accountFromList = await accountPage.getFirstAccountFromUnlinkedList(); await accountPage.clickOnAccountsLink(); @@ -223,6 +231,7 @@ test.describe('Workflow tests', () => { }); test('Verify file card is visible with valid information', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); await accountPage.clickOnAccountsLink(); await filePage.clickOnFilesMenuButton(); @@ -253,6 +262,7 @@ test.describe('Workflow tests', () => { }); test('Verify file card update flow leads to update page with prefilled fileid', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); await accountPage.clickOnAccountsLink(); await filePage.clickOnFilesMenuButton(); @@ -267,6 +277,7 @@ test.describe('Workflow tests', () => { }); test('Verify file card append flow leads to append page with prefilled fileid', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); await accountPage.clickOnAccountsLink(); await filePage.clickOnFilesMenuButton(); @@ -281,6 +292,7 @@ test.describe('Workflow tests', () => { }); test('Verify file card read flow leads to read page with prefilled fileid', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); await accountPage.clickOnAccountsLink(); await filePage.clickOnFilesMenuButton(); @@ -295,6 +307,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Add new" and "Create new" navigates the user to create new file transaction page', async () => { + await allure.severity(Severity.TRIVIAL); await filePage.clickOnFilesMenuButton(); await filePage.clickOnAddNewFileButton(); await filePage.clickOnCreateNewFileLink(); @@ -304,6 +317,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Add new" and "Update" navigates the user to update file transaction page w/o prefilled id', async () => { + await allure.severity(Severity.TRIVIAL); await filePage.clickOnFilesMenuButton(); await filePage.clickOnAddNewFileButton(); await filePage.clickOnUpdateFileLink(); @@ -316,6 +330,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Add new" and "Append" navigates the user to update file transaction page w/o prefilled id', async () => { + await allure.severity(Severity.TRIVIAL); await filePage.clickOnFilesMenuButton(); await filePage.clickOnAddNewFileButton(); await filePage.clickOnAppendFileLink(); @@ -328,6 +343,7 @@ test.describe('Workflow tests', () => { }); test('Verify clicking on "Add new" and "Read" navigates the user to update file transaction page w/o prefilled id', async () => { + await allure.severity(Severity.TRIVIAL); await filePage.clickOnFilesMenuButton(); await filePage.clickOnAddNewFileButton(); await filePage.clickOnReadFileLink(); @@ -340,6 +356,7 @@ test.describe('Workflow tests', () => { }); test('Verify user can unlink multiple files', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureFileExists('test', globalCredentials.password); await filePage.clickOnFilesMenuButton(); const fileFromPage = await filePage.getFirstFileIdFromPage(); @@ -364,6 +381,7 @@ test.describe('Workflow tests', () => { }); test('Verify user can add an existing file to files card', async () => { + await allure.severity(Severity.NORMAL); await filePage.ensureFileExistsAndUnlinked(globalCredentials.password); await filePage.clickOnFilesMenuButton(); await filePage.clickOnAddNewButtonForFile(); @@ -379,12 +397,14 @@ test.describe('Workflow tests', () => { }); test('Verify account create tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); const { newTransactionId } = await transactionPage.createNewAccount(globalCredentials.password); await transactionPage.clickOnTransactionsMenuButton(); await detailsPage.assertTransactionDisplayed(newTransactionId, 'Account Create Transaction'); }); test('Verify transaction details are displayed for account tx ', async () => { + await allure.severity(Severity.NORMAL); const { newTransactionId } = await transactionPage.createNewAccount(globalCredentials.password); await transactionPage.clickOnTransactionsMenuButton(); await detailsPage.clickOnFirstTransactionDetailsButton(); @@ -412,6 +432,7 @@ test.describe('Workflow tests', () => { }); test('Verify account update tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const updatedMemoText = 'Updated memo'; @@ -427,6 +448,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for account update tx ', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const updatedMemoText = 'Updated memo'; @@ -469,6 +491,7 @@ test.describe('Workflow tests', () => { }); test('Verify account delete tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const newTransactionId = await transactionPage.deleteAccount( @@ -480,6 +503,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for account delete tx ', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const newTransactionId = await transactionPage.deleteAccount( @@ -502,6 +526,7 @@ test.describe('Workflow tests', () => { }); test('Verify transfer tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeTransferred = '1'; @@ -515,6 +540,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for transfer tx ', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeTransferred = '1'; @@ -545,6 +571,7 @@ test.describe('Workflow tests', () => { }); test('Verify approve allowance tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeApproved = '10'; @@ -561,6 +588,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for approve allowance tx ', async () => { + await allure.severity(Severity.NORMAL); await transactionPage.ensureAccountExists(globalCredentials.password); const accountFromList = await transactionPage.getFirstAccountFromList(); const amountToBeApproved = '10'; @@ -588,12 +616,14 @@ test.describe('Workflow tests', () => { }); test('Verify file create tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); const { transactionId } = await transactionPage.createFile('test', globalCredentials.password); await transactionPage.clickOnTransactionsMenuButton(); await detailsPage.assertTransactionDisplayed(transactionId, 'File Create Transaction'); }); test('Verify transaction details are displayed for file create tx ', async () => { + await allure.severity(Severity.NORMAL); const { transactionId } = await transactionPage.createFile('test', globalCredentials.password); await transactionPage.clickOnTransactionsMenuButton(); await detailsPage.clickOnFirstTransactionDetailsButton(); @@ -614,6 +644,7 @@ test.describe('Workflow tests', () => { }); test('Verify file update tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); const newText = 'Lorem Ipsum'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -627,6 +658,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for file update tx ', async () => { + await allure.severity(Severity.NORMAL); const newText = 'New text'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -654,6 +686,7 @@ test.describe('Workflow tests', () => { }); test('Verify file append tx is displayed in history page', async () => { + await allure.severity(Severity.NORMAL); const newText = ' extra text to append'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); @@ -667,6 +700,7 @@ test.describe('Workflow tests', () => { }); test('Verify transaction details are displayed for file append tx ', async () => { + await allure.severity(Severity.NORMAL); const newText = ' extra text to append'; await transactionPage.ensureFileExists('test', globalCredentials.password); const fileId = await transactionPage.getFirsFileIdFromCache(); From 2795bb9ce6800c9ae71c5278af74b48846f652bf Mon Sep 17 00:00:00 2001 From: Yordan Iliev Date: Wed, 26 Jun 2024 16:33:55 +0300 Subject: [PATCH 3/4] Edit readme and fix flaky behaviour Signed-off-by: Yordan Iliev --- automation/README.md | 17 ++++++- automation/pages/AccountPage.js | 28 ++++++----- automation/pages/DetailsPage.js | 6 +-- automation/pages/FilePage.js | 39 ++++++++------- automation/pages/RegistrationPage.js | 2 +- automation/pages/SettingsPage.js | 72 ++++++++++++++-------------- automation/pages/TransactionPage.js | 2 +- 7 files changed, 94 insertions(+), 72 deletions(-) diff --git a/automation/README.md b/automation/README.md index 24724cad8..eb97ca667 100644 --- a/automation/README.md +++ b/automation/README.md @@ -63,7 +63,7 @@ npx playwright test This will launch Playwright and execute the test suites defined in the project, outputting the results to your terminal. -## Current Đ¢est Suites +## Current Test Suites ### 1. Registration tests @@ -94,3 +94,18 @@ npx playwright test tests/TransactionTests ```bash npx playwright test tests/WorkflowTests ``` + +## Test Reports +After running the tests, you can generate and view Allure reports by executing the following commands: + +### 1. Generate reports + +```bash +npm run allure:generate +``` + +### 2. Open reports + +```bash +npm run allure:open +``` diff --git a/automation/pages/AccountPage.js b/automation/pages/AccountPage.js index 14e4645ef..e4586e8cd 100644 --- a/automation/pages/AccountPage.js +++ b/automation/pages/AccountPage.js @@ -43,20 +43,23 @@ class AccountPage extends BasePage { multiSelectCheckboxSelector = 'checkbox-multiple-account-id-'; async clickOnEditButton() { - return allure.step('Click on Edit Button', async () => { + await allure.step('Click on Edit Button', async () => { await this.clickByTestId(this.editButtonSelector); }); } async clickOnRemoveButton() { - return allure.step('Click on Remove Button', async () => { + await allure.step('Click on Remove Button', async () => { await this.clickByTestId(this.removeButtonSelector); }); } async clickOnAddNewButton() { - return allure.step('Click on Add New Button', async () => { + await allure.step('Click on Add New Button', async () => { + const { delay } = await import('../utils/util.js'); + await delay(500); await this.clickByTestId(this.addNewButtonSelector); + await delay(500); }); } @@ -73,7 +76,7 @@ class AccountPage extends BasePage { } async clickOnAccountsLink() { - return allure.step('Click on Accounts Link', async () => { + await allure.step('Click on Accounts Link', async () => { await this.clickByTestId(this.accountsLinkSelector); }); } @@ -169,13 +172,13 @@ class AccountPage extends BasePage { } async clickOnDeleteFromNetworkLink() { - return allure.step('Click on Delete From Network Link', async () => { + await allure.step('Click on Delete From Network Link', async () => { await this.clickByTestId(this.deleteFromNetworkLinkSelector); }); } async clickOnUpdateInNetworkLink() { - return allure.step('Click on Update In Network Link', async () => { + await allure.step('Click on Update In Network Link', async () => { await this.clickByTestId(this.updateInNetworkLinkSelector); }); } @@ -187,20 +190,20 @@ class AccountPage extends BasePage { } async unlinkAccounts() { - return allure.step('Unlink Accounts', async () => { + await allure.step('Unlink Accounts', async () => { await this.waitForElementToBeVisible(this.confirmUnlinkButtonSelector); await this.clickByTestId(this.confirmUnlinkButtonSelector); }); } async fillInExistingAccountId(accountId) { - return allure.step('Fill In Existing Account ID', async () => { + await allure.step('Fill In Existing Account ID', async () => { await this.fillByTestId(this.existingAccountIdInputSelector, accountId); }); } async clickOnLinkAccountButton() { - return allure.step('Click on Link Account Button', async () => { + await allure.step('Click on Link Account Button', async () => { await this.clickByTestId(this.linkAccountButtonSelector); }); } @@ -218,7 +221,7 @@ class AccountPage extends BasePage { } async ensureAccountExistsAndUnlinked(password) { - return allure.step('Ensure Account Exists and Unlinked', async () => { + await allure.step('Ensure Account Exists and Unlinked', async () => { if (await this.isUnlinkedAccountsListEmpty()) { const { newAccountId } = await this.transactionPage.createNewAccount(password); await this.transactionPage.mirrorGetAccountResponse(newAccountId); @@ -226,12 +229,13 @@ class AccountPage extends BasePage { await this.clickOnAccountsLink(); await this.clickOnRemoveButton(); await this.unlinkAccounts(newAccountId); + await this.addAccountToUnliked(newAccountId); } }); } async clickOnAccountCheckbox(accountId) { - return allure.step('Click on Account Checkbox', async () => { + await allure.step('Click on Account Checkbox', async () => { const { delay } = await import('../utils/util.js'); await delay(1000); const index = await this.transactionPage.findAccountIndexById(accountId); @@ -240,7 +244,7 @@ class AccountPage extends BasePage { } async clickOnSelectManyAccountsButton() { - return allure.step('Click on Select Many Accounts Button', async () => { + await allure.step('Click on Select Many Accounts Button', async () => { await this.clickByTestId(this.selectManyAccountsButtonSelector); }); } diff --git a/automation/pages/DetailsPage.js b/automation/pages/DetailsPage.js index b5ea307e1..fe81d3c44 100644 --- a/automation/pages/DetailsPage.js +++ b/automation/pages/DetailsPage.js @@ -47,7 +47,7 @@ class DetailsPage extends BasePage { fileDetailsKeyTextSelector = 'p-file-details-key-text'; async clickOnFirstTransactionDetailsButton() { - return allure.step('Click on First Transaction Details Button', async () => { + await allure.step('Click on First Transaction Details Button', async () => { await this.clickByTestId(this.transactionDetailsButtonIndexSelector + '0'); }); } @@ -251,7 +251,7 @@ class DetailsPage extends BasePage { } async assertTransactionDisplayed(expectedId, expectedType) { - return allure.step('Assert Transaction Displayed', async () => { + await allure.step('Assert Transaction Displayed', async () => { const transactionId = await this.getFirstTransactionId(); expect(expectedId.toString()).toContain(transactionId); @@ -270,7 +270,7 @@ class DetailsPage extends BasePage { } async assertTransactionDetails(expectedId, expectedType, extraAssertions = () => {}) { - return allure.step('Assert Transaction Details', async () => { + await allure.step('Assert Transaction Details', async () => { const transactionId = await this.getTransactionDetailsId(); expect(expectedId.toString()).toContain(transactionId); diff --git a/automation/pages/FilePage.js b/automation/pages/FilePage.js index 09d1fbf7c..5a135ccd7 100644 --- a/automation/pages/FilePage.js +++ b/automation/pages/FilePage.js @@ -41,25 +41,25 @@ class FilePage extends BasePage { toastMessageSelector = '.v-toast__text'; async clickOnRemoveFileCardButton() { - return allure.step('Click on Remove File Card Button', async () => { + await allure.step('Click on Remove File Card Button', async () => { await this.clickByTestId(this.removeFileCardButtonSelector); }); } async clickOnUpdateFileButton() { - return allure.step('Click on Update File Button', async () => { + await allure.step('Click on Update File Button', async () => { await this.clickByTestId(this.updateFileButtonSelector); }); } async clickOnAppendFileButton() { - return allure.step('Click on Append File Button', async () => { + await allure.step('Click on Append File Button', async () => { await this.clickByTestId(this.appendFileButtonSelector); }); } async clickOnReadFileButton() { - return allure.step('Click on Read File Button', async () => { + await allure.step('Click on Read File Button', async () => { await this.clickByTestId(this.readFileButtonSelector); }); } @@ -71,43 +71,43 @@ class FilePage extends BasePage { } async clickOnCreateNewFileLink() { - return allure.step('Click on Create New File Link', async () => { + await allure.step('Click on Create New File Link', async () => { await this.clickByTestId(this.createNewLinkSelector); }); } async clickOnUpdateFileLink() { - return allure.step('Click on Update File Link', async () => { + await allure.step('Click on Update File Link', async () => { await this.clickByTestId(this.updateLinkSelector); }); } async clickOnAppendFileLink() { - return allure.step('Click on Append File Link', async () => { + await allure.step('Click on Append File Link', async () => { await this.clickByTestId(this.appendLinkSelector); }); } async clickOnReadFileLink() { - return allure.step('Click on Read File Link', async () => { + await allure.step('Click on Read File Link', async () => { await this.clickByTestId(this.readLinkSelector); }); } async clickOnAddExistingFileLink() { - return allure.step('Click on Add Existing File Link', async () => { + await allure.step('Click on Add Existing File Link', async () => { await this.clickByTestId(this.addExistingLinkSelector); }); } async clickOnLinkFileButton() { - return allure.step('Click on Link File Button', async () => { + await allure.step('Click on Link File Button', async () => { await this.clickByTestId(this.linkFileButtonSelector); }); } async fillInExistingFileId(fileId) { - return allure.step('Fill in Existing File ID', async () => { + await allure.step('Fill in Existing File ID', async () => { await this.fillByTestId(this.existingFileIdInputSelector, fileId); }); } @@ -173,19 +173,19 @@ class FilePage extends BasePage { } async addFileToUnliked(fileId) { - return allure.step('Add File to Unliked', async () => { + await allure.step('Add File to Unliked', async () => { this.unlikedFiles.push(fileId); }); } async clickOnFilesMenuButton() { - return allure.step('Click on Files Menu Button', async () => { + await allure.step('Click on Files Menu Button', async () => { await this.clickByTestId(this.filesMenuButtonSelector); }); } async clickOnConfirmUnlinkFileButton() { - return allure.step('Click on Confirm Unlink File Button', async () => { + await allure.step('Click on Confirm Unlink File Button', async () => { await this.clickByTestId(this.confirmUnlinkFileButtonSelector); }); } @@ -197,13 +197,16 @@ class FilePage extends BasePage { } async clickOnAddNewButtonForFile() { - return allure.step('Click on Add New Button for File', async () => { + await allure.step('Click on Add New Button for File', async () => { + const { delay } = await import('../utils/util.js'); + await delay(500); await this.clickByTestId(this.addNewButtonSelector); + await delay(500); }); } async clickOnFileCheckbox(fileId) { - return allure.step('Click on File Checkbox', async () => { + await allure.step('Click on File Checkbox', async () => { const { delay } = await import('../utils/util.js'); await delay(1000); const index = await this.findFileByIndex(fileId); @@ -241,7 +244,7 @@ class FilePage extends BasePage { } async ensureFileExistsAndUnlinked(password) { - return allure.step('Ensure File Exists and Unlinked', async () => { + await allure.step('Ensure File Exists and Unlinked', async () => { if (await this.isUnlinkedFilesEmpty()) { const { fileId } = await this.transactionPage.createFile('test', password); await this.clickOnFilesMenuButton(); @@ -254,7 +257,7 @@ class FilePage extends BasePage { } async clickOnSelectManyFilesButton() { - return allure.step('Click on Select Many Files Button', async () => { + await allure.step('Click on Select Many Files Button', async () => { await this.clickByTestId(this.selectManyFilesButtonSelector); }); } diff --git a/automation/pages/RegistrationPage.js b/automation/pages/RegistrationPage.js index a03f8e839..1ed1314ae 100644 --- a/automation/pages/RegistrationPage.js +++ b/automation/pages/RegistrationPage.js @@ -478,7 +478,7 @@ class RegistrationPage extends BasePage { async isConfirmPasswordFieldVisible() { return await allure.step('Is Confirm Password Field Visible', async () => { - return await this.isElementVisible(this.confirmPasswordInputSelector, 5000); + return await this.isElementVisible(this.confirmPasswordInputSelector, 7500); }); } diff --git a/automation/pages/SettingsPage.js b/automation/pages/SettingsPage.js index c2496003b..92d138746 100644 --- a/automation/pages/SettingsPage.js +++ b/automation/pages/SettingsPage.js @@ -84,7 +84,7 @@ class SettingsPage extends BasePage { } async incrementIndex() { - return allure.step('Increment Index', async () => { + await allure.step('Increment Index', async () => { let numericValue = parseInt(this.currentIndex); numericValue++; this.currentIndex = numericValue.toString(); @@ -92,7 +92,7 @@ class SettingsPage extends BasePage { } async decrementIndex() { - return allure.step('Decrement Index', async () => { + await allure.step('Decrement Index', async () => { let numericValue = parseInt(this.currentIndex); numericValue--; this.currentIndex = numericValue.toString(); @@ -136,25 +136,25 @@ class SettingsPage extends BasePage { } async clickOnSettingsButton() { - return allure.step('Click on Settings Button', async () => { + await allure.step('Click on Settings Button', async () => { await this.clickByTestId(this.settingsButtonSelector); }); } async clickOnKeysTab() { - return allure.step('Click on Keys Tab', async () => { + await allure.step('Click on Keys Tab', async () => { await this.clickByTestId(this.keysTabButtonSelector); }); } async clickOnProfileTab() { - return allure.step('Click on Profile Tab', async () => { + await allure.step('Click on Profile Tab', async () => { await this.clickByTestId(this.profileTabButtonSelector); }); } async clickOnRestoreButton() { - return allure.step('Click on Restore Button', async () => { + await allure.step('Click on Restore Button', async () => { const { delay } = require('../utils/util.js'); const maxRetries = 10; let attempt = 0; @@ -175,139 +175,139 @@ class SettingsPage extends BasePage { } async clickOnContinueButton() { - return allure.step('Click on Continue Button', async () => { + await allure.step('Click on Continue Button', async () => { await this.clickByTestId(this.continueButtonSelector, 25000); }); } async fillInPassword(password) { - return allure.step('Fill in Password', async () => { + await allure.step('Fill in Password', async () => { await this.fillByTestId(this.passwordInputSelector, password); }); } async clickOnPasswordContinueButton() { - return allure.step('Click on Password Continue Button', async () => { + await allure.step('Click on Password Continue Button', async () => { await this.clickByTestId(this.continuePasswordButtonSelector); }); } async fillInIndex(index = 1) { - return allure.step('Fill in Index', async () => { + await allure.step('Fill in Index', async () => { await this.fillByTestId(this.indexInputSelector, index); }); } async clickOnIndexContinueButton() { - return allure.step('Click on Index Continue Button', async () => { + await allure.step('Click on Index Continue Button', async () => { await this.clickByTestId(this.continueIndexButtonSelector); }); } async fillInNickname(nickname) { - return allure.step('Fill in Nickname', async () => { + await allure.step('Fill in Nickname', async () => { await this.fillByTestId(this.nicknameInputSelector, nickname); }); } async clickOnNicknameContinueButton() { - return allure.step('Click on Nickname Continue Button', async () => { + await allure.step('Click on Nickname Continue Button', async () => { await this.clickByTestId(this.continueNicknameButtonSelector, 12000); }); } async clickOnContinuePhraseButton() { - return allure.step('Click on Continue Phrase Button', async () => { + await allure.step('Click on Continue Phrase Button', async () => { await this.clickByTestId(this.continuePhraseButtonSelector); }); } async clickOnCustomTab() { - return allure.step('Click on Custom Tab', async () => { + await allure.step('Click on Custom Tab', async () => { await this.clickByTestId(this.customTabButtonSelector); }); } async clickOnImportButton() { - return allure.step('Click on Import Button', async () => { + await allure.step('Click on Import Button', async () => { await this.clickByTestId(this.importButtonSelector); }); } async clickOnECDSADropDown() { - return allure.step('Click on ECDSA Drop Down', async () => { + await allure.step('Click on ECDSA Drop Down', async () => { await this.clickByTestId(this.ecdsaImportLinkSelector); }); } async clickOnED25519DropDown() { - return allure.step('Click on ED25519 Drop Down', async () => { + await allure.step('Click on ED25519 Drop Down', async () => { await this.clickByTestId(this.ed25519ImportLinkSelector); }); } async fillInECDSAPrivateKey(ecdsaPrivateKey) { - return allure.step('Fill in ECDSA Private Key', async () => { + await allure.step('Fill in ECDSA Private Key', async () => { await this.fillByTestId(this.ecdsaPrivateKeyInputSelector, ecdsaPrivateKey); }); } async fillInED25519PrivateKey(ecdsaPrivateKey) { - return allure.step('Fill in ED25519 Private Key', async () => { + await allure.step('Fill in ED25519 Private Key', async () => { await this.fillByTestId(this.ed25519PrivateKeyInputSelector, ecdsaPrivateKey); }); } async fillInECDSANickname(ecdsaNickname) { - return allure.step('Fill in ECDSA Nickname', async () => { + await allure.step('Fill in ECDSA Nickname', async () => { await this.fillByTestId(this.ecdsaNicknameInputSelector, ecdsaNickname); }); } async fillInED25519Nickname(ecdsaNickname) { - return allure.step('Fill in ED25519 Nickname', async () => { + await allure.step('Fill in ED25519 Nickname', async () => { await this.fillByTestId(this.ed25519PNicknameInputSelector, ecdsaNickname); }); } async fillInECDSAPassword(password) { - return allure.step('Fill in ECDSA Password', async () => { + await allure.step('Fill in ECDSA Password', async () => { await this.fillByTestId(this.ecdsaPasswordInputSelector, password); }); } async fillInED25519Password(password) { - return allure.step('Fill in ED25519 Password', async () => { + await allure.step('Fill in ED25519 Password', async () => { await this.fillByTestId(this.ed25519PasswordInputSelector, password); }); } async clickOnECDSAImportButton() { - return allure.step('Click on ECDSA Import Button', async () => { + await allure.step('Click on ECDSA Import Button', async () => { await this.clickByTestId(this.ecdsaImportButtonSelector); }); } async clickOnED25519ImportButton() { - return allure.step('Click on ED25519 Import Button', async () => { + await allure.step('Click on ED25519 Import Button', async () => { await this.clickByTestId(this.ed25519ImportButtonSelector); }); } async clickOnEyeDecryptIcon() { - return allure.step('Click on Eye Decrypt Icon', async () => { + await allure.step('Click on Eye Decrypt Icon', async () => { await this.clickByTestId(this.decryptMainPrivateKeyButtonSelector); }); } async fillInDecryptPassword(password) { - return allure.step('Fill in Decrypt Password', async () => { + await allure.step('Fill in Decrypt Password', async () => { await this.fillByTestId(this.decryptPasswordInputSelector, password); }); } async clickOnDecryptButton() { - return allure.step('Click on Decrypt Button', async () => { + await allure.step('Click on Decrypt Button', async () => { await this.clickByTestId(this.decryptPasswordButtonSelector); }); } @@ -319,43 +319,43 @@ class SettingsPage extends BasePage { } async clickOnDeleteButtonAtIndex(index) { - return allure.step('Click on Delete Button at Index', async () => { + await allure.step('Click on Delete Button at Index', async () => { await this.clickByTestId(this.deleteKeyButtonPrefix + index); }); } async clickOnDeleteKeyPairButton() { - return allure.step('Click on Delete Key Pair Button', async () => { + await allure.step('Click on Delete Key Pair Button', async () => { await this.clickByTestId(this.deleteKeyPairButton); }); } async fillInCurrentPassword(password) { - return allure.step('Fill in Current Password', async () => { + await allure.step('Fill in Current Password', async () => { await this.fillByTestId(this.currentPasswordInputSelector, password); }); } async fillInNewPassword(password) { - return allure.step('Fill in New Password', async () => { + await allure.step('Fill in New Password', async () => { await this.fillByTestId(this.newPasswordInputSelector, password); }); } async clickOnChangePasswordButton() { - return allure.step('Click on Change Password Button', async () => { + await allure.step('Click on Change Password Button', async () => { await this.clickByTestId(this.changePasswordButtonSelector); }); } async clickOnConfirmChangePassword() { - return allure.step('Click on Confirm Change Password', async () => { + await allure.step('Click on Confirm Change Password', async () => { await this.clickByTestId(this.confirmChangePasswordButtonSelector); }); } async clickOnCloseButton() { - return allure.step('Click on Close Button', async () => { + await allure.step('Click on Close Button', async () => { await this.waitForElementToBeVisible(this.closeButtonSelector, 15000); await this.clickByTestId(this.closeButtonSelector); }); diff --git a/automation/pages/TransactionPage.js b/automation/pages/TransactionPage.js index 9ddb2ad2e..fb217e8f0 100644 --- a/automation/pages/TransactionPage.js +++ b/automation/pages/TransactionPage.js @@ -133,7 +133,7 @@ class TransactionPage extends BasePage { async closeDraftModal() { return await allure.step('Close Draft Modal', async () => { const modalButton = this.window.getByTestId(this.discardModalDraftButtonSelector); - await modalButton.waitFor({ state: 'visible', timeout: 500 }).catch(e => {}); + await modalButton.waitFor({ state: 'visible', timeout: 100 }).catch(e => {}); if (await modalButton.isVisible()) { await modalButton.click(); From 24f04e5ad8b6b73d16f4e918dc5d75888077ed5b Mon Sep 17 00:00:00 2001 From: Yordan Iliev Date: Wed, 26 Jun 2024 16:50:54 +0300 Subject: [PATCH 4/4] Fix playwright reporter Signed-off-by: Yordan Iliev --- automation/playwright.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automation/playwright.config.js b/automation/playwright.config.js index 109177430..84f8c8fb4 100644 --- a/automation/playwright.config.js +++ b/automation/playwright.config.js @@ -2,13 +2,12 @@ import { defineConfig } from '@playwright/test'; import * as os from 'os'; import dotenv from 'dotenv'; -// Load environment variables from .env file dotenv.config(); export default defineConfig({ reporter: process.env.CI ? [ - 'github', + ['github'], ['list'], [ 'allure-playwright',