Skip to content

Commit

Permalink
fix(tests) e2e: Adapt tests with new API routes, ignore failing test …
Browse files Browse the repository at this point in the history
…on OS X (#2383)

* Fix API modifications

* Ignore Toggle logs tes on OS X

* Remove debug logs

* Explicitly skip test
  • Loading branch information
spg committed Sep 16, 2019
1 parent 1f9dab8 commit d1caacb
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/e2e/admin/bots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Admin - Bot Management', () => {
autoAnswerDialog()

await clickButtonForBot('#btn-delete', importBotId)
await expectAdminApiCallSuccess(`bots/${importBotId}`, 'DELETE')
await expectAdminApiCallSuccess(`bots/${importBotId}/delete`, 'POST')
await page.waitFor(200)
})

Expand Down Expand Up @@ -68,7 +68,7 @@ describe('Admin - Bot Management', () => {
await page.keyboard.press('ArrowDown')
await page.keyboard.press('Enter')
await clickOn('#btn-save')
await expectAdminApiCallSuccess(`bots/${tempBotId}`, 'PUT')
await expectAdminApiCallSuccess(`bots/${tempBotId}`, 'POST')
await gotoAndExpect(`${bpConfig.host}/admin/workspace/bots`)
})

Expand All @@ -92,7 +92,7 @@ describe('Admin - Bot Management', () => {
autoAnswerDialog()

await clickButtonForBot('#btn-delete', tempBotId)
await expectAdminApiCallSuccess(`bots/${tempBotId}`, 'DELETE')
await expectAdminApiCallSuccess(`bots/${tempBotId}/delete`, 'POST')
await page.waitFor(200)
})
})
2 changes: 1 addition & 1 deletion src/e2e/admin/logout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Admin - Logout', () => {
if (bpConfig.recreateBot) {
autoAnswerDialog()
await clickButtonForBot('#btn-delete')
await expectAdminApiCallSuccess(`bots/${bpConfig.botId}`, 'DELETE')
await expectAdminApiCallSuccess(`bots/${bpConfig.botId}/delete`, 'POST')
}
})
})
4 changes: 2 additions & 2 deletions src/e2e/admin/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Admin - Users', () => {
await page.keyboard.press('Enter')
await clickOn('#btn-save')

await expectAdminApiCallSuccess(`users/workspace/update_role`, 'PUT')
await expectAdminApiCallSuccess(`users/workspace/update_role`, 'POST')
await expectMatch('Role updated successfully')
})

Expand All @@ -64,6 +64,6 @@ describe('Admin - Users', () => {

autoAnswerDialog()
await clickButtonForUser('#btn-deleteUser', testUserEmail)
await expectAdminApiCallSuccess(`admin/users/default/${testUserEmail}`, 'DELETE')
await expectAdminApiCallSuccess(`admin/users/default/${testUserEmail}/delete`, 'POST')
})
})
1 change: 1 addition & 0 deletions src/e2e/all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,4 @@ describe('Integration Tests', () => {
// Change this to test a different pipeline
allTests.map(x => require(x))
})

2 changes: 1 addition & 1 deletion src/e2e/modules/code-editor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('Module - Code Editor', () => {
await clickOnTreeNode('hello_copy.js', 'right')
await clickOn('#btn-disable')

await expectBotApiCallSuccess('mod/code-editor/rename', 'PUT')
await expectBotApiCallSuccess('mod/code-editor/rename', 'POST')
const response = await waitForBotApiResponse('mod/code-editor/files')
const disabledFile = response.actionsBot.find(x => x.name === '.hello_copy.js')
expect(disabledFile).toBeDefined()
Expand Down
2 changes: 1 addition & 1 deletion src/e2e/modules/qna.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Module - QNA', () => {
await page.mouse.move(x, y) // This makes the delete icon visible for the next step

await clickOn('.bp3-icon-trash')
await expectBotApiCallSuccess('mod/qna/questions', 'DELETE')
await expectBotApiCallSuccess('mod/qna/questions', 'POST')
})

it('Export to JSON', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/e2e/studio/flows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ describe('Studio - Flows', () => {
await clickOnTreeNode('test_flow', 'right')
await clickOn('#btn-rename')

await expectBotApiCallSuccess('flow/test_flow_renamed.flow.json', 'PUT')
await expectBotApiCallSuccess('flow/test_flow_renamed.flow.json', 'POST')
})

it('Delete flow', async () => {
autoAnswerDialog()
await clickOnTreeNode('test_flow_renamed', 'right')
await clickOn('#btn-delete')

await expectBotApiCallSuccess('flow/test_flow_renamed.flow.json', 'DELETE')
await expectBotApiCallSuccess('flow/test_flow_renamed.flow.json/delete', 'POST')
})

it('Duplicate flow', async () => {
Expand Down
20 changes: 13 additions & 7 deletions src/e2e/studio/ui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@ describe('Studio - UI', () => {
await expectBotApiCallSuccess('mod/channel-web/messages/')
})

it('Toggle Logs', async () => {
await page.focus('#mainLayout')
await triggerKeyboardShortcut('KeyJ', true)
const bottomPanel = await page.$('div[data-tab-id="bt-panel-logs"]')
expect(await bottomPanel.isIntersectingViewport()).toBe(true)
await triggerKeyboardShortcut('KeyJ', true)
})
if (process.platform === 'darwin') {
// TODO (1): Skip this test using native Jest features once https://github.com/facebook/jest/issues/8604 is resolved
// TODO (2): Activate this test once Puppeteer supports native shortcuts (e.g. `⌘ J`) on OS X
it.skip('Toggle Logs (SKIPPED ON MAC)', async () => {})
} else {
it('Toggle Logs', async () => {
await page.focus('#mainLayout')
await triggerKeyboardShortcut('KeyJ', true)
const bottomPanel = await page.$('div[data-tab-id="bt-panel-logs"]')
expect(await bottomPanel.isIntersectingViewport()).toBe(true)
await triggerKeyboardShortcut('KeyJ', true)
})
}

it('Load Analytics', async () => {
await clickOn('#bp-menu_analytics')
Expand Down

0 comments on commit d1caacb

Please sign in to comment.