-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat, fix: add api key handling, error with show-connections and use …
…playwright for tests (#15) * feat: add API key handling * fix: bug with list connections * feat: use plawright for tests * feat: update python 3.9.1 to 3.9.19
- Loading branch information
1 parent
063cf9d
commit 86f7382
Showing
11 changed files
with
176 additions
and
73 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 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 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
// Look for test files in the "tests" directory, relative to this configuration file. | ||
testDir: 'tests', | ||
|
||
// Run all tests in parallel. | ||
fullyParallel: true, | ||
|
||
// Fail the build on CI if you accidentally left test.only in the source code. | ||
forbidOnly: !!process.env.CI, | ||
|
||
// Retry on CI only. | ||
retries: process.env.CI ? 2 : 0, | ||
|
||
// Opt out of parallel tests on CI. | ||
workers: process.env.CI ? 1 : undefined, | ||
projects: [ | ||
{ | ||
name: 'user session management', | ||
testMatch: /global\.setup\.ts/, | ||
teardown: 'logout user session', | ||
}, | ||
{ | ||
name: 'logout user session', | ||
testMatch: /global\.teardown\.ts/, | ||
}, | ||
{ | ||
name: 'cli', | ||
dependencies: ['user session management'], | ||
}, | ||
] | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,25 @@ | ||
import { test as setup, expect } from '@playwright/test'; | ||
import { execSync } from 'child_process'; | ||
import fs from "fs"; | ||
|
||
const userDataPath = `${process.env.HOME}/.composio`; | ||
|
||
setup('user session management', async ({ }) => { | ||
// Check if directory exists, delete it if it does | ||
if (fs.existsSync(userDataPath)) { | ||
execSync(`rm -rf ${userDataPath}`); | ||
console.log(`Existing directory '${userDataPath}' deleted successfully.`); | ||
} | ||
|
||
// Create directory and write file | ||
execSync(`mkdir -p ${userDataPath}`); | ||
fs.writeFileSync( | ||
`${userDataPath}/user_data.json`, | ||
JSON.stringify({ "api_key": "3kmtwhffkxvwebhnm7qwzj" }, null, 2) | ||
); | ||
|
||
// Read file and verify content | ||
const data = fs.readFileSync(`${userDataPath}/user_data.json`, 'utf8'); | ||
expect(data).toContain('3kmtwhffkxvwebhnm7qwzj'); | ||
console.log('user_data.json created and verified successfully.'); | ||
}); |
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,8 @@ | ||
import { test as teardown, expect } from '@playwright/test'; | ||
import { execSync } from 'child_process'; | ||
|
||
teardown('logout user session', async ({ }) => { | ||
const output = execSync(`python3 core/start_cli.py logout`).toString(); | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
expect(output).not.toBeNull(); | ||
}); |
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,21 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import fs from 'fs'; | ||
import { execSync } from 'child_process'; | ||
|
||
test.describe('Python CLI Operations', () => { | ||
const commands = [ | ||
{ command: 'whoami', description: 'Running whoami' }, | ||
{ command: 'show-apps', description: 'Running show-apps' }, | ||
{ command: 'show-connections github', description: 'Running show-connections github' }, | ||
{ command: 'list-triggers github', description: 'Running list-triggers github' }, | ||
]; | ||
|
||
commands.forEach(({ command, description }) => { | ||
test(description, async () => { | ||
const output = execSync(`python3 core/start_cli.py ${command}`).toString(); | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
console.log(description + ':', output); | ||
expect(output).not.toBeNull(); | ||
}); | ||
}); | ||
}); |