Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#46150] fix timing issues in feature specs

Eric Schubert145c24a8a25d
diff --git a/frontend/src/app/features/enterprise/enterprise-active-trial/ee-active-trial.component.html b/frontend/src/app/features/enterprise/enterprise-active-trial/ee-active-trial.component.html
index 4d6faf057e1..a1cc5b991c9 100644
--- a/frontend/src/app/features/enterprise/enterprise-active-trial/ee-active-trial.component.html
+++ b/frontend/src/app/features/enterprise/enterprise-active-trial/ee-active-trial.component.html
@@ -7,8 +7,11 @@
<span [textContent]="subscriber"></span>
</div>
</div>
- <div class="attributes-key-value--key" [textContent]="text.label_email"> </div>
- <div class="attributes-key-value--value-container">
+ <div class="attributes-key-value--key" [textContent]="text.label_email"></div>
+ <div
+ class="attributes-key-value--value-container"
+ data-qa-selector="ee-active-trial-email"
+ >
<div class="attributes-key-value--value -text">
<span [textContent]="email"></span>
</div>
@@ -20,18 +23,22 @@
</div>
</div>
<div *ngIf="domain" class="attributes-key-value--key" [textContent]="text.label_domain"></div>
- <div *ngIf="domain" class="attributes-key-value--value-container">
+ <div
+ *ngIf="domain"
+ class="attributes-key-value--value-container"
+ data-qa-selector="ee-active-trial-domain"
+ >
<div class="attributes-key-value--value -text">
<span [textContent]="domain"></span>
</div>
</div>
- <div *ngIf="userCount" class="attributes-key-value--key" [textContent]="text.label_maximum_users"> </div>
+ <div *ngIf="userCount" class="attributes-key-value--key" [textContent]="text.label_maximum_users"></div>
<div *ngIf="userCount" class="attributes-key-value--value-container">
<div class="attributes-key-value--value -text">
<span [textContent]="userCount"></span>
</div>
</div>
- <div *ngIf="startsAt" class="attributes-key-value--key" [textContent]="text.label_starts_at"> </div>
+ <div *ngIf="startsAt" class="attributes-key-value--key" [textContent]="text.label_starts_at"></div>
<div *ngIf="startsAt" class="attributes-key-value--value-container">
<div class="attributes-key-value--value -text">
<span [textContent]="startsAt"></span>
@@ -47,4 +54,4 @@
</div>
</div>
</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
index a93ea3d9eae..7dd24e0c96f 100644
--- a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
+++ b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
@@ -101,6 +101,8 @@ describe 'Upload attachment to budget', js: true do
click_on "Update"
end
+ # Wait for page load
+ expect(page).to have_selector('[data-qa-selector="op-attachments"]')
script = <<~JS
const event = new DragEvent('dragenter');
document.body.dispatchEvent(event);
diff --git a/spec/features/admin/enterprise/token_domain_spec.rb b/spec/features/admin/enterprise/token_domain_spec.rb
index 54c40f3edd0..5eb80de97c0 100644
--- a/spec/features/admin/enterprise/token_domain_spec.rb
+++ b/spec/features/admin/enterprise/token_domain_spec.rb
@@ -30,13 +30,13 @@ require 'spec_helper'
describe 'Enterprise Edition token domain', js: true do
let(:current_user) { create(:admin) }
- let(:ee_token) { File.read(Rails.root.join("spec/fixtures/ee_tokens/v2_1_user_localhost_3001.token")) }
+ let(:ee_token) { Rails.root.join("spec/fixtures/ee_tokens/v2_1_user_localhost_3001.token").read }
before do
allow(User).to receive(:current).and_return current_user
end
- shared_context 'uploading a token' do
+ shared_context 'when uploading a token' do
before do
visit '/admin/enterprise'
@@ -48,19 +48,19 @@ describe 'Enterprise Edition token domain', js: true do
describe 'initial upload' do
context 'with correct domain', with_settings: { host_name: 'localhost:3001' } do
- it_behaves_like 'uploading a token' do
+ it_behaves_like 'when uploading a token' do
it 'saves the token' do
expect(body).to have_text 'Successful update.'
end
it 'shows the token info' do
- expect(body).to have_text '[email protected]'
+ expect(page).to have_selector('[data-qa-selector="ee-active-trial-email"]', text: '[email protected]')
end
end
end
context 'with incorrect domain', with_settings: { host_name: 'localhost:3000' } do
- it_behaves_like 'uploading a token' do
+ it_behaves_like 'when uploading a token' do
it "shows an invalid domain error" do
expect(body).to have_text "Domain is invalid."
end
@@ -75,7 +75,7 @@ describe 'Enterprise Edition token domain', js: true do
visit '/admin/enterprise'
end
- shared_context 'replacing a token' do
+ shared_context 'when replacing a token' do
let(:new_token) { raise 'define me!' }
before do
@@ -88,12 +88,12 @@ describe 'Enterprise Edition token domain', js: true do
end
it 'shows the current token info' do
- expect(body).to have_text '[email protected]'
+ expect(page).to have_selector('[data-qa-selector="ee-active-trial-email"]', text: '[email protected]')
end
describe 'replacing the token' do
context 'with correct domain' do
- it_behaves_like 'replacing a token' do
+ it_behaves_like 'when replacing a token' do
let(:new_token) { ee_token }
it 'updates the token' do
@@ -103,15 +103,15 @@ describe 'Enterprise Edition token domain', js: true do
end
context 'with incorrect domain' do
- it_behaves_like 'replacing a token' do
- let(:new_token) { File.read(Rails.root.join("spec/fixtures/ee_tokens/v2_1_user_localhost_3000.token")) }
+ it_behaves_like 'when replacing a token' do
+ let(:new_token) { Rails.root.join("spec/fixtures/ee_tokens/v2_1_user_localhost_3000.token").read }
it 'shows an invalid domain error' do
expect(body).to have_text 'Domain is invalid.'
end
it "shows the new token's info" do
- expect(body).to have_text 'localhost:3000'
+ expect(page).to have_selector('[data-qa-selector="ee-active-trial-domain"]', text: 'localhost:3000')
end
it "but doesn't save the new token" do