qa 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/commands/index.js +2 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/start.d.ts +19 -0
- package/dist/commands/start.js +63 -0
- package/dist/commands/utils/index.js +1 -1
- package/dist/commands/utils/prompts.js +1 -1
- package/dist/index.js +2 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<!-- <a href="https://github.com/codeless-qa/qa/blob/main/LICENSE"><img src="https://img.shields.io/github/license/codeless-qa/qa.svg?style=flat&colorA=080f12&colorB=1fa669"></a> -->
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
The CodelessQA provides a CLI tool that gives you access to all your tests within the CodelessQA platform.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
## Install
|
|
19
19
|
|
|
20
20
|
To install the latest version of CodelessQA CLI, run this command:
|
|
21
21
|
|
|
@@ -23,6 +23,8 @@ To install the latest version of CodelessQA CLI, run this command:
|
|
|
23
23
|
npm i -g qa
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
26
28
|
To quickly start a new project, run the following commands:
|
|
27
29
|
|
|
28
30
|
```sh
|
|
@@ -33,4 +35,4 @@ qa test <PROJECT> # run an API or browser test
|
|
|
33
35
|
|
|
34
36
|
## Documentation
|
|
35
37
|
|
|
36
|
-
For details on how to use Codeless CLI, check out our [documentation](https://docs.codeless.qa).
|
|
38
|
+
For details on how to use Codeless CLI, check out our [documentation](https://docs.codeless.qa/cli).
|
package/dist/commands/index.js
CHANGED
package/dist/commands/init.js
CHANGED
package/dist/commands/login.js
CHANGED
|
@@ -17,7 +17,7 @@ export const cmdArgs = {
|
|
|
17
17
|
export const builder = (yargs) => {
|
|
18
18
|
return yargs
|
|
19
19
|
.options(cmdArgs)
|
|
20
|
-
.example('qa login',
|
|
20
|
+
.example('qa login', desc)
|
|
21
21
|
.example('qa login --token XXX', 'Log in through access token')
|
|
22
22
|
.epilogue(CLI_EPILOGUE)
|
|
23
23
|
.help();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "start [option]";
|
|
3
|
+
export declare const desc = "Start the CodelessQA IDE";
|
|
4
|
+
export declare const cmdArgs: {
|
|
5
|
+
readonly token: {
|
|
6
|
+
readonly alias: "t";
|
|
7
|
+
readonly desc: "Provide an access token to authenticate with the platform";
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "token"> & import("yargs").InferredOptionTypes<{
|
|
12
|
+
readonly token: {
|
|
13
|
+
readonly alias: "t";
|
|
14
|
+
readonly desc: "Provide an access token to authenticate with the platform";
|
|
15
|
+
readonly type: "string";
|
|
16
|
+
};
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const handler: () => Promise<void>;
|
|
19
|
+
//# sourceMappingURL=start.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { remote } from 'webdriverio';
|
|
2
|
+
// import { getAccessToken } from '../auth.js'
|
|
3
|
+
import { CLI_EPILOGUE } from '../constants.js';
|
|
4
|
+
export const command = 'start [option]';
|
|
5
|
+
export const desc = 'Start the CodelessQA IDE';
|
|
6
|
+
export const cmdArgs = {
|
|
7
|
+
token: {
|
|
8
|
+
alias: 't',
|
|
9
|
+
desc: 'Provide an access token to authenticate with the platform',
|
|
10
|
+
type: 'string',
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const builder = (yargs) => {
|
|
14
|
+
return yargs
|
|
15
|
+
.options(cmdArgs)
|
|
16
|
+
.example('qa start', desc)
|
|
17
|
+
.epilogue(CLI_EPILOGUE)
|
|
18
|
+
.help();
|
|
19
|
+
};
|
|
20
|
+
export const handler = async ( /*argv: typeof cmdArgs*/) => {
|
|
21
|
+
// let token = await getAccessToken(argv.token as unknown as string)
|
|
22
|
+
try {
|
|
23
|
+
const [workbench, ide] = await Promise.all([
|
|
24
|
+
remote({
|
|
25
|
+
logLevel: 'error',
|
|
26
|
+
capabilities: getCapabilities('1024,768', '100,100')
|
|
27
|
+
}),
|
|
28
|
+
remote({
|
|
29
|
+
logLevel: 'error',
|
|
30
|
+
capabilities: getCapabilities('500,768', '1124,100')
|
|
31
|
+
})
|
|
32
|
+
]);
|
|
33
|
+
const style = '"width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-around; align-items: center;"';
|
|
34
|
+
await Promise.all([
|
|
35
|
+
openPage(workbench, `<h1 style=${style}>Workbench</h1>`),
|
|
36
|
+
openPage(ide, `<div style=${style}>
|
|
37
|
+
<h1>IDE</h1>
|
|
38
|
+
<span>(I will close myself in 5s)</span>
|
|
39
|
+
</div>`)
|
|
40
|
+
]);
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
workbench.deleteSession();
|
|
43
|
+
ide.deleteSession();
|
|
44
|
+
}, 5000);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.error('Failed to start the CodelessQA IDE', err);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
function getCapabilities(windowSize, windowPosition) {
|
|
51
|
+
return {
|
|
52
|
+
browserName: 'chrome',
|
|
53
|
+
'goog:chromeOptions': {
|
|
54
|
+
args: [
|
|
55
|
+
`window-size=${windowSize}`,
|
|
56
|
+
`window-position=${windowPosition}`,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function openPage(driver, html) {
|
|
62
|
+
driver.url('data:text/html,' + html);
|
|
63
|
+
}
|
|
@@ -24,7 +24,7 @@ export async function generateTests(token, id, spinner, body) {
|
|
|
24
24
|
params: { id },
|
|
25
25
|
body
|
|
26
26
|
});
|
|
27
|
-
if (resTests.status !== 200 || 'error' in resTests.body) {
|
|
27
|
+
if (resTests.status !== 200 || (resTests.body && 'error' in resTests.body)) {
|
|
28
28
|
spinner.stop();
|
|
29
29
|
const error = typeof resTests.body === 'object' && resTests.body && 'error' in resTests.body
|
|
30
30
|
? resTests.body.error instanceof Error
|
|
@@ -181,7 +181,7 @@ export async function askServerParams(spec) {
|
|
|
181
181
|
options: [
|
|
182
182
|
...spec.servers.map((server, value) => ({
|
|
183
183
|
label: server.description || server.url,
|
|
184
|
-
value,
|
|
184
|
+
value: value.toString(),
|
|
185
185
|
hint: server.description ? server.url : undefined
|
|
186
186
|
})),
|
|
187
187
|
{
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,9 @@ const DESCRIPTION = [
|
|
|
12
12
|
export async function run() {
|
|
13
13
|
const argv = yargs(hideBin(process.argv))
|
|
14
14
|
.command(commands)
|
|
15
|
+
.example('qa start', 'Starts the CodelessQA IDE')
|
|
15
16
|
.example('qa login', 'Logs you into the platform')
|
|
17
|
+
.example('qa init', 'Creates a new CodelessQA project')
|
|
16
18
|
.example('qa test myAPI', 'Runs test on API named "myAPI"')
|
|
17
19
|
.updateStrings({ 'Commands:': `${DESCRIPTION.join('\n')}\n\nCommands:` })
|
|
18
20
|
.version(pkg.version)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"author": "Christian Bromann <christian@codeless.qa>",
|
|
5
5
|
"description": "Codeless QA CLI",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@clack/prompts": "^0.
|
|
13
|
+
"@clack/prompts": "^0.8.1",
|
|
14
14
|
"@types/uuid": "^9.0.8",
|
|
15
15
|
"@types/ws": "^8.5.10",
|
|
16
16
|
"@types/yargs": "^17.0.32",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"uuid": "^11.0.3",
|
|
20
20
|
"ws": "^8.17.0",
|
|
21
21
|
"yargs": "^17.7.2",
|
|
22
|
-
"
|
|
22
|
+
"webdriverio": "^9.5.0",
|
|
23
|
+
"@codeless.qa/contracts": "0.0.10"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"replace-in-files-cli": "^3.0.0",
|