Skip to content

Commit

Permalink
Merge pull request #590 from shopgate/PWA-1198-e2e
Browse files Browse the repository at this point in the history
Patch for e2e tests for new slider implementation
  • Loading branch information
fkloes committed Apr 1, 2019
2 parents 5dcb239 + 0bff996 commit 5fa0dca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
4 changes: 2 additions & 2 deletions themes/theme-gmd/e2e/elements/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default {
navigationDrawerLoginButton: "[data-test-id='navDrawerLoginButton']",
navigationDrawerEntry: "[data-test-id='NavDrawer'] [data-test-id='Ripple'] span",
shopLogo: "[data-test-id='Navigator'] img",
imageSliderImage1: "[data-test-id='Slider']:nth-child(2) img[data-test-id='withoutLink']",
imageSliderImage2: "[data-test-id='Slider']:nth-child(3) img[data-test-id='withoutLink']",
imageSliderImage1: "[data-test-id='Slider']:nth-child(1) img[data-test-id='link: /cart']",
imageSliderImage2: "[data-test-id='Slider']:nth-child(2) img[data-test-id='link: /cart']",
imageWidgetWithLink1: "[data-test-id='imageWidget: /category/3537']",
productSliderProduct1: "[data-test-id='Slider'] [data-test-id='Productname: Product with long description -4-']",
liveShoppingWidgetWithExpectedProduct: "[data-test-id='liveShoppingWidget'] [data-test-id='product with base price 1']",
Expand Down
1 change: 0 additions & 1 deletion themes/theme-gmd/e2e/helper/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { navigatorButton, backButton, navigationDrawerBackdrop } from '../elemen
* Open the navDrawer
*/
export function openNavDrawer() {
cy.reload();
cy.get(navigatorButton)
.should('be.visible')
.click();
Expand Down
14 changes: 7 additions & 7 deletions themes/theme-gmd/e2e/integration/consistency/StartPage.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import els from '../../elements/de';
import { openNavDrawer, closeNavDrawer } from '../../helper/navigation';

describe('AndroidGMDTest startPage', () => {
afterEach(() => {
cy.get(els.shopLogo).scrollIntoView();
});

it('should check Navigation Drawer', () => {
// Open page
cy.visit('');

// Click on Navigation button
cy.get(els.navigatorButton)
.click();
openNavDrawer();

// Check for drawer entries
cy.get(els.navigationDrawerLoginButton)
Expand All @@ -34,13 +37,10 @@ describe('AndroidGMDTest startPage', () => {
cy.get(els.navDrawerImprintButton)
.scrollIntoView()
.should('be.visible');
closeNavDrawer();
});

it('should check for shop logo', () => {
// Open page
cy.visit('');
cy.wait(500);

// Check for logo
cy.get(els.shopLogo)
.should('be.visible');
Expand Down
22 changes: 6 additions & 16 deletions themes/theme-gmd/widgets/ImageSlider/__snapshots__/spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,10 @@ exports[`<ImageSliderWidget /> should map the correct image settings to the comp
>
<Connect(Link)
className="css-63oe3q"
data-test-id="withLink"
href="http://example.com"
>
<Link
className="css-63oe3q"
data-test-id="withLink"
disabled={false}
historyPush={[Function]}
historyReplace={[Function]}
Expand All @@ -245,7 +243,7 @@ exports[`<ImageSliderWidget /> should map the correct image settings to the comp
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: http://example.com"
src="http://placehold.it/350x150"
/>
</div>
Expand All @@ -263,12 +261,10 @@ exports[`<ImageSliderWidget /> should map the correct image settings to the comp
>
<Connect(Link)
className="css-63oe3q"
data-test-id="withLink"
href="http://other.example.com"
>
<Link
className="css-63oe3q"
data-test-id="withLink"
disabled={false}
historyPush={[Function]}
historyReplace={[Function]}
Expand All @@ -289,7 +285,7 @@ exports[`<ImageSliderWidget /> should map the correct image settings to the comp
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: http://other.example.com"
src="http://placehold.it/10x10"
/>
</div>
Expand Down Expand Up @@ -651,7 +647,7 @@ exports[`<ImageSliderWidget /> should render the images with links 1`] = `
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: null"
src="http://placehold.it/350x150"
/>
</div>
Expand All @@ -666,12 +662,10 @@ exports[`<ImageSliderWidget /> should render the images with links 1`] = `
>
<Connect(Link)
className="css-63oe3q"
data-test-id="withLink"
href="http://other.example.com"
>
<Link
className="css-63oe3q"
data-test-id="withLink"
disabled={false}
historyPush={[Function]}
historyReplace={[Function]}
Expand All @@ -692,7 +686,7 @@ exports[`<ImageSliderWidget /> should render the images with links 1`] = `
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: http://other.example.com"
src="http://placehold.it/10x10"
/>
</div>
Expand Down Expand Up @@ -931,12 +925,10 @@ exports[`<ImageSliderWidget /> should render the slider with the correct number
>
<Connect(Link)
className="css-63oe3q"
data-test-id="withLink"
href="http://example.com"
>
<Link
className="css-63oe3q"
data-test-id="withLink"
disabled={false}
historyPush={[Function]}
historyReplace={[Function]}
Expand All @@ -957,7 +949,7 @@ exports[`<ImageSliderWidget /> should render the slider with the correct number
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: http://example.com"
src="http://placehold.it/350x150"
/>
</div>
Expand All @@ -975,12 +967,10 @@ exports[`<ImageSliderWidget /> should render the slider with the correct number
>
<Connect(Link)
className="css-63oe3q"
data-test-id="withLink"
href="http://other.example.com"
>
<Link
className="css-63oe3q"
data-test-id="withLink"
disabled={false}
historyPush={[Function]}
historyReplace={[Function]}
Expand All @@ -1001,7 +991,7 @@ exports[`<ImageSliderWidget /> should render the slider with the correct number
"data-css-1rozygh": "",
}
}
data-test-id="link : undefined"
data-test-id="link: http://other.example.com"
src="http://placehold.it/10x10"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions themes/theme-gmd/widgets/ImageSlider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ const ImageSliderWidget = ({ settings, className }) => {
loop={settings.loop}
>
{settings.images.map(({ image, alt, link }) => {
const img = <img src={image} alt={alt} className={imgStyle} data-test-id={`link : ${settings.link}`} />;
const img = <img src={image} alt={alt} className={imgStyle} data-test-id={`link: ${link}`} />;

if (link) {
return (
<Swiper.Item key={image}>
<Link href={link} className={linkStyle} data-test-id="withLink">
<Link href={link} className={linkStyle}>
{img}
</Link>
</Swiper.Item>
Expand Down

0 comments on commit 5fa0dca

Please sign in to comment.