diff --git a/packages/e2e-tests/src/assert/settings/CookiePolicyDrawerAssert.ts b/packages/e2e-tests/src/assert/settings/CookiePolicyDrawerAssert.ts index bc54b91b5f..3b16317a9c 100644 --- a/packages/e2e-tests/src/assert/settings/CookiePolicyDrawerAssert.ts +++ b/packages/e2e-tests/src/assert/settings/CookiePolicyDrawerAssert.ts @@ -2,6 +2,8 @@ import CookiePolicyDrawer from '../../elements/settings/CookiePolicyDrawer'; import { expect } from 'chai'; import { readFromFile } from '../../utils/fileUtils'; import { t } from '../../utils/translationService'; +import { browser } from '@wdio/globals'; +import { removeWhitespacesFromText } from '../../utils/textUtils'; class CookiePolicyDrawerAssert { assertSeeDrawerNavigationTitle = async () => { @@ -28,9 +30,22 @@ class CookiePolicyDrawerAssert { assertSeeCookiePolicyContent = async () => { await CookiePolicyDrawer.cookiePolicyContent.waitForDisplayed(); - const actualCookiePolicyText = await CookiePolicyDrawer.cookiePolicyContent.getText(); - const expectedCookiePolicyText = readFromFile(__dirname, './cookiePolicy.txt'); - await expect(actualCookiePolicyText).to.equal(expectedCookiePolicyText); + + const expectedCookiePolicyText = await removeWhitespacesFromText(readFromFile(__dirname, './cookiePolicy.txt')); + + await browser.waitUntil( + async () => + (await removeWhitespacesFromText(await CookiePolicyDrawer.cookiePolicyContent.getText())) === + expectedCookiePolicyText, + { + timeout: 3000, + interval: 1000, + timeoutMsg: `failed while waiting for expected cookie policy text + expected: ${expectedCookiePolicyText} + current: ${await removeWhitespacesFromText(await CookiePolicyDrawer.cookiePolicyContent.getText())} + ` + } + ); }; } diff --git a/packages/e2e-tests/src/assert/settings/PrivacyPolicyDrawerAssert.ts b/packages/e2e-tests/src/assert/settings/PrivacyPolicyDrawerAssert.ts index d36d8fd488..32dfc88744 100644 --- a/packages/e2e-tests/src/assert/settings/PrivacyPolicyDrawerAssert.ts +++ b/packages/e2e-tests/src/assert/settings/PrivacyPolicyDrawerAssert.ts @@ -3,6 +3,7 @@ import { t } from '../../utils/translationService'; import { expect } from 'chai'; import { readFromFile } from '../../utils/fileUtils'; import { removeWhitespacesFromText } from '../../utils/textUtils'; +import { browser } from '@wdio/globals'; class PrivacyPolicyDrawerAssert { assertSeeDrawerNavigationTitle = async () => { @@ -28,11 +29,20 @@ class PrivacyPolicyDrawerAssert { } async assertSeePrivacyPolicyContent() { - const expectedPolicy = readFromFile(__dirname, '../settings/privacyPolicy.txt'); + const expectedPolicy = await removeWhitespacesFromText(readFromFile(__dirname, '../settings/privacyPolicy.txt')); await PrivacyPolicyDrawer.privacyPolicyContent.waitForDisplayed(); - const currentPolicy = await PrivacyPolicyDrawer.privacyPolicyContent.getText(); - await expect(await removeWhitespacesFromText(currentPolicy)).to.equal( - await removeWhitespacesFromText(expectedPolicy) + + await browser.waitUntil( + async () => + (await removeWhitespacesFromText(await PrivacyPolicyDrawer.privacyPolicyContent.getText())) === expectedPolicy, + { + timeout: 3000, + interval: 1000, + timeoutMsg: `failed while waiting for expected privacy policy text + expected: ${expectedPolicy} + current: ${await removeWhitespacesFromText(await PrivacyPolicyDrawer.privacyPolicyContent.getText())} + ` + } ); } } diff --git a/packages/e2e-tests/src/assert/settings/TermsAndConditionsSettingsDrawerAssert.ts b/packages/e2e-tests/src/assert/settings/TermsAndConditionsSettingsDrawerAssert.ts index 960657c539..0209d0579c 100644 --- a/packages/e2e-tests/src/assert/settings/TermsAndConditionsSettingsDrawerAssert.ts +++ b/packages/e2e-tests/src/assert/settings/TermsAndConditionsSettingsDrawerAssert.ts @@ -1,8 +1,8 @@ import TermsAndConditionsDrawer from '../../elements/settings/TermsAndConditionsDrawer'; -import { expect } from 'chai'; import { removeWhitespacesFromText } from '../../utils/textUtils'; import { readFromFile } from '../../utils/fileUtils'; import { isPopupMode } from '../../utils/pageUtils'; +import { browser } from '@wdio/globals'; class TermsAndConditionsSettingsDrawerAssert { assertTermsAndConditionsContent = async () => { @@ -10,11 +10,22 @@ class TermsAndConditionsSettingsDrawerAssert { ? await TermsAndConditionsDrawer.drawerHeaderBackButton.waitForClickable() : await TermsAndConditionsDrawer.drawerHeaderCloseButton.waitForClickable(); await TermsAndConditionsDrawer.termsAndConditionsContent.waitForDisplayed(); - const actualContent = await removeWhitespacesFromText( - await TermsAndConditionsDrawer.termsAndConditionsContent.getText() + + const expectedPolicy = await removeWhitespacesFromText(readFromFile(__dirname, './termsAndConditions.txt')); + + await browser.waitUntil( + async () => + (await removeWhitespacesFromText(await TermsAndConditionsDrawer.termsAndConditionsContent.getText())) === + expectedPolicy, + { + timeout: 3000, + interval: 1000, + timeoutMsg: `failed while waiting for expected T&C policy text + expected: ${expectedPolicy} + current: ${await removeWhitespacesFromText(await TermsAndConditionsDrawer.termsAndConditionsContent.getText())} + ` + } ); - const expectedContent = await removeWhitespacesFromText(readFromFile(__dirname, './termsAndConditions.txt')); - await expect(actualContent).to.equal(expectedContent); }; }