Skip to content

Commit

Permalink
feat(args): add isolated
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Oct 27, 2023
1 parent 6b2b863 commit 23e90df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func ReadFlags() error {
CONFIG_PASSWORD := flag.String("p", "", "user password, example: 123456. Deprecated")
CONFIG_PLATFORM := flag.String("platform", "", "testing platform (Android or iOS only)")
CONFIG_OS_VERSION := flag.String("os-version", "", "Android or iOS OS version")
CONFIG_ISOLATED := flag.String("isolated", "", "Run each test using isolated execution. Default is false.")

args := os.Args
if len(args) > 1 && args[1] == "help" {
Expand Down Expand Up @@ -80,6 +81,10 @@ func ReadFlags() error {
config.Set("API_KEY", *CONFIG_API_KEY)
}

if len(*CONFIG_ISOLATED) > 0 {
config.Set("ISOLATED", *CONFIG_ISOLATED)
}

if len(*CONFIG_API_KEY) == 0 && (len(*CONFIG_LOGIN) == 0 || len(*CONFIG_PASSWORD) == 0) {
return errors.New("api-key or login with password must be specified")
}
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func main() {
allureOutput := conf.GetString("ALLURE_OUTPUT")
platform := conf.GetString("PLATFORM")
osVersion := conf.GetString("OS_VERSION")
isolated := conf.GetString("ISOLATED")

if len(apiKey) == 0 {
token, err := request.Authorize(login, password)
Expand Down Expand Up @@ -59,7 +60,7 @@ func main() {
fmt.Println(err)
return
}
runId, err := request.SendNewRunWithKey(apiKey, app, testApp, commitName, commitLink, platform, osVersion)
runId, err := request.SendNewRunWithKey(apiKey, app, testApp, commitName, commitLink, platform, osVersion, isolated)
if err != nil {
fmt.Println(err.Error())
os.Exit(5)
Expand Down
5 changes: 4 additions & 1 deletion request/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ type CreateRunResponse struct {
Status string `json:"status"`
}

func SendNewRunWithKey(apiKey string, appPath string, testAppPath string, commitName string, commitLink string, platform string, osVersion string) (string, error) {
func SendNewRunWithKey(apiKey string, appPath string, testAppPath string, commitName string, commitLink string, platform string, osVersion string, isolated string) (string, error) {
appFile, err := os.Open(appPath)
if err != nil {
fmt.Println("Can't read apk file")
Expand Down Expand Up @@ -122,6 +122,9 @@ func SendNewRunWithKey(apiKey string, appPath string, testAppPath string, commit
if len(osVersion) > 0 {
writer.WriteField("osversion", osVersion)
}
if isolated == "true" || isolated == "false" {
writer.WriteField("isolated", isolated)
}

writer.Close()

Expand Down

0 comments on commit 23e90df

Please sign in to comment.