Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate the status of app version to be ready_for_review before submitting the app #20515

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions deliver/lib/deliver/submit_for_review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ def create_review_submission(options, app, version, platform)
end

submission.add_app_store_version_to_review_items(app_store_version_id: version.id)

loop do
404pilot marked this conversation as resolved.
Show resolved Hide resolved
version_with_latest_info = Spaceship::ConnectAPI::AppStoreVersion.get(app_store_version_id: version.id)

if version_with_latest_info.app_store_state == Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_REVIEW
break
end

UI.message("Waiting for the state of the version to become #{Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_REVIEW}...")

sleep(15)
end

submission.submit_for_review
end

Expand Down
13 changes: 13 additions & 0 deletions deliver/spec/submit_for_review_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
id: '1',
version_string: "1.0.0")
end
let(:ready_for_review_version) do
double('ready_for_review_version',
id: '1',
app_store_state: "READY_FOR_REVIEW",
version_string: "1.0.0")
end
let(:selected_build) { double('selected_build') }
let(:idfa_declaration) { double('idfa_declaration') }

Expand Down Expand Up @@ -118,6 +124,7 @@
expect(app).not_to receive(:create_review_submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -170,6 +177,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -202,6 +210,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -231,6 +240,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -259,6 +269,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -298,6 +309,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down Expand Up @@ -337,6 +349,7 @@
expect(app).to receive(:create_review_submission).and_return(submission)

expect(submission).to receive(:add_app_store_version_to_review_items).with(app_store_version_id: edit_version.id)
expect(Spaceship::ConnectAPI::AppStoreVersion).to receive(:get).and_return(ready_for_review_version)
expect(submission).to receive(:submit_for_review)

review_submitter.submit!(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AppStoreVersion

module AppStoreState
READY_FOR_SALE = "READY_FOR_SALE"
READY_FOR_REVIEW = "READY_FOR_REVIEW"
PROCESSING_FOR_APP_STORE = "PROCESSING_FOR_APP_STORE"
PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
Expand Down