Skip to content

[WPB-26754] Logout tests#9687

Open
lizaveta-korshuk wants to merge 8 commits into
devfrom
WPB-26754_Logout_tests
Open

[WPB-26754] Logout tests#9687
lizaveta-korshuk wants to merge 8 commits into
devfrom
WPB-26754_Logout_tests

Conversation

@lizaveta-korshuk

@lizaveta-korshuk lizaveta-korshuk commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
StoryWPB-26754 [Desktop/QA] Write Logout tests

Comment thread e2e-tests/poms/app/logoutPopup.page.ts Outdated
Comment thread e2e-tests/specs/criticalFlow/logout.spec.ts
Comment thread e2e-tests/specs/criticalFlow/logout.spec.ts
Comment thread e2e-tests/specs/criticalFlow/logout.spec.ts Outdated
Comment thread e2e-tests/specs/criticalFlow/logout.spec.ts Outdated
Comment thread e2e-tests/specs/criticalFlow/logout.spec.ts Outdated
zhannach
zhannach previously approved these changes Jul 10, 2026
Comment thread package.json Outdated
"lodash": "4.18.1",
"logdown": "3.3.1",
"minimist": "1.2.8",
"open": "^11.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed open is added to package.json, but I couldn't find any imports or usages of it in this PR. Is this dependency actually needed, or was it added unintentionally?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was meant for testing deep links, it will be needed later, but I could remove it for now or leave it for future
It's added anyway but not explicitly

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great then lets remove it for now and add it again when needed.

clearDataCheckbox: app.page.getByTestId('modal-option-checkbox'),
cancelButton: app.page.getByTestId('do-secondary'),
logoutButton: app.page.getByTestId('do-action'),
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modal Dismissal Not Tested

The "Cancel" button on the logout popup is created but never tested.
ESC key dismissal not tested.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is supposed to be tested on web, cancelButton has been added to have full functionality of the pop up available for future need

});

await test.step("User clicks 'Log Out' button on the popup", async () => {
app.page = app.windows()[2];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensing a possible race condition here

app.page = app.windows()[2] relies on window order
If windows are created/destroyed in different order, this breaks. Shall we Use app.waitForEvent('window') or more stable window tracking.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that windows are already created and are not destroyed.
We are checking that (while being on the account A) clicking the logout option in the account's B context menu will trigger the focus on the account B. But then we still need to manually assign app.page to account B which has index 2 because it doesn't happen automatically

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we could find a not active window, e.g. like this

const userBWindow = app.windows().find(win => win !== app.page && win.url().startsWith('http'));

if (userBWindow) {
app.page = userBWindow;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is much better i think it finds the window by logic, not position and works regardless of window count or creation order.

Consider extracting this into a helper function since it might be useful in other tests.

export const switchToNonActiveWindow = async (app: App) => {
  const inactiveWindow = app.windows().find(
    win => win !== app.page && win.url().startsWith('http')
  );
  
  if (!inactiveWindow) {
    throw new Error('No inactive window found');
  }
  
  app.page = inactiveWindow;
};

export const loginUserAfterDataCleanup = async (page: Page, user: User) => {
await fillLoginCredentials(page, user);
const historyConfirmButton = loginPage(page).historyConfirmButton;
await historyConfirmButton.click();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clicking historyConfirmButton without checking if it's visible assumes the history confirmation modal always appears. Should run expect().toBeVisible() first.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-e2e Execute the e2e tests for this PR 👕 size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants