-
Notifications
You must be signed in to change notification settings - Fork 40
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
SWC-6605 #5235
SWC-6605 #5235
Changes from all commits
da4743b
90eff2c
f4e90fa
bec84a2
ae69fa9
dce739d
fb22de1
62cb016
7452af7
7812a0f
c2f3cd7
6fdcb49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,9 @@ env: | |
PW_ALL_BLOBS_DIR: all-blob-reports | ||
jobs: | ||
build: | ||
# Run in Sage repo on develop or release- branches | ||
# Run in Sage repo on release- branches | ||
# and on all branches in user-owned forks | ||
if: ${{ github.ref_name == 'develop' || startsWith(github.ref_name, 'release-') || github.actor == github.repository_owner }} | ||
if: ${{ startsWith(github.ref_name, 'release-') || github.actor == github.repository_owner }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -25,9 +25,10 @@ jobs: | |
retention-days: 1 | ||
playwright-tests: | ||
needs: [build] | ||
runs-on: ${{ github.repository_owner == 'Sage-Bionetworks' && 'ubuntu-22.04-4core-16GBRAM-150GBSSD' || 'macos-latest' }} | ||
runs-on: 'macos-latest' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use macOS runner for all jobs to decrease flakiness vs linux runners -- see 10x passing runs using macOS runner here. |
||
timeout-minutes: 60 | ||
strategy: | ||
max-parallel: ${{ github.repository_owner == 'Sage-Bionetworks' && 1 || 3 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only run one shard at a time in the Sage repo, so macOS runners are available for other teams' workflows |
||
fail-fast: false | ||
matrix: | ||
shard: [1/3, 2/3, 3/3] | ||
|
@@ -81,8 +82,8 @@ jobs: | |
run: colima stop | ||
merge-reports: | ||
# Merge reports after playwright-tests, even if some shards have failed | ||
# But skip this job if the previous job was cancelled | ||
if: ${{ !cancelled() }} | ||
# But skip this job if the previous job was cancelled or skipped | ||
if: ${{ !cancelled() && needs.playwright-tests.result != 'skipped' }} | ||
Comment on lines
+85
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "skipped" !== "cancelled" -- skip the job if the workflow was "skipped", as in this case. |
||
needs: [playwright-tests] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { Page, expect, test } from '@playwright/test' | ||
import { defaultExpectTimeout } from '../playwright.config' | ||
import { testAuth } from './fixtures/authenticatedUserPages' | ||
import { entityUrlPathname } from './helpers/entities' | ||
import { | ||
setupProjectWithPermissions, | ||
teardownProjectsAndFileHandles, | ||
} from './helpers/setupTeardown' | ||
import { | ||
dismissAlert, | ||
expectDiscussionPageLoaded, | ||
expectDiscussionThreadLoaded, | ||
getDefaultDiscussionPath, | ||
goToDashboardPage, | ||
reloadDashboardPage, | ||
} from './helpers/testUser' | ||
import { Project } from './helpers/types' | ||
import { UserPrefix, userConfigs } from './helpers/userConfig' | ||
|
@@ -58,38 +61,6 @@ const expectThreadTableLoaded = async ( | |
}) | ||
} | ||
|
||
const expectDiscussionThreadLoaded = async ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved into |
||
page: Page, | ||
threadId: number, | ||
threadTitle: string, | ||
threadBody: string, | ||
) => { | ||
await testAuth.step('Discussion thread has loaded', async () => { | ||
await page.waitForURL( | ||
`${entityUrlPathname(userProject.id)}/discussion/threadId=${threadId}`, | ||
) | ||
await expect( | ||
page.getByRole('heading', { name: 'Discussion' }), | ||
).toBeVisible() | ||
|
||
await expect( | ||
page.getByRole('button', { name: /show all threads/i }), | ||
).toBeVisible({ timeout: 60_000 }) | ||
await expect( | ||
page.getByRole('button', { name: 'Date Posted' }), | ||
).toBeVisible() | ||
await expect( | ||
page.getByRole('button', { name: 'Most Recent' }), | ||
).toBeVisible() | ||
|
||
const discussionThread = page.locator(discussionThreadSelector) | ||
await expect(discussionThread.getByText(threadTitle)).toBeVisible() | ||
await expect(discussionThread.getByText(threadBody)).toBeVisible({ | ||
timeout: 60_000, | ||
}) | ||
}) | ||
} | ||
|
||
const expectThreadReplyVisible = async ( | ||
page: Page, | ||
threadReply: string, | ||
|
@@ -102,7 +73,9 @@ const expectThreadReplyVisible = async ( | |
name: `@${userConfigs[replierPrefix].username}`, | ||
}), | ||
).toBeVisible() | ||
await expect(discussionReply.getByText(threadReply)).toBeVisible() | ||
await expect(discussionReply.getByText(threadReply)).toBeVisible({ | ||
timeout: defaultExpectTimeout * 2, // allow extra time for reply to become visible | ||
}) | ||
}) | ||
} | ||
|
||
|
@@ -153,6 +126,7 @@ test.describe('Discussions', () => { | |
}) | ||
|
||
testAuth.afterAll(async ({ browser }) => { | ||
test.slow() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Allow extra time for the project and file handle to be cleaned up |
||
if (userProject.id) { | ||
await teardownProjectsAndFileHandles( | ||
browser, | ||
|
@@ -173,7 +147,11 @@ test.describe('Discussions', () => { | |
const threadReplyEdited = 'An edited reply to the Thread' | ||
|
||
await testAuth.step('First user goes to Project', async () => { | ||
await userPage.goto(getDefaultDiscussionPath(userProject.id)) | ||
await goToDashboardPage( | ||
userPage, | ||
getDefaultDiscussionPath(userProject.id), | ||
) | ||
|
||
Comment on lines
-176
to
+154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Playwright's |
||
await expectDiscussionPageLoaded(userPage, userProject.id) | ||
}) | ||
|
||
|
@@ -226,6 +204,7 @@ test.describe('Discussions', () => { | |
threadId, | ||
threadTitle, | ||
threadBody, | ||
userProject.id, | ||
) | ||
}) | ||
|
||
|
@@ -257,8 +236,12 @@ test.describe('Discussions', () => { | |
// retry if the view count hasn't updated | ||
await expect(async () => { | ||
// reload is necessary for view count to update | ||
await userPage.reload() | ||
await expectDiscussionPageLoaded(userPage, userProject.id) | ||
await reloadDashboardPage(userPage) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the custom |
||
await expectDiscussionPageLoaded( | ||
userPage, | ||
userProject.id, | ||
defaultExpectTimeout * 0.5, // use shorter expect timeout, so reload is tried earlier | ||
) | ||
await expectThreadTableLoaded( | ||
userPage, | ||
threadTitle, | ||
|
@@ -270,7 +253,10 @@ test.describe('Discussions', () => { | |
}) | ||
|
||
await testAuth.step('Second user can view discussion', async () => { | ||
await validatedUserPage.goto(getDefaultDiscussionPath(userProject.id)) | ||
await goToDashboardPage( | ||
validatedUserPage, | ||
getDefaultDiscussionPath(userProject.id), | ||
) | ||
await expectDiscussionPageLoaded(validatedUserPage, userProject.id) | ||
await expectThreadTableLoaded( | ||
userPage, | ||
|
@@ -288,6 +274,7 @@ test.describe('Discussions', () => { | |
threadId, | ||
threadTitle, | ||
threadBody, | ||
userProject.id, | ||
) | ||
}) | ||
|
||
|
@@ -384,6 +371,7 @@ test.describe('Discussions', () => { | |
threadId, | ||
threadTitle, | ||
threadBody, | ||
userProject.id, | ||
) | ||
}) | ||
|
||
|
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.
Only run e2e workflow for
release-**
branches in Sage repo, so macOS runners are available for other teams' workflows