From 156bf3c23f75eecf810cf87b4ca4be42c0819e87 Mon Sep 17 00:00:00 2001 From: Tom <20648924+moT01@users.noreply.github.com> Date: Fri, 1 Apr 2022 00:07:01 -0500 Subject: [PATCH] fix: cypress (#45593) --- .../integration/learn/challenges/backend.js | 12 +++++++--- .../integration/learn/challenges/codeally.js | 22 ++++++++++++++----- .../integration/settings/username-change.js | 20 ++++++++++++++--- cypress/support/commands.js | 6 ++++- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/cypress/integration/learn/challenges/backend.js b/cypress/integration/learn/challenges/backend.js index 898475f6e0..88f361f95c 100644 --- a/cypress/integration/learn/challenges/backend.js +++ b/cypress/integration/learn/challenges/backend.js @@ -26,9 +26,15 @@ describe('Backend challenge', function () { it('does not generate unhandled errors on submission', () => { cy.visit(locations.index); - cy.get(selectors.input) - .type('https://example.com') - .type('{enter}') + cy.get(selectors.input).type('https://example.com'); + + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`I've completed this challenge`) + .click() + + // revert to this when it is + // .type('{enter}') + .then(() => { cy.get(selectors.defaultOutput) .contains(runningOutput) diff --git a/cypress/integration/learn/challenges/codeally.js b/cypress/integration/learn/challenges/codeally.js index 32140cbea5..283a2b3dba 100644 --- a/cypress/integration/learn/challenges/codeally.js +++ b/cypress/integration/learn/challenges/codeally.js @@ -9,9 +9,14 @@ describe('CodeAlly cert challenge', function () { }); it('should not allow you to submit a URL', function () { - cy.get('input[name="solution"]') - .type('https://example.com') - .type('{enter}'); + cy.get('input[name="solution"]').type('https://example.com'); + + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`I've completed this challenge`).click(); + + // revert to this when it is + // .type('{enter}') + cy.contains('You must complete the project first.'); }); }); @@ -26,9 +31,14 @@ describe('CodeAlly cert challenge', function () { }); it('should allow you to submit a URL', function () { - cy.get('input[name="solution"]') - .type('https://example.com') - .type('{enter}'); + cy.get('input[name="solution"]').type('https://example.com'); + + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`I've completed this challenge`).click(); + + // revert to this when it is + // .type('{enter}') + cy.get('.completion-modal-body'); }); }); diff --git a/cypress/integration/settings/username-change.js b/cypress/integration/settings/username-change.js index d1bb2d75ab..7bb08673f7 100644 --- a/cypress/integration/settings/username-change.js +++ b/cypress/integration/settings/username-change.js @@ -183,7 +183,12 @@ describe('Username input field', () => { .clear({ force: true }) .type('nhcarrigan', { force: true }); cy.contains('Username is available'); - cy.get('@usernameInput').type('{enter}', { force: true, release: false }); + + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`Save`).click(); + + // revert to this when it is + // cy.get('@usernameInput').type('{enter}', { force: true, release: false }); cy.contains('We have updated your username to nhcarrigan') .should('be.visible') @@ -203,7 +208,12 @@ describe('Username input field', () => { .clear({ force: true }) .type('bjorno', { force: true }); cy.contains('Username is available'); - cy.get('@usernameInput').type('{enter}', { force: true, release: false }); + + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`Save`).click(); + + // revert to this when it is + // cy.get('@usernameInput').type('{enter}', { force: true, release: false }); cy.contains('We have updated your username to bjorno').within(() => { cy.get('button').click(); @@ -221,7 +231,11 @@ describe('Username input field', () => { .type('symbol', { force: true }); cy.contains('Username is available'); - cy.get('@usernameInput').type('{enter}', { force: true, release: false }); + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`Save`).click(); + + // revert to this when it is + // cy.get('@usernameInput').type('{enter}', { force: true, release: false }); cy.contains('Account Settings for symbol').should('be.visible'); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 3110f954bf..b6f389eded 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -61,7 +61,11 @@ Cypress.Commands.add('resetUsername', () => { cy.contains('Username is available'); - cy.get('@usernameInput').type('{enter}', { force: true, release: false }); + // temporary fix until https://github.com/cypress-io/cypress/issues/20562 is fixed + cy.contains(`Save`).click(); + + // revert to this when it is + // cy.get('@usernameInput').type('{enter}', { force: true, release: false }); cy.contains('Account Settings for developmentuser').should('be.visible'); });