diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index ec63a81c8..c51c863d1 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -5,9 +5,12 @@ import { } from "cypress-cucumber-preprocessor/steps"; import helpers from "../../support/helpers"; import { VERSION } from '../../constants/terms-and-conditions-version.js' +import locales from '../../../webapp/locales' +import orderBy from 'lodash/orderBy' /* global cy */ +const languages = orderBy(locales, 'name') let lastPost = {}; let loginCredentials = { @@ -245,9 +248,10 @@ Then("I select a category", () => { .click(); }); -When("I choose a language for the post", () => { +When("I choose {string} as the language for the post", (languageCode) => { cy.get('.ds-flex-item > .ds-form-item .ds-select ') - .click().get('.ds-select-option').first().click() + .click().get('.ds-select-option') + .eq(languages.findIndex(l => l.code === languageCode)).click() }) Then("the post shows up on the landing page at position {int}", index => { diff --git a/cypress/integration/notifications/Mentions.feature b/cypress/integration/notifications/Mentions.feature index 810b77433..ef2694abc 100644 --- a/cypress/integration/notifications/Mentions.feature +++ b/cypress/integration/notifications/Mentions.feature @@ -20,7 +20,7 @@ Feature: Notification for a mention """ And mention "@matt-rider" in the text And I select a category - And I choose a language for the post + And I choose "en" as the language for the post And I click on "Save" When I log out And I log in with the following credentials: diff --git a/cypress/integration/post/WritePost.feature b/cypress/integration/post/WritePost.feature index c5762536e..0d74606ad 100644 --- a/cypress/integration/post/WritePost.feature +++ b/cypress/integration/post/WritePost.feature @@ -18,7 +18,7 @@ Feature: Create a post for active citizenship. """ And I select a category - And I choose a language for the post + And I choose "en" as the language for the post And I click on "Save" Then I get redirected to ".../my-first-post" And the post was saved successfully