commit ba3d36c521cba62bc30bb651c6542262edd80181
parent 3b992fc6b66b97cb81dd04cedb38050645af55c3
Author: MTRNord <mtrnord1@gmail.com>
Date: Thu, 20 Jan 2022 21:22:27 +0100
Fix mobile tests
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/e2e/home.spec.ts b/e2e/home.spec.ts
@@ -4,7 +4,7 @@ test.use({
storageState: 'e2e/auth.json'
});
-test('test navigation to details', async ({ page }) => {
+test('test navigation to details', async ({ page }, testInfo) => {
page.on('console', msg => console.log(msg.text()));
// Go to http://localhost:3000/
@@ -17,12 +17,18 @@ test('test navigation to details', async ({ page }) => {
page.click('text=FlowersMTRNord @ Art')
]);
+
await expect(page).toHaveURL('http://localhost:3000/post/%24xoIMe7tUMb2NhCBZaxsZr2CVkptCVu1GaJ_eJMKbJQo');
- // Click img[alt="Flowers"]
- await page.click('img[alt="Flowers"]');
- // Click [aria-label="Close gallery"]
- await page.click('[aria-label="Close gallery"]');
- await expect(page).toHaveURL('http://localhost:3000/post/%24xoIMe7tUMb2NhCBZaxsZr2CVkptCVu1GaJ_eJMKbJQo');
+
+ // Dont run this on mobile as the button does only exist on desktop browsers
+ if (!testInfo.project.name.includes("Mobile")) {
+ // Click img[alt="Flowers"]
+ await page.click('img[alt="Flowers"]');
+ // Click [aria-label="Close gallery"]
+ await page.click('[aria-label="Close gallery"]');
+ await expect(page).toHaveURL('http://localhost:3000/post/%24xoIMe7tUMb2NhCBZaxsZr2CVkptCVu1GaJ_eJMKbJQo');
+ }
+
// Click svg
await Promise.all([