Path: blob/trunk/rb/spec/integration/selenium/webdriver/navigation_spec.rb
1864 views
# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819require_relative 'spec_helper'20module Selenium21module WebDriver22describe Navigation do23it 'navigates back and forward' do24form_title = 'We Leave From Here'25result_title = 'We Arrive Here'26form_url = url_for 'formPage.html'27result_url = url_for 'resultPage.html'2829driver.navigate.to form_url30expect(driver.title).to eq(form_title)3132driver.find_element(id: 'imageButton').click33wait.until { driver.title != form_title }3435expect(driver.current_url).to include(result_url)36expect(driver.title).to eq(result_title)3738driver.navigate.back3940expect(driver.current_url).to include(form_url)41expect(driver.title).to eq(form_title)4243driver.navigate.forward44expect(driver.current_url).to include(result_url)45expect(driver.title).to eq(result_title)46end4748it 'refreshes the page' do49changed_title = 'Changed'5051driver.navigate.to url_for('javascriptPage.html')52driver.find_element(link_text: 'Change the page title!').click53expect(driver.title).to eq(changed_title)5455driver.navigate.refresh56wait.until { driver.title != changed_title }5758expect(driver.title).to eq('Testing Javascript')59end60end61end # WebDriver62end # Selenium636465