Try to fix flaky E2E test

This commit is contained in:
Kalle
2022-07-19 00:27:46 +03:00
parent b3d7aa1e1f
commit c4ce5c5eb3
2 changed files with 15 additions and 3 deletions

View File

@@ -344,6 +344,7 @@ function SuggestedUser({
<Link
className="all-unset"
to={userPage(suggested.suggestedUser.discordId)}
data-cy="suggested-user-name"
>
{suggested.suggestedUser.discordName}
</Link>

View File

@@ -16,10 +16,21 @@ describe("Plus suggestions page", () => {
it("adds a comment and deletes one", () => {
cy.auth();
cy.visit(PLUS_SUGGESTIONS_PAGE);
cy.getCy("plus2-radio").click();
cy.getCy("comment-button").first().click();
cy.url().should("include", "/2/"); // let's check the radio button click did something
cy.getCy("suggested-user-name")
.first()
.invoke("text")
.then((previousContent) => {
cy.getCy("plus2-radio").click();
// let's verify the radio button click actually changed stuff
cy.getCy("suggested-user-name")
.first()
.invoke("text")
.should("not.equal", previousContent);
});
cy.getCy("comment-button").first().click();
cy.getCy("comment-textarea").type("Cracked!");
cy.getCy("submit-button").click();