Skip to content

Commit

Permalink
✅ Remove unnessary async annotations from E2E tests (#35672)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimha committed Aug 13, 2021
1 parent 862f51f commit 87e21c1
Show file tree
Hide file tree
Showing 72 changed files with 117 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describes.endtoend(
experiments: ['bento-accordion'],
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;

let header1;
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-accordion/1.0/test-e2e/test-single-expand.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ describes.endtoend(
experiments: ['bento-accordion'],
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describes.endtoend(
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describes.endtoend(
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describes.endtoend(
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ describes.endtoend(
environments: ['single'],
browsers: ['chrome'],
},
async (env) => {
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/0.1/test-e2e/test-advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describes.endtoend(
environments: ['single'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;
let nextArrow;
let prevArrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ describes.endtoend(
fixture: 'amp-base-carousel/arrows-in-lightbox.amp.html',
environments: ['single'],
},
async (env) => {
(env) => {
let controller;
let nextArrow;
let prevArrow;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describes.endtoend(
//TODO(spaharmi): fails on shadow demo
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;
let prevArrow;
let nextArrow;
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-autoadvance.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ describes.endtoend(
experiments: ['amp-base-carousel', 'layers'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;

function rect(el) {
return controller.getElementRect(el);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/0.1/test-e2e/test-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describes.endtoend(
//TODO(spaharmi): fails on shadow demo
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 7;
let controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describes.endtoend(
let scrollContainer;
let loop;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-goToSlide.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ describes.endtoend(
fixture: 'amp-base-carousel/arrows-in-lightbox.amp.html',
environments: ['single'],
},
async (env) => {
(env) => {
let controller;
let slides;
let prevArrow;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/0.1/test-e2e/test-grouping.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describes.endtoend(
experiments: ['amp-base-carousel', 'layers'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
const slideWidth = pageWidth / 2;
let controller;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describes.endtoend(

let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ describes.endtoend(
environments: ['single', 'viewer-demo'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
//TODO(spaharmi): fails on viewer and shadow demo
environments: ['single'],
},
async (env) => {
(env) => {
let controller;

function prop(el, name) {
Expand All @@ -41,7 +41,7 @@ describes.endtoend(
await expect(prop(spacers[1], 'offsetWidth')).to.equal(width);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
25 changes: 11 additions & 14 deletions extensions/amp-base-carousel/0.1/test-e2e/test-mixed-lengths.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describes.endtoend(
experiments: ['amp-base-carousel', 'layers'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;

function prop(el, name) {
Expand All @@ -39,7 +39,7 @@ describes.endtoend(
await expect(prop(spacers[1], 'offsetWidth')).to.equal(width);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down Expand Up @@ -69,20 +69,17 @@ describes.endtoend(
await assertSpacerWidth(1, slideTwoWidth);
});

//TODO(sparhami): fails on shadow demo
it.configure()
.skipShadowDemo()
// TODO(#35241): flaky test disabled in #35176
.skip('should snap on the center point', async () => {
const el = await getScrollingElement(controller);
const slides = await getSlides(controller);
const scrollAmount = 1 + slideOneWidth / 2;
// TODO(#35241): flaky test disabled in #35176
it.skip('should snap on the center point', async () => {
const el = await getScrollingElement(controller);
const slides = await getSlides(controller);
const scrollAmount = 1 + slideOneWidth / 2;

await controller.scrollBy(el, {left: scrollAmount});
await expect(controller.getElementRect(slides[1])).to.include({
x: (pageWidth - slideTwoWidth) / 2,
});
await controller.scrollBy(el, {left: scrollAmount});
await expect(controller.getElementRect(slides[1])).to.include({
x: (pageWidth - slideTwoWidth) / 2,
});
});
});
}
);
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-non-looping.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describes.endtoend(
experiments: ['amp-base-carousel', 'layers'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 4;
let controller;
Expand All @@ -36,7 +36,7 @@ describes.endtoend(
return controller.getElementProperty(el, name);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ describes.endtoend(
//TODO(spaharmi): fails on shadow demo
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;

function prop(el, name) {
return controller.getElementProperty(el, name);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-rtl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ describes.endtoend(
// TODO(sparhami) Make other environments work too
environments: ['single'],
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 7;
let controller;
beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describes.endtoend(
async function (env) {
let controller;

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-base-carousel/0.1/test-e2e/test-vertical.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describes.endtoend(
experiments: ['amp-base-carousel', 'layers'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 7;
let controller;
Expand All @@ -40,7 +40,7 @@ describes.endtoend(
return controller.getElementRect(el);
}

beforeEach(async () => {
beforeEach(() => {
controller = env.controller;
});

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/1.0/test-e2e/test-advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describes.endtoend(
environments: ['single'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;
let nextArrow;
let prevArrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
const styles = useStyles();
let controller;
let prevArrow;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;
const styles = useStyles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 7;
let controller;
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-base-carousel/1.0/test-e2e/test-grouping.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single'],
},
async (env) => {
(env) => {
let controller, btnPrev, btnNext;

const styles = useStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
let controller;
const styles = useStyles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
environments: ['single', 'viewer-demo'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
let controller;
const styles = useStyles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
environments: ['single', 'viewer-demo'],
initialRect: {width: pageWidth, height: pageHeight},
},
async (env) => {
(env) => {
/** The total number of slides in the carousel */
const SLIDE_COUNT = 4;
const styles = useStyles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describes.endtoend(
initialRect: {width: pageWidth, height: pageHeight},
environments: ['single', 'viewer-demo'],
},
async (env) => {
(env) => {
const styles = useStyles();
let controller;
let carousel;
Expand Down

0 comments on commit 87e21c1

Please sign in to comment.