-
Notifications
You must be signed in to change notification settings - Fork 404
E2e/bugfix/fixes for desktop tests #2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vlad-dargel
merged 7 commits into
release/2.28.0
from
e2e/bugfix/fixes-for-desktop-tests
Jun 28, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f65efb1
updates for api methods to run desktop tests
vlad-dargel 09edbb8
added node version to config for e2e
vlad-dargel 26e029a
fix
vlad-dargel c98f1ea
updates for circleCI
vlad-dargel df81946
return back circleci/node version
vlad-dargel b056910
fix for parameters
vlad-dargel edf4ee1
fix for failed test
vlad-dargel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
import * as request from 'supertest'; | ||
import { Common } from '../common'; | ||
import { Methods } from '../constants'; | ||
|
||
const endpoint = Common.getEndpoint(); | ||
|
||
/** | ||
* Send request using API | ||
* @param method http method | ||
* @param resourcePath URI path segment | ||
* @param statusCode Expected status code of the response | ||
* @param body Request body | ||
*/ | ||
export async function sendRequest( | ||
method: string, | ||
resourcePath: string, | ||
statusCode: number, | ||
body?: Record<string, unknown> | ||
): Promise<any> { | ||
const windowId = Common.getWindowId(); | ||
let requestEndpoint; | ||
|
||
if (method === Methods.post) { | ||
(requestEndpoint = request(endpoint) | ||
.post(resourcePath) | ||
.send(body) | ||
.set('Accept', 'application/json')); | ||
} | ||
else if (method === Methods.get) { | ||
(requestEndpoint = request(endpoint) | ||
.get(resourcePath) | ||
.set('Accept', 'application/json')); | ||
} | ||
else if (method === Methods.delete) { | ||
(requestEndpoint = request(endpoint) | ||
.delete(resourcePath) | ||
.send(body) | ||
.set('Accept', 'application/json')); | ||
} | ||
|
||
if (await windowId) { | ||
requestEndpoint.set('X-Window-Id', await windowId); | ||
} | ||
|
||
return await requestEndpoint.expect(statusCode); | ||
} | ||
This file contains hidden or 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 hidden or 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,14 +1,9 @@ | ||
import { t } from 'testcafe'; | ||
import * as request from 'supertest'; | ||
import { Common } from '../common'; | ||
|
||
const endpoint = Common.getEndpoint(); | ||
import { sendRequest } from './api-common'; | ||
import { Methods } from '../constants'; | ||
|
||
/** | ||
* Synchronize features | ||
*/ | ||
export async function syncFeaturesApi(): Promise<void> { | ||
const response = await request(endpoint).post('/features/sync') | ||
.set('Accept', 'application/json'); | ||
await t.expect(response.status).eql(200, `Synchronization request failed: ${await response.body.message}`); | ||
await sendRequest(Methods.post, '/features/sync', 200); | ||
} |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that we need such wrapper.
Is it possible to initiate supertest instance per api service (if needed) or globally with x-window-id header preconfigured like it possible for axios?
It is up to you. Just wanted to highlight this