fix(cc-widgets): e2e tests - #588
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
adhmenon
left a comment
There was a problem hiding this comment.
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.
Question - do we need such a large timeout?
There was a problem hiding this comment.
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.
Notice this timeout is different, have we added optimised values - is this why each are different?
There was a problem hiding this comment.
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.
Do we need such large timeouts?
There was a problem hiding this comment.
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.
WHy is this change needed?
There was a problem hiding this comment.
because of default value and hideDesktopCheckbox visibility is false
| test.afterAll(async () => { | ||
| await testManager.cleanup(); | ||
| }); | ||
| // No afterAll here - suite handles cleanup |
| 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.
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.
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.
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.
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.
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.
We can throw this error to ensure the tests fails.
There was a problem hiding this comment.
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) { |
| */ | ||
|
|
||
| export const handleStrayTasks = async ( | ||
| page: Page, |
There was a problem hiding this comment.
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.
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.
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.