-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix E2E tests on Windows #76
Conversation
src/components/onboarding.tsx
Outdated
<div | ||
className="flex flex-row flex-grow" | ||
data-testid="onboarding" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could actually remote this, given the current code doesn't use it because I couldn't get it to work.
e2e/sites.test.ts
Outdated
const frontendUrl = await siteContent.frontendButton.textContent(); | ||
expect( frontendUrl ).toBeTruthy(); | ||
expect( frontendUrl ).not.toBeNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to make this "to not be empty"
e2e/page-objects/onboarding.ts
Outdated
get siteNameInput() { | ||
return this.locator.getByLabel( 'Site name' ); | ||
} | ||
|
||
get sitePathInput() { | ||
return this.locator.getByLabel( 'Local path' ); | ||
} | ||
|
||
get continueButton() { | ||
return this.locator.getByRole('button', { name: 'Continue' }); | ||
} | ||
|
||
private get localPathButton() { | ||
return this.locator.getByTestId( 'select-path-button' ); | ||
} | ||
|
||
// This usually opens an OS folder dialog, except we can't interact with it in playwrite. | ||
// In tests the dialog returns the value of the E2E_OPEN_FOLDER_DIALOG environment variable. | ||
async clickLocalPathButtonAndSelectFromEnv() { | ||
await this.localPathButton.click(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of this logic is duplicated from add-site-modal.ts
. I shall extract it in a site-form.ts
object, but maybe in a followup PR. Very keen to get E2E back to stable in CI.
47a027b
to
034f575
Compare
034f575
to
1a39796
Compare
Currently failing, see #37
1a39796
to
2e6fd2d
Compare
Thanks @mokagio. I merged the other branch, merged trunk to this one, and changed PR title to account for its reduced scope. |
I managed to reproduce the issue by downloading the binary generated in CI. However, it only fails when running E2E tests. If I open the executable and create a site, it copies all WordPress files 🙃. After adding more logs, I realized that the problem is related to not waiting for the server files to be copied before using the app. In general, this is not a problem as by the time you interact with the app the copy operation is finished. This log entry (reference) should have happened before creating the site. In e2e tests actions are executed as soon as the window is ready, so the combination of copy operation being a bit slower on Windows and creating a site right after the app is opened is resulting in a race condition problem. I'll solve this by moving the |
I managed to address the issue about the site folder but the test case UPDATE: As expected, the delete action is failing with the error |
Great job @fluiddot !
At least it's progress 😄 |
Just for my understanding, the fix you implemented is at the app runtime level, not in the E2E tests, right? If I understand correctly, the unusual setup in the tests brought to light a design flaw that was present but hard to run into when interacting with the app as a human. If that's the case, I'll add this to my collection of examples of how testing helps discover edge cases 😄 (If instead I have misunderstood, then that's good too as it's an occasion for me to learn more) |
Exactly, here's the fix I applied. The issue is more prone to happen on E2E due to the fact that UI interaction happens quickly. Still, I presume it could be reproducible if you open the app and click on the "Add Site" button right away. Additionally, if disk operations are slow in the machine, this would be also easier to experience. |
I tried different approaches to solve the error when deleting a site but none have proven to work (reference). I tested locally and all E2E tests pass, so I'm thinking of disabling that test case temporarily on Windows. WDYT? |
@fluiddot makes sense, let's do it. We can have a proper comment there and come back to that in the future, and still benefit from running other tests on Windows. |
This test case fails when running in CI but not locally. Until we find a workaround, we'll temporarily disable it.
This is mostly needed for Windows because some operations take longer, like creating a site.
I continued exploring the needed workarounds to unblock this PR and managed the E2E tests to pass in a separate branch with the following changes:
Since this PR is related to E2E, I'm also going to apply the following changes:
cc @mokagio |
E2E tests are now run in Buildkite.
Excellent! Thanks @fluiddot |
Update: Rebased on top of #99. The diff is noisy because it includes the changes from #17, too.
Update2: Merged trunk to the branch and solved conflicts. Shouldn't be noisy anymore.
Update3: Merged trunk to the branch and scope of this PR changes to fixing tests for Windows
Works on my machine™
Let's see what CI does...
Proposed Changes
The PR adds E2E tests to Buildkite pipeline.
Testing Instructions
Pre-merge Checklist