-
Notifications
You must be signed in to change notification settings - Fork 62
fix(cc-widgets): e2e tests #588
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
base: next
Are you sure you want to change the base?
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
adhmenon
left a comment
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.
Mostly looks good.
Few doubts around timeout duration and some utils.
| const incomingTaskDiv = testManager.agent1Page.getByTestId('samples:incoming-task-telephony').first(); | ||
| await incomingTaskDiv.waitFor({state: 'visible', timeout: 80000}); | ||
|
|
||
| await waitForIncomingTask(testManager.agent1Page, TASK_TYPES.CALL, 80000); |
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.
Question - do we need such a large timeout?
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.
addressed by adding a constant with 60000
| ); | ||
|
|
||
| // Agent 2 should receive the transfer and accept it | ||
| await acceptIncomingTask(testManager.agent2Page, TASK_TYPES.CALL, 60000); |
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.
Notice this timeout is different, have we added optimised values - is this why each are different?
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.
addressed by adding a constant with 60000
| await incomingChatTaskDiv.waitFor({state: 'visible', timeout: 40000}); | ||
| await acceptIncomingTask(testManager.agent1Page, TASK_TYPES.CHAT); | ||
| await incomingEmailTaskDiv.waitFor({state: 'visible', timeout: 3000}); | ||
| await incomingEmailTaskDiv.waitFor({state: 'visible', timeout: 40000}); |
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.
Do we need such large timeouts?
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.
yes. email takes time to reach ui
| await hideDesktopCheckbox.click(); | ||
| await testManager.agent1Page.waitForTimeout(500); | ||
| await verifyDesktopOptionVisibility(testManager.agent1Page, true); | ||
| await verifyDesktopOptionVisibility(testManager.agent1Page, false); |
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.
WHy is this change needed?
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.
because of default value and hideDesktopCheckbox visibility is false
| test.afterAll(async () => { | ||
| await testManager.cleanup(); | ||
| }); | ||
| // No afterAll here - suite handles cleanup |
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.
Nit: can remove this.
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.
removed
| import {loginExtension} from './incomingTaskUtils'; | ||
| import {dismissOverlays} from './helperUtils'; | ||
| import {AWAIT_TIMEOUT, FORM_FIELD_TIMEOUT} from '../constants'; | ||
| import {AWAIT_TIMEOUT, FORM_FIELD_TIMEOUT, LONG_WAIT} from '../constants'; |
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.
Nit: Maybe rename the LONG_WAIT to something else?
| const endButton = page.getByTestId('call-control:end-call').first(); | ||
| const endButtonVisible = await endButton.isVisible().catch(() => false); | ||
|
|
||
| if (endButtonVisible) { |
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.
Wondering why we had to do these end button checks for cleaning up stray tasks? Would they not be handled by the test itself?
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.
this will be useful when some test fails and make sure other tests have clean state. and for the end button for extension or in hold state end button is disabled. so to clear that task we have to unhold before we click end
| const endBtnAfterAccept = page.getByTestId('call-control:end-call').first(); | ||
| const endVisibleAfterAccept = await endBtnAfterAccept.isVisible().catch(() => false); | ||
| if (endVisibleAfterAccept) { | ||
| const endEnabledAfterAccept = await endBtnAfterAccept.isEnabled().catch(() => false); | ||
| if (endEnabledAfterAccept) { |
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.
Why are we accepting tasks in the stray task cleanup?
I feel this should be handled in tests...
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.
same to make suer other test have clean slate if at all some test fails .
| // Don't continue - fall through to check wrapup immediately | ||
| } else { | ||
| } | ||
| } catch (e) { |
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 throw this error to ensure the tests fails.
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.
this is to silently give clean slate for the tests and and wont affect any tests to throw error
| actionTaken = true; | ||
| await page.waitForTimeout(300); | ||
| continue; | ||
| } catch (e) { |
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.
Same here
| */ | ||
|
|
||
| export const handleStrayTasks = async ( | ||
| page: Page, |
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.
Can we create sub method for this 300 lines method. It became very hard to follow
| ); | ||
| // Ensure only one page remains in the Dial Number context to avoid duplicate web client instances | ||
| await this.enforceSingleDialNumberInOwnContext(); | ||
| // await this.enforceSingleDialNumberInOwnContext(); |
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.
Can we remove this if not required
| }); | ||
| test.describe('Dial Number Tests', () => { | ||
| test.beforeAll(async () => { | ||
| test.skip(!process.env.PW_DIAL_NUMBER_NAME, 'PW_DIAL_NUMBER_NAME not set'); |
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 remove this, we are not doing anything here
COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7496
This pull request addresses
Fixing the e2e tests.
Added logging for better debug.
by making the following changes
move all the dial numbers tests into one suite.
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.