Skip to content

Commit

Permalink
wait for modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Zasa-san committed Jan 13, 2025
1 parent fdf53bf commit 0a66d83
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cypress/e2e/settings/languages.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { clearCookiesAndLogin } from '../helpers/login';
import 'cypress-axe';

const addLanguages = (languages: string[]) => {
languages.forEach(lang => {
cy.get('[data-testid=modal]').within(() => {
cy.clearAndType('input[type=text]', lang);
cy.contains('button', lang).click();
cy.get('[data-testid=modal]')
.should('be.visible')
.within(() => {
languages.forEach(lang => {
cy.clearAndType('input[type=text]', lang);
cy.contains('button', lang).click();
});
});
});
};

const stringToTranslate = "*please keep this key secret and don't share it.";
Expand All @@ -24,16 +26,20 @@ describe('Languages', () => {
describe('Languages List', () => {
it('should open the install language modal', () => {
cy.contains('Install Language').click();
cy.get('[data-testid=modal]').should('be.visible');
cy.checkA11y();
});

it('should install new languages', () => {
const BACKEND_LANGUAGE_INSTALL_DELAY = 25000;
cy.intercept('POST', 'api/translations/languages').as('addLanguage');

addLanguages(['Spanish', 'French']);
cy.get('[data-testid=modal]').within(() => {
cy.contains('button', 'Install').click();
});
cy.get('[data-testid=modal]').should('not.exist');

cy.wait('@addLanguage');
cy.contains('Dismiss').click();
cy.contains('Spanish', { timeout: BACKEND_LANGUAGE_INSTALL_DELAY });
Expand Down

0 comments on commit 0a66d83

Please sign in to comment.