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

Attempt to stabilize amp-list integration tests #20063

Merged
merged 3 commits into from Dec 26, 2018
Merged
Changes from all commits
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
54 changes: 39 additions & 15 deletions extensions/amp-list/0.1/test/integration/test-amp-list.js
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import {BrowserController} from '../../../../../testing/test-helper';
import {isExperimentOn} from '../../../../../src/experiments';
import {poll} from '../../../../../testing/iframe';

Expand All @@ -30,15 +31,32 @@ describe('amp-list (integration)', function() {
'</amp-list>`;

const basicTests = env => {

let browser;
let doc;
let win;

beforeEach(() => {
win = env.win;
browser = new BrowserController(win);
doc = win.document;
});

it('should build', function*() {
const list = doc.querySelector('amp-list');
expect(list).to.exist;
yield browser.waitForElementBuild('amp-list', TIMEOUT);
const container = list.querySelector('div[role="list"]');
expect(container).to.exist;
});

it('should render items', function*() {
const list = env.win.document.querySelector('amp-list');
const list = doc.querySelector('amp-list');
expect(list).to.exist;

let children;
yield poll('#list render', () => {
children = list.querySelectorAll('div[role=list] > div');
return children.length > 0;
}, /* onError */ undefined, TIMEOUT);
yield browser.waitForElementLayout('amp-list', TIMEOUT);

const children = list.querySelectorAll('div[role=list] > div');

expect(children.length).to.equal(3);
expect(children[0].textContent.trim()).to.equal('apple : 47 @ 0.33');
Expand Down Expand Up @@ -68,19 +86,23 @@ describe('amp-list (integration)', function() {
extensions: ['amp-list', 'amp-mustache'],
experiments: ['amp-list-resizable-children'],
}, env => {
let win, doc;
let browser;
let doc;
let win;

beforeEach(() => {
win = env.win;
browser = new BrowserController(win);
doc = win.document;
});

it('should change to layout container as action', function*() {
expect(isExperimentOn(win, 'amp-list-resizable-children')).to.be.true;

const button = doc.querySelector('button');
const list = doc.querySelector('amp-list');
button.click();

yield browser.waitForElementLayout('amp-list', TIMEOUT);
browser.click('button');

yield poll('changes to layout container', () => {
const layout = list.getAttribute('layout');
Expand All @@ -91,9 +113,7 @@ describe('amp-list (integration)', function() {
});
});

// TODO(cathyxz, #19647): Fix test on Chrome 71. Might be because
// amp-bind isn't ready by the time the button is clicked.
describes.integration.skip('[is-layout-container]', {
describes.integration('[is-layout-container]', {
body: `
<amp-state id="state">
<script type="application/json">
Expand All @@ -109,19 +129,23 @@ describe('amp-list (integration)', function() {
extensions: ['amp-list', 'amp-mustache', 'amp-bind'],
experiments: ['amp-list-resizable-children'],
}, env => {
let win, doc;
let browser;
let doc;
let win;

beforeEach(() => {
win = env.win;
browser = new BrowserController(win);
doc = win.document;
});

it('should change to layout container as on bind', function*() {
expect(isExperimentOn(win, 'amp-list-resizable-children')).to.be.true;

const button = doc.querySelector('button');
const list = doc.querySelector('amp-list');
button.click();

yield browser.waitForElementLayout('amp-list', TIMEOUT);
browser.click('button');

yield poll('changes to layout container', () => {
const layout = list.getAttribute('layout');
Expand Down