Skip to content

Commit

Permalink
Merge pull request #34 from DrMarcII/master
Browse files Browse the repository at this point in the history
v 1.4.0
  • Loading branch information
DrMarcII committed Feb 27, 2015
2 parents ae8b696 + 859efb2 commit 2ac1ed3
Show file tree
Hide file tree
Showing 19 changed files with 341 additions and 269 deletions.
27 changes: 13 additions & 14 deletions dart/lib/clock.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

library pageloader.clock;

/// Interface used to abstract away waiting mechanisms.
Expand Down
36 changes: 18 additions & 18 deletions dart/lib/html.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// PageLoader HTML provides the necessary bindings to support using PageLoader
/// Objects in tests that run within the browser.
library pageloader.html;

import 'dart:async' show Future;
import 'dart:collection';
import 'dart:html';
import 'dart:mirrors' hide Comment;

import 'clock.dart';
import 'src/core.dart';
import 'src/interfaces.dart';
export 'src/interfaces.dart';

import 'dart:collection';
import 'dart:html';
import 'dart:mirrors' hide Comment;

/// A function that will be executed after [click] and [type] and during
/// [waitFor] and [waitForValue] to allow events to be processed. For example
/// if using Angular's async test wrapper this should be a function that calls
Expand Down
27 changes: 13 additions & 14 deletions dart/lib/objects.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// PageLoader Objects provides the core interface and annotation definitions
/// that should be used within PageLoader Objects.
library pageloader.objects;
Expand Down
74 changes: 52 additions & 22 deletions dart/lib/src/annotations.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
library pageloader.annotations;
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'interfaces.dart';
library pageloader.annotations;

import 'dart:collection';

import 'interfaces.dart';

class ById implements Finder {
final String id;

Expand Down Expand Up @@ -91,21 +90,52 @@ class EnsureTag implements Finder {
}

class InShadowDom implements Finder {
final Finder finder;
final Finder of;
final Finder find;

const InShadowDom([this.finder]);
/// Traverses into the shadow dom of the elements found by [of] (or of the
/// current scope if [of] not provided), and then finds elements using [find]
/// if provided.
const InShadowDom({this.of, this.find});

@override
List<PageLoaderElement> findElements(PageLoaderElement context) {
if (finder == null) {
return new UnmodifiableListView<PageLoaderElement>([context.shadowRoot]);
Iterable<PageLoaderElement> candidates;
if (of != null) {
candidates = of.findElements(context);
} else {
return finder.findElements(context.shadowRoot);
candidates = [context];
}
candidates = candidates.map((candidate) => candidate.shadowRoot);
if (find != null) {
var newCandidates = new Set();
for (var candidate in candidates) {
newCandidates.addAll(find.findElements(candidate));
}
candidates = newCandidates;
}
return new UnmodifiableListView<PageLoaderElement>(candidates);
}

@override
String toString() => '@InShadowDom(${finder == null ? '' : finder})';
String toString() {
var buffer = new StringBuffer('@InShadowDom(');
bool commaNeeded = false;
if (of != null) {
buffer
..write('of: ')
..write(of);
commaNeeded = true;
}
if (find != null) {
if (commaNeeded) buffer.write(', ');
buffer
..write('find: ')
..write(find);
}
buffer.write(')');
return buffer.toString();
}
}

class Returns {
Expand Down
37 changes: 18 additions & 19 deletions dart/lib/src/core.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

library pageloader.core;

import 'annotations.dart';
import 'interfaces.dart';
import '../clock.dart';
import 'dart:collection';
import 'dart:mirrors';

import 'package:matcher/matcher.dart';

import 'dart:collection';
import 'dart:mirrors';
import '../clock.dart';
import 'annotations.dart';
import 'interfaces.dart';

bool _printedWarning = false;

Expand Down
31 changes: 15 additions & 16 deletions dart/lib/src/interfaces.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
library pageloader.interfaces;
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:matcher/matcher.dart';
library pageloader.interfaces;

import 'dart:collection';

import 'package:matcher/matcher.dart';

abstract class Lazy<T> {
T call();
}
Expand Down
37 changes: 18 additions & 19 deletions dart/lib/webdriver.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
/*
* Copyright 2014 Google Inc. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2014 Google Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// PageLoader WebDriver provides the necessary bindings to support using
/// PageLoader in WebDriver-based tests.
library pageloader.webdriver;

import 'clock.dart';
import 'src/core.dart';
import 'src/interfaces.dart';
export 'src/interfaces.dart';

import 'dart:collection';
import 'dart:io' as io;

import 'package:sync_webdriver/sync_webdriver.dart' as wd;

import 'clock.dart';
import 'src/core.dart';
import 'src/interfaces.dart';
export 'src/interfaces.dart';

class WebDriverPageLoader extends BasePageLoader {
WebDriverPageLoaderElement _globalContext;
@override
Expand Down
4 changes: 2 additions & 2 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pageloader
version: 1.3.2
version: 1.4.0
author: Google Inc.
description: >
Supports the creation of page objects that can be shared between in-browser tests
Expand All @@ -9,7 +9,7 @@ environment:
sdk: '>=1.8.0 <2.0.0'
dependencies:
matcher: '^0.11.4+1'
sync_webdriver: '^1.1.4'
sync_webdriver: '^1.1.4+1'
dev_dependencies:
browser: '^0.10.0+2'
path: '^1.3.3'
Expand Down
Loading

0 comments on commit 2ac1ed3

Please sign in to comment.