-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add methods `assertPage`, `navigateToPage` and `reloadPage` to base `Page` feat: add util `reloadDocument`
- Loading branch information
Showing
15 changed files
with
93 additions
and
62 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 was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import {LogEventType} from '../../constants/internal'; | ||
import {createClientFunction} from '../../createClientFunction'; | ||
import {log} from '../../utils/log'; | ||
|
||
import type {AnyPageClassType} from '../../types/internal'; | ||
|
||
const clientReloadPage = createClientFunction(() => window.location.reload(), {name: 'reloadPage'}); | ||
|
||
/** | ||
* Reloads the page, taking into account its stabilization interval. | ||
*/ | ||
export const reloadPage = async (page: InstanceType<AnyPageClassType>): Promise<void> => { | ||
log(`Reload page "${page.constructor.name}"`, LogEventType.InternalAction); | ||
|
||
await clientReloadPage(); | ||
await page.beforeReloadPage?.(); | ||
|
||
await page.reloadPage(); | ||
|
||
await page.waitForPageLoaded(); | ||
|
||
await page.afterReloadPage?.(); | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export {getDocumentCookie} from './getDocumentCookie'; | ||
export {getDocumentTitle} from './getDocumentTitle'; | ||
export {getDocumentUrl} from './getDocumentUrl'; | ||
export {reloadDocument} from './reloadDocument'; |
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,18 @@ | ||
import {createClientFunction} from '../../createClientFunction'; | ||
|
||
import type {ClientFunction} from '../../types/internal'; | ||
|
||
let clientReloadDocument: ClientFunction | undefined; | ||
|
||
/** | ||
* Reloads current document. | ||
*/ | ||
export const reloadDocument = (): Promise<void> => { | ||
if (clientReloadDocument === undefined) { | ||
clientReloadDocument = createClientFunction(() => window.location.reload(), { | ||
name: 'reloadPage', | ||
}); | ||
} | ||
|
||
return clientReloadDocument(); | ||
}; |
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