|
| 1 | +import path from 'path'; |
| 2 | +import SeleniumHelper from '../helpers/selenium-helper'; |
| 3 | + |
| 4 | +const { |
| 5 | + clickText, |
| 6 | + clickXpath, |
| 7 | + findByText, |
| 8 | + findByXpath, |
| 9 | + notExistsByXpath, |
| 10 | + getDriver, |
| 11 | + getLogs, |
| 12 | + loadUri, |
| 13 | + rightClickText, |
| 14 | + scope |
| 15 | +} = new SeleniumHelper(); |
| 16 | + |
| 17 | +const uri = path.resolve(__dirname, '../../build/index.html'); |
| 18 | + |
| 19 | +let driver; |
| 20 | + |
| 21 | +const trademarkNames = [ |
| 22 | + 'Cat', |
| 23 | + 'Cat-Flying', |
| 24 | + 'Gobo', |
| 25 | + 'Pico', |
| 26 | + 'Pico Walking', |
| 27 | + 'Nano', |
| 28 | + 'Tera', |
| 29 | + 'Giga', |
| 30 | + 'Giga Walking' |
| 31 | +]; |
| 32 | + |
| 33 | +describe('Removed trademarks (ex: Scratch Cat)', () => { |
| 34 | + beforeAll(() => { |
| 35 | + driver = getDriver(); |
| 36 | + }); |
| 37 | + |
| 38 | + afterAll(async () => { |
| 39 | + await driver.quit(); |
| 40 | + }); |
| 41 | + |
| 42 | + |
| 43 | + test('Removed trademark sprites', async () => { |
| 44 | + await loadUri(uri); |
| 45 | + await clickXpath('//button[@aria-label="Choose a Sprite"]'); |
| 46 | + const searchElement = await findByXpath("//input[@placeholder='Search']"); |
| 47 | + |
| 48 | + for (let name of trademarkNames) { |
| 49 | + searchElement.clear(); |
| 50 | + await searchElement.sendKeys(name); |
| 51 | + await new Promise(resolve => setTimeout(resolve, 500)); |
| 52 | + expect(await notExistsByXpath(`//*[span[text()="${name}"]]`)).toBeTruthy(); |
| 53 | + } |
| 54 | + |
| 55 | + const logs = await getLogs(); |
| 56 | + await expect(logs).toEqual([]); |
| 57 | + }); |
| 58 | + |
| 59 | + test('Removed trademark costumes', async () => { |
| 60 | + await loadUri(uri); |
| 61 | + await clickText('Costumes'); |
| 62 | + await clickXpath('//button[@aria-label="Choose a Costume"]'); |
| 63 | + const searchElement = await findByXpath("//input[@placeholder='Search']"); |
| 64 | + |
| 65 | + for (let name of trademarkNames) { |
| 66 | + searchElement.clear(); |
| 67 | + const costumePrefix = `${name}-`; |
| 68 | + await searchElement.sendKeys(costumePrefix); |
| 69 | + await new Promise(resolve => setTimeout(resolve, 500)); |
| 70 | + expect(await notExistsByXpath(`//*[span[contains(text(), "${costumePrefix}")]]`)).toBeTruthy(); |
| 71 | + } |
| 72 | + |
| 73 | + const logs = await getLogs(); |
| 74 | + await expect(logs).toEqual([]); |
| 75 | + }); |
| 76 | + |
| 77 | +}); |
0 commit comments