Skip to content

Commit

Permalink
Merge pull request #5184 from hallieswan/SWC-6536
Browse files Browse the repository at this point in the history
SWC-6536: handle timing issues related to using larger runner
  • Loading branch information
hallieswan authored Sep 8, 2023
2 parents ad83c64 + 903edec commit eb23290
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
6 changes: 0 additions & 6 deletions e2e/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ for (const {
})

setup('create and authenticate user', async () => {
// This may be the first test to run and trigger SWC compilation
// ...which may take 15+ seconds. Mark this test as slow,
// ...so the test will be given triple timeout.
// https://playwright.dev/docs/api/class-test#test-slow-1
setup.slow()

await setup.step('create test user', async () => {
userId = await createTestUser(user, getAdminPAT(), userPage)
expect(userId).not.toBeUndefined()
Expand Down
20 changes: 18 additions & 2 deletions e2e/helpers/testUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,26 @@ export async function loginTestUser(

await page.getByRole('link', { name: 'Log in to Synapse' }).first().click()
await page.getByRole('button', { name: 'Sign in with your email' }).click()
await page.getByLabel('Username or Email Address').fill(testUserName)
await page.getByLabel('Password').fill(testUserPassword)

const usernameInput = page.getByLabel('Username or Email Address')
await usernameInput.fill(testUserName)
await expect(usernameInput).toHaveValue(testUserName)

const passwordInput = page.getByLabel('Password')
await expect(passwordInput).toBeEmpty()
await passwordInput.fill(testUserPassword)
await expect(passwordInput).not.toBeEmpty()

await page.getByRole('button', { name: 'Sign in' }).click()

// Ensure that correct username/password were received
const loadingButton = page.getByRole('button', { name: 'Logging you in' })
await expect(loadingButton).toBeVisible()
await expect(loadingButton).not.toBeVisible()
await expect(
page.getByText('The provided username/password combination is incorrect'),
).not.toBeVisible()

// Wait for redirect
await expect(async () => {
expect(page.url()).not.toContain('LoginPlace')
Expand Down
6 changes: 5 additions & 1 deletion e2e/projects.loggedin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ const PROJECT_NAME = 'swc-e2e-project-' + uuidv4()
async function createProject(page: Page, projectName: string) {
await page.getByLabel('Projects', { exact: true }).click()
await page.getByLabel('Create a New Project').click()
await page.getByLabel('Project Name').type(projectName)

const projectNameInput = page.getByLabel('Project Name')
await projectNameInput.fill(projectName)
await expect(projectNameInput).toHaveValue(projectName)

await page.getByRole('button', { name: 'Save' }).click()
}

Expand Down
5 changes: 4 additions & 1 deletion e2e/teams.loggedin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ test.describe('Teams', () => {
).toBeVisible()

await userPage.getByRole('button', { name: 'Create a New Team' }).click()
await userPage.getByRole('textbox').nth(1).fill(TEAM_NAME)
const teamNameInput = userPage.getByRole('textbox').nth(1)
await teamNameInput.fill(TEAM_NAME)
await expect(teamNameInput).toHaveValue(TEAM_NAME)

await userPage.getByRole('button', { name: 'OK' }).click()
await expect(
userPage.getByText(`Team Created: ${TEAM_NAME}`),
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dotenv.config()
export default defineConfig({
testDir: './e2e',
/* Timeout to allow portal enough time to compile when running locally */
timeout: 5 * 60 * 1000,
timeout: 2 * 60 * 1000,
/* Increase expectation timeout on CI */
expect: { timeout: process.env.CI ? 30 * 1000 : 5 * 1000 },
/* Run tests in files in parallel */
Expand Down

0 comments on commit eb23290

Please sign in to comment.