Add level 50 Pokemon test for VGC (#964)

This commit is contained in:
Konrad Borowski 2017-07-06 08:34:20 +02:00 committed by Guangcong Luo
parent 2eade6fdf5
commit cfd87a91c1
3 changed files with 28 additions and 2 deletions

View File

@ -8,7 +8,7 @@ addons:
sources:
- google-chrome
packages:
- google-chrome-stable
- google-chrome-stable fluxbox
cache:
directories:
- node_modules
@ -18,4 +18,5 @@ before_script:
- "sh -e /etc/init.d/xvfb start"
script:
- "npm test"
- "fluxbox >/dev/null 2>&1 &"
- "npm run-script testcafe"

View File

@ -15,6 +15,7 @@
},
"dependencies": {},
"devDependencies": {
"@types/node": "^8.0.7",
"eslint": "^3.2.2",
"testcafe": "^0.16.1"
},

View File

@ -1,7 +1,19 @@
import { Selector } from 'testcafe';
import { execFile } from 'child_process';
const showdownDirectory = __dirname + '/../data/Pokemon-Showdown';
fixture('Pokemon Showdown')
.page('../testclient.html?~~localhost');
.page('../testclient.html?~~localhost')
.before(async ctx => {
ctx.process = execFile(showdownDirectory + '/pokemon-showdown', {
cwd: showdownDirectory,
});
})
.after(async ctx => {
ctx.process.kill();
})
.beforeEach(t => t.maximizeWindow());
const expectedTeam = `=== Untitled 1 ===
@ -20,3 +32,15 @@ test('Teambuilder works', async t => {
await t.expect((await Selector('textarea').value).trim()).eql(expectedTeam);
});
test('Teambuilder shows level 50 for VGC', async t => {
await t.click('[name="close"]')
.click('[value="teambuilder"]')
.click('[name="newTop"]')
.click('.teambuilderformatselect')
.click('[value^="gen7vgc"]')
.click('[name="addPokemon"]')
.click('[data-entry="pokemon|Absol"]')
.click('.setdetails')
.expect(Selector('[name="level"]').value).eql('50');
});