Skip to content

Commit

Permalink
Merge pull request #5321 from hallieswan/SWC-6723
Browse files Browse the repository at this point in the history
SWC-6723: clean up end to end tests
  • Loading branch information
hallieswan authored Mar 11, 2024
2 parents 55efbd9 + 1ec8bbb commit bf375f6
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 144 deletions.
4 changes: 2 additions & 2 deletions e2e/account.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect, test } from '@playwright/test'
import { expect } from '@playwright/test'
import { testAuth } from './fixtures/authenticatedUserPages'
import { goToDashboard } from './helpers/testUser'

test.describe('Account Settings', () => {
testAuth.describe('Account Settings', () => {
testAuth('should show certification status', async ({ userPage }) => {
await goToDashboard(userPage)

Expand Down
8 changes: 4 additions & 4 deletions e2e/discussions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { defaultExpectTimeout } from '../playwright.config'
import { testAuth } from './fixtures/authenticatedUserPages'
import {
Expand Down Expand Up @@ -109,7 +109,7 @@ const getDiscussionReplyActionButtons = (page: Page, threadReply: string) => {
let userProject: Project
const fileHandleIds: string[] = []

test.describe('Discussions', () => {
testAuth.describe('Discussions', () => {
testAuth.beforeAll(async ({ browser, storageStatePaths }) => {
userProject = await setupProjectWithPermissions(
browser,
Expand All @@ -120,7 +120,7 @@ test.describe('Discussions', () => {
})

testAuth.afterAll(async ({ browser }) => {
test.slow()
testAuth.slow()
if (userProject.id) {
await teardownProjectsAndFileHandles(
browser,
Expand All @@ -133,7 +133,7 @@ test.describe('Discussions', () => {
testAuth(
'should allow discussion and reply CRUD',
async ({ userPage, validatedUserPage }) => {
test.slow()
testAuth.slow()

const threadTitle = 'The Title of the Thread'
const threadBody = 'The body of the Thread'
Expand Down
4 changes: 2 additions & 2 deletions e2e/favorites.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { testAuth } from './fixtures/authenticatedUserPages'
import { entityUrlPathname } from './helpers/entities'
import {
Expand Down Expand Up @@ -41,7 +41,7 @@ function getFavoriteStarSpiner(page: Page) {
return page.locator('.pageHeader').locator('.spinner:visible')
}

test.describe('Favorites', () => {
testAuth.describe('Favorites', () => {
testAuth('should be visible', async ({ userPage }) => {
await goToDashboard(userPage)
await goToFavorites(userPage)
Expand Down
10 changes: 5 additions & 5 deletions e2e/files.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import path from 'path'
import { defaultExpectTimeout } from '../playwright.config'
import { testAuth } from './fixtures/authenticatedUserPages'
Expand Down Expand Up @@ -178,13 +178,13 @@ const getFileMD5 = async (page: Page) => {
let userProject: Project
const fileHandleIds: string[] = []

test.describe('Files', () => {
testAuth.describe('Files', () => {
testAuth.beforeAll(async ({ browser, storageStatePaths }) => {
userProject = await setupProject(browser, 'swc-e2e-user', storageStatePaths)
})

testAuth.afterAll(async ({ browser }) => {
test.slow()
testAuth.slow()
if (userProject.id) {
await teardownProjectsAndFileHandles(
browser,
Expand All @@ -201,7 +201,7 @@ test.describe('Files', () => {
// when there is a test timeout. Since test timeouts are expensive,
// Playwright recommends skipping the test entirely with test.fixme.
// See: https://github.com/microsoft/playwright/issues/16317
test.fixme(
testAuth.fixme(
browserName === 'webkit' && !!process.env.CI,
`Very slow in webkit in CI only (passes after 6min in macos-latest runner,
times out after 10min in Sage ubuntu-22.04-4core-16GBRAM-150GBSSD runner).
Expand Down Expand Up @@ -345,7 +345,7 @@ test.describe('Files', () => {
)

testAuth('should create and delete a file', async ({ userPage }) => {
test.slow()
testAuth.slow()

const fileName = 'test_file.csv'
const filePath = `data/${fileName}`
Expand Down
4 changes: 3 additions & 1 deletion e2e/homepage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test'
import { testAuth } from './fixtures/authenticatedUserPages'
import { waitForInitialPageLoad } from './helpers/utils'

test.describe('Homepage', () => {
test.describe('Homepage - Unauthenticated', () => {
test('should show Log In To Synapse button when logged out', async ({
page,
}) => {
Expand All @@ -16,7 +16,9 @@ test.describe('Homepage', () => {
page.getByRole('link', { name: 'View Your Dashboard' }),
).toHaveCount(0)
})
})

testAuth.describe('Homepage - Authenticated', () => {
testAuth(
'should show View Your Dashboard button when logged in',
async ({ userPage }) => {
Expand Down
8 changes: 4 additions & 4 deletions e2e/projects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { v4 as uuidv4 } from 'uuid'
import { testAuth } from './fixtures/authenticatedUserPages'
import { deleteProject, getEntityIdFromPathname } from './helpers/entities'
Expand All @@ -21,9 +21,9 @@ async function createProject(page: Page, projectName: string) {
// Run multiple describes in parallel, but run tests inside each describe in order
// ...tests within describe expect afterAll to be run with the same users, i.e. on the same worker
// https://playwright.dev/docs/api/class-test#test-describe-configure
test.describe.configure({ mode: 'serial' })
testAuth.describe.configure({ mode: 'serial' })

test.describe('Projects', () => {
testAuth.describe('Projects', () => {
testAuth('should create a project', async ({ userPage }) => {
await testAuth.step(
'should create a project with a unique name',
Expand Down Expand Up @@ -80,7 +80,7 @@ test.describe('Projects', () => {
})

testAuth.afterAll(async ({ browser }) => {
test.slow()
testAuth.slow()
// if test failed before project was deleted, then delete project here
if (projectId) {
const context = await browser.newContext()
Expand Down
Loading

0 comments on commit bf375f6

Please sign in to comment.