|
|
@ -37,7 +37,7 @@ describe('main window', function spec() { |
|
|
|
await client.waitUntilWindowLoaded(); |
|
|
|
await delay(500); |
|
|
|
const title = await browserWindow.getTitle(); |
|
|
|
expect(title).toBe('Hello Electron React!'); |
|
|
|
expect(title).toBe('Zap'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should haven\'t any logs in console of main window', async () => { |
|
|
@ -51,65 +51,4 @@ describe('main window', function spec() { |
|
|
|
}); |
|
|
|
expect(logs).toHaveLength(0); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should to Counter with click "to Counter" link', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
await client.click('[data-tid=container] > a'); |
|
|
|
expect(await findCounter().getText()).toBe('0'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should display updated count after increment button click', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
const buttons = await findButtons(); |
|
|
|
await client.elementIdClick(buttons[0]); // +
|
|
|
|
expect(await findCounter().getText()).toBe('1'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should display updated count after descrement button click', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
const buttons = await findButtons(); |
|
|
|
await client.elementIdClick(buttons[1]); // -
|
|
|
|
expect(await findCounter().getText()).toBe('0'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('shouldnt change if even and if odd button clicked', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
const buttons = await findButtons(); |
|
|
|
await client.elementIdClick(buttons[2]); // odd
|
|
|
|
expect(await findCounter().getText()).toBe('0'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should change if odd and if odd button clicked', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
const buttons = await findButtons(); |
|
|
|
await client.elementIdClick(buttons[0]); // +
|
|
|
|
await client.elementIdClick(buttons[2]); // odd
|
|
|
|
expect(await findCounter().getText()).toBe('2'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should change if async button clicked and a second later', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
|
|
|
|
const buttons = await findButtons(); |
|
|
|
await client.elementIdClick(buttons[3]); // async
|
|
|
|
expect(await findCounter().getText()).toBe('2'); |
|
|
|
await delay(1500); |
|
|
|
expect(await findCounter().getText()).toBe('3'); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should back to home if back button clicked', async () => { |
|
|
|
const { client } = this.app; |
|
|
|
await client.element( |
|
|
|
'[data-tid="backButton"] > a' |
|
|
|
).click(); |
|
|
|
|
|
|
|
expect( |
|
|
|
await client.isExisting('[data-tid="container"]') |
|
|
|
).toBe(true); |
|
|
|
}); |
|
|
|
}); |
|
|
|