Skip to content

Commit

Permalink
chore: stabilize form support tests (#10296)
Browse files Browse the repository at this point in the history
The first step in most form tests is to check if the form can be submitted, which depends on the custom components having their validity set without interacting with them. This often causes tests to fail because Cypress tests sometimes run too quickly.
  • Loading branch information
nnaydenow authored Dec 4, 2024
1 parent 4ff8ab7 commit 0ac5ce0
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions packages/main/cypress/specs/FormSupport.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -78,6 +81,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -107,6 +113,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -148,6 +157,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -189,6 +201,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -230,6 +245,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -271,6 +289,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -335,6 +356,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -396,6 +420,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -433,6 +460,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -471,6 +501,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -498,6 +531,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand All @@ -513,6 +549,7 @@ describe("Form support", () => {
cy.get("#rb_4")
.realClick();

// eslint-disable-next-line cypress/no-unnecessary-waiting
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

Expand All @@ -538,6 +575,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -610,6 +650,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -655,6 +698,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -683,6 +729,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -712,6 +761,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -750,6 +802,9 @@ describe("Form support", () => {
<button type="submit">Submits forms</button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -792,6 +847,9 @@ describe("Form support", () => {
</form>`);
/* eslint-enable no-irregular-whitespace */

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -828,6 +886,9 @@ describe("Form support", () => {
<ui5-button id="b1">Does not submit forms</ui5-button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down Expand Up @@ -872,6 +933,9 @@ describe("Form support", () => {
<ui5-button id="b2" submits>Submits forms</ui5-button>
</form>`);

// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(200);

cy.get("form")
.then($item => {
$item.get(0).addEventListener("submit", e => e.preventDefault());
Expand Down

0 comments on commit 0ac5ce0

Please sign in to comment.