-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jindřich Bär <[email protected]>
- Loading branch information
1 parent
0eed20b
commit 6345162
Showing
20 changed files
with
1,143 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# Feature: Builds namespace | ||
|
||
- As an Actor developer or user | ||
- I want to be able to manage the builds of my actors on Apify Console | ||
- In order to trigger new builds from the CLI, list them, and get details about them | ||
|
||
## Background: | ||
|
||
- Given my `pwd` is a fully initialized Actor project directory | ||
- And the `actor.json` is valid | ||
- And I am a logged in Apify Console User | ||
|
||
## Rule: Creating builds works | ||
|
||
### Example: calling create with invalid actor ID fails | ||
|
||
- When I run: | ||
``` | ||
$ apify builds create --actor=invalid-id | ||
``` | ||
- Then I can read text on stderr: | ||
``` | ||
Actor with name or ID "invalid-id" was not found | ||
``` | ||
|
||
### Example: calling create from an unpublished actor directory fails | ||
|
||
- When I run: | ||
``` | ||
$ apify builds create | ||
``` | ||
- Then I can read text on stderr: | ||
``` | ||
Actor with name "{{ testActorName }}" was not found | ||
``` | ||
|
||
### Example: calling create from a published actor directory works | ||
|
||
- Given the local Actor is pushed to the Apify platform | ||
- When I run: | ||
``` | ||
$ apify builds create | ||
``` | ||
- Then I can read text on stderr: | ||
``` | ||
Build Started | ||
``` | ||
- And I can read text on stderr: | ||
``` | ||
{{ testActorName}} | ||
``` | ||
|
||
### Example: calling create from a published actor with `--json` prints valid JSON data | ||
|
||
- Given the local Actor is pushed to the Apify platform | ||
- When I run: | ||
``` | ||
$ apify builds create --json | ||
``` | ||
- Then I can read valid JSON on stdout | ||
|
||
## Rule: Printing information about builds works | ||
|
||
### Example: calling info with invalid build ID fails | ||
|
||
- When I run: | ||
``` | ||
$ apify builds info invalid-id | ||
``` | ||
- Then I can read text on stderr: | ||
``` | ||
Build with ID "invalid-id" was not found | ||
``` | ||
|
||
### Example: calling info with valid build ID works | ||
|
||
- Given the local Actor is pushed to the Apify platform | ||
- When I run: | ||
``` | ||
$ apify builds create | ||
``` | ||
- And I capture the build ID | ||
- And I run with captured data: | ||
``` | ||
$ apify builds info {{ buildId }} | ||
``` | ||
- Then I can read text on stderr: | ||
``` | ||
{{ testActorName }} | ||
``` | ||
|
||
### Example: calling info with valid build ID and `--json` prints valid JSON data | ||
|
||
- Given the local Actor is pushed to the Apify platform | ||
- When I run: | ||
``` | ||
$ apify builds create | ||
``` | ||
- And I capture the build ID | ||
- And I run with captured data: | ||
``` | ||
$ apify builds info {{ buildId }} --json | ||
``` | ||
- Then I can read valid JSON on stdout | ||
|
||
## Rule: Listing builds works | ||
|
||
<!-- TODO table testing? --> | ||
|
||
### Example: calling list with --json prints valid JSON data | ||
|
||
- Given the local Actor is pushed to the Apify platform | ||
- When I run: | ||
``` | ||
$ apify builds ls --json | ||
``` | ||
- Then I can read valid JSON on stdout | ||
|
||
<!-- TODO: We should test builds log, but that's gonna be annoying, so for now leave it as is --> |
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,12 @@ | ||
export interface StringMatcherTemplate { | ||
testActorName?: string; | ||
buildId?: string; | ||
} | ||
|
||
export function replaceMatchersInString(str: string, matchers: StringMatcherTemplate): string { | ||
for (const [key, replaceValue] of Object.entries(matchers) as [keyof StringMatcherTemplate, string][]) { | ||
str = str.replace(new RegExp(`{{\\s*${key}\\s*}}`, 'g'), replaceValue); | ||
} | ||
|
||
return str; | ||
} |
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
Oops, something went wrong.