Question
Is there a way to scan a QR code from a PNG file
I am trying to write a test for scanning a QR code from a PNG file. I followed an explanation from this YouTube tutorial and copied the exact same code, except I changed the name of the PNG file in my tests.
/// <reference types="cypress" />
import { Decoder } from '@nuintun/qrcode'
it('decodes QR code', () => {
cy.fixture('frame.png', 'base64')
.then((base64) => `data:image/png;base64,${base64}`)
.then((imageSrc) => {
const qrcode = new Decoder()
return qrcode.scan(imageSrc)
})
.its('data')
.then(cy.log)
.should('include', 'cypress.tips')
})
However, while running this code I am getting an error:
TypeError
qrcode.scan is not a function
What am I doing wrong in this code? Is there any way that I can scan a QR code without firstly screenshotting it from a website, since it will not be present on it?