-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclick-screenshot-fail.test.ts
More file actions
34 lines (27 loc) · 1.21 KB
/
click-screenshot-fail.test.ts
File metadata and controls
34 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { expect } from 'chai'
import { createMocks } from './mocks'
import { runBackground } from './steps/run-background'
import { mountPopup } from './steps/mount-popup'
import { authenticateViaTwitter } from './steps/authenticate-via-twitter'
import { signInViaTwitter } from './steps/sign-in-via-twitter'
describe('screenshotCaptureFailure + clickPost', () => {
const mocks = createMocks()
runBackground(mocks, { allowActionFailure: true })
mountPopup(mocks, { handle: 'fetched' })
signInViaTwitter(mocks)
authenticateViaTwitter(mocks)
// See clickPost in src/background/listeners.ts
describe('on screenshot failure', () => {
it('does not post the screenshot if capturing the visible tab fails', async () => {
const postButton = mocks.app().querySelector('.twitter-interface button.post-btn')! as HTMLButtonElement
postButton.click()
expect(mocks.getState().mostRecentAction.type).to.equal('clickPost')
mocks.rejectLatestCaptureVisibleTab()
const state = await mocks.whenState(state => state.mostRecentAction.type !== 'clickPost')
expect(state.alert).to.eql({
message: 'Something went wrong. Please try again.',
contactSupport: true,
})
})
})
})