-
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.
FI-943 feat: support CDP (aka native automation)
- Loading branch information
Showing
35 changed files
with
441 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export {createRandomUser} from './createRandomUser'; | ||
export {setPageCookiesAndNavigateToUrl} from './setPageCookiesAndNavigateToUrl'; | ||
export {setPageRequestHeadersAndNavigateToUrl} from './setPageRequestHeadersAndNavigateToUrl'; |
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
23 changes: 23 additions & 0 deletions
23
autotests/actions/setPageRequestHeadersAndNavigateToUrl.ts
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,23 @@ | ||
import {setHeadersAndNavigateToUrl} from 'e2ed/actions'; | ||
import {LogEventType} from 'e2ed/constants'; | ||
import {log} from 'e2ed/utils'; | ||
|
||
import type {Headers, Url} from 'e2ed/types'; | ||
|
||
/** | ||
* Navigate to the url and set additional page request headers. | ||
*/ | ||
export const setPageRequestHeadersAndNavigateToUrl = async ( | ||
url: Url, | ||
pageRequestHeaders: Headers, | ||
): Promise<void> => { | ||
const mapRequestHeaders = (): Headers => pageRequestHeaders; | ||
|
||
log( | ||
`Navigate to ${url} and set page request headers`, | ||
{pageRequestHeaders, url}, | ||
LogEventType.Action, | ||
); | ||
|
||
await setHeadersAndNavigateToUrl(url, {mapRequestHeaders}); | ||
}; |
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 +1,6 @@ | ||
export {clearPageCookies, getPageCookies, setPageCookies} from './pageCookies'; | ||
export { | ||
clearPageRequestHeaders, | ||
getPageRequestHeaders, | ||
setPageRequestHeaders, | ||
} from './pageRequestHeaders'; |
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,9 @@ | ||
import {useContext} from 'e2ed'; | ||
|
||
import type {Headers} from 'e2ed/types'; | ||
|
||
/** | ||
* Get, set and clear additional page request headers, that will be added when navigating to the page. | ||
*/ | ||
export const [getPageRequestHeaders, setPageRequestHeaders, clearPageRequestHeaders] = | ||
useContext<Headers>(); |
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
14 changes: 14 additions & 0 deletions
14
autotests/tests/e2edReportExample/setPageRequestHeaders.ts
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,14 @@ | ||
import {test} from 'autotests'; | ||
import {E2edReportExample} from 'autotests/pageObjects/pages'; | ||
import {navigateToPage, waitForRequest} from 'e2ed/actions'; | ||
|
||
const headerName = 'x-custom-header'; | ||
const pageRequestHeaders = {[headerName]: 'foo'}; | ||
|
||
test('set page request headers correctly', {meta: {testId: '17'}}, async () => { | ||
void navigateToPage(E2edReportExample, {pageRequestHeaders}); | ||
|
||
await waitForRequest( | ||
({requestHeaders}) => requestHeaders[headerName] === pageRequestHeaders[headerName], | ||
); | ||
}); |
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
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
Oops, something went wrong.