-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pavyarov
authored and
pavyarov
committed
Aug 4, 2020
1 parent
8ce83ee
commit ea1094c
Showing
50 changed files
with
1,542 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const DEBUGGER_VERSION = '1.3'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { GLOBAL, LOCAL } from './eventTypes'; | ||
export { TOKEN_HEADER, TOKEN_KEY } from './connection'; | ||
export { DEBUGGER_VERSION } from './global'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { startGroupSession } from './start-group-session'; | ||
export { startAgentSession } from './start-agent-session'; | ||
export { startSession } from './start-session'; |
12 changes: 8 additions & 4 deletions
12
src/content-script/pages/manual-testing-page/api/start-agent-session.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import axios from 'axios'; | ||
import { browser } from 'webextension-polyfill-ts'; | ||
|
||
import { AgentConfig } from '../../../../types/agent-config'; | ||
import { DomainConfig } from '../../../../types/domain-config'; | ||
|
||
export async function startAgentSession(activeTab: string, testName: string, config: AgentConfig) { | ||
export async function startAgentSession(activeTab: string, testName: string, config: DomainConfig) { | ||
const { drillAgentId } = config; | ||
const { domains } = await browser.storage.local.get('domains') || {}; | ||
const { data } = await axios.post(`/agents/${drillAgentId}/plugins/test2code/dispatch-action`, { | ||
type: 'START', | ||
payload: { testType: 'MANUAL' }, | ||
}); | ||
const { data: { payload: { sessionId } } } = data; | ||
|
||
browser.storage.local.set({ | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
domains: { | ||
...domains, | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
}, | ||
}, | ||
}); | ||
} |
12 changes: 8 additions & 4 deletions
12
src/content-script/pages/manual-testing-page/api/start-group-session.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import axios from 'axios'; | ||
import { browser } from 'webextension-polyfill-ts'; | ||
|
||
import { AgentConfig } from '../../../../types/agent-config'; | ||
import { DomainConfig } from '../../../../types/domain-config'; | ||
|
||
export async function startGroupSession(activeTab: string, testName: string, config: AgentConfig) { | ||
export async function startGroupSession(activeTab: string, testName: string, config: DomainConfig) { | ||
const { drillGroupId } = config; | ||
const { domains } = await browser.storage.local.get('domains') || {}; | ||
const { data: [response] } = await axios.post(`/service-groups/${drillGroupId}/plugins/test2code/dispatch-action`, { | ||
type: 'START', | ||
payload: { testType: 'MANUAL' }, | ||
}); | ||
const { data: { payload: { sessionId } } } = response; | ||
|
||
browser.storage.local.set({ | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
domains: { | ||
...domains, | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
}, | ||
}, | ||
}); | ||
} |
45 changes: 45 additions & 0 deletions
45
src/content-script/pages/manual-testing-page/api/start-session.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import axios from 'axios'; | ||
import { browser } from 'webextension-polyfill-ts'; | ||
import nanoid from 'nanoid'; | ||
|
||
import { DomainConfig } from '../../../../types/domain-config'; | ||
|
||
export async function startSession(activeTab: string, testName: string, config: DomainConfig) { | ||
const { drillAgentId, drillAgentType = 'Java', drillAdminUrl } = config; | ||
const { domains } = await browser.storage.local.get('domains') || {}; | ||
|
||
if (drillAgentType === 'JS') { | ||
const connection = axios.create({ baseURL: `http://${drillAdminUrl}` }); | ||
const sessionId = nanoid(); | ||
|
||
browser.runtime.sendMessage({ action: 'START_TEST', testName }); | ||
|
||
await connection.post(`/agents/${drillAgentId}/plugins/test2code/sessions/${sessionId}`); | ||
|
||
browser.runtime.sendMessage({ action: 'START_TEST' }); | ||
|
||
browser.storage.local.set({ | ||
domains: { | ||
...domains, | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
}, | ||
}, | ||
}); | ||
} else { | ||
const { data } = await axios.post(`/agents/${drillAgentId}/plugins/test2code/dispatch-action`, { | ||
type: 'START', | ||
payload: { testType: 'MANUAL', isRealtime: true }, | ||
}); | ||
const { data: { payload: { sessionId } } } = data; | ||
|
||
browser.storage.local.set({ | ||
domains: { | ||
...domains, | ||
[activeTab]: { | ||
...config, testName, isActive: true, sessionId, timerStart: Date.now(), | ||
}, | ||
}, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.