Commit 528bec8b authored by Kushal Pandya's avatar Kushal Pandya

Add wait_for_requests, update selectors to be Geo Nodes vue app compatible

parent a52a3d9c
require 'spec_helper' require 'spec_helper'
RSpec.describe 'admin Geo Nodes', type: :feature do describe 'admin Geo Nodes', :js do
let!(:geo_node) { create(:geo_node) } let!(:geo_node) { create(:geo_node) }
before do before do
...@@ -10,6 +10,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do ...@@ -10,6 +10,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do
it 'show all public Geo Nodes and create new node link' do it 'show all public Geo Nodes and create new node link' do
visit admin_geo_nodes_path visit admin_geo_nodes_path
wait_for_requests
expect(page).to have_link('New node', href: new_admin_geo_node_path) expect(page).to have_link('New node', href: new_admin_geo_node_path)
page.within(find('.geo-nodes', match: :first)) do page.within(find('.geo-nodes', match: :first)) do
...@@ -30,6 +31,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do ...@@ -30,6 +31,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do
click_button 'Add Node' click_button 'Add Node'
expect(current_path).to eq admin_geo_nodes_path expect(current_path).to eq admin_geo_nodes_path
wait_for_requests
page.within(find('.geo-nodes', match: :first)) do page.within(find('.geo-nodes', match: :first)) do
expect(page).to have_content(geo_node.url) expect(page).to have_content(geo_node.url)
...@@ -52,7 +54,8 @@ RSpec.describe 'admin Geo Nodes', type: :feature do ...@@ -52,7 +54,8 @@ RSpec.describe 'admin Geo Nodes', type: :feature do
describe 'update an existing Geo Node' do describe 'update an existing Geo Node' do
before do before do
visit admin_geo_nodes_path visit admin_geo_nodes_path
page.within(find('.node-actions', match: :first)) do wait_for_requests
page.within(find('.geo-node-actions', match: :first)) do
page.click_link('Edit') page.click_link('Edit')
end end
end end
...@@ -63,6 +66,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do ...@@ -63,6 +66,7 @@ RSpec.describe 'admin Geo Nodes', type: :feature do
click_button 'Save changes' click_button 'Save changes'
expect(current_path).to eq admin_geo_nodes_path expect(current_path).to eq admin_geo_nodes_path
wait_for_requests
page.within(find('.geo-nodes', match: :first)) do page.within(find('.geo-nodes', match: :first)) do
expect(page).to have_content('http://newsite.com') expect(page).to have_content('http://newsite.com')
...@@ -74,14 +78,16 @@ RSpec.describe 'admin Geo Nodes', type: :feature do ...@@ -74,14 +78,16 @@ RSpec.describe 'admin Geo Nodes', type: :feature do
describe 'remove an existing Geo Node' do describe 'remove an existing Geo Node' do
before do before do
visit admin_geo_nodes_path visit admin_geo_nodes_path
wait_for_requests
end end
it 'removes an existing Geo Node' do it 'removes an existing Geo Node' do
page.within(find('.node-actions', match: :first)) do page.within(find('.geo-node-actions', match: :first)) do
page.click_link('Remove') page.click_link('Remove')
end end
expect(current_path).to eq admin_geo_nodes_path expect(current_path).to eq admin_geo_nodes_path
wait_for_requests
expect(page).not_to have_css('.geo-nodes') expect(page).not_to have_css('.geo-nodes')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment