-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * Makes onboarding work! * Make create site work * Make delete site work * All E2E tests work 🎉 * Fix E2E tearDown cleanup condition * Cleanup * Add a check for consistency * Only run onboarding when needed * Improve debugging * Remove useless comment * Address lint issues * Disable failing delete site test * DRY site form interaction via page object in E2E tests --------- Co-authored-by: Wojtek Naruniec <wojtek@naruniec.me>
- Loading branch information
Showing
8 changed files
with
158 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { type Page } from '@playwright/test'; | ||
import SiteForm from './site-form'; | ||
|
||
export default class Onboarding { | ||
constructor( private page: Page ) {} | ||
|
||
private get locator() { | ||
// This fails, not sure why... | ||
// return this.page.getByTestId( 'onboarding' ); | ||
// | ||
// Accessing the Page directly works even though it's confusing because Page is not a Locator | ||
return this.page; | ||
} | ||
|
||
private get siteForm() { | ||
return new SiteForm( this.page ); | ||
} | ||
|
||
get heading() { | ||
return this.locator.getByRole( 'heading', { name: 'Add your first site' } ); | ||
} | ||
|
||
get siteNameInput() { | ||
return this.siteForm.siteNameInput; | ||
} | ||
|
||
get localPathInput() { | ||
return this.siteForm.localPathInput; | ||
} | ||
|
||
get continueButton() { | ||
return this.locator.getByRole( 'button', { name: 'Continue' } ); | ||
} | ||
|
||
async selectLocalPathForTesting() { | ||
await this.siteForm.clickLocalPathButtonAndSelectFromEnv(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { type Page } from '@playwright/test'; | ||
|
||
export default class SiteForm { | ||
private page: Page; | ||
|
||
constructor( page: Page ) { | ||
this.page = page; | ||
} | ||
|
||
get siteNameInput() { | ||
return this.page.getByLabel( 'Site name' ); | ||
} | ||
|
||
get localPathInput() { | ||
return this.page.getByLabel( 'Local path' ); | ||
} | ||
|
||
private get localPathButton() { | ||
return this.page.getByTestId( 'select-path-button' ); | ||
} | ||
|
||
// This usually opens an OS folder dialog, except we can't interact with it in Playwright. | ||
// In tests the dialog returns the value of the E2E_OPEN_FOLDER_DIALOG environment variable. | ||
async clickLocalPathButtonAndSelectFromEnv() { | ||
await this.localPathButton.click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters