Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Files] Change language test #2192

Merged
merged 5 commits into from
Jun 16, 2022
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 @@ -10,6 +10,9 @@ import { planChangeSuccessModal } from "../../support/page-objects/modals/billin
export const settingsPage = {
...basePage,

// settings
settingsTitleLabel: () => cy.get("[data-cy=label-title-settings]"),

// profile tab
profileTabButton: () => cy.get("[data-testid=tab-profile]"),
profileTabHeader: () => cy.get("[data-cy=label-profile-header]"),
Expand All @@ -29,6 +32,12 @@ export const settingsPage = {
displayTabHeader: () => cy.get("[data-cy=label-display-header]"),
darkThemeLabel: () => cy.get("[data-testid=radio-input-dark-theme]"),
lightThemeLabel: () => cy.get("[data-testid=radio-input-light-theme]"),
languageDropdown: () => cy.get("[data-testid=dropdown-title-language-selection]"),
germanLanguageOption: () => cy.get("[data-cy=label-language-option-de]"),
englishLanguageOption: () => cy.get("[data-cy=label-language-option-en]"),
spanishLanguageOption: () => cy.get("[data-cy=label-language-option-es]"),
frenchLanguageOption: () => cy.get("[data-cy=label-language-option-fr]"),
norwegianLanguageOption: () => cy.get("[data-cy=label-language-option-no]"),

// security tab
securityTabButton: () => cy.get("[data-testid=tab-security]"),
Expand Down
53 changes: 53 additions & 0 deletions packages/files-ui/cypress/tests/settings.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,59 @@ describe("Settings", () => {
})
})
})

it("can switch between different languages that the app provides", () => {
cy.web3Login({ withNewSession: true })
navigationMenu.settingsNavButton().click()
settingsPage.displayTabButton().click()

cy.intercept("GET", "**/buckets/summary").as("refresh").then(() => {
// ensure that spanish language is displayed
settingsPage.languageDropdown().click()
settingsPage.spanishLanguageOption().click()
cy.wait("@refresh")
settingsPage.languageDropdown()
.should("be.visible")
.should("have.text", "Español")
settingsPage.settingsTitleLabel().should("have.text", "Ajustes")

// ensure that french language is displayed
settingsPage.languageDropdown().click()
settingsPage.frenchLanguageOption().click()
cy.wait("@refresh")
settingsPage.languageDropdown()
.should("be.visible")
.should("have.text", "Français")
settingsPage.settingsTitleLabel().should("have.text", "Paramètres")

// ensure that german language is displayed
settingsPage.languageDropdown().click()
settingsPage.germanLanguageOption().click()
cy.wait("@refresh")
settingsPage.languageDropdown()
.should("be.visible")
.should("have.text", "Deutsch")
settingsPage.settingsTitleLabel().should("have.text", "Einstellungen")

// ensure that norweigian language is displayed
settingsPage.languageDropdown().click()
settingsPage.norwegianLanguageOption().click()
cy.wait("@refresh")
settingsPage.languageDropdown()
.should("be.visible")
.should("have.text", "Norsk")
settingsPage.settingsTitleLabel().should("have.text", "Innstillinger")

// ensure that norweigian language is displayed
settingsPage.languageDropdown().click()
settingsPage.englishLanguageOption().click()
cy.wait("@refresh")
settingsPage.languageDropdown()
.should("be.visible")
.should("have.text", "English")
settingsPage.settingsTitleLabel().should("have.text", "Settings")
})
})
})

context("mobile", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ const LanguageSelection = () => {
menuItems={availableLanguages.map((lang) => (
{
contents: (
<span>
<span data-cy={`label-language-option-${lang.id}`}>
{lang.label}
</span>
),
onClick: () => setActiveLanguage(lang.id)
}
))}
title={currentLanguage}
testId="language-selection"
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ const Settings: React.FC = () => {
variant="h1"
component="p"
className={classes.title}
data-cy="label-title-settings"
>
<Trans>Settings</Trans>
</Typography>
Expand Down