Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MerchantUserLoginScenario } from '@scenarios/mp';
describe(
'restore session after login timeout',
{
tags: ['@mp', '@user-account-management', 'marketplace-merchantportal-core'],
tags: ['@mp', '@user-account-management', 'marketplace-merchantportal-core', '@quarantine'],
},
(): void => {
const loginPage = container.get(LoginPage);
Expand All @@ -24,15 +24,18 @@ describe(
});

suiteIt('should redirect merchant user to last-visited page after session timeout re-login', (): void => {
ignoreExpiredSessionParsingError();

merchantUserLoginScenario.execute({
username: dynamicFixtures.merchantUser.username,
password: staticFixtures.defaultPassword,
withoutSession: true,
});

cy.clearCookie('last-visited-page');
cy.intercept('GET', `**${staticFixtures.lastVisitedPageUrl}/table-data**`).as('lastVisitedPageData');
cy.visitMerchantPortal(staticFixtures.lastVisitedPageUrl);
cy.reload();
cy.wait('@lastVisitedPageData');

loginPage.clearSessionCookie();

Expand All @@ -55,6 +58,14 @@ describe(
dashboardPage.assertPageLocation();
});

function ignoreExpiredSessionParsingError(): void {
cy.on('uncaught:exception', (error: Error): false | void => {
if (String(error?.message).includes(loginPage.getPageUrl())) {
return false;
}
});
}

function suiteIt(description: string, testFn: () => void): void {
onlyForRepositoriesIt(['suite', 'b2b-mp'], description, testFn);
}
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/pages/abstract-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export class AbstractPage {
protected DEFAULT_PASSWORD_PREFIX = 'Change!23456';
protected faker = faker;

getPageUrl(): string {
return this.PAGE_URL;
}

assertPageLocation = (): void => {
// eslint-disable-next-line spryker-cypress/no-assertions-in-page-objects -- Page-navigation guard: confirming arrival on PAGE_URL is a page-object responsibility.
cy.url({ timeout: 20000 }).should('include', this.PAGE_URL);
Expand Down
Loading