Skip to content

Commit

Permalink
fix(e2e): optional WTM tests with external URLS (#2176)
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban authored Jan 8, 2025
1 parent 13e0274 commit e3887f4
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions tests/e2e/spec/whotracksme.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,33 @@ describe('WhoTracksMe', function () {
describe('Trackers Preview', function () {
it('shows badge', async function () {
await setWhoTracksMeToggle('wtmSerpReport', true);
await browser.url(PAGE_URL);

await expect($$('.wtm-tracker-wheel-container')).toBeElementsArrayOfSize({
gte: 1,
});
if (await browser.url(PAGE_URL).catch(() => false)) {
await expect(
$$('.wtm-tracker-wheel-container'),
).toBeElementsArrayOfSize({
gte: 1,
});
}
});

it("doesn't show badge", async function () {
await setWhoTracksMeToggle('wtmSerpReport', false);
await browser.url(PAGE_URL);

await expect($$('.wtm-tracker-wheel-container')).toBeElementsArrayOfSize(
0,
);
if (await browser.url(PAGE_URL).catch(() => false)) {
await expect(
$$('.wtm-tracker-wheel-container'),
).toBeElementsArrayOfSize(0);
}
});

it('shows popover iframe', async function () {
await setWhoTracksMeToggle('wtmSerpReport', true);
await browser.url(PAGE_URL);

await $('.wtm-tracker-wheel-container').click();
await expect($('.wtm-popup-iframe-wrapper iframe')).toBeDisplayed();
if (await browser.url(PAGE_URL).catch(() => false)) {
await $('.wtm-tracker-wheel-container').click();
await expect($('.wtm-popup-iframe-wrapper iframe')).toBeDisplayed();
}
});

it('displays trackers stats', async function () {
Expand All @@ -69,20 +74,20 @@ describe('WhoTracksMe', function () {
await getExtensionElement('button:disable').click();
await getExtensionElement('button:confirm').click();

await browser.url(PAGE_URL);

await expect($$('.wtm-tracker-wheel-container')).toBeElementsArrayOfSize(
0,
);
if (await browser.url(PAGE_URL).catch(() => false)) {
await expect(
$$('.wtm-tracker-wheel-container'),
).toBeElementsArrayOfSize(0);

await browser.url(getExtensionPageURL('settings'));
await getExtensionElement('button:whotracksme').click();
await browser.url(getExtensionPageURL('settings'));
await getExtensionElement('button:whotracksme').click();

const toggleValue = await getExtensionElement(
'toggle:wtmSerpReport',
).getProperty('value');
const toggleValue = await getExtensionElement(
'toggle:wtmSerpReport',
).getProperty('value');

await expect(toggleValue).toBe(false);
await expect(toggleValue).toBe(false);
}
});
});
});

0 comments on commit e3887f4

Please sign in to comment.