-
Notifications
You must be signed in to change notification settings - Fork 149
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
[ACS-8951] [E2E] tags and categories e2es added in ACA #4210
Conversation
814ef65
to
4462619
Compare
e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts
Outdated
Show resolved
Hide resolved
|
||
async function createTagGetId() { | ||
const requestTagData = await tagsApi.createTags([tagBody]); | ||
if (Object.keys(requestTagData).includes('entry')) { |
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.
we can replace this if with better code like below to replace unknown type checking.
if ('entry' in requestTagData) {
return (requestTagData as { entry: { id: string } }).entry.id;
}
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 was using 'entry' in request but sonar cloud is giving me this error:
**_Use "indexOf" or "includes" (available from ES2016) instead._**
I switched it back to using 'in' keyword and the issue occurs again. What should I do here?
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.
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.
@AleksanderSklorz the sonar cloud issue is discussed here.
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.
Hmm I see. Honestly not sure why Sonar is complaining about that. Using 'in' should be fine as well in my opinion as it looks simpler. @MichalKinas is there any reason why we can't use 'in'? Should we somehow change it for sonar?
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.
That's why I used this line of code return (createdTag as { entry: { id: string } }).entry.id;
, because it treats the createdTag as a specific object with entry and id, and not as TagEntry which is somehow interpreted differently in this case.
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.
So in your first case you got beforeAll failed : TypeError: Cannot use 'in' operator to search for 'entry' in undefined
which means that in that case createdTag[0]
is undefined which means that tagsApi.createTags
didn't return tags, the rest of the code should work fine I even tested that in jsconsole ->
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.
If you still get the error please let me know how to run this case locally I will try to debug
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.
@MichalKinas in both cases the tags are created. This is the case with createdTag[0]. I still don't understand why it creates 3 tags, but I don't think this is the issue right now. The code is up-to-date on this branch, so if you want to debug it locally, you can do it. You can message me if you encounter any issues with running the e2es.
createdTag: {
entry: { tag: 'tag-1ld4r', id: '222ce83c-e6a1-487c-ace8-3ce6a1487c98' }
}
beforeAll failed : TypeError: Cannot use 'in' operator to search for 'entry' in undefined
createdTag: {
entry: { tag: 'tag-10mri', id: '2c78ac98-e2a9-44c8-b8ac-98e2a9a4c894' }
}
beforeAll failed : TypeError: Cannot use 'in' operator to search for 'entry' in undefined
createdTag: {
entry: { tag: 'tag-137wp', id: 'bcf4dce5-93be-4955-b4dc-e593be395537' }
}
beforeAll failed : TypeError: Cannot use 'in' operator to search for 'entry' in undefined
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.
XD this does not return array of 3 tags, those are 3 separate calls to create tags, that's why it fails when you try to access first element, this looks like an API inconsistency since it returns an object instead of an array, I can recall we had a ticket for that somewhere? Well anyway in that case doing return (requestTagData as { entry: { id: string } }).entry.id
should be fine until that gets fixed, sorry for the confusion I didn't know that API doesn't return an array
projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts
Outdated
Show resolved
Hide resolved
projects/aca-playwright-shared/src/page-objects/components/adf-info-drawer.component.ts
Outdated
Show resolved
Hide resolved
b6fdeb0
to
9e1cb96
Compare
e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts
Outdated
Show resolved
Hide resolved
e2e/playwright/info-drawer/src/tests/file-folder-properties.e2e.ts
Outdated
Show resolved
Hide resolved
@@ -50,41 +102,139 @@ test.describe('Info Drawer - File Folder Properties', () => { | |||
|
|||
test.afterAll(async () => { | |||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); | |||
await categoriesApi.deleteCategory(responseCategoryId); |
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.
responseCategoryId
might be null if error will happen
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.
Fixed, please check if properly.
@@ -50,41 +102,139 @@ test.describe('Info Drawer - File Folder Properties', () => { | |||
|
|||
test.afterAll(async () => { | |||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed'); | |||
await categoriesApi.deleteCategory(responseCategoryId); | |||
await tagsApi.deleteTag(responseTagsId); |
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.
responseTagsId
may be null as well
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.
Fixed, please check if properly.
0ae9059
to
479a875
Compare
479a875
to
513528f
Compare
Quality Gate passedIssues Measures |
JIRA ticket link or changeset's description
https://hyland.atlassian.net/browse/ACS-8951