index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-18 15:11:04 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-04-18 17:39:18 -0700 |
commit | ac71447aee59daa5693cc09a50b4b3101fbdefb2 (patch) | |
tree | f80eb3e7223633e048c170cadadee37cacd837d8 /test/integration/page.test.js | |
parent | 25172dafedc72f9691086b7ace3137c8aaf89fd1 (diff) |
Add another integration test; document debugging integration tests
Diffstat (limited to 'test/integration/page.test.js')
-rw-r--r-- | test/integration/page.test.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/integration/page.test.js b/test/integration/page.test.js index 7157bff..452d542 100644 --- a/test/integration/page.test.js +++ b/test/integration/page.test.js @@ -1,4 +1,4 @@ -const { Builder } = require('selenium-webdriver'), +const { Builder, By } = require('selenium-webdriver'), chrome = require('selenium-webdriver/chrome.js'), { expect, it } = require('@jest/globals'), chromeOptions = new chrome.Options(); @@ -7,12 +7,25 @@ let driver; chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox'); -beforeAll(async () => { +beforeEach(async () => { driver = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build(); + await driver.get("http://localhost:3005"); }); it('loads the page', async () => { - await driver.get("http://localhost:3005"); - expect(await driver.getTitle()).toEqual('Infantry Combat Solo Basic'); }); + +it('selects a trooper by clicking on their counter', async () => { + await driver.switchTo().frame(driver.findElement(By.css('object'))); + + const selector = 'use.counter[data-allegiance="liao"][data-number="1"]', + svg = await driver.findElement(By.css('svg')), + counter = await driver.findElement(By.css(selector), svg); + + await counter.click(); + + expect(await counter.getAttribute('class')).toEqual(expect.stringContaining('selected')); +}); + +afterEach(async () => await driver.quit()); |