Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/compare-browser.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const repo=(id,full_name,stars)=>({id,full_name,html_url:'https://github.com/'+f
await page.waitForFunction(()=>!document.getElementById('result').hidden);assert.match(await page.locator('#rows').innerText(),/example\/renamed/);assert.match(await page.locator('#rows').innerText(),/example\/old/);assert.match(await page.locator('#rows').innerText(),/\+7/);assert.match(await page.locator('#missing').innerText(),/1.*1/);assert.match(await page.locator('#scope').innerText(),/不完整/);
await page.setViewportSize({width:390,height:844});assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);await page.screenshot({path:path.join(os.tmpdir(),'gapcue-compare-mobile.png'),fullPage:true});
await page.locator('#language').click();await page.waitForFunction(()=>document.getElementById('scope').textContent.includes('incomplete'));assert.match(await page.locator('#scope').innerText(),/incomplete/);
await page.locator('#second').setInputFiles({name:'bad.json',mimeType:'application/json',buffer:Buffer.from('{bad')});assert.match(await page.locator('#status').innerText(),/Could not read/);assert.equal(await page.locator('#result').isHidden(),true);
await page.locator('#second').setInputFiles({name:'bad.json',mimeType:'application/json',buffer:Buffer.from('{bad')});await page.waitForFunction(()=>document.getElementById('status').innerText.includes('Could not read'));assert.match(await page.locator('#status').innerText(),/Could not read/);assert.equal(await page.locator('#result').isHidden(),true);
const offline=await browser.newContext({offline:true});try{const p=await offline.newPage();await p.goto(pathToFileURL(path.join(__dirname,'../app/compare.html')).href);await p.locator('#first').setInputFiles(aPath);await p.locator('#second').setInputFiles(bPath);await p.waitForFunction(()=>!document.getElementById('result').hidden);assert.match(await p.locator('#rows').innerText(),/\+7/);}finally{await offline.close()}
assert.deepEqual(errors,[]);console.log('Repository snapshots: downloads, stable IDs, partial results, language, malformed input, mobile and offline passed.');
}finally{await ctx.close();await browser.close();await new Promise(r=>server.close(r))}
Expand Down
Loading