-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove-first-screenshot.test.ts
More file actions
31 lines (27 loc) · 1.33 KB
/
remove-first-screenshot.test.ts
File metadata and controls
31 lines (27 loc) · 1.33 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
import { expect } from 'chai'
import { createMocks } from './mocks'
import { ensureActiveTab } from '../../selectors'
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'
import { captureFirstScreenshot } from './steps/capture-first-screenshot'
describe('removing the first screenshot', () => {
const mocks = createMocks()
runBackground(mocks)
mountPopup(mocks, { handle: 'fetched' })
signInViaTwitter(mocks)
authenticateViaTwitter(mocks)
captureFirstScreenshot(mocks)
describe('removing first screenshot', () => {
it('deletes the first screenshot and does not take a new one', async () => {
const firstImage = mocks.app().querySelector('.twitter-interface > .images')!
const firstScreenshotCloseButton = firstImage.querySelector('.image-thumbnail > .close-btn') as HTMLButtonElement
firstScreenshotCloseButton.click()
const state = await mocks.whenState(state => ensureActiveTab(state).feedbackState.images.length === 0)
const activeTab = ensureActiveTab(state)
expect(activeTab.feedbackState.addingImages).to.equal(0)
expect(mocks.app().querySelectorAll('.image-spinner')).to.have.length(0)
})
})
})