Skip to content

Commit

Permalink
[Flaky Tests]: Link Form Submission
Browse files Browse the repository at this point in the history
The test passes consistently locally, but fails consistently in CI:

```
1) [chrome] › form_submission_tests.ts:909:1 › test following a link with [data-turbo-method] and [data-turbo=true] set when html[data-turbo=false]

  AssertionError: does not navigate the full page: expected 'Hello' to equal 'Form'

    918 |   await link.click()

    919 |

  > 920 |   assert.equal(await page.textContent("h1"), "Form", "does not navigate the full page")

        |          ^

    921 |   assert.equal(await page.textContent("#hello h2"), "Hello from a frame", "drives the turbo-frame")

    922 | })

    923 |

      at /home/runner/work/turbo/turbo/src/tests/functional/form_submission_tests.ts:920:10

2) [chrome] › form_submission_tests.ts:924:1 › test following a link with [data-turbo-method] and [data-turbo=true] set when Turbo.session.drive = false

  AssertionError: does not navigate the full page: expected 'Hello' to equal 'Form'

    932 |   await link.click()

    933 |

  > 934 |   assert.equal(await page.textContent("h1"), "Form", "does not navigate the full page")

        |          ^

    935 |   assert.equal(await page.textContent("#hello h2"), "Hello from a frame", "drives the turbo-frame")

    936 | })

    937 |

      at /home/runner/work/turbo/turbo/src/tests/functional/form_submission_tests.ts:934:10
```

As a precaution, escape the URL path to embedded into the `[href]`
attribute.

Additionally, execute CI with the GitHub Actions reporter.
  • Loading branch information
seanpdoyle committed Jul 18, 2022
1 parent b449b58 commit 4ca2dbc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ jobs:
- name: Firefox Test
run: yarn test:browser --project=firefox

- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: playwright-report
path: playwright-report

- name: Publish dev build
run: .github/scripts/publish-dev-build '${{ secrets.DEV_BUILD_GITHUB_TOKEN }}'
if: ${{ github.event_name == 'push' }}
2 changes: 1 addition & 1 deletion src/tests/fixtures/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ <h2>Frame: Form</h2>
<form method="post" action="https://httpbin.org/post">
<button id="submit-external">POST to https://httpbin.org/post</button>
</form>
<a href="/__turbo/redirect?path=/src/tests/fixtures/frames/hello.html" data-turbo-method="post" data-turbo-frame="hello" id="turbo-method-post-to-targeted-frame">Turbo method post to targeted frame</a>
<a href="/__turbo/redirect?path=%2Fsrc%2Ftests%2Ffixtures%2Fframes%2Fhello.html" data-turbo-method="post" data-turbo-frame="hello" id="turbo-method-post-to-targeted-frame">Turbo method post to targeted frame</a>
<turbo-frame id="hello"></turbo-frame>
<hr>

Expand Down

0 comments on commit 4ca2dbc

Please sign in to comment.