Skip to content

Commit

Permalink
FRW-9368 WIP adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
olhalivitchuk committed Dec 5, 2024
1 parent 12030a9 commit 2de90d5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
import { container } from '@utils';
import { LocaleScenario } from '@scenarios/yves';
import { LocaleSwitchingScenario } from '@scenarios/yves';
import { CatalogPage, IndexPage } from '@pages/yves';
import { LocaleStaticFixtures } from '@interfaces/yves';

(['b2c', 'b2c-mp', 'b2b', 'b2b-mp'].includes(Cypress.env('repositoryId')) ? describe.skip : describe)(
'locale switching',
{ tags: ['@shop', '@locale'] },
{ tags: ['@core', '@yves'] },
(): void => {
const indexPage = container.get(IndexPage);
const catalogPage = container.get(CatalogPage);
const localeSwitchingScenario = container.get(LocaleScenario);
const visitFirstProductDetailPage = (): void => {
cy.get('[data-qa="component product-item"]')
.first()
.find('a.js-product-item__link-detail-page')
.invoke('attr', 'href')
.then((url) => {
cy.visit(url as string);
});
};
const localeSwitchingScenario = container.get(LocaleSwitchingScenario);

let staticFixtures: LocaleStaticFixtures;

Expand Down Expand Up @@ -47,18 +38,18 @@ import { LocaleStaticFixtures } from '@interfaces/yves';
localeSwitchingScenario.getCurrentLocale(staticFixtures.localeEN);
};

it('Should be able to switch locales at the home page.', (): void => {
testLocaleSwitching(() => indexPage.visit());
});

it('Should be able to switch locales at the catalog page.', (): void => {
testLocaleSwitching(() => catalogPage.visit());
});
// it('Should be able to switch locales at the home page.', (): void => {
// testLocaleSwitching(() => indexPage.visit());
// });
//
// it('Should be able to switch locales at the catalog page.', (): void => {
// testLocaleSwitching(() => catalogPage.visit());
// });

it('Should be able to switch locales at the product detailed page.', (): void => {
catalogPage.visit();

testLocaleSwitching(() => visitFirstProductDetailPage());
testLocaleSwitching(() => catalogPage.search({ query: 'Canon IXUS 285' }));
});
}
);
2 changes: 2 additions & 0 deletions cypress/support/pages/yves/yves-repository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export interface YvesRepository {
}
2 changes: 1 addition & 1 deletion cypress/support/scenarios/yves/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from './agent-login-scenario';
export * from './checkout-scenario';
export * from './checkout-mp-scenario';
export * from './customer-login-scenario';
export * from './locale-scenario';
export * from './locale-switching-scenario';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { injectable } from 'inversify';

@injectable()
@autoWired
export class LocaleScenario {
export class LocaleSwitchingScenario {
getAvailableLocales = (): Cypress.Chainable => {
return cy.get('[data-qa="language-selector"] option').then((options) => {
const values = Array.from(options).map((option) => option.textContent?.trim() || '');
Expand Down
3 changes: 2 additions & 1 deletion cypress/support/types/yves/locale.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Locale } from './shared';
import { Locale, ProductConcrete } from './shared';

export interface LocaleStaticFixtures {
localeDE: string;
localeEN: string;
availableLocales: Locale[];
// concreteProduct: ProductConcrete;
}

0 comments on commit 2de90d5

Please sign in to comment.