-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create E2E tests for reset-project feature #550
Conversation
After discussion with Kevin today, we decided to lower the |
7899354
to
ec35883
Compare
Rebased on top of develop; now the number of commits is actually correct. |
This should help minimize the number of times the Send/Receive tests run into a race condition where a new test has been created on the hgweb server, but Mercurial hasn't yet picked it up.
The new SendReceiveAfterProjectReset test is passing now that hgweb is checking for new repos every 5 seconds; let's try to ensure that it stays reliable by adding 5-second sleeps in the right places.
Now the resetProject.test.ts file will run again.
Now we check after the project has been reset to verify that it's at the same hash, with the same number of files at the top level, as before the reset-and-upload process.
This fixture creates a temporary project and deletes it afterwards.
This is about the smallest Mercurial repo possible that isn't empty: a repo with just one commit of an empty file. We'll use this in E2E testing to populate new projects.
Greatly expanded the reset-project Playwright test: - It uses a temp project now, whose name is based on a hash of the test title and browser settings, so Chromium and Firefox will use different project names. This will allow the test to run in parallel with itself. - It uploads a known initial state of a Mercurial repo, which is a tiny zip file containing just one commit. - It checks that the project-reset modal dialog can reset the project to an empty state or upload from a zip file correctly. Combined with the .NET test that confirms that a project can still be used with Send/Receive after resetting to an empty state, that should cover just about everything.
bde8e27
to
8a98102
Compare
Rebased on top of latest |
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.
looks good to me, I'll run it myself on Monday. There was one case where localhost was hard-coded in.
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.
Looks good to me. @myieye would you review the playwright tests?
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.
Looks good to me.
I just have a small pile of refactoring ideas.
Co-authored-by: Tim Haasdyk <[email protected]>
Co-authored-by: Tim Haasdyk <[email protected]>
If two copies of the test run simultaneously in Chromium and Firefox, you can end up with the situation where one of them sees two copies of the test project in the admin dashboard. And while they have different project codes, until now they had the same project name. However, since the admin dashboard code to click on the project uses the project name (with `{exact: true}`), the locator was seeing two copies of the project, and therefore throwing an error. This commit fixes that by putting the test ID (which is different for each browser) into the project name as well as the project code, so that the admin dashboard locators will only ever find a single project.
One locator was using this.page instead of this.componentLocator, because of an error that turned out to be unrelated. So it can be switched back to using this.componentLocator again.
This should save some time, as the browser tab won't have to load and render the hgweb HTML. It also lets us make more fine-grained checks of the results, since we're getting back JSON structures that we know will have certain properties.
Note that this doesn't actually improve the type safety of this code at all, since Typescript just takes our word for it that we know the structure of the JSON returned by that particular fetch request. But it makes the linter happy not to get Typescript errors.
We're changing the clickResetProject() method to actually return a ResetProjectModal instance as the return type suggests, and to wait for it so there's no need for the `waitFor()` calls in the calling function.
Fix #440.
Fix #515.
This PR creates two tests: