Fix flaky E2E specs (#20714)

This commit is contained in:
Mac Siri 2024-03-04 09:46:34 -05:00 committed by GitHub
parent 0140a7631c
commit 180440f096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View file

@ -265,7 +265,8 @@ describe('Article flagged by a trusted user', () => {
cy.wait('@request');
cy.get('.flex .c-indicator').should('be.visible').as('flagStatus');
cy.get('@flagStatus').should('contain', 'Valid');
cy.get('.flex .c-indicator')
.should('be.visible')
.should('contain', 'Valid');
});
});

View file

@ -34,13 +34,15 @@ describe('Moderation Tools for Comments', () => {
});
});
it.skip('flags and unflags only the comment when clicked', () => {
it('flags and unflags only the comment when clicked', () => {
cy.intercept('POST', '/reactions').as('flagRequest');
findButton('Flag to Admins', { as: 'contentFlag' });
findButton(`Flag questionable_user`, { as: 'userFlag' });
clickButton('@contentFlag');
cy.get('.reaction-button').filter(`:contains("Flag to Admins")`).click();
cy.get('@contentFlag').should('have.class', 'reacted');
cy.wait('@flagRequest');
cy.get('@contentFlag').should('have.class', 'reacted');
cy.get('@userFlag').should('not.have.class', 'reacted');
@ -57,10 +59,13 @@ describe('Moderation Tools for Comments', () => {
findButton('Flag to Admins', { as: 'contentFlag' });
findButton(`Flag questionable_user`, { as: 'userFlag' });
clickButton('@userFlag');
cy.get('.reaction-button')
.filter(':contains("Flag questionable_user")')
.click();
cy.get('@userFlag').should('have.class', 'reacted');
cy.wait('@flagRequest');
cy.get('@contentFlag').should('not.have.class', 'reacted');
cy.get('@userFlag').should('have.class', 'reacted');
clickButton('@userFlag');