Skip to content

Commit

Permalink
added tests for running dismissal actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmrj committed May 31, 2024
1 parent 7d305c7 commit 470a6db
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/features/webapp-prompt/test-utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const allSelectors = {
progressWrapper: '.appPrompt-progressWrapper',
progress: '.appPrompt-progress',
appSwitcher: '#unav-app-switcher',
indicatorRing: '.coach-indicator-ring',
tooltip: '[data-pep-dismissal-tooltip]',
};

export const defaultConfig = {
Expand Down
20 changes: 20 additions & 0 deletions test/features/webapp-prompt/webapp-prompt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,26 @@ describe('PEP', () => {
});
});

describe('PEP dismissal tests', () => {
it('should add three rings to the app switcher and remove them after the alloted time', async () => {
await initPep({});
await clock.runAllAsync();
document.querySelector(allSelectors.closeIcon).click();
expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(3);
await clock.runAllAsync();
expect([...document.querySelectorAll(allSelectors.indicatorRing)].length).to.equal(0);
});

it('should add a data attribute to the app switcher with the correct data and remove it after the allotted time', async () => {
await initPep({});
await clock.runAllAsync();
document.querySelector(allSelectors.closeIcon).click();
expect(document.querySelector(allSelectors.tooltip)).to.exist;
await clock.runAllAsync();
expect(document.querySelector(allSelectors.tooltip)).to.not.exist;
});
});

describe('PEP logging tests', () => {
beforeEach(() => {
window.lana.log = sinon.spy();
Expand Down

0 comments on commit 470a6db

Please sign in to comment.