-
-
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
Add tests for requesting to join project #1410
base: develop
Are you sure you want to change the base?
Conversation
This also contains a fix for #1409. |
C# Unit Tests104 tests ±0 104 ✅ ±0 5s ⏱️ ±0s Results for commit 84430e3. ± Comparison against base commit 9355ee2. This pull request removes 2 and adds 2 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
This one exercises the create-project page workflow. The next one will exercise the workflow that goes through the project page visible to org members.
This one exercises the project page workflow.
e92abd6
to
f00b9d6
Compare
|
||
// Get to Sena-3 project page via org page, then ask to join | ||
const testOrgPage = await new OrgPage(page, 'Test Org', testOrgId).goto(); | ||
await testOrgPage.membersTab.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.
why click the members tab?
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.
Leftover code from making sure I got locators right. Removed in commit 003d20a.
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.
that didn't actually make it into that commit
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.
left some feedback.
I tried running the tests and join via project page
failed because it couldn't click the project link on the org page. I ran it multiple times and it never passed on other ff or chrome.
Running the join via create project
test failed with this error:
Error: Timed out 5000ms waiting for expect(locator).toBeVisible()
Locator: locator('#group-extra-projects')
Expected: visible
Received: <element(s) not found>
Call log:
- expect.toBeVisible with timeout 5000ms
- waiting for locator('#group-extra-projects')
at C:\dev\LexBox\frontend\tests\emailWorkflow.test.ts:178:51
Forgot to mention, when I ran this I had to mark the Sena-3 project as NON-confidential in order for the "Ask to join" button to show up. So I might need to create a whole separate, non-confidential, test project in order for this to work properly. Either that, or change our seeding data to make Sena-3 non-confidential, which I bet would require adjusting the expectations of a few other tests. I'll check what would be involved in that; it does make sense, from a "realism" point of view for Sena-3 (the project that's distributed with FieldWorks as example data) to be considered non-confidential rather than "confidentiality unknown". |
Elawa is marked as non-confidential in our seeding data, so it's going to show up by default for org members. Sena-3 has confidentiality unknown so org members can't see it by default and thus can't ask to join it, so it won't work for this set of tests.
Not working yet, will continue working on this later.
Commit a8d9a37 is an attempt to fix the test by using Elawa (non-confidential in seeding data) instead of Sena-3 (confidentiality unknown in seeding data) so that the newly-added org member will be able to see the "Ask to Join" button. I haven't gotten it working, but I ran out of time for today. I'll continue working on this tomorrow. |
On my local machine, the tests are now passing in Firefox but failing on Chromium. But when I run them in Chromium alone, they pass. That would seem to indicate an issue with running them in parallel, but I've double-checked all the obvious issues (such as #1409) and don't see anything. I'm going to push this and see what it does on GHA; it's possible that the tests are fine and I have a setup issue on my dev machine. |
... But it doesn't always fail on Chromium? I ran the full test suite this time, and got one out of four tests (2 each on Firefox and Chromium) passing: "ask to join project via project page" on Chromium passed, the other three failed. I'm going to throw up my hands at this point, say "If it passes on GHA, I'll call it good," and move on to a different PR. |
@hahn-kev - GHA tests were failing because the That aside, these tests are now passing and I believe I've addressed all review concerns so far. Want to re-review this, and decide whether the |
return pagePromise; | ||
} | ||
|
||
export async function addUserToOrg(api: APIRequestContext, userId: string, orgId: string, role: string): Promise<unknown> { |
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.
I don't love doing the role this way, but I'm fine with it as a workaround. But could we restrict the role to valid values?
`); | ||
} | ||
|
||
export async function addUserToProject(api: APIRequestContext, userId: string, projectId: string, role: string): Promise<unknown> { |
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.
same for roles here
await newProjectPage.fillForm({name: 'Elaw', code: 'xyz', purpose: 'Testing', organization: 'Test Org'}); | ||
await expect(newProjectPage.extraProjectsDiv).toBeVisible(); | ||
await expect(newProjectPage.askToJoinBtn).toBeDisabled(); | ||
await newProjectPage.extraProjectsDiv.locator('#extra-projects-elawa-dev-flex').check(); |
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.
can we make this a helper function on CreateProjectPage
? something like relatedProjectItem(projectCode: string): Locator
just because we've got a bit of magic strings here with the current locator.
await dashboardPage.emailVerificationAlert.assertPleaseVerify(); | ||
let emailPage = await tempUserInTestOrg.mailbox.openEmail(page, EmailSubjects.VerifyEmail); | ||
let pagePromise = emailPage.page.context().waitForEvent('page'); | ||
await emailPage.clickVerifyEmail(); |
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.
should be using verifyTempUserEmail
helper here
let dashboardPage = await new UserDashboardPage(page).goto(); | ||
|
||
// Must verify email before being made manager of a project | ||
await dashboardPage.emailVerificationAlert.assertPleaseVerify(); |
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.
just a thought, since we're not actually testing the verification we could skip this. And since email verification does not require login we could actually skip logging in, going to the dashboard and checking for verification. The same can be done for the user and in the other test as well
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, tests are passing for me now. There's a few minor things to change and I left a suggestion about streamlining email verification, but feel free to ignore it.
Fixes #1014
This adds two tests: one that exercises the create-project page workflow, and one that exercises the workflow that goes through the project page's "Ask to Join" button visible to org members.