cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.97k stars 3.18k forks source link

current Mui Chip removed after entering another value on textField #9243

Closed elycisjasa123 closed 3 years ago

elycisjasa123 commented 3 years ago

Code Snippet

it.only('should add student on a class', () => {
      cy.createCourse('Cypress Course 3');
      cy.request({
        url: '/api/me/courses?role=instructor&type=all&page=1',
        method: 'GET',
        headers: {
          Authorization: `Bearer ${Cypress.env('INSTRUCTOR_TOKEN')}`,
        },
      }).then(getCourses => {
        const courseId = getCourses.body[0].id;
        const classId = getCourses.body[0].classes[0].id;
        cy.server();
        cy.route('GET', `/api/courses/${courseId}?view=instructor`).as(
          'getSelectedCourse',
        );
        cy.route('GET', `/api/courses/${courseId}/classes`).as('getClasses');
        cy.route('GET', `/api/classes/${classId}/class_quizzes`).as(
          'classQuizzes',
        );
        cy.route('GET', `/api/classes/${classId}/users`).as('classUser');
        cy.route('POST', `/api/multiple_class_users`).as('multipleUsers');
        cy.dataTest('cypress-course-3')
          .first()
          .click();
        cy.wait('@getSelectedCourse')
          .its('status')
          .should('eq', 200);
        cy.dataTest('show-menu').click();
        cy.dataTest('classes').click();
        cy.dataTest('class-name').click();
        cy.wait('@classUser')
          .its('status')
          .should('eq', 200);
        cy.dataTest('people').click();
        cy.dataTest('add-user')
          .eq(1)
          .click();
        if (Cypress.env('AUTHENTICATION') === 'local') {
          cy.dataTest('user-email')
            .click()
            .type('student1@gmail.com');
          cy.route('POST', `/api/classes/${classId}/addable_users`).as(
            'autoCompleteOne',
          );
          cy.wait('@autoCompleteOne')
            .its('status')
            .should('eq', 200);
          cy.dataTest('user-email')
            .type('{downarrow}')
            .type('{enter}');
          cy.dataTest('user-email')
            .click()
            .type('student2@gmail.com');
          cy.route('POST', `/api/classes/${classId}/addable_users`).as(
            'autoCompleteTwo',
          );
          cy.wait('@autoCompleteTwo')
            .its('status')
            .should('eq', 200);
          cy.dataTest('user-email')
            .type('{downarrow}')
            .type('{enter}');
        } else {
          cy.dataTest('user-email')
            .click()
            .type('student1@gmail.com');
          cy.route('POST', `/api/classes/${classId}/addable_users`).as(
            'autoCompleteOne',
          );
          cy.wait('@autoCompleteOne')
            .its('status')
            .should('eq', 200);
          cy.dataTest('user-email')
            .type('{downarrow}')
            .type('{downarrow}')
            .type('{enter}');
          cy.dataTest('user-email')
            .click()
            .type('student2@gmail.com');
          cy.route('POST', `/api/classes/${classId}/addable_users`).as(
            'autoCompleteTwo',
          );
          cy.wait('@autoCompleteTwo')
            .its('status')
            .should('eq', 200);
          cy.dataTest('user-email')
            .type('{downarrow}')
            .type('{downarrow}')
            .type('{enter}');
        }
        cy.dataTest('add-people').click();
        cy.wait('@multipleUsers')
          .its('status')
          .should('eq', 200);
      });
    });

Screen record Link

jennifer-shehane commented 3 years ago

Can you provide a reproducible example? The currently provided code can't be run as is - since there is no application to run the code against. We won't be able to look at it without this.

Here are some tips for providing a Short, Self Contained, Correct, Example and our own Troubleshooting Cypress guide.

elycisjasa123 commented 3 years ago

I think the issue already works