|
1 | 1 | import { expect } from '@playwright/test'; |
2 | 2 | import { configs, test } from '@utils/test/playwright'; |
3 | 3 |
|
4 | | -configs().forEach(({ title, screenshot, config }) => { |
| 4 | +configs({ modes: ['ios', 'md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => { |
5 | 5 | test.describe(title('item: lines'), () => { |
6 | | - test('should not have visual regressions', async ({ page }) => { |
7 | | - await page.goto(`/src/components/item/test/lines`, config); |
| 6 | + test.describe('default', () => { |
| 7 | + test('should not have visual regressions', async ({ page }) => { |
| 8 | + await page.setContent( |
| 9 | + ` |
| 10 | + <ion-item> |
| 11 | + <ion-label>Label</ion-label> |
| 12 | + </ion-item> |
| 13 | + `, |
| 14 | + config |
| 15 | + ); |
8 | 16 |
|
9 | | - await page.setIonViewport(); |
| 17 | + const item = page.locator('ion-item'); |
10 | 18 |
|
11 | | - await expect(page).toHaveScreenshot(screenshot(`item-lines-diff`)); |
| 19 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-default`)); |
| 20 | + }); |
| 21 | + |
| 22 | + test('should not have visual regressions with slotted icons', async ({ page }) => { |
| 23 | + await page.setContent( |
| 24 | + ` |
| 25 | + <ion-item> |
| 26 | + <ion-icon name="star" slot="start"></ion-icon> |
| 27 | + <ion-label>Label</ion-label> |
| 28 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 29 | + </ion-item> |
| 30 | + `, |
| 31 | + config |
| 32 | + ); |
| 33 | + |
| 34 | + const item = page.locator('ion-item'); |
| 35 | + |
| 36 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-default-icon`)); |
| 37 | + }); |
| 38 | + |
| 39 | + test('should not have visual regressions with color', async ({ page }) => { |
| 40 | + await page.setContent( |
| 41 | + ` |
| 42 | + <ion-item color="danger"> |
| 43 | + <ion-icon name="star" slot="start"></ion-icon> |
| 44 | + <ion-label>Label</ion-label> |
| 45 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 46 | + </ion-item> |
| 47 | + `, |
| 48 | + config |
| 49 | + ); |
| 50 | + |
| 51 | + const item = page.locator('ion-item'); |
| 52 | + |
| 53 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-color`)); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
| 57 | + test.describe('inset', () => { |
| 58 | + test('should not have visual regressions', async ({ page }) => { |
| 59 | + await page.setContent( |
| 60 | + ` |
| 61 | + <ion-item lines="inset"> |
| 62 | + <ion-label>Label</ion-label> |
| 63 | + </ion-item> |
| 64 | + `, |
| 65 | + config |
| 66 | + ); |
| 67 | + |
| 68 | + const item = page.locator('ion-item'); |
| 69 | + |
| 70 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-inset`)); |
| 71 | + }); |
| 72 | + |
| 73 | + test('should not have visual regressions with slotted icons', async ({ page }) => { |
| 74 | + await page.setContent( |
| 75 | + ` |
| 76 | + <ion-item lines="inset"> |
| 77 | + <ion-icon name="star" slot="start"></ion-icon> |
| 78 | + <ion-label>Label</ion-label> |
| 79 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 80 | + </ion-item> |
| 81 | + `, |
| 82 | + config |
| 83 | + ); |
| 84 | + |
| 85 | + const item = page.locator('ion-item'); |
| 86 | + |
| 87 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-inset-icon`)); |
| 88 | + }); |
| 89 | + |
| 90 | + test('should not have visual regressions with color', async ({ page }) => { |
| 91 | + await page.setContent( |
| 92 | + ` |
| 93 | + <ion-item lines="inset" color="danger"> |
| 94 | + <ion-icon name="star" slot="start"></ion-icon> |
| 95 | + <ion-label>Label</ion-label> |
| 96 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 97 | + </ion-item> |
| 98 | + `, |
| 99 | + config |
| 100 | + ); |
| 101 | + |
| 102 | + const item = page.locator('ion-item'); |
| 103 | + |
| 104 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-inset-color`)); |
| 105 | + }); |
| 106 | + }); |
| 107 | + |
| 108 | + test.describe('full', () => { |
| 109 | + test('should not have visual regressions', async ({ page }) => { |
| 110 | + await page.setContent( |
| 111 | + ` |
| 112 | + <ion-item lines="full"> |
| 113 | + <ion-label>Label</ion-label> |
| 114 | + </ion-item> |
| 115 | + `, |
| 116 | + config |
| 117 | + ); |
| 118 | + |
| 119 | + const item = page.locator('ion-item'); |
| 120 | + |
| 121 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-full`)); |
| 122 | + }); |
| 123 | + |
| 124 | + test('should not have visual regressions with slotted icons', async ({ page }) => { |
| 125 | + await page.setContent( |
| 126 | + ` |
| 127 | + <ion-item lines="full"> |
| 128 | + <ion-icon name="star" slot="start"></ion-icon> |
| 129 | + <ion-label>Label</ion-label> |
| 130 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 131 | + </ion-item> |
| 132 | + `, |
| 133 | + config |
| 134 | + ); |
| 135 | + |
| 136 | + const item = page.locator('ion-item'); |
| 137 | + |
| 138 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-full-icon`)); |
| 139 | + }); |
| 140 | + |
| 141 | + test('should not have visual regressions with color', async ({ page }) => { |
| 142 | + await page.setContent( |
| 143 | + ` |
| 144 | + <ion-item lines="full" color="danger"> |
| 145 | + <ion-icon name="star" slot="start"></ion-icon> |
| 146 | + <ion-label>Label</ion-label> |
| 147 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 148 | + </ion-item> |
| 149 | + `, |
| 150 | + config |
| 151 | + ); |
| 152 | + |
| 153 | + const item = page.locator('ion-item'); |
| 154 | + |
| 155 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-full-color`)); |
| 156 | + }); |
| 157 | + }); |
| 158 | + |
| 159 | + test.describe('none', () => { |
| 160 | + test('should not have visual regressions', async ({ page }) => { |
| 161 | + await page.setContent( |
| 162 | + ` |
| 163 | + <ion-item lines="none"> |
| 164 | + <ion-label>Label</ion-label> |
| 165 | + </ion-item> |
| 166 | + `, |
| 167 | + config |
| 168 | + ); |
| 169 | + |
| 170 | + const item = page.locator('ion-item'); |
| 171 | + |
| 172 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-none`)); |
| 173 | + }); |
| 174 | + |
| 175 | + test('should not have visual regressions with slotted icons', async ({ page }) => { |
| 176 | + await page.setContent( |
| 177 | + ` |
| 178 | + <ion-item lines="none"> |
| 179 | + <ion-icon name="star" slot="start"></ion-icon> |
| 180 | + <ion-label>Label</ion-label> |
| 181 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 182 | + </ion-item> |
| 183 | + `, |
| 184 | + config |
| 185 | + ); |
| 186 | + |
| 187 | + const item = page.locator('ion-item'); |
| 188 | + |
| 189 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-none-icon`)); |
| 190 | + }); |
| 191 | + |
| 192 | + test('should not have visual regressions with color', async ({ page }) => { |
| 193 | + await page.setContent( |
| 194 | + ` |
| 195 | + <ion-item lines="none" color="danger"> |
| 196 | + <ion-icon name="star" slot="start"></ion-icon> |
| 197 | + <ion-label>Label</ion-label> |
| 198 | + <ion-icon name="information-circle" slot="end"></ion-icon> |
| 199 | + </ion-item> |
| 200 | + `, |
| 201 | + config |
| 202 | + ); |
| 203 | + |
| 204 | + const item = page.locator('ion-item'); |
| 205 | + |
| 206 | + await expect(item).toHaveScreenshot(screenshot(`item-lines-none-color`)); |
| 207 | + }); |
12 | 208 | }); |
13 | 209 | }); |
14 | 210 | }); |
0 commit comments